diff --git a/dev/build.image/build-fat-image.xml b/dev/build.image/build-fat-image.xml index 48195971a649..f34298b39a75 100755 --- a/dev/build.image/build-fat-image.xml +++ b/dev/build.image/build-fat-image.xml @@ -82,9 +82,9 @@ - + - + diff --git a/dev/build.image/build.gradle b/dev/build.image/build.gradle index cd3149ef5aa9..e6db335d0113 100644 --- a/dev/build.image/build.gradle +++ b/dev/build.image/build.gradle @@ -2,6 +2,7 @@ import org.apache.tools.ant.filters.ReplaceTokens task copyPropertiesToBuildImage (type:Copy) { + dependsOn jar from "${projectDir}/publish/gradle" into "${projectDir}/wlp/lib/versions" include '*.properties' @@ -10,6 +11,7 @@ task copyPropertiesToBuildImage (type:Copy) { } task copyReadmeToBuildImage (type:Copy) { + dependsOn jar from "${projectDir}/publish/gradle" into "${rootDir}/build.image/wlp" include 'README.TXT' @@ -17,7 +19,15 @@ task copyReadmeToBuildImage (type:Copy) { tokens: [BUILD_ID: bnd.buildID, LIBERTY_VERSION: bnd.libertyRelease]) } +task copyCopyrightToBuildImage (type:Copy) { + dependsOn jar + from "${projectDir}" + into "${rootDir}/build.image/wlp" + include 'Copyright.txt' +} + task copyGeneratedToBuildImageBinTools (type:Copy) { + dependsOn jar from "${projectDir}/wlp/lib" into "${projectDir}/wlp/bin/tools" include 'bootstrap-agent.jar' @@ -25,19 +35,17 @@ task copyGeneratedToBuildImageBinTools (type:Copy) { } task copyGeneratedToCnfLib (type:Copy) { + dependsOn jar from "${projectDir}/wlp/dev/api/spec/" into "${rootDir}/${bnd_cnf}/lib" include 'com.ibm.ws.org.osgi.core.6.0.0_*.jar' rename '.*.jar', 'osgi.core.jar' } -assemble.dependsOn copyGeneratedToCnfLib -copyGeneratedToCnfLib.dependsOn jar - -assemble.dependsOn copyGeneratedToBuildImageBinTools -copyGeneratedToBuildImageBinTools.dependsOn jar - -assemble.dependsOn copyPropertiesToBuildImage -assemble.dependsOn copyReadmeToBuildImage -copyPropertiesToBuildImage.dependsOn jar -copyReadmeToBuildImage.dependsOn jar +assemble { + dependsOn copyPropertiesToBuildImage + dependsOn copyReadmeToBuildImage + dependsOn copyCopyrightToBuildImage + dependsOn copyGeneratedToBuildImageBinTools + dependsOn copyGeneratedToCnfLib +} diff --git a/dev/build.image/editions/bluemix/beta.properties b/dev/build.image/editions/bluemix/beta.properties deleted file mode 100755 index ddd602310334..000000000000 --- a/dev/build.image/editions/bluemix/beta.properties +++ /dev/null @@ -1,2 +0,0 @@ -license.type=IPLA -editions=BLUEMIX diff --git a/dev/build.image/editions/bluemix/beta.xml b/dev/build.image/editions/bluemix/beta.xml deleted file mode 100755 index 3707447dd213..000000000000 --- a/dev/build.image/editions/bluemix/beta.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - osgiBundle-1.0 - logstashCollector-1.1 - bluemixLogCollector-1.1 - audit-1.0 - - diff --git a/dev/build.sharedResources/.classpath b/dev/build.sharedResources/.classpath new file mode 100644 index 000000000000..bd52baaf243d --- /dev/null +++ b/dev/build.sharedResources/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/build.sharedResources/.classpath.gradle b/dev/build.sharedResources/.classpath.gradle new file mode 100644 index 000000000000..bd52baaf243d --- /dev/null +++ b/dev/build.sharedResources/.classpath.gradle @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/build.sharedResources/.project b/dev/build.sharedResources/.project index 4dd451b9feeb..a47ce5f6abff 100755 --- a/dev/build.sharedResources/.project +++ b/dev/build.sharedResources/.project @@ -5,7 +5,19 @@ + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/build.sharedResources/bnd.bnd b/dev/build.sharedResources/bnd.bnd new file mode 100644 index 000000000000..43acc3bacd95 --- /dev/null +++ b/dev/build.sharedResources/bnd.bnd @@ -0,0 +1,3 @@ +-include ~../cnf/resources/bnd/liberty-release.props + +-nobundles=true diff --git a/dev/build.sharedResources/bnd.bnd.gradle b/dev/build.sharedResources/bnd.bnd.gradle new file mode 100644 index 000000000000..43acc3bacd95 --- /dev/null +++ b/dev/build.sharedResources/bnd.bnd.gradle @@ -0,0 +1,3 @@ +-include ~../cnf/resources/bnd/liberty-release.props + +-nobundles=true diff --git a/dev/build.sharedResources/build.nogradle b/dev/build.sharedResources/build.gradle similarity index 100% rename from dev/build.sharedResources/build.nogradle rename to dev/build.sharedResources/build.gradle diff --git a/dev/build.sharedResources/lib/ws-junit/ws-junit.jar b/dev/build.sharedResources/lib/ws-junit/ws-junit.jar index 83c41ddca177..c7f0e65ac881 100755 Binary files a/dev/build.sharedResources/lib/ws-junit/ws-junit.jar and b/dev/build.sharedResources/lib/ws-junit/ws-junit.jar differ diff --git a/dev/cnf/.gitignore b/dev/cnf/.gitignore index c6c6c5d8b8fc..ca78ea0ce444 100644 --- a/dev/cnf/.gitignore +++ b/dev/cnf/.gitignore @@ -2,4 +2,3 @@ /bin/ /release/ /generated/ -settings.txt \ No newline at end of file diff --git a/dev/cnf/build.bnd b/dev/cnf/build.bnd index e265835c13a6..d20854b0ef95 100644 --- a/dev/cnf/build.bnd +++ b/dev/cnf/build.bnd @@ -2,7 +2,7 @@ -include ${workspace}/gradle.properties # Artifactory repository credentials --connection-settings: ${.}/settings.txt +-connection-settings: ${.}/settings.xml # Logging for repository connection when debugging #-connection-log: ${.}/connectionlog.txt @@ -18,24 +18,36 @@ # location = ~/.bnd/shacache; \ # index = ${build}/central.json --plugin.2.Templates: \ +-plugin.1.MavenLocal: \ + aQute.bnd.deployer.repository.LocalIndexedRepo; \ + name = MavenLocal; \ + pretty = true; \ + local = ${build}/maven-local + +-plugin.2.Local: \ + aQute.bnd.deployer.repository.LocalIndexedRepo; \ + name = Local; \ + pretty = true; \ + local = ${build}/local + +-plugin.3.Templates: \ aQute.bnd.deployer.repository.LocalIndexedRepo; \ name = Templates; \ pretty = true; \ local = ${build}/templates --plugin.3.Local = \ - aQute.bnd.repository.maven.provider.MavenBndRepository; \ - index = ~/.m2/was-liberty/local.maven; \ - local = ~/.m2/was-liberty; \ - name = "Local"; +-plugin.4.Release: \ + aQute.bnd.deployer.repository.LocalIndexedRepo; \ + name = Release; \ + pretty = true; \ + local = ${build}/release --plugin.4.Release = \ +-plugin.5.Artifactory = \ aQute.bnd.repository.maven.provider.MavenBndRepository; \ releaseUrl=${artifactoryReleaseUrl} ; \ snapshotUrl=${artifactorySnapshotUrl} ; \ index=${build}/release.maven; \ - name = "Release"; + name = "Artifactory"; # Don't upload sources or javadoc unless bundle overrides -maven-release: remote, sources;path=NONE, javadoc;path=NONE @@ -49,10 +61,8 @@ javac.encoding: UTF-8 -pedantic: true -fixupmessages.missingexport: "Used bundle version * for exported package";is:=error -# Uncomment this line for releases -#-snapshot: --buildrepo: Local -releaserepo: Release +-baselinerepo: Release # This is the version of JUnit that will be used at build time and run time junit: org.apache.servicemix.bundles.junit;version="[4.11,5)" @@ -67,7 +77,7 @@ mockito: org.mockito.mockito-core;version="[1.9,2)",\ instrument.disabled: false instrument.classesIncludes: **/*.class -instrument.classesExcludes: +instrument.classesExcludes: instrument.ffdc: true instrument.taskInjection: false diff --git a/dev/cnf/gradle/dev.spi.ibm/com.ibm.websphere.appserver.spi.zosCommandProcessing.bnd b/dev/cnf/gradle/dev.spi.ibm/com.ibm.websphere.appserver.spi.zosCommandProcessing.bnd index 5131e63eeae6..3b3bb4a4caa3 100644 --- a/dev/cnf/gradle/dev.spi.ibm/com.ibm.websphere.appserver.spi.zosCommandProcessing.bnd +++ b/dev/cnf/gradle/dev.spi.ibm/com.ibm.websphere.appserver.spi.zosCommandProcessing.bnd @@ -14,4 +14,4 @@ publish.wlp.jar.suffix: dev/spi/ibm -buildpath: \ ${javac.bootclasspath.java6}, \ - com.ibm.ws.zos.command.processing + com.ibm.ws.zos.core diff --git a/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.apiDiscoveryValidator-1.0.bnd b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.apiDiscoveryValidator-1.0.bnd new file mode 100644 index 000000000000..7717de4aeb62 --- /dev/null +++ b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.apiDiscoveryValidator-1.0.bnd @@ -0,0 +1,9 @@ +-include ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-SymbolicName: com.ibm.websphere.appserver.apiDiscoveryValidator-1.0 + +publish.feature.resources: *.mf + +-buildpath: \ + com.ibm.ws.rest.api.discovery.validator;version=latest diff --git a/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.apiDiscoveryValidator-1.0.mf b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.apiDiscoveryValidator-1.0.mf new file mode 100644 index 000000000000..b4acc9333683 --- /dev/null +++ b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.apiDiscoveryValidator-1.0.mf @@ -0,0 +1,22 @@ +Bnd-LastModified: 1490282142366 +Created-By: 1.8.0_121 (Oracle Corporation) +IBM-App-ForceRestart: install, + uninstall +IBM-AppliesTo: com.ibm.websphere.appserver;${mfProductVersion} +IBM-Feature-Version: 2 +IBM-Install-Policy: when-satisfied +IBM-InstallTo: core +IBM-License-Agreement: wlp/lafiles/LA +IBM-ProductID: com.ibm.websphere.appserver +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.validator-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.apiDiscovery-1.0))" +Subsystem-Content: com.ibm.ws.rest.api.discovery.validator; version="[1.0.0,1.0.200)" +Subsystem-Description: %description +Subsystem-License: http://www.ibm.com/licenses/wlp-featureterms-v1 +Subsystem-Localization: OSGI-INF/l10n/com.ibm.websphere.appserver.apiDiscoveryValidator-1.0 +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: com.ibm.websphere.appserver.apiDiscoveryValidator-1.0; visibility:=private; singleton:=false +Subsystem-Type: osgi.subsystem.feature +Subsystem-Vendor: IBM Corp. +Subsystem-Version: 1.0.0 +Tool: Bnd-3.3.0.201609221906 diff --git a/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.jaxwsClient-2.2.bnd b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.jaxwsClient-2.2.bnd index b877c2917b69..464dd225d74c 100644 --- a/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.jaxwsClient-2.2.bnd +++ b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.jaxwsClient-2.2.bnd @@ -6,17 +6,17 @@ Bundle-SymbolicName: com.ibm.websphere.appserver.jaxwsClient-2.2 publish.feature.resources: *.mf -buildpath: \ - ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-transports-http-2.6.2-ibm-s20160819-0403.jar;version=file,\ - ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-core-2.6.2-ibm-s20160819-0403.jar;version=file,\ - ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-bindings-soap-2.6.2-ibm-s20160819-0403.jar;version=file,\ - ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-bindings-xml-2.6.2-ibm-s20160819-0403.jar;version=file,\ - ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-databinding-jaxb-2.6.2-ibm-s20160819-0403.jar;version=file,\ - ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-management-2.6.2-ibm-s20160819-0403.jar;version=file,\ - ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-ws-addr-2.6.2-ibm-s20160819-0403.jar;version=file,\ - ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-frontend-simple-2.6.2-ibm-s20160819-0403.jar;version=file,\ - ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-frontend-jaxws-2.6.2-ibm-s20160819-0403.jar;version=file,\ - ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-ws-policy-2.6.2-ibm-s20160819-0403.jar;version=file,\ - ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-api-2.6.2-ibm-s20160819-0403.jar;version=file,\ + ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-transports-http-2.6.2-ibm-s20170216-1739.jar;version=file,\ + ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-core-2.6.2-ibm-s20170216-1739.jar;version=file,\ + ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-bindings-soap-2.6.2-ibm-s20170216-1739.jar;version=file,\ + ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-bindings-xml-2.6.2-ibm-s20170216-1739.jar;version=file,\ + ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-databinding-jaxb-2.6.2-ibm-s20170216-1739.jar;version=file,\ + ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-management-2.6.2-ibm-s20170216-1739.jar;version=file,\ + ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-ws-addr-2.6.2-ibm-s20170216-1739.jar;version=file,\ + ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-frontend-simple-2.6.2-ibm-s20170216-1739.jar;version=file,\ + ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-frontend-jaxws-2.6.2-ibm-s20170216-1739.jar;version=file,\ + ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-rt-ws-policy-2.6.2-ibm-s20170216-1739.jar;version=file,\ + ../com.ibm.ws.org.apache.cxf.jaxws/lib/cxf-api-2.6.2-ibm-s20170216-1739.jar;version=file,\ com.ibm.websphere.appserver.injection-1.0;version=latest, \ com.ibm.websphere.appserver.containerServices-1.0;version=latest, \ com.ibm.websphere.appserver.classloading-1.0;version=latest, \ diff --git a/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.microprofile.faulttolerance1.0.bnd b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.microprofile.faulttolerance1.0.bnd deleted file mode 100644 index fc5ac013f036..000000000000 --- a/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.microprofile.faulttolerance1.0.bnd +++ /dev/null @@ -1,9 +0,0 @@ --include ~../cnf/resources/bnd/bundle.props -bVersion=1.0 - -Bundle-SymbolicName: com.ibm.websphere.appserver.internal.microprofile.faulttolerance1.0 - --buildpath: \ - com.ibm.websphere.microprofile.faulttolerance;version=latest,\ - com.ibm.websphere.microprofile.faulttolerance.impl;version=latest - diff --git a/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.microprofile.faulttolerance1.0.mf b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.microprofile.faulttolerance1.0.mf deleted file mode 100644 index 073f8c75a00c..000000000000 --- a/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.microprofile.faulttolerance1.0.mf +++ /dev/null @@ -1,22 +0,0 @@ -Bnd-LastModified: 1479650132013 -Created-By: 1.7.0_85 (Oracle Corporation) -IBM-API-Package: com.ibm.websphere.appserver.microprofile.faulttolerance; type="internal" -IBM-App-ForceRestart: install, - uninstall -IBM-AppliesTo: com.ibm.websphere.appserver;productVersion="@PRODUCT_VERSION@" -IBM-Feature-Version: 2 -IBM-Install-Policy: when-satisfied -IBM-InstallTo: core -IBM-License-Agreement: wlp/lafiles/LA -IBM-ProductID: com.ibm.websphere.appserver -IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.faulttolerance-1.0))" -Subsystem-Content: com.ibm.websphere.microprofile.faulttolerance; version="[1.0.0,1.0.200)", - com.ibm.websphere.microprofile.faulttolerance.impl; version="[1.0.0,1.0.200)" -Subsystem-Description: %description -Subsystem-License: http://www.ibm.com/licenses/wlp-featureterms-v1 -Subsystem-ManifestVersion: 1 -Subsystem-SymbolicName: com.ibm.websphere.appserver.internal.microprofile.faulttolerance1.0; visibility:=private; singleton:=false -Subsystem-Type: osgi.subsystem.feature -Subsystem-Vendor: IBM Corp. -Subsystem-Version: 1.0.0 -Tool: Bnd-3.1.0.201511301807 diff --git a/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.org.eclipse.microProfileFaultTolerance-0.1.bnd b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.org.eclipse.microProfileFaultTolerance-0.1.bnd new file mode 100644 index 000000000000..7923938ae3fa --- /dev/null +++ b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.org.eclipse.microProfileFaultTolerance-0.1.bnd @@ -0,0 +1,8 @@ +-include ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-SymbolicName: com.ibm.websphere.appserver.org.eclipse.microProfileFaultTolerance-0.1 + +-buildpath: \ + com.ibm.websphere.org.eclipse.microprofile.faulttolerance.0.1;version=latest + diff --git a/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.org.eclipse.microProfileFaultTolerance-0.1.mf b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.org.eclipse.microProfileFaultTolerance-0.1.mf new file mode 100644 index 000000000000..0c8bbdedc42d --- /dev/null +++ b/dev/cnf/gradle/internal.features/com.ibm.websphere.appserver.org.eclipse.microProfileFaultTolerance-0.1.mf @@ -0,0 +1,17 @@ +Bnd-LastModified: 1490308521164 +Created-By: 1.8.0_121 (Oracle Corporation) +IBM-AppliesTo: com.ibm.websphere.appserver;${mfProductVersion} +IBM-Feature-Version: 2 +IBM-InstallTo: core +IBM-License-Agreement: wlp/lafiles/LA +IBM-ProductID: com.ibm.websphere.appserver +Subsystem-Content: com.ibm.websphere.org.eclipse.microprofile.faulttolerance.0.1; location:="dev/api/spec/,lib/"; version="[1.0.0,1.0.200)" +Subsystem-Description: %description +Subsystem-License: http://www.ibm.com/licenses/wlp-featureterms-v1 +Subsystem-Localization: OSGI-INF/l10n/com.ibm.websphere.appserver.org.eclipse.microProfileFaultTolerance-0.1 +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: com.ibm.websphere.appserver.org.eclipse.microProfileFaultTolerance-0.1; visibility:=private; singleton:=true +Subsystem-Type: osgi.subsystem.feature +Subsystem-Vendor: IBM Corp. +Subsystem-Version: 1.0.0 +Tool: Bnd-3.3.0.201609221906 diff --git a/dev/cnf/gradle/public.features/com.ibm.websphere.appserver.microProfileFaultTolerance-0.1.mf b/dev/cnf/gradle/public.features/com.ibm.websphere.appserver.microProfileFaultTolerance-0.1.mf index 1dca5b1b8d7f..8655c2616982 100644 --- a/dev/cnf/gradle/public.features/com.ibm.websphere.appserver.microProfileFaultTolerance-0.1.mf +++ b/dev/cnf/gradle/public.features/com.ibm.websphere.appserver.microProfileFaultTolerance-0.1.mf @@ -1,6 +1,7 @@ Bnd-LastModified: 1489177718859 Created-By: 1.8.0_121 (Oracle Corporation) IBM-API-Package: com.ibm.websphere.microprofile.faulttolerance; version="1.0", + com.ibm.websphere.microprofile.faulttolerance.spi; version="1.0", org.eclipse.microprofile.faulttolerance; version="1.0", org.eclipse.microprofile.faulttolerance.spi; version="1.0" IBM-App-ForceRestart: install, @@ -11,9 +12,9 @@ IBM-InstallTo: core IBM-License-Agreement: wlp/lafiles/LA IBM-ProductID: com.ibm.websphere.appserver IBM-ShortName: microProfileFaultTolerance-0.1 -Subsystem-Content: com.ibm.websphere.microprofile.faulttolerance; version="[1.0.0,1.0.200)", - com.ibm.ws.net.jodah.failsafe.1.0.1; version="[1.0.0,1.0.200)", - com.ibm.websphere.microprofile.faulttolerance.failsafe.impl; version="[1.0.0,1.0.200)" +Subsystem-Content: com.ibm.websphere.appserver.org.eclipse.microProfileFaultTolerance-0.1; type="osgi.subsystem.feature", + com.ibm.ws.net.jodah.failsafe.1.0.1; apiJar=false; location:="lib/"; version="[1.0.0,1.0.200)", + com.ibm.ws.microprofile.faulttolerance.failsafe.impl; apiJar=false; location:="lib/"; version="[1.0.0,1.0.200)" Subsystem-Description: %description Subsystem-License: http://www.ibm.com/licenses/wlp-featureterms-v1 Subsystem-Localization: OSGI-INF/l10n/com.ibm.websphere.appserver.microProfileFaultTolerance-0.1 diff --git a/dev/cnf/gradle/public.features/com.ibm.websphere.appserver.validator-1.0.mf b/dev/cnf/gradle/public.features/com.ibm.websphere.appserver.validator-1.0.mf new file mode 100644 index 000000000000..20c8e2a3c4b8 --- /dev/null +++ b/dev/cnf/gradle/public.features/com.ibm.websphere.appserver.validator-1.0.mf @@ -0,0 +1,21 @@ +Bnd-LastModified: 1490308491514 +Created-By: 1.8.0_121 (Oracle Corporation) +IBM-AppliesTo: com.ibm.websphere.appserver;${mfProductVersion} +IBM-Feature-Version: 2 +IBM-InstallTo: core +IBM-License-Agreement: wlp/lafiles/LA +IBM-ProductID: com.ibm.websphere.appserver +IBM-ShortName: validator-1.0 +Subsystem-Content: com.ibm.websphere.appserver.apiDiscovery-1.0; type="osgi.subsystem.feature", + com.ibm.websphere.appserver.servlet-3.0; ibm.tolerates:="3.1"; type="osgi.subsystem.feature", + com.ibm.ws.config.validator; version="[1.0.0,1.0.200)" +Subsystem-Description: %description +Subsystem-License: http://www.ibm.com/licenses/wlp-featureterms-v1 +Subsystem-Localization: OSGI-INF/l10n/com.ibm.websphere.appserver.validator-1.0 +Subsystem-ManifestVersion: 1 +Subsystem-Name: Resource Config Validator 1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.validator-1.0; visibility:=public; singleton:=true +Subsystem-Type: osgi.subsystem.feature +Subsystem-Vendor: IBM Corp. +Subsystem-Version: 1.0.0 +Tool: Bnd-3.3.0.201609221906 diff --git a/dev/cnf/gradle/transform/transform.properties b/dev/cnf/gradle/transform/transform.properties index 8538dfeb7300..051ac51213b6 100644 --- a/dev/cnf/gradle/transform/transform.properties +++ b/dev/cnf/gradle/transform/transform.properties @@ -5,19 +5,23 @@ com.ibm.json4j=Kernel com.ibm.os400.native=Kernel com.ibm.websphere.appserver.api.config=Kernel com.ibm.websphere.appserver.api.hpel=Kernel +com.ibm.websphere.appserver.api.json=KernelTest com.ibm.websphere.appserver.api.kernel.service=Kernel com.ibm.websphere.appserver.kernel-1.0=Kernel com.ibm.websphere.appserver.kernelCore-1.0=Kernel com.ibm.websphere.appserver.osgiConsole-1.0=Kernel +com.ibm.websphere.appserver.spi.httptransport=KernelTest com.ibm.websphere.appserver.spi.kernel.embeddable=Kernel com.ibm.websphere.appserver.spi.kernel.filemonitor=Kernel com.ibm.websphere.appserver.spi.kernel.metatype=Kernel com.ibm.websphere.appserver.spi.kernel.service=Kernel com.ibm.websphere.appserver.spi.logging=Kernel com.ibm.websphere.appserver.spi.threading=Kernel +com.ibm.websphere.appserver.spi.zosCommandProcessing=Kernel +com.ibm.websphere.filetransfer=KernelTest com.ibm.websphere.javaee.jsonp.1.0=Kernel -com.ibm.websphere.javaee.servlet.3.0=KernelTestPrereq -com.ibm.websphere.javaee.servlet.3.1=KernelTestPrereq +com.ibm.websphere.javaee.servlet.3.0=KernelTest +com.ibm.websphere.javaee.servlet.3.1=KernelTest com.ibm.websphere.org.osgi.core=KernelPrereq com.ibm.websphere.org.osgi.service.blueprint=KernelPrereq com.ibm.websphere.org.osgi.service.cm=KernelPrereq @@ -25,10 +29,11 @@ com.ibm.websphere.org.osgi.service.component=KernelPrereq com.ibm.websphere.org.osgi.service.http=KernelPrereq com.ibm.websphere.org.osgi.service.http.whiteboard=KernelPrereq com.ibm.ws.cds=Kernel -com.ibm.ws.channelfw=KernelTestPrereq +com.ibm.ws.channelfw=KernelTest com.ibm.ws.cik.launcher=Kernel com.ibm.ws.common.encoder=Kernel com.ibm.ws.common.encoder_test=KernelTest +com.ibm.ws.componenttest=KernelTest com.ibm.ws.config=Kernel com.ibm.ws.config.ext=Kernel com.ibm.ws.config.schemagen=Kernel @@ -38,8 +43,11 @@ com.ibm.ws.config.server.schemagen=Kernel com.ibm.ws.config.server.schemagen.serverschemagen=Kernel com.ibm.ws.config.utility=Kernel com.ibm.ws.config.utility.configUtility=Kernel +com.ibm.ws.config.utility_fat=KernelTest com.ibm.ws.config.utility_test=KernelTest com.ibm.ws.config_bvt.parser=KernelTest +com.ibm.ws.config_bvt.schema=KernelTest +com.ibm.ws.config_fat=KernelTest com.ibm.ws.config_test=KernelTest com.ibm.ws.crypto.certificateutil=Kernel com.ibm.ws.crypto.certificateutil_bvt=KernelTest @@ -61,7 +69,9 @@ com.ibm.ws.install.utility.installUtility=Kernel com.ibm.ws.install.ws-cikLauncher=Kernel com.ibm.ws.install_test=KernelTest com.ibm.ws.jmx=Kernel +com.ibm.ws.jmx.connector.client.rest=KernelTest com.ibm.ws.jmx.scripting.client=Kernel +com.ibm.ws.jmx_fat=KernelTest com.ibm.ws.jmx_test=KernelTest com.ibm.ws.kernel.boot=Kernel com.ibm.ws.kernel.boot.archive=Kernel @@ -74,6 +84,7 @@ com.ibm.ws.kernel.boot.nested=Kernel com.ibm.ws.kernel.boot.ws-launch=Kernel com.ibm.ws.kernel.boot.ws-server=Kernel com.ibm.ws.kernel.boot_bvt=KernelTest +com.ibm.ws.kernel.boot_fat=KernelTest com.ibm.ws.kernel.boot_test=KernelTest com.ibm.ws.kernel.cmdline=Kernel com.ibm.ws.kernel.cmdline_test=KernelTest @@ -84,12 +95,15 @@ com.ibm.ws.kernel.feature.core=Kernel com.ibm.ws.kernel.feature.featureManager=Kernel com.ibm.ws.kernel.feature.featurelist=Kernel com.ibm.ws.kernel.feature_bvt=KernelTest +com.ibm.ws.kernel.feature_fat=KernelTest com.ibm.ws.kernel.feature_test=KernelTest com.ibm.ws.kernel.filemonitor=Kernel +com.ibm.ws.kernel.filemonitor_fat=KernelTest com.ibm.ws.kernel.filemonitor_test=KernelTest com.ibm.ws.kernel.instrument.agent=Kernel com.ibm.ws.kernel.instrument.check=Kernel com.ibm.ws.kernel.metatype.helper=Kernel +com.ibm.ws.kernel.metatype.helper_fat=KernelTest com.ibm.ws.kernel.metatype.helper_test=KernelTest com.ibm.ws.kernel.security.thread=Kernel com.ibm.ws.kernel.service=Kernel @@ -102,9 +116,11 @@ com.ibm.ws.logging.hpel=Kernel com.ibm.ws.logging.hpel.binarylogviewer=Kernel com.ibm.ws.logging.hpel.osgi=Kernel com.ibm.ws.logging.hpel_bvt=KernelTest +com.ibm.ws.logging.hpel_fat=KernelTest com.ibm.ws.logging.hpel_test=KernelTest com.ibm.ws.logging.osgi=Kernel com.ibm.ws.logging_bvt=KernelTest +com.ibm.ws.logging_fat=KernelTest com.ibm.ws.logging_test=KernelTest com.ibm.ws.org.apache.ant=KernelPrereq com.ibm.ws.org.apache.aries.jmx.api=KernelPrereq @@ -116,44 +132,58 @@ com.ibm.ws.org.apache.felix.gogo.command=KernelPrereq com.ibm.ws.org.apache.felix.gogo.runtime=KernelPrereq com.ibm.ws.org.apache.felix.gogo.shell=KernelPrereq com.ibm.ws.org.apache.felix.scr=KernelPrereq -com.ibm.ws.org.codehaus.jackson=KernelTestPrereq +com.ibm.ws.org.codehaus.jackson=KernelTest com.ibm.ws.org.eclipse.equinox.console=KernelPrereq com.ibm.ws.org.eclipse.equinox.coordinator=KernelPrereq com.ibm.ws.org.eclipse.equinox.metatype=KernelPrereq com.ibm.ws.org.eclipse.equinox.region=KernelPrereq com.ibm.ws.org.glassfish.json=KernelPrereq +com.ibm.ws.org.glassfish.json_fat=KernelTest com.ibm.ws.org.objectweb.asm=KernelPrereq com.ibm.ws.org.osgi.annotation.versioning=KernelPrereq -com.ibm.ws.org.osgi.service.resolver=KernelTestPrereq +com.ibm.ws.org.osgi.service.resolver=KernelTest com.ibm.ws.product.utility=Kernel com.ibm.ws.product.utility.productutil=Kernel com.ibm.ws.product.utility_bvt=KernelTest +com.ibm.ws.product.utility_fat=KernelTest com.ibm.ws.product.utility_test=KernelTest com.ibm.ws.ras.instrument=Kernel com.ibm.ws.repository=Kernel com.ibm.ws.repository.liberty=Kernel com.ibm.ws.repository.resolver=Kernel +com.ibm.ws.repository.resolver_fat=KernelTest com.ibm.ws.repository.resolver_test=KernelTest +com.ibm.ws.repository.test.utils=KernelTest +com.ibm.ws.repository.test.utils_test=KernelTest com.ibm.ws.runtime.update=Kernel com.ibm.ws.runtime.update_bvt=KernelTest +com.ibm.ws.runtime.update_fat=KernelTest com.ibm.ws.runtime.update_test=KernelTest +com.ibm.ws.security.thread.zos.hooks=Kernel com.ibm.ws.security.utility=Kernel com.ibm.ws.security.utility.securityutil=Kernel com.ibm.ws.security.utility_bvt=KernelTest +com.ibm.ws.security.utility_fat=KernelTest com.ibm.ws.security.utility_test=KernelTest com.ibm.ws.threading=Kernel com.ibm.ws.threading_bvt=KernelTest +com.ibm.ws.threading_fat=KernelTest com.ibm.ws.threading_test=KernelTest -com.ibm.ws.timer=KernelTestPrereq -com.ibm.ws.transport.http=KernelTestPrereq +com.ibm.ws.timer=KernelTest +com.ibm.ws.transport.http=KernelTest +com.ibm.ws.zos.channel.console=Kernel com.ibm.ws.zos.command.processing=Kernel com.ibm.ws.zos.command.processing_test=KernelTest +com.ibm.ws.zos.command.processing_zfat=KernelTest +com.ibm.ws.zos.command.processing_ztest=KernelTest com.ibm.ws.zos.core=Kernel com.ibm.ws.zos.core_test=KernelTest com.ibm.ws.zos.diagnostics=Kernel com.ibm.ws.zos.diagnostics_test=KernelTest com.ibm.ws.zos.logging=Kernel com.ibm.ws.zos.logging_test=KernelTest +com.ibm.ws.zos.logging_zfat=KernelTest +com.ibm.ws.zos.logging_ztest=KernelTest com.ibm.wsspi.org.osgi.core=KernelPrereq com.ibm.wsspi.org.osgi.namespace.service=KernelPrereq com.ibm.wsspi.org.osgi.service.cm=KernelPrereq @@ -167,10 +197,12 @@ com.ibm.wsspi.org.osgi.service.metatype.annotations=KernelPrereq com.ibm.wsspi.org.osgi.service.subsystem=KernelPrereq com.ibm.wsspi.thirdparty.equinox=KernelPrereq com.ibm.zos.native=Kernel +fattest.simplicity=KernelTest org.eclipse.osgi=Kernel prereq.java.1.6=KernelPrereq prereq.java.1.7=KernelPrereq prereq.java.1.8=KernelPrereq prereq.java.tools=KernelPrereq wlp.lib.extract=Kernel +wlp.lib.extract_fat=KernelTest wlp.lib.extract_test=KernelTest diff --git a/dev/cnf/settings.xml b/dev/cnf/settings.xml new file mode 100644 index 000000000000..8212796b7b3e --- /dev/null +++ b/dev/cnf/settings.xml @@ -0,0 +1,12 @@ + + + + https://na-blue.artifactory.swg-devops.com + ../../../ssh_keys/id_rsa.pub + false + + + diff --git a/dev/com.ibm.websphere.appserver.api.json/.classpath b/dev/com.ibm.websphere.appserver.api.json/.classpath new file mode 100644 index 000000000000..bd52baaf243d --- /dev/null +++ b/dev/com.ibm.websphere.appserver.api.json/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.websphere.appserver.api.json/.gitignore b/dev/com.ibm.websphere.appserver.api.json/.gitignore new file mode 100644 index 000000000000..05ee82b1e374 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.api.json/.gitignore @@ -0,0 +1,3 @@ +/bin/ +/build/ +/generated/ diff --git a/dev/com.ibm.websphere.appserver.api.json/.project b/dev/com.ibm.websphere.appserver.api.json/.project new file mode 100644 index 000000000000..93a49f1138b4 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.api.json/.project @@ -0,0 +1,23 @@ + + + com.ibm.websphere.appserver.api.json + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.websphere.appserver.api.json/bnd.bnd b/dev/com.ibm.websphere.appserver.api.json/bnd.bnd new file mode 100644 index 000000000000..41f99c8f9b54 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.api.json/bnd.bnd @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion: 1.0 + +Bundle-Name: WebSphere JSON API +Bundle-Description: WebSphere JSON API, version ${bVersion} +Bundle-SymbolicName: com.ibm.websphere.appserver.api.json + +Export-Package: com.ibm.json.java,com.ibm.json.xml + +Import-Package: com.ibm.json.java,com.ibm.json.xml + +-includeresource: {META-INF/maven/com.ibm.websphere.appserver.api/com.ibm.websphere.appserver.api.json/pom.xml=com.ibm.websphere.appserver.api.json.pom} + +publish.wlp.jar.suffix: dev/api/ibm + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + com.ibm.json4j;version=latest diff --git a/dev/com.ibm.ws.common.encoder_test/build.nogradle b/dev/com.ibm.websphere.appserver.api.json/build.gradle similarity index 100% rename from dev/com.ibm.ws.common.encoder_test/build.nogradle rename to dev/com.ibm.websphere.appserver.api.json/build.gradle diff --git a/dev/com.ibm.websphere.appserver.api.json/com.ibm.websphere.appserver.api.json.pom b/dev/com.ibm.websphere.appserver.api.json/com.ibm.websphere.appserver.api.json.pom new file mode 100644 index 000000000000..3d8e15485dbf --- /dev/null +++ b/dev/com.ibm.websphere.appserver.api.json/com.ibm.websphere.appserver.api.json.pom @@ -0,0 +1,26 @@ + + + + + + + IBM International License Agreement for Non-Warranted Programs + http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/licenses/L-JTHS-8SZMHX/HTML/ + repo + Additional notices http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/licenses/L-JTHS-8SZMHX/HTML/notices.html + + + + 4.0.0 + com.ibm.websphere.appserver.api + com.ibm.websphere.appserver.api.json + ${bFullVersion} + WebSphere JSON API + WebSphere JSON API, version 1.0 + diff --git a/dev/com.ibm.websphere.appserver.kernel-1.0/bnd.bnd b/dev/com.ibm.websphere.appserver.kernel-1.0/bnd.bnd index 9993d426f9d3..a55886b43387 100644 --- a/dev/com.ibm.websphere.appserver.kernel-1.0/bnd.bnd +++ b/dev/com.ibm.websphere.appserver.kernel-1.0/bnd.bnd @@ -114,6 +114,9 @@ bVersion=1.0 com.ibm.ws.repository;version=latest,\ com.ibm.ws.security.utility.securityutil;version=latest,\ com.ibm.ws.security.utility;version=latest,\ + com.ibm.ws.security.thread.zos.hooks;version=latest,\ + com.ibm.websphere.appserver.spi.zosCommandProcessing;version=latest,\ + com.ibm.ws.zos.channel.console;version=latest,\ com.ibm.ws.zos.command.processing;version=latest,\ com.ibm.ws.zos.core;version=latest,\ com.ibm.ws.zos.diagnostics;version=latest,\ diff --git a/dev/com.ibm.websphere.appserver.spi.httptransport/.classpath b/dev/com.ibm.websphere.appserver.spi.httptransport/.classpath new file mode 100644 index 000000000000..bd52baaf243d --- /dev/null +++ b/dev/com.ibm.websphere.appserver.spi.httptransport/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.websphere.appserver.spi.httptransport/.gitignore b/dev/com.ibm.websphere.appserver.spi.httptransport/.gitignore new file mode 100644 index 000000000000..05ee82b1e374 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.spi.httptransport/.gitignore @@ -0,0 +1,3 @@ +/bin/ +/build/ +/generated/ diff --git a/dev/com.ibm.websphere.appserver.spi.httptransport/.project b/dev/com.ibm.websphere.appserver.spi.httptransport/.project new file mode 100644 index 000000000000..126bb709e65a --- /dev/null +++ b/dev/com.ibm.websphere.appserver.spi.httptransport/.project @@ -0,0 +1,23 @@ + + + com.ibm.websphere.appserver.spi.httptransport + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.websphere.appserver.spi.httptransport/bnd.bnd b/dev/com.ibm.websphere.appserver.spi.httptransport/bnd.bnd new file mode 100644 index 000000000000..ec5ba29ca728 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.spi.httptransport/bnd.bnd @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion: 1.1 + +Bundle-Name: WebSphere HTTP Transport SPI +Bundle-Description: WebSphere HTTP Transport SPI, version ${bVersion} +Bundle-SymbolicName: com.ibm.websphere.appserver.spi.httptransport + +Import-Package: com.ibm.wsspi.http + +Export-Package: com.ibm.wsspi.http + +-includeresource: {META-INF/maven/com.ibm.websphere.appserver.spi/com.ibm.websphere.appserver.spi.httptransport/pom.xml=com.ibm.websphere.appserver.spi.httptransport.pom} + +publish.wlp.jar.suffix: dev/spi/ibm + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + com.ibm.ws.transport.http diff --git a/dev/com.ibm.ws.config.schemagen_test/build.nogradle b/dev/com.ibm.websphere.appserver.spi.httptransport/build.gradle similarity index 100% rename from dev/com.ibm.ws.config.schemagen_test/build.nogradle rename to dev/com.ibm.websphere.appserver.spi.httptransport/build.gradle diff --git a/dev/com.ibm.websphere.appserver.spi.httptransport/com.ibm.websphere.appserver.spi.httptransport.pom b/dev/com.ibm.websphere.appserver.spi.httptransport/com.ibm.websphere.appserver.spi.httptransport.pom new file mode 100644 index 000000000000..0ded337f88f0 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.spi.httptransport/com.ibm.websphere.appserver.spi.httptransport.pom @@ -0,0 +1,26 @@ + + + + + + + IBM International License Agreement for Non-Warranted Programs + http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/licenses/L-JTHS-8SZMHX/HTML/ + repo + Additional notices http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/licenses/L-JTHS-8SZMHX/HTML/notices.html + + + + 4.0.0 + com.ibm.websphere.appserver.spi + com.ibm.websphere.appserver.spi.httptransport + ${bFullVersion} + WebSphere HTTP Transport SPI + WebSphere HTTP Transport SPI, version 1.1 + diff --git a/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/.classpath b/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/.classpath new file mode 100644 index 000000000000..bd52baaf243d --- /dev/null +++ b/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/.gitignore b/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/.gitignore new file mode 100644 index 000000000000..05ee82b1e374 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/.gitignore @@ -0,0 +1,3 @@ +/bin/ +/build/ +/generated/ diff --git a/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/.project b/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/.project new file mode 100644 index 000000000000..fd7f331879d2 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/.project @@ -0,0 +1,23 @@ + + + com.ibm.websphere.appserver.spi.zosCommandProcessing + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/bnd.bnd b/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/bnd.bnd new file mode 100644 index 000000000000..3b3bb4a4caa3 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/bnd.bnd @@ -0,0 +1,17 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion: 1.0 + +Bundle-Name: WebSphere ZOS Command Processing SPI +Bundle-Description: WebSphere ZOS Command Processing SPI, version ${bVersion} +Bundle-SymbolicName: com.ibm.websphere.appserver.spi.zosCommandProcessing + +Import-Package: com.ibm.wsspi.zos.command.processing + +Export-Package: com.ibm.wsspi.zos.command.processing +-includeresource: {META-INF/maven/com.ibm.websphere.appserver.spi/com.ibm.websphere.appserver.spi.zosCommandProcessing/pom.xml=com.ibm.websphere.appserver.spi.zosCommandProcessing.pom} + +publish.wlp.jar.suffix: dev/spi/ibm + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + com.ibm.ws.zos.core diff --git a/dev/com.ibm.ws.config.utility_test/build.nogradle b/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/build.gradle similarity index 100% rename from dev/com.ibm.ws.config.utility_test/build.nogradle rename to dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/build.gradle diff --git a/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/com.ibm.websphere.appserver.spi.zosCommandProcessing.pom b/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/com.ibm.websphere.appserver.spi.zosCommandProcessing.pom new file mode 100644 index 000000000000..6f63f397d737 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.spi.zosCommandProcessing/com.ibm.websphere.appserver.spi.zosCommandProcessing.pom @@ -0,0 +1,26 @@ + + + + + + + IBM International License Agreement for Non-Warranted Programs + http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/licenses/L-JTHS-8SZMHX/HTML/ + repo + Additional notices http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/licenses/L-JTHS-8SZMHX/HTML/notices.html + + + + 4.0.0 + com.ibm.websphere.appserver.spi + com.ibm.websphere.appserver.spi.zosCommandProcessing + 1.0.16 + WebSphere ZOS Command Processing SPI + WebSphere ZOS Command Processing SPI, version 1.0 + diff --git a/dev/com.ibm.websphere.filetransfer/.classpath b/dev/com.ibm.websphere.filetransfer/.classpath new file mode 100755 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.websphere.filetransfer/.classpath.gradle b/dev/com.ibm.websphere.filetransfer/.classpath.gradle new file mode 100644 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.websphere.filetransfer/.gitignore b/dev/com.ibm.websphere.filetransfer/.gitignore new file mode 100644 index 000000000000..57b341172a1b --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/generated/ diff --git a/dev/com.ibm.websphere.filetransfer/.project b/dev/com.ibm.websphere.filetransfer/.project new file mode 100755 index 000000000000..d0435f4bb977 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.project @@ -0,0 +1,23 @@ + + + com.ibm.websphere.filetransfer + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..845c3083c7df --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c874b5816985 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.websphere.filetransfer/.settings/org.sonar.ide.eclipse.core.prefs b/dev/com.ibm.websphere.filetransfer/.settings/org.sonar.ide.eclipse.core.prefs new file mode 100755 index 000000000000..e0b979e14e47 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.settings/org.sonar.ide.eclipse.core.prefs @@ -0,0 +1,7 @@ +analyseLocally=false +eclipse.preferences.version=1 +extraProperties= +lastAnalysisDate=1366911191199 +projectKey=Liberty-8.5.5\:com.ibm.websphere.filetransfer +serverUrl=http\://szeged.hursley.ibm.com\:8080/sonar +version=2 diff --git a/dev/com.ibm.websphere.filetransfer/README.txt b/dev/com.ibm.websphere.filetransfer/README.txt new file mode 100755 index 000000000000..9cd48f08a57f --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/README.txt @@ -0,0 +1,5 @@ +Last update: 2013/08/13 + +This project (com.ibm.websphere.filetransfer) is intended to encapsulate all of +the public API and SPI related to file transfer support. Do not add non-public +interfaces to this project. diff --git a/dev/com.ibm.websphere.filetransfer/bnd.bnd b/dev/com.ibm.websphere.filetransfer/bnd.bnd new file mode 100755 index 000000000000..c5c4404d0cf5 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: WebSphere File Services APIs +Bundle-SymbolicName: com.ibm.websphere.filetransfer +Bundle-Description: APIs for WebSphere File Services; version=${bVersion} +Bundle-ActivationPolicy: lazy + +Export-Package: com.ibm.websphere.filetransfer + +instrument.disabled: true + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + com.ibm.ws.org.osgi.annotation.versioning.1.0.0;version=latest diff --git a/dev/com.ibm.ws.config_bvt.parser/build.nogradle b/dev/com.ibm.websphere.filetransfer/build.gradle similarity index 100% rename from dev/com.ibm.ws.config_bvt.parser/build.nogradle rename to dev/com.ibm.websphere.filetransfer/build.gradle diff --git a/dev/com.ibm.websphere.filetransfer/build.xml b/dev/com.ibm.websphere.filetransfer/build.xml new file mode 100755 index 000000000000..511276204f20 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/build.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.websphere.filetransfer/findbugs.exclude.xml b/dev/com.ibm.websphere.filetransfer/findbugs.exclude.xml new file mode 100755 index 000000000000..1cf8902cff2b --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/findbugs.exclude.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileServiceMXBean.java b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileServiceMXBean.java new file mode 100755 index 000000000000..acf390bfa21e --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileServiceMXBean.java @@ -0,0 +1,231 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.filetransfer; + +import java.beans.ConstructorProperties; +import java.util.Date; +import java.util.List; + +/** + * This MBean provides file service operations on the host system on which + * the server resides. + *

+ * The ObjectName for this MBean is {@value #OBJECT_NAME}. + *

+ * All paths are implicitly remote, as the operations performed by this MBean + * occur on the host which the server resides. All paths are required to be + * absolute, either explicitly or rooted with a WebSphere variable such as + * ${wlp.install.dir}. + * + * @ibm-api + */ +public interface FileServiceMXBean { + + /** + * A String representing the {@link javax.management.ObjectName} that this MXBean maps to. + */ + String OBJECT_NAME = "WebSphere:feature=restConnector,type=FileService,name=FileService"; + + /** + * Option indicating all available keys should be used for the query. + */ + String REQUEST_OPTIONS_ALL = "a"; + + /** + * Option indicating that "isDirectory" key should be used for the query. + */ + String REQUEST_OPTIONS_IS_DIRECTORY = "d"; + + /** + * Option indicating that "isReadOnly" key should be used for the query. + */ + String REQUEST_OPTIONS_READ_ONLY = "r"; + + /** + * Option indicating that "size" key should be used for the query. + */ + String REQUEST_OPTIONS_SIZE = "s"; + + /** + * Option indicating that "lastModified" key should be used for the query. + */ + String REQUEST_OPTIONS_LAST_MODIFIED = "t"; + + /** + * The name of the attribute representing the list of read locations. + */ + String ATTRIBUTE_NAME_READ_LIST = "ReadList"; + + /** + * The name of the attribute representing the list of write locations. + */ + String ATTRIBUTE_NAME_WRITE_LIST = "WriteList"; + + /** + * Get the configured list of read-accessible locations on the host where + * this server resides. This list is configurable for each server by + * modifying the server.xml. Each directory to allow for read access can + * be specified to the <remoteFileAccess> configuration element + * 'readDir' attribute. + *

+ * For example: + *
+ *

+     * <remoteFileAccess>
+     *     <readDir>$ server.output.dir}/payloads</readDir>
+     * </remoteFileAccess>
+     * 
+ *

+ * The default is an empty list. + * + * @return a list of Strings containing the absolute paths which are read-accessible. + */ + List getReadList(); + + /** + * Get the configured list of write-accessible locations on the host where + * this server resides. This list is configurable for each server by + * modifying the server.xml. Each direcoty to allow for write access can + * be specified to the <remoteFileAccess> configuration element + * 'writeDir' attribute. + *

+ * For example: + *
+ *

+     * <remoteFileAccess>
+     *     <writeDir>${server.output.dir}/target</writeDir>
+     * </remoteFileAccess>
+     * 
+ *

+ * The default is a list containing 3 entries: ${wlp.install.dir}, + * ${wlp.user.dir} and ${server.output.dir}. + * + * @return a list of Strings containing the absolute paths which are write-accessible. + */ + List getWriteList(); + + /** + * Get the metadata pertaining to the specified path. The result object + * will contain the requested metadata subset as indicated by the + * requestOptions String value, which should be constructed as a + * concatenation of the desired values. + *

+ * For example: to obtain a request that provides only the "size" and + * "lastModified" metadata values, the user can pass in "st" as the + * requestOptions field. + * + * @param path the absolute path of the file or directory for which to retrieve the metadata + * @param requestOptions a String representing the concatenation of the requested metadata keys. See REQUEST_OPTIONS_* fields. + * @return a CompositeData containing the requested metadata + */ + MetaData getMetaData(String path, String requestOptions); + + /** + * List the directory/files for the given path. + * + * @param directory the absolute path of the directory to list + * @param recursive a boolean to specify if the search should be done to all descendant paths + * @param requestOptions a String representing the concatenation of the requested metadata keys + * @return an array of CompositeData, representing the requested metadata for each entry + */ + MetaData[] getDirectoryEntries(String directory, boolean recursive, String requestOptions); + + /** + * Create an archive of the given sourcePath. + *

+ * This operation occurs on the file system on which this server resides. + * Therefore the sourcePath and targetPath are paths on the server's host + * system. + * + * @param sourcePath the absolute path of the entity to archive + * @param targetPath the absolute path to where resulting archive is to be stored + * @return true if archive was successfully created, false otherwise + */ + boolean createArchive(String sourcePath, String targetPath); + + /** + * Expand the archive at the given sourcePath. + *

+ * This operation occurs on the file system on which this server resides. + * Therefore the sourcePath and targetPath are paths on the server's host + * system. + * + * @param sourcePath the absolute path of the archive to be expanded + * @param targetPath the absolute path to where archive is to be expanded + * @return true if archive was successfully expanded, false otherwise + */ + boolean expandArchive(String sourcePath, String targetPath); + + /** + * Return type for the getMetaData and getDirectoryEntries methods. + * + * The JMX framework will convert this to a CompositeData object on the client side. + */ + public class MetaData { + + private final Boolean directory; + private final Boolean readOnly; + private final Date lastModified; + private final Long size; + private final String fileName; + + @ConstructorProperties({ "directory", "lastModified", "size", "readOnly", "fileName" }) + public MetaData(Boolean directory, Date lastModified, Long size, Boolean readOnly, String fileName) { + this.directory = directory; + this.lastModified = (lastModified == null) ? null : (Date) lastModified.clone(); + this.size = size; + this.readOnly = readOnly; + this.fileName = fileName; + } + + /** + * Boolean value indicating whether or not the entity is a directory. + * + * @return {@code true} if the entity is a directory, {@code false} otherwise. + */ + public Boolean getDirectory() { + return this.directory; + } + + /** + * @return Date object representing the time the entity was last modified + */ + public Date getLastModified() { + return (this.lastModified == null) ? null : (Date) this.lastModified.clone(); + } + + /** + * @return Long object indicating the size of the entity. + */ + public Long getSize() { + return this.size; + } + + /** + * Boolean value indicating whether or not the entity is read-only. + * + * @return {@code true} if the entity is read-only, {@code false} otherwise. + */ + public Boolean getReadOnly() { + return this.readOnly; + } + + /** + * @return String value indicating the entity's absolute path. + */ + public String getFileName() { + return this.fileName; + } + + } + +} diff --git a/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileTransferMBean.java b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileTransferMBean.java new file mode 100755 index 000000000000..33b9690890cb --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileTransferMBean.java @@ -0,0 +1,137 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.filetransfer; + +import java.io.IOException; +import java.util.List; + +/** + * This MBean exposes remote file transfer capabilities and must be accessed + * only within IBM's JMX REST Connector. Accessing this MBean by any + * other means will result in a {@link java.lang.UnsupportedOperationException}. + *

+ * The ObjectName for this MBean is {@value #OBJECT_NAME}. + *

+ * For the remote file parameters (ie: remoteSourceFile for download/delete + * and remoteTargetFile for upload) the following characteristics apply: + *

    + *
  • the remote file will be either on the connected host or on the routing host (if one is setup). + *
  • all file paths need to be either absolute or prepend a Liberty-defined symbol (described on <wlp>/README.txt) that resolves to an absolute path. + *
  • all read and write operations need to be within the configured (or defaulted) read/write regions. See {@link com.ibm.websphere.filetransfer.FileServiceMXBean} for details. + *
+ *

+ * For the local file parameters (ie: localTargetFile for download and and + * localSourceFile for upload) the following characteristics apply: + *

    + *
  • the local file will be in a folder that contains the appropriate read/write permissions. + *
  • the file path is either absolute or relative to the current working directory. + *
+ * + * @ibm-api + */ +public interface FileTransferMBean { + + /** + * A string representing the {@link javax.management.ObjectName} that this MBean maps to. + */ + String OBJECT_NAME = "WebSphere:feature=restConnector,type=FileTransfer,name=FileTransfer"; + + /** + * Download a file from the specified remote source location and write it + * in the specified local target location. + *

+ * Directories are not supported as the remote source file. To download a + * directory, it must first be archived. + * + * @param remoteSourceFile the remote file location of the source to download + * @param localTargetFile the local file location where the source contents will be written + * @throws IOException if there are any issues handling the source or target files + */ + void downloadFile(String remoteSourceFile, String localTargetFile) throws IOException; + + /** + * Download part of a file from the specified remote source location using the specified start and + * end offset byte values and write it in the specified local target location. + *

+ * Directories are not supported as the remote source file. To download a + * directory, it must first be archived. + *

+ * This partial download feature is currently available only in non-routing scenarios. + * + * @param remoteSourceFile the remote file location of the source to download + * @param localTargetFile the local file location where the source contents will be written + * @param startOffset index of the first byte to copy (zero-based and inclusive) + * @param endOffset index of the last byte to copy (zero-based and inclusive). + * Specify -1 to copy until the end of file. + * + * @return Index to use as start offset for next partial file download request. + * If this value is greater than the startOffset value that was passed in, then + * some bytes (equivalent to the difference) were transferred by this download request. + *
+ * Note: It is assumed that in-between the download requests, remote source file is not + * modified in any way except for appending contents to end of the file. + * + * @throws IOException if there are any issues handling the source or target files + */ + long downloadFile(String remoteSourceFile, String localTargetFile, long startOffset, long endOffset) throws IOException; + + /** + * Upload a file from the specified local source location and write it + * in the specified remote target location. + *

+ * This method optionally supports expanding an archive (specified as the local + * source file) to the remote target file. The supported compression + * formats are 'zip' and 'jar' (including war and ear) . All other format types will result in + * undefined behaviour. + *

+ * Directories are not supported as the local source file. To upload a + * directory, it must first be archived and can then be expanded during upload using the expandOnCompletion option. + * This option has a special behaviour: the archive will be uploaded as a regular file to the remote system, and then we + * will make a directory that matches the filename specified by remoteTargetFile, and the contents will be expanded inside that new folder. + * + *

Example: Uploading an archive with remoteTargetFile /home/myFolder/wlp.zip and the expandOnCompletion + * option set to true will upload the archive wlp.zip to the remote file system, create a folder called wlp.zip + * under the directory /home/myFolder, and then expand the contents of the archive inside the folder /home/myFolder/wlp.zip. + * + * If expandOnCompletion flag is false,then remoteTargetFile must match a filename with an extension (unless the file has not extension), and + * cannot be a folder. + * + * + * @param localSourceFile the local path to the file that will be uploaded. + * The source file must be a file, since directories are not supported. + * @param remoteTargetFile the remote path of the uploaded file. + * The target file must be a file, since directories are not supported. + * @param expandOnCompletion indicates if the archive should be expanded automatically after it is uploaded. + * @throws IOException if there are any issues handling the request + */ + void uploadFile(String localSourceFile, String remoteTargetFile, boolean expandOnCompletion) throws IOException; + + /** + * Delete a file located at the remote specified location. + *

+ * Recursive deletion of a directory is not supported, however deletion of + * an empty directory is supported. + * + * @param remoteSourceFile the location of the remote file to be deleted + * @throws IOException if there are any issues handling the request + */ + void deleteFile(String remoteSourceFile) throws IOException; + + /** + * Delete files and folders (empty and non-empty) at the remote specified locations + * + * @param remoteArtifacts list of locations of remote files and folders (empty and non-empty) to delete + * @throws IOException if there are any issues handling the request + */ + void deleteAll(List remoteArtifacts) throws IOException; + +} diff --git a/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/package-info.java b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/package-info.java new file mode 100755 index 000000000000..4b8251a907a2 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/package-info.java @@ -0,0 +1,21 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +/** + * This package is intended to encapsulate the public API and SPI related + * to file transfer. Do not add non-public interfaces to this package. + * + * @version 1.1 + */ +@org.osgi.annotation.versioning.Version("1.1") +package com.ibm.websphere.filetransfer; + diff --git a/dev/com.ibm.websphere.javaee.servlet.3.0/.classpath b/dev/com.ibm.websphere.javaee.servlet.3.0/.classpath index 9a3a2e91b106..bd52baaf243d 100644 --- a/dev/com.ibm.websphere.javaee.servlet.3.0/.classpath +++ b/dev/com.ibm.websphere.javaee.servlet.3.0/.classpath @@ -1,7 +1,6 @@ - - - - + + + diff --git a/dev/com.ibm.websphere.javaee.servlet.3.0/.classpath.gradle b/dev/com.ibm.websphere.javaee.servlet.3.0/.classpath.gradle new file mode 100644 index 000000000000..bd52baaf243d --- /dev/null +++ b/dev/com.ibm.websphere.javaee.servlet.3.0/.classpath.gradle @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.websphere.javaee.servlet.3.0/bnd.bnd b/dev/com.ibm.websphere.javaee.servlet.3.0/bnd.bnd new file mode 100644 index 000000000000..6cf29be24adc --- /dev/null +++ b/dev/com.ibm.websphere.javaee.servlet.3.0/bnd.bnd @@ -0,0 +1,24 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-SymbolicName: com.ibm.websphere.javaee.servlet.3.0; singleton:=true + +Export-Package: \ + javax.servlet;thread-context=true;version="2.6.0";uses:="javax.servlet.annotation,javax.servlet.descriptor",\ + javax.servlet.annotation;thread-context=true;version="2.6.0";uses:="javax.servlet",\ + javax.servlet.descriptor;thread-context=true;version="2.6.0",\ + javax.servlet.http;thread-context=true;version="2.6.0";uses:="javax.servlet",\ + javax.servlet.resources;thread-context=true;version="2.6.0" + +Include-Resource: \ + @lib/com.ibm.ws.javax.servlet_3.0.jar!/META-INF/LICENSE, \ + @lib/com.ibm.ws.javax.servlet_3.0.jar!/META-INF/NOTICE, \ + @lib/com.ibm.ws.javax.servlet_3.0.jar!/javax/servlet/resources/** + +instrument.disabled: true + +publish.wlp.jar.suffix: dev/api/spec + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + lib/com.ibm.ws.javax.servlet_3.0.jar;version=file diff --git a/dev/com.ibm.ws.config_test/build.nogradle b/dev/com.ibm.websphere.javaee.servlet.3.0/build.gradle similarity index 100% rename from dev/com.ibm.ws.config_test/build.nogradle rename to dev/com.ibm.websphere.javaee.servlet.3.0/build.gradle diff --git a/dev/com.ibm.websphere.javaee.servlet.3.0/build.xml b/dev/com.ibm.websphere.javaee.servlet.3.0/build.xml new file mode 100644 index 000000000000..77e6bc1ef59e --- /dev/null +++ b/dev/com.ibm.websphere.javaee.servlet.3.0/build.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.websphere.javaee.servlet.3.1/.classpath b/dev/com.ibm.websphere.javaee.servlet.3.1/.classpath index 54c7241a516c..bd52baaf243d 100644 --- a/dev/com.ibm.websphere.javaee.servlet.3.1/.classpath +++ b/dev/com.ibm.websphere.javaee.servlet.3.1/.classpath @@ -1,8 +1,6 @@ - - - - - + + + diff --git a/dev/com.ibm.websphere.javaee.servlet.3.1/.classpath.gradle b/dev/com.ibm.websphere.javaee.servlet.3.1/.classpath.gradle new file mode 100644 index 000000000000..bd52baaf243d --- /dev/null +++ b/dev/com.ibm.websphere.javaee.servlet.3.1/.classpath.gradle @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.websphere.javaee.servlet.3.1/bnd.bnd b/dev/com.ibm.websphere.javaee.servlet.3.1/bnd.bnd new file mode 100644 index 000000000000..672180e2c362 --- /dev/null +++ b/dev/com.ibm.websphere.javaee.servlet.3.1/bnd.bnd @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-SymbolicName: com.ibm.websphere.javaee.servlet.3.1; singleton:=true + +Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))" + +Export-Package: \ + javax.servlet;thread-context=true;version="2.7.0";uses:="javax.servlet.annotation,javax.servlet.descriptor",\ + javax.servlet.annotation;thread-context=true;version="2.7.0";uses:="javax.servlet",\ + javax.servlet.descriptor;thread-context=true;version="2.7.0",\ + javax.servlet.http;thread-context=true;version="2.7.0";uses:="javax.servlet",\ + javax.servlet.resources;thread-context=true;version="2.7.0" + +instrument.disabled: true + +publish.wlp.jar.suffix: dev/api/spec + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + lib/com.ibm.ws.javaee.servlet.3.1.jar;version=file,\ + lib/com.ibm.ws.javax.servlet.resources_3.1.jar;version=file diff --git a/dev/com.ibm.ws.crypto.certificateutil_bvt/build.nogradle b/dev/com.ibm.websphere.javaee.servlet.3.1/build.gradle similarity index 100% rename from dev/com.ibm.ws.crypto.certificateutil_bvt/build.nogradle rename to dev/com.ibm.websphere.javaee.servlet.3.1/build.gradle diff --git a/dev/com.ibm.websphere.javaee.servlet.3.1/build.xml b/dev/com.ibm.websphere.javaee.servlet.3.1/build.xml new file mode 100644 index 000000000000..5c6de07e4b8c --- /dev/null +++ b/dev/com.ibm.websphere.javaee.servlet.3.1/build.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.channelfw/.classpath b/dev/com.ibm.ws.channelfw/.classpath index f9f259e40b22..2876090f9036 100755 --- a/dev/com.ibm.ws.channelfw/.classpath +++ b/dev/com.ibm.ws.channelfw/.classpath @@ -1,9 +1,7 @@ - - - - - + + + diff --git a/dev/com.ibm.ws.channelfw/.classpath.gradle b/dev/com.ibm.ws.channelfw/.classpath.gradle new file mode 100644 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.channelfw/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.channelfw/bnd.bnd b/dev/com.ibm.ws.channelfw/bnd.bnd new file mode 100755 index 000000000000..21dca79dddb5 --- /dev/null +++ b/dev/com.ibm.ws.channelfw/bnd.bnd @@ -0,0 +1,83 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: Channel Framework +Bundle-SymbolicName: com.ibm.ws.channelfw; singleton:=true +Bundle-Description: Provides the channel framework that allows the creation \ + of channel chains for handling both inbound and outbound traffic. The TCP \ + and UDP connector channels are included, version ${bVersion} + +WS-TraceGroup: ChannelFramework + +IBM-Default-Config: OSGI-INF/wlp/defaultInstances.xml + +# For each exported package, create (in that package) a package-info.java +# file, and place an @version javadoc tag in package-level javadoc. +# Append ";provide:=true" if this bundle also provides an implementation +# for the exported API. +Export-Package: com.ibm.websphere.channelfw*;provide:=true, \ + com.ibm.wsspi.channelfw*;provide:=true, \ + com.ibm.wsspi.connmgmt;provide:=true, \ + com.ibm.wsspi.bytebuffer;provide:=true, \ + com.ibm.wsspi.tcpchannel;provide:=true, \ + com.ibm.wsspi.udpchannel;provide:=true, \ + com.ibm.websphere.endpoint;provide:=true, \ + com.ibm.io.async + +Private-Package: com.ibm.io.async, \ + com.ibm.ws.bytebuffer.internal, \ + com.ibm.ws.bytebuffer.internal.resources, \ + com.ibm.ws.channelfw*, \ + com.ibm.ws.tcpchannel.internal, \ + com.ibm.ws.tcpchannel.internal.resources, \ + com.ibm.ws.udpchannel.internal, \ + com.ibm.ws.udpchannel.internal.resources + +Include-Resource: \ + OSGI-INF=resources/OSGI-INF + +-dsannotations: com.ibm.websphere.channelfw.osgi.CHFWBundle,\ + com.ibm.ws.bytebuffer.internal.ByteBufferConfiguration, \ + com.ibm.io.async.ResultHandler, \ + com.ibm.io.async.CompletionKey + +Service-Component: \ + com.ibm.ws.tcpchannel.options; \ + implementation:=com.ibm.wsspi.channelfw.ChannelConfiguration; \ + provide:=com.ibm.wsspi.channelfw.ChannelConfiguration; \ + modified:='modified';\ + immediate:=true;\ + properties:="service.vendor=IBM,service.ranking:Integer=0,type:String=TCPChannel", \ + com.ibm.ws.udpchannel.options; \ + implementation:=com.ibm.wsspi.channelfw.ChannelConfiguration; \ + provide:=com.ibm.wsspi.channelfw.ChannelConfiguration; \ + modified:='modified';\ + immediate:=true;\ + properties:="service.vendor=IBM,service.ranking:Integer=0,type:String=UDPChannel", \ + com.ibm.ws.channelfw.CHFWEventHandler; \ + implementation:=com.ibm.ws.channelfw.internal.CHFWEventHandler; \ + configuration-policy:=ignore;\ + provide:=com.ibm.websphere.event.EventHandler; \ + properties:="event.topics=com/ibm/websphere/channelfw/*,service.vendor=IBM",\ + com.ibm.ws.tcpchannel.zosaio; \ + provide:=com.ibm.ws.tcpchannel.internal.ZosAio; \ + implementation:=com.ibm.ws.tcpchannel.internal.ZosAio; \ + angelUtils=com.ibm.ws.kernel.zos.AngelUtils; \ + configuration-policy:=optional; \ + immediate:=true; \ + properties:="service.vendor=IBM" + +instrument.disabled: true + +-buildpath: \ + com.ibm.ws.logging.core,\ + com.ibm.ws.event,\ + com.ibm.websphere.org.osgi.core.6.0.0,\ + com.ibm.websphere.org.osgi.service.component.1.3.0,\ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0,\ + com.ibm.ws.kernel.feature,\ + com.ibm.ws.kernel.service,\ + com.ibm.ws.timer;version=latest,\ + com.ibm.ws.kernel.security.thread,\ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.org.osgi.annotation.versioning.1.0.0;version=latest diff --git a/dev/com.ibm.ws.channelfw/build-api-spi.xml b/dev/com.ibm.ws.channelfw/build-api-spi.xml new file mode 100755 index 000000000000..33e59db43018 --- /dev/null +++ b/dev/com.ibm.ws.channelfw/build-api-spi.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/dev/com.ibm.ws.crypto.certificateutil_test/build.nogradle b/dev/com.ibm.ws.channelfw/build.gradle similarity index 100% rename from dev/com.ibm.ws.crypto.certificateutil_test/build.nogradle rename to dev/com.ibm.ws.channelfw/build.gradle diff --git a/dev/com.ibm.ws.channelfw/build.xml b/dev/com.ibm.ws.channelfw/build.xml new file mode 100755 index 000000000000..a2d8a79e2f4c --- /dev/null +++ b/dev/com.ibm.ws.channelfw/build.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.cik.launcher/bnd.bnd b/dev/com.ibm.ws.cik.launcher/bnd.bnd index c543b08ebd8e..a70cee733bf6 100755 --- a/dev/com.ibm.ws.cik.launcher/bnd.bnd +++ b/dev/com.ibm.ws.cik.launcher/bnd.bnd @@ -5,6 +5,8 @@ Bundle-Name: WebSphere common install kernel launcher Bundle-SymbolicName: com.ibm.ws.cik.launcher Bundle-Description: WebSphere common install kernel launcher, version ${bVersion} +Import-Package: !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * + Private-Package: \ com.ibm.ws.cik.launcher.* diff --git a/dev/com.ibm.ws.cik.launcher/bnd.bnd.gradle b/dev/com.ibm.ws.cik.launcher/bnd.bnd.gradle index c543b08ebd8e..a70cee733bf6 100755 --- a/dev/com.ibm.ws.cik.launcher/bnd.bnd.gradle +++ b/dev/com.ibm.ws.cik.launcher/bnd.bnd.gradle @@ -5,6 +5,8 @@ Bundle-Name: WebSphere common install kernel launcher Bundle-SymbolicName: com.ibm.ws.cik.launcher Bundle-Description: WebSphere common install kernel launcher, version ${bVersion} +Import-Package: !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * + Private-Package: \ com.ibm.ws.cik.launcher.* diff --git a/dev/com.ibm.ws.common.encoder/README.txt b/dev/com.ibm.ws.common.encoder/README.txt deleted file mode 100755 index 42d71db1f09d..000000000000 --- a/dev/com.ibm.ws.common.encoder/README.txt +++ /dev/null @@ -1,7 +0,0 @@ -This project intentionally does NOT generate a JAR file. - -Do not alter this project to produce a bundle. - -The packages defined in this project MUST NOT be exported by any bundle that -includes them. Doing so will cause package / classpath namespace conflicts -when included by several different bundles. diff --git a/dev/com.ibm.ws.common.encoder/bnd.bnd b/dev/com.ibm.ws.common.encoder/bnd.bnd index 0f1d255d008a..10fd32929733 100644 --- a/dev/com.ibm.ws.common.encoder/bnd.bnd +++ b/dev/com.ibm.ws.common.encoder/bnd.bnd @@ -1,6 +1,8 @@ --include= ~../cnf/resources/bnd/bundle.props, +-include= ~../cnf/resources/bnd/bundle.props bVersion=1.0 +Bundle-SymbolicName: com.ibm.ws.common.encoder + Export-Package: com.ibm.ws.common.internal.encoder instrument.disabled: true diff --git a/dev/com.ibm.ws.common.encoder/bnd.bnd.gradle b/dev/com.ibm.ws.common.encoder/bnd.bnd.gradle index 0f1d255d008a..10fd32929733 100644 --- a/dev/com.ibm.ws.common.encoder/bnd.bnd.gradle +++ b/dev/com.ibm.ws.common.encoder/bnd.bnd.gradle @@ -1,6 +1,8 @@ --include= ~../cnf/resources/bnd/bundle.props, +-include= ~../cnf/resources/bnd/bundle.props bVersion=1.0 +Bundle-SymbolicName: com.ibm.ws.common.encoder + Export-Package: com.ibm.ws.common.internal.encoder instrument.disabled: true diff --git a/dev/com.ibm.ws.common.encoder_test/.classpath b/dev/com.ibm.ws.common.encoder_test/.classpath index ba28ffa57ca6..bd880329225d 100755 --- a/dev/com.ibm.ws.common.encoder_test/.classpath +++ b/dev/com.ibm.ws.common.encoder_test/.classpath @@ -1,15 +1,7 @@ - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.common.encoder_test/.classpath.gradle b/dev/com.ibm.ws.common.encoder_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.common.encoder_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.common.encoder_test/.project b/dev/com.ibm.ws.common.encoder_test/.project index 39d8ceca61ce..f97a31b67cd1 100755 --- a/dev/com.ibm.ws.common.encoder_test/.project +++ b/dev/com.ibm.ws.common.encoder_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.common.encoder_test/bnd.bnd b/dev/com.ibm.ws.common.encoder_test/bnd.bnd new file mode 100755 index 000000000000..e9942b33ac24 --- /dev/null +++ b/dev/com.ibm.ws.common.encoder_test/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.common.encoder;version=latest diff --git a/dev/com.ibm.ws.common.encoder_test/bnd.bnd.gradle b/dev/com.ibm.ws.common.encoder_test/bnd.bnd.gradle new file mode 100755 index 000000000000..e9942b33ac24 --- /dev/null +++ b/dev/com.ibm.ws.common.encoder_test/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.common.encoder;version=latest diff --git a/dev/com.ibm.ws.crypto.ltpakeyutil_test/build.nogradle b/dev/com.ibm.ws.common.encoder_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.crypto.ltpakeyutil_test/build.nogradle rename to dev/com.ibm.ws.common.encoder_test/build.gradle diff --git a/dev/com.ibm.ws.componenttest/.classpath b/dev/com.ibm.ws.componenttest/.classpath new file mode 100755 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.componenttest/.classpath.gradle b/dev/com.ibm.ws.componenttest/.classpath.gradle new file mode 100755 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.componenttest/.gitignore b/dev/com.ibm.ws.componenttest/.gitignore new file mode 100644 index 000000000000..848aca22ec04 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/.gitignore @@ -0,0 +1,2 @@ +*.class +/autoFVT/ \ No newline at end of file diff --git a/dev/com.ibm.ws.componenttest/.project b/dev/com.ibm.ws.componenttest/.project new file mode 100755 index 000000000000..e0c78fd619b1 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.componenttest + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.componenttest/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.componenttest/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.componenttest/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.componenttest/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.componenttest/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.componenttest/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.componenttest/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c92277a371a9 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.componenttest/.settings/org.eclipse.ltk.core.refactoring.prefs b/dev/com.ibm.ws.componenttest/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100755 index 000000000000..0c58c37ccba4 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,3 @@ +#Wed Mar 16 12:40:16 GMT 2011 +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/.gitignore b/dev/com.ibm.ws.componenttest/autoFVT-defaults/.gitignore new file mode 100755 index 000000000000..77408bdb8742 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/.gitignore @@ -0,0 +1,3 @@ +bootstrapping.properties +simplicity.properties +local.properties diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/TestBuild.xml b/dev/com.ibm.ws.componenttest/autoFVT-defaults/TestBuild.xml new file mode 100755 index 000000000000..51dc17271b37 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/TestBuild.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + EXAMPLE USAGE: (only these combinations are valid) + ant -f TestBuild.xml [execute] + ant -f TestBuild.xml -Dsuite=(TestSuite class) + ant -f TestBuild.xml -Dsetup=(TestSetup class) + ant -f TestBuild.xml -Dsetup=(TestSetup class) -Dphase=(Test phase) + ant -f TestBuild.xml -Dtest=(TestCase class) + ant -f TestBuild.xml -Dtest=(TestCase class) -Dmethod=(Test method) + ant -f TestBuild.xml -Dtest=(TestCase class) -Dmethod=(Test method) -Dphase=(Test phase) + DEFINITIONS: + (TestSuite class) = The full package and class name of a Class that + features a public, static, no-argument suite() method + that returns a "junit.framework.Test". + If the class name is supplied without the package name, + "com.ibm.ws.fat.suites" is assumed. + If no suite is defined, the suite defined in + configuration.properties is used. + (TestSetup class) = The full package and class name of a Class that + extends commons.utils.junit.PhasedTestSetup. + If the class name is supplied without the package name, + "com.ibm.ws.fat.setup" is assumed. + (TestCase class) = The full package and class name of a Class that + extends commons.utils.junit.PhasedTestCase. + If the class name is supplied without the package name, + "com.ibm.ws.fat.tests" is assumed. + (Test phase) = The specific test phase you want to run. + If no phase is supplied, then all phases are run. + Valid phases include: "SetUp", "TearDown", and "RunTests" + (not case sensitive). + (Test method) = The specific test method you want to run. + If no method is supplied, then all public no-argument methods + starting with "test" that have a void return type are run. + NOTES: + 1. If no command line arguments are supplied, a full regression is performed + 2. The "execute" target can be specified in addition to any of the other command + line options, but since "execute" is the default target, it has no effect. + 3. The supplied TestCase is evaluated first, followed by the TestSetup, + followed by the TestSuite. In other words, if you define both a TestCase and + a TestSetup, the TestCase will be run. + 4. If a test phase is supplied with no test method for a TestCase, + that specific phase is run for each "test" method (you probably don't want to do this) + ASSUMPTIONS: + 1. A standard WebSphere topology must already be installed on the system under test + (For details, see: http://wasautomation.austin.ibm.com/xwiki/bin/view/TestingCollab/functionalAcceptanceTests) + + diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/configuration.properties b/dev/com.ibm.ws.componenttest/autoFVT-defaults/configuration.properties new file mode 100755 index 000000000000..0b2ea69843dc --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/configuration.properties @@ -0,0 +1,93 @@ +########################################################################################## +# configuration.properties +########################################################################################## +# This properties file describes special configuration properties for your test bucket. +# +# When you want to provide extra (optional) control to the tester regarding the way +# that your test bucket executes, you can provide those controls through this file. +# Properties contained in this file must not have anything to do with the environment +# under test; those properties must be contained in bootstrapping.properties. In other +# words, testers should not need to understand how to use this file to control your bucket; +# use of this file should be targeted for advanced users who desire additional controls. +# All properties in this file should be referenced through Props.java +# +# This file is also referenced by launch.xml to generate a Simplicity configuration file. +# These properties can be updated to control the normal operation modes of Simplicity. +# +########################################################################################## + + +############################################## +# Simplicity properties +############################################## + +# This property sets the WebSphere operations provider. The WebSphere operations +# provider provides WebSphere administration access to the Java api. Valid property +# values are JMX and WSADMIN. Default value is JMX (but only WSADMIN really works) +simplicity.webSphereOperationsProvider=WSADMIN + +# This property sets the command line provider. The command line provider provides +# command line execution capabilities. Some providers such as the RXA provider allow +# for remote execution and machine to machine file transfers. Valid property values +# are RXA, JMX, and LOCAL. Default value is JMX (but only RXA really works) +simplicity.commandLineProvider=RXA + +# This property enables and disables topology caching. If caching is enabled, information +# about the topology is gathered up front and cached to the bootstrapping properties +# file. On subsequent invocations, the Object model is then built from the cache without +# incurring the cost of making an administrative connection. Valid property values +# are true and false. Default value is false. +simplicity.useTopologyCaching=false + +# This property allows the user to set the port number to use when using the JIIWS +# protocol to make wsadmin connections. The JIIWS tool is used to facilitate and managed +# wsadmin connections (http://ausgsa.ibm.com/projects/m/moonstone/distributions/jiiws/). +# JIIWS supports several protocols including a local protocol (no remote connection), +# RXA, and the JIIWS protocol. The JIIWS protocol is used when making a remote wsadmin +# connection if RXA is not being used as the command line provider, or if preferJIIWSWsAdmin +# is set to true. Integer values are valid. Default value is port 1982. +simplicity.jiiwsPort=1982 + +# This property allows the user to set the inactivity timeout for the JIIWS protocol +# in milliseconds. See the the jiiwsPort property description for more information +# about the protocol. If no wsadmin requests are received within the timeout period, +# the remote JIIWS listener stops. Integer values are valid. Default value is 10 minutes +# (10*60*1000 milliseconds). +simplicity.jiiwsInactivityTimeout=600000 + +# This property specifies whether or not to use the JIIWS protocol. See the the jiiwsPort +# property description for more information about the protocol. By default, the JIIWS +# protocol is only used when making a remote wsadmin connection if the RXA is not being +# used as the command line provider. Valid property values are true and false. Default +# value is false. +simplicity.preferJIIWSWsAdmin=false + + +############################################## +# Test bucket properties +############################################## + +# Default test suite to be run, if nothing else is specified on the command line +# Usage notes: +# 1) If no "suite" is defined on the command line, the value of this property is used +# 2) If a "suite" is defined on the command line, the value of this property is overriden +# 3) A Moonstone standard explains that the default behavior of every bucket must +# be to run a full regression test if no other options are specified, so "FullRegression" +# is consistent with this standard +# Default: FullRegression +#suite=jspOne + +# Default suitedef +suitedef=fullregression + +# Separator characters used to distinguish related blocks of output in test bucket trace files +# Small logging breaks are typically encapsulated by larger logging breaks +logging.break.large=------------------------------------------------------------------------ +logging.break.medium=---------------------------------------------------------------- +logging.break.small=----------------------------------------- +logging.break.error=****************************************************************** + +# When ApplicationServers are created, virtual host aliases are automatically created +# for the WC_defaulthost and WC_defaulthost_secure ports. This property controls +# which virtual host alias to associate those host aliases with. Default is default_host +nd.virtualHostName=default_host diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/fatTestCommon.xml b/dev/com.ibm.ws.componenttest/autoFVT-defaults/fatTestCommon.xml new file mode 100755 index 000000000000..d62f37136add --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/fatTestCommon.xml @@ -0,0 +1,5 @@ + + + timedexit-1.0 + + diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/fatTestPorts.xml b/dev/com.ibm.ws.componenttest/autoFVT-defaults/fatTestPorts.xml new file mode 100755 index 000000000000..2f90fa5ce151 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/fatTestPorts.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/ignoredFFDCs.xml b/dev/com.ibm.ws.componenttest/autoFVT-defaults/ignoredFFDCs.xml new file mode 100755 index 000000000000..4f5e27fcdd47 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/ignoredFFDCs.xml @@ -0,0 +1,20 @@ + + + + com.ibm.wsspi.channelfw.exception.ChannelException + com.ibm.wsspi.channelfw.exception.ChannelException: TCP Channel detected a possible loop on thread: + + + org.osgi.framework.ServiceException + Exception in org.apache.felix.scr.impl.manager.DelayedComponentManager.ungetService() + at org.eclipse.osgi.internal.serviceregistry.ServiceUse.releaseService(ServiceUse.java:287) + at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.releaseService(ServiceRegistrationImpl.java:562) + at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:245) + + + + java.lang.IllegalStateException + BundleContext is no longer valid + at org.eclipse.osgi.framework.internal.core.BundleContextImpl.checkValid(BundleContextImpl.java:931) + + \ No newline at end of file diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/lib/fat.util.jar b/dev/com.ibm.ws.componenttest/autoFVT-defaults/lib/fat.util.jar new file mode 100755 index 000000000000..3b5262a31182 Binary files /dev/null and b/dev/com.ibm.ws.componenttest/autoFVT-defaults/lib/fat.util.jar differ diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/logging.properties b/dev/com.ibm.ws.componenttest/autoFVT-defaults/logging.properties new file mode 100755 index 000000000000..029081d49845 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/logging.properties @@ -0,0 +1,74 @@ +############################################################ +# Logging Configuration File +# +# You can use a different file by specifying a filename +# with the java.util.logging.config.file system property. +# For example java -Djava.util.logging.config.file=myfile +############################################################ + +############################################################ +# Global properties +############################################################ + +# "handlers" specifies a comma separated list of log Handler +# classes. These handlers will be installed during VM startup. +# Note that these classes must be on the system classpath. +# By default we only configure a ConsoleHandler, which will only +# show messages at the INFO and above levels. +handlers=com.ibm.ws.fat.util.GenericHandler, java.util.logging.FileHandler + +# Default global logging level. +# This specifies which kinds of events are logged across +# all loggers. For any given facility this global level +# can be overriden by a facility specific level +# Note that the GenericHandler also has a separate level +# setting to limit messages printed to the underlying stream. +.level=INFO + +############################################################ +# Handler specific properties. +# Describes specific configuration info for Handlers. +############################################################ + +# The GenericHandler will log all messages printed at any logging level +com.ibm.ws.fat.util.GenericHandler.level=ALL +com.ibm.ws.fat.util.GenericHandler.formatter=com.ibm.ws.fat.util.GenericFormatter +com.ibm.ws.fat.util.GenericHandler.stream=system.out +com.ibm.ws.fat.util.GenericHandler.flush=true + +# The FileHandler will log all messages printed at any logging level to exactly one file located in results/output.txt +java.util.logging.FileHandler.level=ALL +java.util.logging.FileHandler.formatter=com.ibm.ws.fat.util.GenericFormatter +java.util.logging.FileHandler.limit=0 +java.util.logging.FileHandler.count=1 +java.util.logging.FileHandler.pattern=results/output.txt +java.util.logging.FileHandler.append=true + +############################################################ +# Formatter specific properties. +# Describes specific configuration info for Formatters. +############################################################ + +com.ibm.ws.fat.util.GenericFormatter.class.full=false +com.ibm.ws.fat.util.GenericFormatter.class.length=30 +com.ibm.ws.fat.util.GenericFormatter.class.log=true +com.ibm.ws.fat.util.GenericFormatter.level.log=true +com.ibm.ws.fat.util.GenericFormatter.method.length=30 +com.ibm.ws.fat.util.GenericFormatter.method.log=true +com.ibm.ws.fat.util.GenericFormatter.thread.length=3 +com.ibm.ws.fat.util.GenericFormatter.thread.log=true +com.ibm.ws.fat.util.GenericFormatter.time.format=[MM/dd/yyyy HH:mm:ss:SSS z] +com.ibm.ws.fat.util.GenericFormatter.time.log=true + +############################################################ +# Facility specific properties. +# Provides extra control for each logger. +############################################################ +com.ibm.ws.webcontainer.fvt.level=INFO +com.ibm.websphere.simplicity.level=INFO +#componenttest.common.apiservices.cmdline.LocalProvider.level=ALL +#componenttest.common.apiservices.cmdline.RXAProvider.level=ALL +#com.ibm.websphere.jiiws.level=FINER +#httpclient.wire.level=FINEST +#httpclient.wire.header.level=FINEST +#org.apache.commons.httpclient.level=FINEST diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/productSample.properties b/dev/com.ibm.ws.componenttest/autoFVT-defaults/productSample.properties new file mode 100755 index 000000000000..a9f79cfedab4 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/productSample.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties,sample.properties diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/productSampleServer.xml b/dev/com.ibm.ws.componenttest/autoFVT-defaults/productSampleServer.xml new file mode 100755 index 000000000000..7d76607cdbb0 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/productSampleServer.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/productSample_noBootstrap.properties b/dev/com.ibm.ws.componenttest/autoFVT-defaults/productSample_noBootstrap.properties new file mode 100755 index 000000000000..4f1ae5a2e104 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/productSample_noBootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/src/ant/launch.xml b/dev/com.ibm.ws.componenttest/autoFVT-defaults/src/ant/launch.xml new file mode 100755 index 000000000000..7a8216215578 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/src/ant/launch.xml @@ -0,0 +1,751 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deleting existing properties files + + + + Generating a local properties file that contains all the properties from Ant and configuration.properties + + + + + Created ${local.properties} + + Generating the Simplicity config.props file based on configuration.properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Initializing the classpath for ${test.bucket.name} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Initializing JRE logging + + + + + + + + + + + Running ${test.bucket.name} + Timeout: ${fattest.timeout} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + embedded.trace is active + + + + + + + + + + + + + + + + + + + Coverage settings: + test.coverage: ${test.coverage} + exec.data.file: ${exec.data.file} + jacocoant.file: ${jacocoant.file} + jacocoagent.file: ${jacocoagent.file} + + + + + + framework.maxheap=${framework.maxheap} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Failure running ${test.bucket.name}, attempting to copy logs from servers that did not stop properly : ${serverFile} + + + + + + + + + + + + + + + + + Finished running ${test.bucket.name} + XML report is available at ${dir.log.xml} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + stopServer for ${serverFile} + + + + + + + + + + + + + + + + + + + + + + + + + + + + Generating an HTML report based on the existing XML report + + + + + + + + + HTML report is available at ${dir.log.html} + + + + + + + + + + + + + + + + + + + Base dir is: ${basedir} + Liberty dir is: ${liberty.dir} + libertyInstallPath is: ${libertyInstallPath} + + + + + liberty.location is: ${liberty.location} + + + + + install.location is: ${install.location} + + + + + + + + + + + + + + + + + + + + + + + + + + Check ports are available + + + + + + + + + + + + + + + + + + + + + + For first ldap Non-SSL port : ${ldap.1.port} and SSL port : ${ldap.1.ssl.port} + For second ldap Non-SSL port : ${ldap.2.port} and SSL port : ${ldap.2.ssl.port} + For third ldap Non-SSL port : ${ldap.3.port} and SSL port : ${ldap.3.ssl.port} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Debug Data: + libertyInstallPath: ${libertyInstallPath} + jacocoant.file: ${jacocoant.file} + exec.data.file: ${exec.data.file} + is.exec.data.file.avialable: ${is.exec.data.file.avialable} + dir.log.coverage: ${dir.log.coverage} + project.name: ${project.name} + project.under.test: ${project.under.test} + project.under.test.bundles.path: ${project.under.test.bundles.path} + is.project.under.test.bundles.available: ${is.project.under.test.bundles.available} + project.under.test.source.path: ${project.under.test.source.path} + is.project.under.test.source.available: ${is.project.under.test.source.available} + generateFatJaCoCoReport.run: ${generateFatJaCoCoReport.run} + + + + The jacoco.exec file is unavaialbe: ${exec.data.file} + This can happen if: + 1. The FAT project overrides the default execution targets. + 2. The FAT tests did not actually run. + + + + The project under test's bundles are unavailable: ${libertyInstallPath}/lib/${project.under.test}*.jar + This can happen if: + 1. The test project deviates from the standard naming pattern: project / project_[test|fat]. + 2. The production code project deviates from the standard bundle naming pattern: project.*jar. + 3. The FAT target is invoked from a non-production project + + + + No FAT coverage report will be generated for ${project.under.test}. See the log for earlier reasons. + + + + Generating the FAT coverage report for component ${project.under.test} + + + + + + + + + + + + + + + + + + + + + + + + + Generating the FAT coverage report for component ${project.under.test} (no source) + + + + + + + + + + + + + + + + + + + + + + + + + HTML report for code coverage is available at ${dir.log.coverage}/index.html + CSV report for code coverage is available at ${dir.log.coverage}/report.csv + XML report for code coverage is available at ${dir.log.coverage}/report.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/src/ant/properties.xml b/dev/com.ibm.ws.componenttest/autoFVT-defaults/src/ant/properties.xml new file mode 100755 index 000000000000..0fea97a3f4ed --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/src/ant/properties.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.componenttest/autoFVT-defaults/testports.properties b/dev/com.ibm.ws.componenttest/autoFVT-defaults/testports.properties new file mode 100755 index 000000000000..3d9f188ff269 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/autoFVT-defaults/testports.properties @@ -0,0 +1,172 @@ +# Main test port used by both tests and framework +# The ports set here will be updated if they are not available immediately +# before the tests run. +# The 'bvt.prop.' prefix is required for the value to be exported to the test +# client JVM, e.g. bvt.prop.HTTP_default -> HTTP_default +bvt.prop.JMXREST_default=8880 + +bvt.prop.IIOP=2809 +bvt.prop.IIOP.secure=2810 + +bvt.prop.IIOP.secondary=2819 +bvt.prop.IIOP.secondary.secure=2820 + +bvt.prop.IIOP.tertiary=2829 +bvt.prop.IIOP.tertiary.secure=2830 + +bvt.prop.IIOP.client=2811 +bvt.prop.IIOP.client.secure=2812 + +bvt.prop.UDPTest=18004 +bvt.prop.SSL_bvt=18005 + +bvt.prop.HTTP_default=8010 +bvt.prop.HTTP_default.secure=8020 + +bvt.prop.HTTP_secondary=8030 +bvt.prop.HTTP_secondary.secure=8040 + +bvt.prop.httpFAT_1=18080 +bvt.prop.httpFAT_2=18082 +bvt.prop.httpFAT_3=18443 +bvt.prop.httpFAT_4=19030 + +bvt.prop.http.0=${bvt.prop.HTTP_default} +bvt.prop.http.0.ssl=${bvt.prop.HTTP_default.secure} +bvt.prop.http.1=${bvt.prop.HTTP_secondary} +bvt.prop.http.1.ssl=${bvt.prop.HTTP_secondary.secure} + +bvt.prop.jms.0=7276 +bvt.prop.jms.0.ssl=7286 +bvt.prop.jms.1=17010 +bvt.prop.jms.1.ssl=17510 +bvt.prop.jms.2=17020 +bvt.prop.jms.2.ssl=17520 +bvt.prop.jms.3=17030 +bvt.prop.jms.3.ssl=17530 +bvt.prop.jms.4=17040 +bvt.prop.jms.4.ssl=17540 +bvt.prop.jms.5=17050 +bvt.prop.jms.5.ssl=17550 +bvt.prop.jms.6=17060 +bvt.prop.jms.6.ssl=17560 +bvt.prop.jms.7=17070 +bvt.prop.jms.7.ssl=17570 +bvt.prop.jms.8=17080 +bvt.prop.jms.8.ssl=17580 +bvt.prop.jms=${bvt.prop.jms.0} +bvt.prop.jms.ssl=${bvt.prop.jms.0.ssl} + +bvt.prop.mockservice.http=9111 + +# Test ports used for System Management scenarios +# These ports provide up to: +# -- 5 members with HTTP and HTTPS ports +# -- 5 controllers with HTTP, HTTPS and REPLICA ports +# ________ +# / \ +# / _ ___ _ _ \ DO NOT ADD +# |(_` | / \|_)| ANY MORE PORTS +# |._) | \_/| | TO THIS LIST +# \ / +# \__________/ +# +# Helpful Tips: +# -- HTTP ports are even numbers +# -- HTTPS ports are odd numbers +# -- Member ports start at 8080 +# -- Controller ports start at 9080 +# -- Replica ports start at 10010 + +bvt.prop.member.alternateElectionPort=40572 + +# Ports for Member 1 +bvt.prop.member_1.http=8080 +bvt.prop.member_1.https=8081 +# Ports for Member 2 +bvt.prop.member_2.http=8082 +bvt.prop.member_2.https=8083 +# Ports for Member 3 +bvt.prop.member_3.http=8084 +bvt.prop.member_3.https=8085 +# Ports for Member 4 +bvt.prop.member_4.http=8086 +bvt.prop.member_4.https=8087 +# Ports for Member 5 +bvt.prop.member_5.http=8088 +bvt.prop.member_5.https=8089 +# Ports for Member 6 +bvt.prop.member_6.http=8090 +bvt.prop.member_6.https=8091 +# Ports for Controller 1 +bvt.prop.controller_1.http=9080 +bvt.prop.controller_1.https=9081 +bvt.prop.controller_1.replica=10010 +# Ports for Controller 2 +bvt.prop.controller_2.http=9082 +bvt.prop.controller_2.https=9083 +bvt.prop.controller_2.replica=10011 +# Ports for Controller 3 +bvt.prop.controller_3.http=9084 +bvt.prop.controller_3.https=9085 +bvt.prop.controller_3.replica=10012 +# Ports for Controller 4 +bvt.prop.controller_4.http=9086 +bvt.prop.controller_4.https=9087 +bvt.prop.controller_4.replica=10013 +# Ports for Controller 5 +bvt.prop.controller_5.http=9088 +bvt.prop.controller_5.https=9089 +bvt.prop.controller_5.replica=10014 + +# Test ports used for the javaMail-1.5 feature +bvt.prop.smtp_port=3025 +bvt.prop.imap_port=6663 +bvt.prop.pop3_port=3110 + +# property expected by OSGI framework must be the same as the default http +org.osgi.service.http.port=${bvt.prop.HTTP_default} + +# Console listens on this port +osgi.console=5678 + +com.ibm.ws.logging.max.file.size=0 + +#Most BVT tests will override this +com.ibm.ws.logging.trace.specification=*=info=enabled:logservice=all=enabled +ds.loglevel=debug + +# property for the file containing the FFDCs that need to be ignored +bvt.prop.fileFFDC=ignoredFFDCs.xml + +# enable summary file updates after each FFDC +com.ibm.ws.logging.ffdc.summary.policy=immediate + +# Ports for Local LDAP server +ldap.1.port=10389 +ldap.2.port=20389 +ldap.3.port=30389 + +# SSL ports for local LDAP server +ldap.1.ssl.port=10636 +ldap.2.ssl.port=20636 +ldap.3.ssl.port=30636 + +# Test ports used for Security multiple server scenarios +# These ports provide up to: +bvt.prop.OP_HTTP_default=8940 +bvt.prop.OP_HTTP_default.secure=8945 +bvt.prop.RP_HTTP_default=8941 +bvt.prop.RP_HTTP_default.secure=8946 + +# Test ports used Batch multiple server scenarios +# These ports provide up to: +bvt.prop.batch.dispatcher_1_HTTP_default=8942 +bvt.prop.batch.dispatcher_1_HTTP_default.secure=8950 +bvt.prop.batch.dispatcher_2_HTTP_default=8943 +bvt.prop.batch.dispatcher_2_HTTP_default.secure=8951 +bvt.prop.batch.endpoint_1_HTTP_default=8944 +bvt.prop.batch.endpoint_1_HTTP_default.secure=8952 +bvt.prop.batch.endpoint_2_HTTP_default=8945 +bvt.prop.batch.endpoint_2_HTTP_default.secure=8953 + diff --git a/dev/com.ibm.ws.componenttest/bnd.bnd b/dev/com.ibm.ws.componenttest/bnd.bnd new file mode 100755 index 000000000000..e35988a1d126 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/bnd.bnd @@ -0,0 +1,53 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: FAT infrastructure +Bundle-SymbolicName: com.ibm.ws.componenttest +Bundle-Description: FAT infrastructure; version=${bVersion} + +Export-Package: \ + componenttest.app;version=1.0.16, \ + componenttest.matchers;version=1.0.16, \ + junit.*;version=1.0.16, \ + org.jmock.*;version=1.0.16, \ + org.junit.*;version=1.0.16, \ + org.hamcrest.*;version=1.0.16 + +# componenttest.app depends on javax.servlet, but we don't want to include it in +# the componenttest-1.0 feature since we want tests to fail if a product feature +# is actually missing javax.servlet, so we use a dynamic import instead. +Import-Package: \ + !javax.servlet.*, \ + !org.apache.tools.ant.*, \ + !org.easymock, \ + !org.jmock.core, \ + * + +DynamicImport-Package: \ + javax.servlet, \ + javax.servlet.http + +-buildpath: \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ + lib/com.ibm.componenttest.common.jar;version=file,\ + lib/com.ibm.ws.topology.helper.jar;version=file,\ + lib/commons-httpclient-3.1.jar;version=file,\ + lib/httpunit.jar;version=file,\ + lib/jlanclient.jar;version=file,\ + lib/jtidy-r938.jar;version=file,\ + lib/provider.api.jar;version=file,\ + lib/public.api.jar;version=file,\ + lib/remoteaccess.jar;version=file,\ + lib/shrinkwrap-api-1.2.3.jar;version=file,\ + lib/shrinkwrap-impl-base-1.2.3.jar;version=file,\ + lib/shrinkwrap-spi-1.2.3.jar;version=file,\ + lib/ssh.jar;version=file,\ + autoFVT-defaults/lib/fat.util.jar;version=file,\ + jdbc/derby/derbynet.jar;version=file,\ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file,\ + ../build.sharedResources/lib/hamcrest-all.jar;version=file,\ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file,\ + com.ibm.websphere.javaee.servlet.3.1;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0;version=latest diff --git a/dev/com.ibm.ws.componenttest/build-common.xml b/dev/com.ibm.ws.componenttest/build-common.xml new file mode 100755 index 000000000000..93554dcc6362 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/build-common.xml @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Generating ${validate.server.xsd} + + + + + + + + + + + + + + + + + + + + + + + + + Validating ${validate.server.xmls.files.count} server.xml against ${validate.server.xsd} + + + + + + + + + + + + + + + + + + + + + + + + + + + The FAT server.xml appears to contain an unsupported configuration - it can not be validated against the current schema. + + The cached schema file used to validate test servers is here: + ${validate.server.xsd} + + Take one of two actions. Either: + 1. Correct the server.xml - look for typos or other errors in the configuration + 2. If the configuration should not be validated against the schema, define a pattern set to exclude the file: + + + + + For more information about test server.xml validation: + http://was.pok.ibm.com/xwiki/bin/view/Liberty/Test-FAT#HserverxmlXSDvalidation + + + + + + + + + Additions for SLE delivery: work item 194657 (Package Web Sockets and other FATs for 9003 - automation) + + + + + + + + + + + + + + + + ... Flag: deliver ${basedir} for ${LibertyFATSource.zip} + + + + + ... Flag: SKIP ${basedir} for ${LibertyBVTSource.zip} + + + + + + diff --git a/dev/com.ibm.ws.componenttest/build-noship.xml b/dev/com.ibm.ws.componenttest/build-noship.xml new file mode 100755 index 000000000000..b7f24bee8b45 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/build-noship.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.componenttest/build-properties.xml b/dev/com.ibm.ws.componenttest/build-properties.xml new file mode 100755 index 000000000000..06d165248edf --- /dev/null +++ b/dev/com.ibm.ws.componenttest/build-properties.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.crypto.passwordutil_test/build.nogradle b/dev/com.ibm.ws.componenttest/build.gradle similarity index 100% rename from dev/com.ibm.ws.crypto.passwordutil_test/build.nogradle rename to dev/com.ibm.ws.componenttest/build.gradle diff --git a/dev/com.ibm.ws.componenttest/componenttest.framework.component.async.loadproperties b/dev/com.ibm.ws.componenttest/componenttest.framework.component.async.loadproperties new file mode 100755 index 000000000000..57df80e5b2d4 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/componenttest.framework.component.async.loadproperties @@ -0,0 +1,6 @@ +# This file is used to determine which files in the build component get loaded when running an async build. +# All we're after is a thin bootstrapping layer. + +versionableName=/fattest.simplicity/ +versionableName=/test_prereqs/ +versionableName=/test_build/ diff --git a/dev/com.ibm.ws.componenttest/componenttest.framework.withjdbc.component.async.loadproperties b/dev/com.ibm.ws.componenttest/componenttest.framework.withjdbc.component.async.loadproperties new file mode 100755 index 000000000000..979a46895632 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/componenttest.framework.withjdbc.component.async.loadproperties @@ -0,0 +1,7 @@ +# This file is used to determine which files in the build component get loaded when running an async build. +# All we're after is a thin bootstrapping layer. + +versionableName=/fattest.simplicity/ +versionableName=/test_prereqs/ +versionableName=/test_build/ +versionableName=/prereq.dbtest/ diff --git a/dev/com.ibm.ws.componenttest/delivery.sets b/dev/com.ibm.ws.componenttest/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.componenttest/jdbc/derby/derby.jar b/dev/com.ibm.ws.componenttest/jdbc/derby/derby.jar new file mode 100755 index 000000000000..f01ce42907ab Binary files /dev/null and b/dev/com.ibm.ws.componenttest/jdbc/derby/derby.jar differ diff --git a/dev/com.ibm.ws.componenttest/jdbc/derby/derbyclient.jar b/dev/com.ibm.ws.componenttest/jdbc/derby/derbyclient.jar new file mode 100755 index 000000000000..fd8eed6ce482 Binary files /dev/null and b/dev/com.ibm.ws.componenttest/jdbc/derby/derbyclient.jar differ diff --git a/dev/com.ibm.ws.componenttest/jdbc/derby/derbynet.jar b/dev/com.ibm.ws.componenttest/jdbc/derby/derbynet.jar new file mode 100755 index 000000000000..a7e1d9de1726 Binary files /dev/null and b/dev/com.ibm.ws.componenttest/jdbc/derby/derbynet.jar differ diff --git a/dev/com.ibm.ws.componenttest/jdbc/derby/derbytools.jar b/dev/com.ibm.ws.componenttest/jdbc/derby/derbytools.jar new file mode 100755 index 000000000000..ae270bab4189 Binary files /dev/null and b/dev/com.ibm.ws.componenttest/jdbc/derby/derbytools.jar differ diff --git a/dev/com.ibm.ws.componenttest/jdbc/oracle/ojdbc6_g.jar b/dev/com.ibm.ws.componenttest/jdbc/oracle/ojdbc6_g.jar new file mode 100755 index 000000000000..6862ecca76da Binary files /dev/null and b/dev/com.ibm.ws.componenttest/jdbc/oracle/ojdbc6_g.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/com.ibm.componenttest.common.jar b/dev/com.ibm.ws.componenttest/lib/com.ibm.componenttest.common.jar new file mode 100755 index 000000000000..b4af18f52798 Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/com.ibm.componenttest.common.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/com.ibm.ws.topology.helper.jar b/dev/com.ibm.ws.componenttest/lib/com.ibm.ws.topology.helper.jar new file mode 100755 index 000000000000..52e2317c7240 Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/com.ibm.ws.topology.helper.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/commons-httpclient-3.1.jar b/dev/com.ibm.ws.componenttest/lib/commons-httpclient-3.1.jar new file mode 100755 index 000000000000..7c59774aed4f Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/commons-httpclient-3.1.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/httpunit.jar b/dev/com.ibm.ws.componenttest/lib/httpunit.jar new file mode 100755 index 000000000000..dd2404fca91e Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/httpunit.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/jlanclient.jar b/dev/com.ibm.ws.componenttest/lib/jlanclient.jar new file mode 100755 index 000000000000..73ae6a60685f Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/jlanclient.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/jtidy-r938.jar b/dev/com.ibm.ws.componenttest/lib/jtidy-r938.jar new file mode 100755 index 000000000000..efde902f3e9b Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/jtidy-r938.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/provider.api.jar b/dev/com.ibm.ws.componenttest/lib/provider.api.jar new file mode 100755 index 000000000000..6c5621abb3fc Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/provider.api.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/public.api.jar b/dev/com.ibm.ws.componenttest/lib/public.api.jar new file mode 100755 index 000000000000..edf6ecdc4e64 Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/public.api.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/remoteaccess.jar b/dev/com.ibm.ws.componenttest/lib/remoteaccess.jar new file mode 100755 index 000000000000..038039373581 Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/remoteaccess.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/shrinkwrap-api-1.2.3.jar b/dev/com.ibm.ws.componenttest/lib/shrinkwrap-api-1.2.3.jar new file mode 100755 index 000000000000..7c502bc824e1 Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/shrinkwrap-api-1.2.3.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/shrinkwrap-impl-base-1.2.3.jar b/dev/com.ibm.ws.componenttest/lib/shrinkwrap-impl-base-1.2.3.jar new file mode 100755 index 000000000000..59061b48d74a Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/shrinkwrap-impl-base-1.2.3.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/shrinkwrap-spi-1.2.3.jar b/dev/com.ibm.ws.componenttest/lib/shrinkwrap-spi-1.2.3.jar new file mode 100755 index 000000000000..506196b61d34 Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/shrinkwrap-spi-1.2.3.jar differ diff --git a/dev/com.ibm.ws.componenttest/lib/ssh.jar b/dev/com.ibm.ws.componenttest/lib/ssh.jar new file mode 100755 index 000000000000..fa3e237d8eb4 Binary files /dev/null and b/dev/com.ibm.ws.componenttest/lib/ssh.jar differ diff --git a/dev/com.ibm.ws.componenttest/publish/features/com.ibm.websphere.appserver.componenttest-1.0.mf b/dev/com.ibm.ws.componenttest/publish/features/com.ibm.websphere.appserver.componenttest-1.0.mf new file mode 100755 index 000000000000..83e3af61aad4 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/publish/features/com.ibm.websphere.appserver.componenttest-1.0.mf @@ -0,0 +1,15 @@ +Subsystem-ManifestVersion: 1 +IBM-Test-Feature: true +IBM-ShortName: componenttest-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.componenttest-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.componenttest; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 +IBM-API-Package: componenttest.app, + componenttest.matchers, + junit.framework, + org.jmock, + org.junit, + org.hamcrest, + org.hamcrest.core diff --git a/dev/com.ibm.ws.componenttest/src/componenttest/app/FATDatabaseServlet.java b/dev/com.ibm.ws.componenttest/src/componenttest/app/FATDatabaseServlet.java new file mode 100644 index 000000000000..9aa759bd2b71 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/src/componenttest/app/FATDatabaseServlet.java @@ -0,0 +1,172 @@ +package componenttest.app; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; + +import javax.sql.DataSource; + +/** + * Helper methods for working with JDBC tables. In general, any methods that take a + * Connection object use the connection without closing it. Any methods + * that take a DataSource object get, use, and close their own connection. + */ +@SuppressWarnings("serial") +public abstract class FATDatabaseServlet extends FATServlet +{ + /** + * Creates a table with the given name and schema. Gets a new connection and closes it. + */ + public static void dropAndCreateTable(DataSource ds, String tableName, String tableSchema) { + try { + Connection conn = ds.getConnection(); + try { + dropTableSafely(conn, tableName); + createTable(conn, tableName, tableSchema); + } finally { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(System.out); + } + } + + /** + * Creates a table with the given name and the following schema:
+ * id int not null primary key, val varchar(30)

+ * Gets a new connection and closes it. + */ + public static void dropAndCreateBasicTable(DataSource ds, String tableName) { + try { + Connection conn = ds.getConnection(); + try { + dropTableSafely(conn, tableName); + createBasicTable(conn, tableName); + } finally { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(System.out); + } + } + + /** + * Creates a table with the given name and schema, using an existing connection. + * Does not close the connection. + */ + public static void dropAndCreateTable(Connection conn, String tableName, String tableSchema) throws SQLException { + dropTableSafely(conn, tableName); + createTable(conn, tableName, tableSchema); + } + + /** + * Creates a table with the given name and the following schema:
+ * id int not null primary key, val varchar(30)
+ * Does not close the connection. + */ + public static void dropAndCreateBasicTable(Connection conn, String tableName) throws SQLException { + dropTableSafely(conn, tableName); + createBasicTable(conn, tableName); + } + + /** + * Creates a table with the given name and the following schema:
+ * id int not null primary key, val varchar(30)
+ * Does not close the connection. + */ + public static void createBasicTable(Connection conn, String tableName) throws SQLException + { + createTable(conn, tableName, "id int not null primary key, val varchar(30)"); + } + + public static void createTable(DataSource ds, String tableName, String tableSchema) { + try { + Connection conn = ds.getConnection(); + try { + createTable(conn, tableName, tableSchema); + } finally { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(System.out); + } + } + + /** + * Creates a table with the given name and schema. Does not close the connection. + */ + public static void createTable(Connection conn, String tableName, String tableSchema) throws SQLException + { + Statement stmt1 = conn.createStatement(); + stmt1.executeUpdate("create table " + tableName + " (" + tableSchema + ")"); + stmt1.close(); + } + + /** + * Drops a table. Gets a new connection and closes it. + */ + public static void dropTable(DataSource ds, String tableName) { + try { + Connection conn = ds.getConnection(); + try { + dropTableSafely(conn, tableName); + } finally { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(System.out); + } + } + + /** + * Drops a table, and does not throw an exception if the table does not exist. + * Does not close the connection. + */ + public static void dropTableSafely(Connection conn, String tableName) { + try { + Statement stmt1 = conn.createStatement(); + try { + stmt1.executeUpdate("drop table " + tableName); + } catch (SQLException ignore) { + } + stmt1.close(); + } catch (SQLException e) { + e.printStackTrace(System.out); + } + } + + /** + * Drops a table with the given name. Does not close the connection. + */ + public static void dropTable(Connection conn, String tableName) throws SQLException { + Statement stmt1 = conn.createStatement(); + stmt1.executeUpdate("drop table " + tableName); + stmt1.close(); + } + + /** + * Deletes all contents of a table. Opens a new connection and closes it. + */ + public static void clearTable(DataSource ds, String tableName) { + try { + Connection conn = ds.getConnection(); + try { + clearTable(conn, tableName); + } finally { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(System.out); + } + } + + /** + * Deletes all contents of a table using an existing connection. Does not close the connection. + */ + public static void clearTable(Connection conn, String tableName) throws SQLException { + Statement stmt = conn.createStatement(); + stmt.executeUpdate("DELETE FROM " + tableName); + conn.close(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.componenttest/src/componenttest/app/FATServlet.java b/dev/com.ibm.ws.componenttest/src/componenttest/app/FATServlet.java new file mode 100755 index 000000000000..a670829dfe6a --- /dev/null +++ b/dev/com.ibm.ws.componenttest/src/componenttest/app/FATServlet.java @@ -0,0 +1,105 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013, 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.app; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.junit.Assert; + +/** + * Servlet base class that can be used to call remote methods. The servlet is + * expected to be called via {@link FATServletClient}, and the servlet is + * expected to contain test methods that match the names of the corresponding + * methods in the JUnit test class. + * + *

Servlet test methods must have one of the following prototypes: + *

    + *
  • testMethod() + *
  • testMethod(HttpServletRequest, HttpServletResponse) + *
+ * + *

Note: If you use this class, you should set {@code lib.componenttest=true} in your package.properties file. + * + *

Servlet test methods should indicate failure by throwing an exception, + * typically {@link java.lang.AssertionError}. Servlets can use {@link Assert} if + * junit.jar is visible to the application, typically by copying it + * to {@code publish/servers/server/lib/global}. + */ +@SuppressWarnings("serial") +public abstract class FATServlet extends HttpServlet { + public static final String SUCCESS = "SUCCESS"; + public static final String TEST_METHOD = "testMethod"; + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + System.out.println("BEGIN " + request.getRequestURL() + '?' + request.getQueryString()); + + PrintWriter writer = response.getWriter(); + String method = request.getParameter(TEST_METHOD); + if (method != null && method.length() > 0) { + try { + before(); + + try { + Method mthd = getClass().getMethod(method, HttpServletRequest.class, HttpServletResponse.class); + mthd.invoke(this, request, response); + } catch (NoSuchMethodException nsme) { + Method mthd = getClass().getMethod(method, (Class[]) null); + mthd.invoke(this); + } finally { + after(); + } + + writer.println(SUCCESS); + } catch (Throwable t) { + if (t instanceof InvocationTargetException) { + t = t.getCause(); + } + + System.out.println("ERROR: " + t); + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw)); + System.err.print(sw); + + writer.println("ERROR: Caught exception attempting to call test method " + method + " on servlet " + getClass().getName()); + t.printStackTrace(writer); + } + } else { + System.out.println("ERROR: expected testMethod parameter"); + writer.println("ERROR: expected testMethod parameter"); + } + + writer.flush(); + writer.close(); + + System.out.println("END"); + } + + /** + * Override to mimic JUnit's {@code @Before} annotation. + */ + protected void before() throws Exception {} + + /** + * Override to mimic JUnit's {@code @After} annotation. + */ + protected void after() throws Exception {} +} \ No newline at end of file diff --git a/dev/com.ibm.ws.componenttest/src/componenttest/matchers/Matchers.java b/dev/com.ibm.ws.componenttest/src/componenttest/matchers/Matchers.java new file mode 100755 index 000000000000..ec6b709ca2a8 --- /dev/null +++ b/dev/com.ibm.ws.componenttest/src/componenttest/matchers/Matchers.java @@ -0,0 +1,126 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.matchers; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.hasItem; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +/** + * Extensions and wrappers for Hamcrest {@link Matcher}s. + */ +public final class Matchers { + + /** + * Decorates another {@link Matcher}, retaining its behaviour, but allowing tests to be slightly more expressive. + */ + public static Matcher does(final Matcher matcher) { + return matcher; + } + + public static Matcher containString(final String subString) { + return containsString(subString); + } + + public static Matcher> haveItem(T element) { + return hasItem(element); + } + + /** + * Creates a matcher for {@code Iterable}s that matches when the given items are a subsequence of the {@code Iterable}. + * + * @see Subsequence + */ + public static final Matcher> hasSubsequence(T... items) { + return new DoesCollectionHaveSubsequence(Arrays.asList(items)); + } + + /** + * Convenience method for {@link #hasSubsequence(T...)} to add extra readability. E.g. {@code assertThat(list, item(a).isBefore(b))} + */ + public static final Positional item(T item) { + return new Positional(item); + } + + public static final class Positional { + private final T item1; + + public Positional(T item1) { + this.item1 = item1; + } + + @SuppressWarnings("unchecked") + public Matcher> isBefore(T item2) { + return hasSubsequence(item1, item2); + } + + @SuppressWarnings("unchecked") + public Matcher> isAfter(T item2) { + return hasSubsequence(item2, item1); + } + } + + /** + * A matcher for a checking whether a list of items occur in a collection in a given order. Extra items between the given items are allowed. + *

+ * For example, if checking that a collection contains {@code ["A", "C"]} in order: + *

{@code ["A", "C"]} will pass. + *

{@code ["A", "B", "C"]} will pass. + *

{@code ["C", "B", "A"]} will fail. + *

{@code ["C", "B", "A", "B", "C"]} will pass. + */ + public static final class DoesCollectionHaveSubsequence extends TypeSafeMatcher> { + + private final List elements; + + public DoesCollectionHaveSubsequence(final List elements) { + this.elements = elements; + } + + private static boolean findInOrder(final Iterable iterToSearch, final Iterator itemsToFind) { + if (itemsToFind.hasNext()) { + T itemToFind = itemsToFind.next(); + for (T candidate : iterToSearch) { + if (candidate.equals(itemToFind)) { + if (itemsToFind.hasNext()) { + itemToFind = itemsToFind.next(); + } else { + return true; + } + } + } + } else { + return true; + } + return false; + } + + @Override + public void describeTo(final Description description) { + description.appendText("a collection containing, in order (ignoring extra entries): " + elements.toString()); + } + + @Override + public boolean matchesSafely(final Iterable item) { + return findInOrder(item, elements.iterator()); + } + } + + private Matchers() {} +} diff --git a/dev/com.ibm.ws.config.schemagen/bnd.bnd b/dev/com.ibm.ws.config.schemagen/bnd.bnd index 91400b839a2a..669b84cd536d 100755 --- a/dev/com.ibm.ws.config.schemagen/bnd.bnd +++ b/dev/com.ibm.ws.config.schemagen/bnd.bnd @@ -7,6 +7,8 @@ Bundle-SymbolicName: com.ibm.ws.config.schemagen WS-TraceGroup: config +Import-Package: !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * + Private-Package: com.ibm.ws.config.schemagen.internal -dsannotations: diff --git a/dev/com.ibm.ws.config.schemagen_test/.classpath b/dev/com.ibm.ws.config.schemagen_test/.classpath index 9b04a1490141..bd880329225d 100755 --- a/dev/com.ibm.ws.config.schemagen_test/.classpath +++ b/dev/com.ibm.ws.config.schemagen_test/.classpath @@ -1,8 +1,7 @@ - - - - + + + diff --git a/dev/com.ibm.ws.config.schemagen_test/.classpath.gradle b/dev/com.ibm.ws.config.schemagen_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.config.schemagen_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config.schemagen_test/.project b/dev/com.ibm.ws.config.schemagen_test/.project index db77a7aa72d3..b732a442401e 100755 --- a/dev/com.ibm.ws.config.schemagen_test/.project +++ b/dev/com.ibm.ws.config.schemagen_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.config.schemagen_test/bnd.bnd b/dev/com.ibm.ws.config.schemagen_test/bnd.bnd new file mode 100755 index 000000000000..7ea7d967863f --- /dev/null +++ b/dev/com.ibm.ws.config.schemagen_test/bnd.bnd @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.config.schemagen;version=latest diff --git a/dev/com.ibm.ws.config.schemagen_test/bnd.bnd.gradle b/dev/com.ibm.ws.config.schemagen_test/bnd.bnd.gradle new file mode 100755 index 000000000000..7ea7d967863f --- /dev/null +++ b/dev/com.ibm.ws.config.schemagen_test/bnd.bnd.gradle @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.config.schemagen;version=latest diff --git a/dev/com.ibm.ws.event_bvt/build.nogradle b/dev/com.ibm.ws.config.schemagen_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.event_bvt/build.nogradle rename to dev/com.ibm.ws.config.schemagen_test/build.gradle diff --git a/dev/com.ibm.ws.config.server.schemagen/bnd.bnd b/dev/com.ibm.ws.config.server.schemagen/bnd.bnd index de841987805b..00be319b488b 100644 --- a/dev/com.ibm.ws.config.server.schemagen/bnd.bnd +++ b/dev/com.ibm.ws.config.server.schemagen/bnd.bnd @@ -9,6 +9,8 @@ Main-Class: com.ibm.ws.config.server.schemagen.ServerSchemaGenCommand WS-TraceGroup: config +Import-Package: !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * + Private-Package: \ com.ibm.ws.config.server.schemagen.* diff --git a/dev/com.ibm.ws.config.server.schemagen/bnd.bnd.gradle b/dev/com.ibm.ws.config.server.schemagen/bnd.bnd.gradle index de841987805b..00be319b488b 100644 --- a/dev/com.ibm.ws.config.server.schemagen/bnd.bnd.gradle +++ b/dev/com.ibm.ws.config.server.schemagen/bnd.bnd.gradle @@ -9,6 +9,8 @@ Main-Class: com.ibm.ws.config.server.schemagen.ServerSchemaGenCommand WS-TraceGroup: config +Import-Package: !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * + Private-Package: \ com.ibm.ws.config.server.schemagen.* diff --git a/dev/com.ibm.ws.config.utility/src/com/ibm/ws/config/utility/actions/InstallAction.java b/dev/com.ibm.ws.config.utility/src/com/ibm/ws/config/utility/actions/InstallAction.java index 232bdd6c502d..f0b8e5e5d25e 100755 --- a/dev/com.ibm.ws.config.utility/src/com/ibm/ws/config/utility/actions/InstallAction.java +++ b/dev/com.ibm.ws.config.utility/src/com/ibm/ws/config/utility/actions/InstallAction.java @@ -472,6 +472,10 @@ private String getValue(String arg) { if (split.length == 1) { return null; } else if (split.length == 2) { + // Handle case where value ends with equals + if (arg.endsWith("=")) { + return split[1] + "="; + } return split[1]; } else { // Handle DN case with multiple =s @@ -482,6 +486,10 @@ private String getValue(String arg) { value.append("="); } } + // Handle case where value ends with equals + if (arg.endsWith("=")) + value.append("="); + return value.toString(); } } diff --git a/dev/com.ibm.ws.config.utility_fat/.classpath b/dev/com.ibm.ws.config.utility_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config.utility_fat/.classpath.gradle b/dev/com.ibm.ws.config.utility_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config.utility_fat/.gitignore b/dev/com.ibm.ws.config.utility_fat/.gitignore new file mode 100644 index 000000000000..27e131e35a6b --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.config.utility_fat/.project b/dev/com.ibm.ws.config.utility_fat/.project new file mode 100755 index 000000000000..91eb01d8ee58 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.config.utility_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c92277a371a9 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.config.utility_fat/bnd.bnd b/dev/com.ibm.ws.config.utility_fat/bnd.bnd new file mode 100644 index 000000000000..d87d7bffc3bb --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.org.apache.commons.io.1.4;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.config.utility;version=latest diff --git a/dev/com.ibm.ws.config.utility_fat/bnd.bnd.gradle b/dev/com.ibm.ws.config.utility_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..d87d7bffc3bb --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/bnd.bnd.gradle @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.org.apache.commons.io.1.4;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.config.utility;version=latest diff --git a/dev/com.ibm.ws.config.utility_fat/build-test.xml b/dev/com.ibm.ws.config.utility_fat/build-test.xml new file mode 100755 index 000000000000..e546d657a955 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/build-test.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.event_test/build.nogradle b/dev/com.ibm.ws.config.utility_fat/build.gradle similarity index 100% rename from dev/com.ibm.ws.event_test/build.nogradle rename to dev/com.ibm.ws.config.utility_fat/build.gradle diff --git a/dev/com.ibm.ws.config.utility_fat/delivery.sets b/dev/com.ibm.ws.config.utility_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/FATSuite.java b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/FATSuite.java new file mode 100755 index 000000000000..19b0cca30542 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/FATSuite.java @@ -0,0 +1,23 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.utility.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Collection of all FAT tests + */ +@RunWith(Suite.class) +@SuiteClasses({ ServerConfigUtilityFatTesting.class }) +public class FATSuite {} \ No newline at end of file diff --git a/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/ServerConfigUtilityFatTesting.java b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/ServerConfigUtilityFatTesting.java new file mode 100755 index 000000000000..69f63909d740 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/ServerConfigUtilityFatTesting.java @@ -0,0 +1,336 @@ +package com.ibm.ws.config.utility.fat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.util.Properties; + +import org.apache.commons.io.FileUtils; +import org.junit.AfterClass; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; + +public class ServerConfigUtilityFatTesting extends TestRepository { + + private static final Class c = ServerConfigUtilityFatTesting.class; + + static Machine machine; + String installRoot = server.getInstallRoot(); + String controllerPort = System.getProperty("HTTP_default.secure"); + String adminUser = "user001"; + String adminPassword = "pass001"; + String keystorePassword = "passwordKeystore"; + String encodingType = "aes"; + String configFilePath = System.getProperty("user.dir") + System.getProperty("file.separator") + "configFile.txt"; + + private static final String SLASH = System.getProperty("file.separator"); + public static LibertyServer server = TestRepository.server; + + @BeforeClass + public static void setUp() throws Exception { + Assume.assumeTrue(new TestRepository().testRepositoryConnection()); + final String methodName = "setUp"; + Log.entering(c, methodName); + + machine = server.getMachine(); + Log.info(c, methodName, "Starting Server"); + server.startServer(); + + // Wait for the smarter planet message + assertNotNull("The smarter planet message did not get printed", server.waitForStringInLog("CWWKF0011I")); + Log.exiting(c, methodName); + } + + @AfterClass + public static void tearDown() throws Exception { + if (server.isStarted()) { + server.stopServer(); + } + } + + public static String readFile(String path) throws IOException { + return FileUtils.readFileToString(new File(path)).trim(); + } + + @Mode(TestMode.LITE) + @Test + public void testConfigUtilityUseLocalFile() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testConfigUtilityUseLocalFile"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + Log.info(c, methodName, "Running configUtility --useLocalFile"); + Log.info(c, methodName, "Path to --useLocalFile" + p); + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p, + "--VadminUser=" + adminUser, + "--VwritePath=path1", + "--encoding=" + encodingType, + "--key=" + "123", + "--VhttpPort=8081" + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "--useLocalFile result:\n" + po.getStdout()); + assertEquals("ConfigUtility task should complete with return code as 0.", 0, po.getReturnCode()); + + assertTrue("Fail: did not match expected username:", po.getStdout().contains("userName=\"" + adminUser + "\"")); + assertTrue("Fail: did not match expected writePath snippet:path1", po.getStdout().contains("path1")); + assertTrue("Fail: did not match expected httpPort snippet:", po.getStdout().toString().contains("httpPort=\"8081\"")); + + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testConfigUtilityCheckErrorCodes() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testConfigUtilityCheckErrorCodes"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + Log.info(c, methodName, "Running configUtility --useLocalFile"); + Log.info(c, methodName, "Path to --useLocalFile" + p); + + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p + "abc", + "--VadminUser=" + adminUser, + "--VwritePath=path1", + "--encoding=" + encodingType, + "--key=" + "123", + "--VhttpPort=8081" + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "--useLocalFile result:\n" + po.getStdout()); + assertEquals("ConfigUtility task should complete with return code as 255.", 255, po.getReturnCode()); + + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testInvalidValArgsConfigUtility() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testInvalidValArgsConfigUtility"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + Log.info(c, methodName, "Running configUtility --useLocalFile"); + Log.info(c, methodName, "Path to --useLocalFile" + p); + + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p, + "--Vinvalid=" + adminUser, + "--VwritePath=path1", + "--encoding=" + encodingType, + "--key=" + "123", + "--VhttpPort=8081" + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "--useLocalFile result:\n" + po.getStdout()); + assertEquals("ConfigUtility task should complete with return code as 20.", 20, po.getReturnCode()); + + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testEncodingConfigUtilityUseLocalFile() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testEncodingConfigUtilityUseLocalFile"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + Log.info(c, methodName, "Running configUtility --useLocalFile"); + + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p, + "--VadminUser=" + adminUser, + "--VwritePath=" + "path1", + "--VadminPassword=" + adminPassword, + "--VkeystorePassword=" + keystorePassword, + "--encoding=" + encodingType, + "--key=" + "123" + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "ConfigUtility result:\n" + po.getStdout()); + assertEquals("ConfigUtility task should complete with return code as 0.", 0, po.getReturnCode()); + + assertTrue("Fail: did not match expected username:", po.getStdout().contains("userName=\"" + adminUser + "\"")); + assertTrue("Fail: did not match expected writePath snippet:path1", po.getStdout().contains("path1")); + assertFalse("Fail: adminPassword should not match generated password:", + po.getStdout().contains(adminPassword)); + assertTrue("Fail: did not match expected encodingType 'aes':", + po.getStdout().contains("userPassword=\"{aes}")); + + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testDefaultEncodingConfigUtility() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testDefaultEncodingConfigUtility"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + Log.info(c, methodName, "Running configUtility --useLocalFile"); + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p, + "--VadminUser=" + adminUser, + "--VwritePath=" + "path1", + "--VadminPassword=" + adminPassword, + "--VkeystorePassword=" + keystorePassword + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "ConfigUtility result:\n" + po.getStdout()); + assertEquals("ConfigUtility task should complete with return code as 0.", 0, po.getReturnCode()); + + assertTrue("Fail: did not match expected username:", po.getStdout().contains("userName=\"" + adminUser + "\"")); + assertTrue("Fail: did not match expected writePath snippet:path1", po.getStdout().contains("path1")); + assertFalse("Fail: adminPassword should not match generated password:", + po.getStdout().contains(adminPassword)); + assertTrue("Fail: did not match expected encodingType 'xor':userPassword=\"{xor}", + po.getStdout().contains("userPassword=\"{xor}")); + + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testFindAllConfigSnippets() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testFindAllConfigSnippets"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + Log.info(c, methodName, "Running configUtility find"); + + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { "find" }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + + assertFalse("FAIL: configUtility find should return all snippets:", po.getStdout().isEmpty()); + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testFindRelatedConfigSnippets() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testFindRelatedConfigSnippets"; + + Log.entering(c, methodName); + Properties env = new Properties(); + String arg = "security"; + + Log.info(c, methodName, "Running configUtility find " + arg); + + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { "find", arg }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + + assertFalse("FAIL: configUtility info should return snippets related to " + arg, po.getStdout().isEmpty()); + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testCreateConfigFileSnippets() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testCreateConfigFileSnippets"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + Log.info(c, methodName, "Running configUtility -list"); + Log.info(c, methodName, "Create Config File in " + configFilePath); + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p, + "--VadminUser=" + adminUser, + "--VwritePath=" + "path1", + "--VadminPassword=" + adminPassword, + "--VkeystorePassword=" + keystorePassword, + "--createConfigFile=" + configFilePath + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "ConfigFile result:\n" + po.getStdout()); + + File configFile = new File(configFilePath); + assertTrue("The configFile " + configFilePath + " was created.", configFile.exists()); + configFile.deleteOnExit(); + + Log.exiting(c, methodName); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/TestRepository.java b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/TestRepository.java new file mode 100755 index 000000000000..1a8adb157023 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/TestRepository.java @@ -0,0 +1,72 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.utility.fat; + +import java.io.File; + +import org.junit.Rule; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.connections.liberty.MainRepository; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + * TestRepository makes sure that the connection to the repository is successful + */ +public class TestRepository { + + private static Class logClass = TestRepository.class; + public static boolean connectedToRepo = false; + public static String massiveRepoFile; + private static String repositoryUrl; + public static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.utility.fat"); + + @Rule + public final TestName method = new TestName(); + private static final String SLASH = System.getProperty("file.separator"); + + @SuppressWarnings("deprecation") + public boolean testRepositoryConnection() { + Log.entering(logClass, method.getMethodName()); + try { + massiveRepoFile = server.pathToAutoFVTTestFiles + "massive" + SLASH + "massiveRepoLocation.props"; + + String repositoryDescriptionUrl = new File(massiveRepoFile).getCanonicalFile().toURI().toURL().toString(); + System.setProperty("repository.description.url", repositoryDescriptionUrl); + + RestRepositoryConnection connection = MainRepository.createConnection(); + connectedToRepo = connection.isRepositoryAvailable(); + + if (connectedToRepo) { + Log.info(logClass, method.getMethodName(), "Repository connection is OK."); + } else { + connectedToRepo = false; + Log.info(logClass, method.getMethodName(), "Cannot connect to the test repository: " + repositoryUrl); + } + + } catch (Exception e) { + Log.info(logClass, method.getMethodName(), "Cannot connect to the repository : " + e.getMessage()); + connectedToRepo = false; + } finally { + MainRepository.clearCachedRepoProperties(); + } + + Log.exiting(logClass, method.getMethodName()); + return connectedToRepo; + } + +} diff --git a/dev/com.ibm.ws.config.utility_fat/publish/files/massive/massiveRepoLocation.props b/dev/com.ibm.ws.config.utility_fat/publish/files/massive/massiveRepoLocation.props new file mode 100755 index 000000000000..7ce8be4e822b --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/files/massive/massiveRepoLocation.props @@ -0,0 +1,6 @@ +# Details for Test Massive Repo - Toronto Polaris Team + +repository.url=http://ltestl91.hursley.ibm.com:9002/ma/v1 +apiKey=79984835186 +userId=xmlxsltb@ca.ibm.com +password=Polaris2015 \ No newline at end of file diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/bootstrap.properties b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/bootstrap.properties new file mode 100755 index 000000000000..08ade3c83183 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/bootstrap.properties @@ -0,0 +1,8 @@ +com.ibm.ws.logging.trace.specification=*=event=enabled:\ +com.ibm.ws.collective.member.*=all=enabled:\ +com.ibm.ws.collective.repository.*=all=enabled +com.ibm.ws.collective.utility.*=all=enabled +com.ibm.ws.logging.max.file.size=0 +ds.loglevel=debug + +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/ejbSnippet.xml b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/ejbSnippet.xml new file mode 100755 index 000000000000..0d8f77439f65 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/ejbSnippet.xml @@ -0,0 +1,50 @@ + +Downloading the requested config snippet... + +Modifiying the config snippet... + + + + + appSecurity-2.0 + ejbLite-3.1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Please ensure administrative security is configured for the server. diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/remoteJMXConnection.xml b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/remoteJMXConnection.xml new file mode 100755 index 000000000000..a31952449ff6 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/remoteJMXConnection.xml @@ -0,0 +1,32 @@ + + + + + + + restConnector-1.0 + + + + + + + + + + + + + + + ${writePath} + ${readPath} + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/resultingSnippet.xml b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/resultingSnippet.xml new file mode 100755 index 000000000000..e94b5be515fa --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/resultingSnippet.xml @@ -0,0 +1,36 @@ + + + + + + + + restConnector-1.0 + + + + + + + + + + + + + + + ${writePath} + ${readPath} + + + + +Please ensure administrative security is configured for the server. +An administrative user is required to join members to the collective. diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/resources/security/ltpa.keys b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/resources/security/ltpa.keys new file mode 100755 index 000000000000..e0e7d511ac36 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/resources/security/ltpa.keys @@ -0,0 +1,8 @@ +#Sun Jan 15 15:01:21 CST 2012 +com.ibm.websphere.CreationDate=Sun Jan 15 15\:01\:21 CST 2012 +com.ibm.websphere.CreationHost=localhost +com.ibm.websphere.ltpa.Realm=PreGeneratedLTPAKeys +com.ibm.websphere.ltpa.version=1.0 +com.ibm.websphere.ltpa.3DESKey=xpUAUsH4SZc+VuiAqzL+Tz+MfBmb+6vv3/cGjIn+mR4\= +com.ibm.websphere.ltpa.PublicKey=AMan4Qo5MKIeYf26TJbTZwRdYai7rWRVXDwy/6XI1iq+CVxny1O74rE4cn7wXalID05hKwm/HUxvFd72Y3dABzL1bTUpl1uE6SQNePrcdrQC8rmtichsdvY0baiGYexURYP7fbHF5Z70RfQGCPYnuZTB9jsHdh4HJlrOlsx6K2mJAQAB +com.ibm.websphere.ltpa.PrivateKey=TkjZeR/1L6khA7UKNjBRI1T+nbwEWXv1AWVSOCEgpKfLvw8iAkIc7+8I2zfc3j88XciTxDuagepUDoWCXHJ1ithSptZSLnHBASD7Ki1dLTKY7jszPXmIIwoa8YaQFtuuNeSJ7r6r8krSB5ml5sk7aTF0Sed8TFrx1aDEQRIZCovZV8BQX29bBZC99gTqk3chCpcOVRqcxvQRGzdP0PenvaA9afeflV5t4Iw8errfmHjedNVDog90ZVVAeecO+ZLqn7yAHh98ZTdV9IEVyqnFI7XQljrMJsNt3zl/tB7ktQ6VuyxJmlQdDbmvJ+F6DZeR9lVC991a/Ks0i1VKVOrwhPxJYLX2Xz7MWpLu09pwapo\= diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/server.xml b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/server.xml new file mode 100755 index 000000000000..80576a2e13bc --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/server.xml @@ -0,0 +1,9 @@ + + + + + servlet-3.0 + restConnector-1.0 + + + diff --git a/dev/com.ibm.ws.config.utility_test/.classpath b/dev/com.ibm.ws.config.utility_test/.classpath index 53fab64f727e..bd880329225d 100755 --- a/dev/com.ibm.ws.config.utility_test/.classpath +++ b/dev/com.ibm.ws.config.utility_test/.classpath @@ -1,16 +1,7 @@ - - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.config.utility_test/.classpath.gradle b/dev/com.ibm.ws.config.utility_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.config.utility_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config.utility_test/.project b/dev/com.ibm.ws.config.utility_test/.project index b4168fb632d3..03f5c98c2b59 100755 --- a/dev/com.ibm.ws.config.utility_test/.project +++ b/dev/com.ibm.ws.config.utility_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.config.utility_test/bnd.bnd b/dev/com.ibm.ws.config.utility_test/bnd.bnd new file mode 100755 index 000000000000..380b900ad076 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_test/bnd.bnd @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.ws.install;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.config.utility;version=latest diff --git a/dev/com.ibm.ws.config.utility_test/bnd.bnd.gradle b/dev/com.ibm.ws.config.utility_test/bnd.bnd.gradle new file mode 100755 index 000000000000..380b900ad076 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_test/bnd.bnd.gradle @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.ws.install;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.config.utility;version=latest diff --git a/dev/com.ibm.ws.httpservice/build.nogradle b/dev/com.ibm.ws.config.utility_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.httpservice/build.nogradle rename to dev/com.ibm.ws.config.utility_test/build.gradle diff --git a/dev/com.ibm.ws.config_bvt.parser/.classpath b/dev/com.ibm.ws.config_bvt.parser/.classpath index bc84efb3e96f..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.config_bvt.parser/.classpath +++ b/dev/com.ibm.ws.config_bvt.parser/.classpath @@ -1,19 +1,7 @@ - - - - - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.config_bvt.parser/.classpath.gradle b/dev/com.ibm.ws.config_bvt.parser/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.parser/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.parser/.project b/dev/com.ibm.ws.config_bvt.parser/.project index 7ed9b2d1f4b6..266cdfe2cd32 100755 --- a/dev/com.ibm.ws.config_bvt.parser/.project +++ b/dev/com.ibm.ws.config_bvt.parser/.project @@ -11,13 +11,13 @@ - com.ibm.ws.rasplugin.RASValidationBuilder + bndtools.core.bndbuilder org.eclipse.jdt.core.javanature - com.ibm.ws.rasplugin.RASValidationNature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.config_bvt.parser/bnd.bnd b/dev/com.ibm.ws.config_bvt.parser/bnd.bnd new file mode 100755 index 000000000000..1ea299818fc3 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.parser/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.config_bvt.parser/bnd.bnd.gradle b/dev/com.ibm.ws.config_bvt.parser/bnd.bnd.gradle new file mode 100755 index 000000000000..1ea299818fc3 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.parser/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.httpservice_bvt/build.nogradle b/dev/com.ibm.ws.config_bvt.parser/build.gradle similarity index 100% rename from dev/com.ibm.ws.httpservice_bvt/build.nogradle rename to dev/com.ibm.ws.config_bvt.parser/build.gradle diff --git a/dev/com.ibm.ws.config_bvt.schema/.classpath b/dev/com.ibm.ws.config_bvt.schema/.classpath new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/.classpath.gradle b/dev/com.ibm.ws.config_bvt.schema/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/.project b/dev/com.ibm.ws.config_bvt.schema/.project new file mode 100755 index 000000000000..34341dba146e --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.config_bvt.schema + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..3d73ed77a172 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,113 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=true +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.config_bvt.schema/bnd.bnd b/dev/com.ibm.ws.config_bvt.schema/bnd.bnd new file mode 100755 index 000000000000..d6ad84f508fc --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bnd.bnd @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.filetransfer;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.kernel.service;version=latest, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.config_bvt.schema/bnd.bnd.gradle b/dev/com.ibm.ws.config_bvt.schema/bnd.bnd.gradle new file mode 100755 index 000000000000..d6ad84f508fc --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bnd.bnd.gradle @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.filetransfer;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.kernel.service;version=latest, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.config_bvt.schema/build-bvt.xml b/dev/com.ibm.ws.config_bvt.schema/build-bvt.xml new file mode 100755 index 000000000000..cfd95ae83507 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/build-bvt.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.httpservice_test/build.nogradle b/dev/com.ibm.ws.config_bvt.schema/build.gradle similarity index 100% rename from dev/com.ibm.ws.httpservice_test/build.nogradle rename to dev/com.ibm.ws.config_bvt.schema/build.gradle diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle.bnd b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle.bnd new file mode 100755 index 000000000000..6a076d8a1faa --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle.bnd @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion = 1.0 + +Bundle-Name: Schema Generator Servlet +Bundle-SymbolicName: test.server.schema +Bundle-Description: Schema Generator Servlet Bundle, version ${bVersion} + +Service-Component: test.server.schema.servlet; \ + implementation:=test.server.schema.SchemaGeneratorActivator; \ + http=org.osgi.service.http.HttpService; \ + schemaGenerator=com.ibm.websphere.metatype.SchemaGenerator; \ + locationService=com.ibm.wsspi.kernel.service.location.WsLocationAdmin; \ + immediate:=true; \ + properties:="service.vendor=IBM" + +Private-Package: test.server.* + +Import-Package: \ + !*.internal.*, * + +Include-Resource: \ + @junit.jar diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-one.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-one.xml new file mode 100755 index 000000000000..ec9638411f38 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-one.xml @@ -0,0 +1,8 @@ + + + + 192.168.1.1 + 192.168.1.2 + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-two.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-two.xml new file mode 100755 index 000000000000..ac83f85b806a --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-two.xml @@ -0,0 +1,7 @@ + + + + localhost + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/singleton.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/singleton.xml new file mode 100755 index 000000000000..aa6de86a06bf --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/singleton.xml @@ -0,0 +1,8 @@ + + + + 192.168.1.1 + 192.168.1.2 + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-attributecopy.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-attributecopy.xml new file mode 100755 index 000000000000..814ccb257f19 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-attributecopy.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-childfirstextends.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-childfirstextends.xml new file mode 100755 index 000000000000..a4eef6a04bdd --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-childfirstextends.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-default.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-default.xml new file mode 100755 index 000000000000..4104848f4cd1 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-default.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-dynamic.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-dynamic.xml new file mode 100755 index 000000000000..5c3bb23e0e44 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-dynamic.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions-two.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions-two.xml new file mode 100755 index 000000000000..fb6ec51a0f78 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions-two.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions.xml new file mode 100755 index 000000000000..3c8cd56a279c --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-hidden.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-hidden.xml new file mode 100755 index 000000000000..dc9cba68f5cb --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-hidden.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-defaults.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-defaults.xml new file mode 100755 index 000000000000..3517b65d8f25 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-defaults.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-merge.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-merge.xml new file mode 100755 index 000000000000..45191d7342de --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-merge.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-two.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-two.xml new file mode 100755 index 000000000000..298392be79b6 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-two.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested.xml new file mode 100755 index 000000000000..2517e32e3e42 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-reference.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-reference.xml new file mode 100755 index 000000000000..822bc5c71ad6 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-reference.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-serviceobjectclass.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-serviceobjectclass.xml new file mode 100755 index 000000000000..eb51e264151a --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-serviceobjectclass.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-variable.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-variable.xml new file mode 100755 index 000000000000..df6523ed86a7 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-variable.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype.xml new file mode 100755 index 000000000000..8221cb375f05 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseHttpTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseHttpTest.java new file mode 100755 index 000000000000..7d0c513401b7 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseHttpTest.java @@ -0,0 +1,62 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server; + +import java.util.Dictionary; +import java.util.HashSet; +import java.util.Set; + +import javax.servlet.Servlet; +import javax.servlet.ServletException; + +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.http.HttpContext; +import org.osgi.service.http.HttpService; +import org.osgi.service.http.NamespaceException; + +@Component +public abstract class BaseHttpTest { + + protected volatile HttpService http = null; + private final Set registrations = new HashSet(); + + protected void activate(ComponentContext context) throws Exception {} + + protected void deactivate(ComponentContext context) { + for (String alias : registrations) { + http.unregister(alias); + } + http = null; + } + + protected void registerServlet(String alias, Servlet servlet, Dictionary initParams, HttpContext context) throws ServletException, NamespaceException { + if (http == null) { + throw new NullPointerException("Http service is not present"); + } + http.registerServlet(alias, servlet, initParams, context); + registrations.add(alias); + } + + @Reference(name = "http", service = HttpService.class) + protected void setHttp(HttpService ref) { + this.http = ref; + } + + protected void unsetHttp(HttpService ref) { + if (ref == this.http) { + this.http = null; + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTest.java new file mode 100755 index 000000000000..94e1f52e1568 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTest.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server; + +public abstract class BaseTest { + + public static final long TIMEOUT = 30 * 1000; + + protected String name; + + public BaseTest(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public abstract String[] getServiceClasses(); + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTestRunner.java new file mode 100755 index 000000000000..a753213ba9d5 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTestRunner.java @@ -0,0 +1,166 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server; + +import static org.junit.Assert.fail; + +import java.io.BufferedWriter; +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.Hashtable; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Reference; + +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; +import com.ibm.wsspi.kernel.service.location.WsResource; + +import test.server.config.dynamic.ConfigWriter; + +public abstract class BaseTestRunner extends BaseHttpTest { + + protected BundleContext bundleContext; + protected WsLocationAdmin locationService; + protected ConfigurationAdmin configAdmin; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + + bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + } + + protected void addTest(BaseTest test) { + Dictionary properties = new Hashtable(); + properties.put(Constants.SERVICE_PID, test.getName()); + bundleContext.registerService(test.getServiceClasses(), test, properties); + } + + @Reference(name = "locationService", service = WsLocationAdmin.class) + protected void setLocationService(WsLocationAdmin ref) { + this.locationService = ref; + } + + protected void unsetLocationService(WsLocationAdmin ref) { + if (ref == this.locationService) { + this.locationService = null; + } + } + + private WsResource getConfigRoot() { + return locationService.resolveResource("${server.config.dir}/server.xml"); + } + + protected ConfigWriter readConfiguration() throws Exception { + InputStream in = getConfigRoot().get(); + try { + return new ConfigWriter(in); + } finally { + close(in); + } + } + + protected void writeConfiguration(ConfigWriter configWriter) throws Exception { + // try to write the entire config in one step (or least possible) + OutputStreamWriter os = new OutputStreamWriter(getConfigRoot().putStream(), "UTF-8"); + BufferedWriter writer = new BufferedWriter(os, 25 * 1024); + try { + configWriter.write(writer); + } finally { + close(writer); + } + StringWriter sw = new StringWriter(); + configWriter.write(sw); + System.out.println(sw.toString()); + } + + public static void dictionaryEquals(Dictionary one, Dictionary two) { + if (one.size() != two.size()) { + fail("Dictionaries are not the same: " + one + " " + two); + } + Enumeration e = one.keys(); + while (e.hasMoreElements()) { + Object key = e.nextElement(); + Object value1 = one.get(key); + Object value2 = two.get(key); + if (value1 instanceof String[] && value2 instanceof String[]) { + value1 = Arrays.asList((String[]) value1); + value2 = Arrays.asList((String[]) value2); + } + if (!value1.equals(value2)) { + fail("Dictionaries are not the same: " + key + " " + value1 + " " + value2); + } + } + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + public class TestDynamicConfigServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest rq, HttpServletResponse rsp) throws IOException { + PrintWriter pw = rsp.getWriter(); + rsp.setContentType("text/plain"); + + String testName = rq.getParameter("testName"); + + try { + log("Begin test: " + testName); + invokeTest(testName); + pw.println("OK"); + } catch (NoSuchMethodException e) { + pw.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + pw.println("FAILED"); + e.getTargetException().printStackTrace(pw); + } catch (Throwable e) { + pw.println("FAILED"); + e.printStackTrace(pw); + } finally { + log("End test: " + testName); + } + } + + } + + public static void close(Closeable closeable) { + if (closeable != null) { + try { + closeable.close(); + } catch (IOException ignore) { + } + } + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationAdminTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationAdminTest.java new file mode 100755 index 000000000000..79161e62be33 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationAdminTest.java @@ -0,0 +1,79 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import java.util.Dictionary; +import java.util.Hashtable; + +import junit.framework.Assert; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * + */ +public class ConfigurationAdminTest extends Test { + private final ConfigurationAdmin configAdmin; + + public ConfigurationAdminTest(String name, ConfigurationAdmin ca) { + super(name, 0); + this.configAdmin = ca; + } + + public void testConfigurationAdmin() throws Exception { + String myPID = "my.test.pid"; + Configuration cfg = configAdmin.createFactoryConfiguration(myPID); + Dictionary props = new Hashtable(); + props.put("a", "a"); +// props.put("A", "a"); + cfg.update(props); + + Configuration caCfg = configAdmin.getConfiguration(cfg.getPid()); + Dictionary caProps = caCfg.getProperties(); + + // check # of elements + Assert.assertNotNull("missing key a", caProps.remove("a")); + Object o = caProps.remove("A"); + Assert.assertNull("has key A: " + o, o); + + // update dictionary make sure its copied + props.put("b", "b"); + Assert.assertNull("b is present", caProps.get("b")); + + caProps.put("c", "c"); + Dictionary caProps2 = caCfg.getProperties(); + Assert.assertNull("c is present", caProps2.get("c")); + + caCfg.update(caProps); + Assert.assertNull("c is present", caProps2.get("c")); + + caProps2 = caCfg.getProperties(); + Assert.assertNotNull("c is not present", caProps2.get("C")); + } + + @Override + public String[] getServiceClasses() { + return null; + } + + @Override + public Throwable getException() { + try { + testConfigurationAdmin(); + } catch (Throwable t) { + exception = t; + } + + return exception; + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationPluginTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationPluginTest.java new file mode 100755 index 000000000000..ad92d4dd1010 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationPluginTest.java @@ -0,0 +1,59 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import java.util.Dictionary; + +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ConfigurationPlugin; + +public class ConfigurationPluginTest extends ManagedFactoryTest implements ConfigurationPlugin { + + /** */ + private static final String VALUE = "VALUE"; + /** */ + private static final String NEW_KEY = "NEW_KEY"; + /** */ + private static final String INJECT = "inject"; + + public ConfigurationPluginTest(String name) { + super(name, 2); + } + + @Override + public String[] getServiceClasses() { + String[] baseServices = super.getServiceClasses(); + String[] services = new String[baseServices.length + 1]; + services[0] = ConfigurationPlugin.class.getName(); + System.arraycopy(baseServices, 0, services, 1, baseServices.length); + return services; + } + + @Override + public void configurationUpdated(String pid, Dictionary props) throws ConfigurationException { + if (Boolean.TRUE.equals(props.get(INJECT))) { + if (!props.get(NEW_KEY).equals(VALUE)) { + throw new ConfigurationException(NEW_KEY, "Missing " + VALUE); + } + } + } + + @Override + public void modifyConfiguration(ServiceReference ref, Dictionary props) { + if (name.equals(ref.getProperty(Constants.SERVICE_PID)) && Boolean.TRUE.equals(props.get(INJECT))) { + props.put(NEW_KEY, VALUE); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryAliasTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryAliasTest.java new file mode 100755 index 000000000000..2967607e157f --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryAliasTest.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class FactoryAliasTest extends ManagedFactoryTest { + + public FactoryAliasTest(String name, int count) { + super(name, count); + } + + @Override + public void configurationUpdated(String pid, Dictionary properties) throws ConfigurationException { + String id = (String) properties.get("id"); + + assertEquals("kids", new Integer(3), properties.get("kids")); + + if ("simpsons".equals(id)) { + assertEquals("lastName", "Simpson", properties.get("lastName")); + assertEquals("firstName", "Homer", properties.get("firstName")); + assertEquals("fullName", "Homer Simpson", properties.get("fullName")); + } else if ("griffins".equals(id)) { + assertEquals("lastName", "Griffin", properties.get("lastName")); + assertEquals("firstName", "Peter", properties.get("firstName")); + assertEquals("fullName", "Peter Griffin", properties.get("fullName")); + } else { + throw new RuntimeException("Invalid instance id: " + id); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryMetaTypeTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryMetaTypeTest.java new file mode 100755 index 000000000000..86fa93a8d0de --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryMetaTypeTest.java @@ -0,0 +1,49 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Dictionary; +import java.util.Vector; + +import org.osgi.service.cm.ConfigurationException; + +public class FactoryMetaTypeTest extends ManagedFactoryTest { + + public FactoryMetaTypeTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(String pid, Dictionary properties) throws ConfigurationException { + String id = (String) properties.get("id"); + if ("FamilyGuy".equals(id)) { + // picked up directly from metatype + assertEquals("present", Boolean.TRUE, properties.get("present")); + assertArrayEquals("int array", new int[] { 1, 2, 3 }, (int[]) properties.get("intColl")); + assertEquals("long vector", new Vector(Arrays.asList(4l, 5l, 6l, 7l)), properties.get("longColl")); + + // from metatype + assertEquals("lastname", "Griffin", properties.get("lastname")); + assertEquals("spouse", "Lois Griffin", properties.get("spouse")); + + // from server config + assertArrayEquals("children", new String[] { "Meg Griffin", "Chris Griffin" }, (String[]) properties.get("children")); + } else { + throw new RuntimeException("Invalid instance id: " + id); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactorySimpleTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactorySimpleTest.java new file mode 100755 index 000000000000..0b003cf92bff --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactorySimpleTest.java @@ -0,0 +1,38 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class FactorySimpleTest extends ManagedFactoryTest { + + public FactorySimpleTest(String name, int count) { + super(name, count); + } + + @Override + public void configurationUpdated(String pid, Dictionary properties) throws ConfigurationException { + String id = (String) properties.get("id"); + if ("serverInstance".equals(id)) { + assertEquals("simple attr", "foo", properties.get("simpleAttr")); + assertArrayEquals("collection attr", new String[] { "Lisa", "Simpson" }, (String[]) properties.get("collAttr")); + } else { + throw new RuntimeException("Invalid instance id: " + id); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FinalTypeTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FinalTypeTest.java new file mode 100755 index 000000000000..adaf906721a9 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FinalTypeTest.java @@ -0,0 +1,41 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; + +/** + * + */ +public class FinalTypeTest extends ManagedTest { + + /** + * @param name + */ + public FinalTypeTest(String name) { + super(name); + } + + /** {@inheritDoc} */ + @Override + public void configurationUpdated(Dictionary properties) throws Exception { + assertEquals("name", "someName", properties.get("name")); + assertNull("finalField1 should be null but is " + properties.get("finalField1"), properties.get("finalField1")); + String configDir = System.getProperty("user.variable"); + assertEquals("finalField2 should be an expanded variable", configDir, properties.get("finalField2")); + assertEquals("finalField3 should be a default value", "someDefault", properties.get("finalField3")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedFactoryTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedFactoryTest.java new file mode 100755 index 000000000000..327e68eb0af5 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedFactoryTest.java @@ -0,0 +1,50 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; + +public abstract class ManagedFactoryTest extends Test implements ManagedServiceFactory { + + public ManagedFactoryTest(String name) { + this(name, 1); + } + + public ManagedFactoryTest(String name, int count) { + super(name, count); + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedServiceFactory.class.getName() }; + } + + @Override + public void updated(String pid, Dictionary properties) throws ConfigurationException { + try { + configurationUpdated(pid, properties); + } catch (Throwable e) { + exception = e; + } finally { + latch.countDown(); + } + } + + public abstract void configurationUpdated(String pid, Dictionary properties) throws Exception; + + @Override + public void deleted(String pid) {} + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedTest.java new file mode 100755 index 000000000000..f4228aa1f458 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedTest.java @@ -0,0 +1,43 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedService; + +public abstract class ManagedTest extends Test implements ManagedService { + + public ManagedTest(String name) { + super(name); + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedService.class.getName() }; + } + + @Override + public void updated(Dictionary properties) throws ConfigurationException { + try { + configurationUpdated(properties); + } catch (Throwable e) { + exception = e; + } finally { + latch.countDown(); + } + } + + public abstract void configurationUpdated(Dictionary properties) throws Exception; + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigComplexElementTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigComplexElementTest.java new file mode 100755 index 000000000000..c6e485c1ef91 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigComplexElementTest.java @@ -0,0 +1,111 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Map; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * Test a complex config requirement that was requested from the security team + */ +public class NestedConfigComplexElementTest extends ManagedFactoryTest { + + private final ConfigurationAdmin configAdmin; + private final Map realms, ids, passwords, users; + private final String GROUP_ELEM = "group"; + private final String USER_ELEM = "user"; + private final String ID_ATTR = "id"; + private final String PASSWORD_ATTR = "password"; + private final String REALM_ATTR = "realm"; + + /** + * @param name + */ + public NestedConfigComplexElementTest(String name, ConfigurationAdmin configAdmin) { + super(name); + this.configAdmin = configAdmin; + realms = new HashMap(); + ids = new HashMap(); + passwords = new HashMap(); + users = new HashMap(); + init(); + } + + /** + * results data to compare against + */ + private void init() { + realms.put("SampleBasicRealm", null); + ids.put("admin", "SampleBasicRealm"); + ids.put("user1", "SampleBasicRealm"); + ids.put("user2", "SampleBasicRealm"); + ids.put("user3", "SampleBasicRealm"); + ids.put("memberlessGroup", "SampleBasicRealm"); + ids.put("adminGroup", "SampleBasicRealm"); + ids.put("users", "SampleBasicRealm"); + passwords.put("admin", "admin"); + passwords.put("user1", "user1"); + passwords.put("user2", "user2"); + passwords.put("user3", "user3"); + users.put("admin", "SampleBasicRealm"); + users.put("user1", "SampleBasicRealm"); + users.put("user2", "SampleBasicRealm"); + } + + /** {@inheritDoc} */ + @Override + public void configurationUpdated(String pid, Dictionary properties) throws Exception { + String name = (String) properties.get(REALM_ATTR); + assertTrue(realms.containsKey(name)); + String[] userArr = (String[]) properties.get(USER_ELEM); + assertNotNull(userArr); + assertEquals(4, userArr.length); + String[] groupArr = (String[]) properties.get(GROUP_ELEM); + assertNotNull(groupArr); + assertEquals(3, groupArr.length); + + for (int i = 0; i < userArr.length; i++) { + Configuration config = configAdmin.getConfiguration(userArr[i]); + Dictionary prop = config.getProperties(); + String id = (String) prop.get(ID_ATTR); + assertTrue(ids.containsKey(id)); + assertEquals(ids.get(id), name); + String password = (String) prop.get(PASSWORD_ATTR); + assertTrue(passwords.containsKey(password)); + assertEquals(passwords.get(password), id); + } + + for (int i = 0; i < groupArr.length; i++) { + Configuration config = configAdmin.getConfiguration(groupArr[i]); + Dictionary prop = config.getProperties(); + String id = (String) prop.get(ID_ATTR); + assertTrue(ids.containsKey(id)); + assertEquals(ids.get(id), name); + String[] userList = (String[]) prop.get(USER_ELEM); + if (userList != null) { + for (int j = 0; j < userList.length; j++) { + assertTrue(users.containsKey(userList[j])); + assertEquals(users.get(userList[j]), name); + } + } + } + + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigElementTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigElementTest.java new file mode 100755 index 000000000000..7d117125cd96 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigElementTest.java @@ -0,0 +1,144 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Map; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +/** + * + */ +public class NestedConfigElementTest extends ManagedFactoryTest { + + private final ConfigurationAdmin configAdmin; + private final Map apps, hostNames, ports; + + /** + * @param name + */ + public NestedConfigElementTest(String name, ConfigurationAdmin configAdmin) { + super(name); + this.configAdmin = configAdmin; + apps = new HashMap(); + hostNames = new HashMap(); + ports = new HashMap(); + init(); + } + + /** + * results data to compare against + */ + private void init() { + apps.put("fred", null); + apps.put("bob", null); + apps.put("app", null); + hostNames.put("w3.ibm.com", "fred"); + hostNames.put("w3.hursley.ibm.com", "fred"); + hostNames.put("butterfly.torolab.ibm.com", "bob"); + hostNames.put("mallet.torolab.ibm.com", "bob"); + hostNames.put("*", "app"); + hostNames.put("nonexistent", "app"); + ports.put("9084", "app"); + ports.put("9085", "app"); + ports.put("9080", "fred"); + ports.put("9081", "fred"); + ports.put("9082", "bob"); + ports.put("9083", "bob"); + } + + /** {@inheritDoc} */ + @Override + public void configurationUpdated(String pid, Dictionary properties) throws Exception { + String parentPID = (String) properties.get("service.pid"); + assertEquals("Expected top level pid", "test.config.nested.elements", properties.get("service.factoryPid")); + String[] virtualHosts = (String[]) properties.get("testVirtualHost"); + assertNotNull(virtualHosts); + assertEquals("There should be two virtual hosts", 2, virtualHosts.length); + String name = (String) properties.get("name"); + assertTrue(apps.containsKey(name)); + + if ("fred".equals(name)) { + String[] nestedSingleton = (String[]) properties.get("aNestedSingleton"); + Configuration singletonConfig = configAdmin.getConfiguration(nestedSingleton[0]); + assertEquals("Expected pid", "bundletwo.singleton", singletonConfig.getPid()); + Dictionary singletonProps = singletonConfig.getProperties(); + assertEquals("The config.parentPID value should be equal to the parent's service.pid value", parentPID, + singletonProps.get(XMLConfigConstants.CFG_PARENT_PID)); + assertEquals("The displayID should be application[fred]/aNestedSingleton", "application[fred]/aNestedSingleton", + singletonProps.get(XMLConfigConstants.CFG_CONFIG_INSTANCE_DISPLAY_ID)); + assertEquals(1, ((String[]) singletonProps.get("anArray")).length); + + String[] libraries = (String[]) properties.get("library"); + assertNotNull(libraries); + assertEquals(2, libraries.length); + + for (int i = 0; i < libraries.length; i++) { + Configuration config = configAdmin.getConfiguration(libraries[i]); + assertEquals("Expected factoryPid", "test.config.nested.bundletwo", config.getFactoryPid()); + Dictionary prop = config.getProperties(); + assertEquals("The config.parentPID value should be equal to the parent's service.pid value", parentPID, + prop.get(XMLConfigConstants.CFG_PARENT_PID)); + String aString = (String) prop.get("aString"); + String[] anArray = (String[]) prop.get("anArray"); + if ("defaultString".equals(aString)) { + assertEquals(4, anArray.length); + assertEquals("The displayID should be application[fred]/library[default-1]", "application[fred]/library[default-1]", + prop.get(XMLConfigConstants.CFG_CONFIG_INSTANCE_DISPLAY_ID)); + } else if ("notADefault".equals(aString)) { + assertEquals(3, anArray.length); + assertEquals("The displayID should be application[fred]/library[default-0]", "application[fred]/library[default-0]", + prop.get(XMLConfigConstants.CFG_CONFIG_INSTANCE_DISPLAY_ID)); + } else { + fail("Invalid value for attribute aString: " + aString); + } + + } + + for (int i = 0; i < virtualHosts.length; i++) { + Configuration config = configAdmin.getConfiguration(virtualHosts[i]); + assertEquals("Expected factoryPid", "test.config.nested.virtualHost", config.getFactoryPid()); + Dictionary prop = config.getProperties(); + assertEquals("The config.parentPID value should be equal to the parent's service.pid value", parentPID, + prop.get(XMLConfigConstants.CFG_PARENT_PID)); + String[] hostAliases = (String[]) prop.get("testHostAlias"); + assertEquals(1, hostAliases.length); + Configuration aliasConfig = configAdmin.getConfiguration(hostAliases[0]); + assertEquals("Expected factoryPid", "test.host.alias", aliasConfig.getFactoryPid()); + Dictionary aliasProps = aliasConfig.getProperties(); + String[] aliases = (String[]) aliasProps.get("names"); + assertEquals(2, aliases.length); + } + } + for (int i = 0; i < virtualHosts.length; i++) { + Configuration config = configAdmin.getConfiguration(virtualHosts[i]); + Dictionary prop = config.getProperties(); + String host = (String) prop.get("host"); + assertTrue(hostNames.containsKey(host)); + assertEquals(hostNames.get(host), name); + String port = String.valueOf(prop.get("port")); + assertTrue(ports.containsKey(port)); + assertEquals(ports.get(port), name); + } + + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedResultTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedResultTest.java new file mode 100755 index 000000000000..e147e32ad39d --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedResultTest.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Dictionary; +import java.util.Map; + +import org.osgi.service.cm.ConfigurationException; + +public class NestedResultTest extends ManagedFactoryTest { + + private Map> expectedProperties; + + public NestedResultTest(String name, int count) { + super(name, count); + } + + public void setExpectedProperties(Map> expectedProperties) { + this.expectedProperties = expectedProperties; + } + + @Override + public void configurationUpdated(String pid, Dictionary properties) throws ConfigurationException { + String name = (String) properties.get("name"); + + Map expectedProps = expectedProperties.get(name); + assertNotNull("Unexpected name: " + name, expectedProps); + for (Map.Entry entry : expectedProps.entrySet()) { + assertEquals("property " + entry.getKey() + " mismatch", entry.getValue(), properties.get(entry.getKey())); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedSingletonTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedSingletonTest.java new file mode 100755 index 000000000000..a5e8eab03547 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedSingletonTest.java @@ -0,0 +1,104 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.cm.ManagedService; + +/** + * Test singleton pids + */ +public class NestedSingletonTest extends ManagedTest { + + private final ConfigurationAdmin configAdmin; + private final String nestedElement; + private Map> expectedProperties; + + public NestedSingletonTest(String name, String nestedElement, ConfigurationAdmin configAdmin) { + super(name); + this.configAdmin = configAdmin; + this.nestedElement = nestedElement; + } + + public void setExpectedProperties(Map> expectedProperties) { + this.expectedProperties = expectedProperties; + } + + public static Map> getExpectedProperties() { + Map map1 = new HashMap(); + map1.put("pass", "9999"); + map1.put("fail", "7777"); + + Map map2 = new HashMap(); + map2.put("pass", "100"); + map2.put("fail", "0"); + + Map> expectedProperties = new HashMap>(); + expectedProperties.put("one", map1); + expectedProperties.put("two", map2); + + return expectedProperties; + } + + public static Map> getMetatypeExpectedProperties() { + Map map1 = new HashMap(); + map1.put("pass", Integer.valueOf(9999)); + map1.put("fail", Integer.valueOf(7777)); + + Map map2 = new HashMap(); + map2.put("pass", Integer.valueOf(100)); + map2.put("fail", Integer.valueOf(0)); + + Map> expectedProperties = new Hashtable>(); + expectedProperties.put("one", map1); + expectedProperties.put("two", map2); + + return expectedProperties; + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedService.class.getName() }; + } + + @Override + public void configurationUpdated(Dictionary properties) throws Exception { + assertEquals("singletonNested1", (properties.get("name"))); + + String[] testResults = (String[]) properties.get(nestedElement); + assertNotNull(testResults); + assertEquals(2, testResults.length); + + Map> expectedProperties = new HashMap>(this.expectedProperties); + for (int i = 0; i < testResults.length; i++) { + Configuration config = configAdmin.getConfiguration(testResults[i]); + Dictionary prop = config.getProperties(); + String innerName = (String) prop.get("name"); + Map expectedProps = expectedProperties.remove(innerName); + assertNotNull("Unexpected name: " + innerName, expectedProps); + for (Map.Entry entry : expectedProps.entrySet()) { + assertEquals("property " + entry.getKey() + " mismatch", entry.getValue(), prop.get(entry.getKey())); + } + } + + assertEquals(0, expectedProperties.size()); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/PasswordTypeTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/PasswordTypeTest.java new file mode 100755 index 000000000000..62606d1c8816 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/PasswordTypeTest.java @@ -0,0 +1,83 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import com.ibm.wsspi.kernel.service.utils.SerializableProtectedString; + +/** + * + */ +public class PasswordTypeTest extends ManagedFactoryTest { + + /** + * @param name + */ + public PasswordTypeTest(String name) { + super(name); + } + + /** {@inheritDoc} */ + @Override + public void configurationUpdated(String pid, Dictionary properties) throws Exception { + + String id = (String) properties.get("id"); + + if (id.equals("p1")) { + + // + assertEquals("p1.name", "admin", properties.get("name")); + SerializableProtectedString sps = (SerializableProtectedString) properties.get("password"); + assertEquals("p1.password", "secret,secret", new String(sps.getChars())); + + } else if (id.equals("p2")) { + + // + // Only substitution variables are path-normalized. p2 contains no substitution + // variables, therefore none of the attribute values are path-normalized. + + assertEquals("p2.name", "my//name/", properties.get("name")); + SerializableProtectedString sps = (SerializableProtectedString) properties.get("password"); + assertEquals("p2.password", "secret//secret/", new String(sps.getChars())); + + } else if (id.equals("p3")) { + + // + // p3.name=my//name/ + // p3.password=secret//secret/ + + // p3 contains substitution variables. Substitution variables are path-normalized for all + // attribute types EXCEPT ibm:type="password". This test ensures that the password attribute + // value is not path-normalized. + + // Path-normalization will... + // 1. convert sequences of "//" to just "/" + // 2. strip off any trailing "/" from the value. + + // NOTE: We are (at least temporarily) removing path normalization for variables, so the test below is + // changing to expect that "my//name/" will not be normalized. + assertEquals("p3.name", "my//name/", properties.get("name")); + + // "secret//secret/" ==> "secret//secret/" (no normalization) + SerializableProtectedString sps = (SerializableProtectedString) properties.get("password"); + assertEquals("p2.password", "secret//secret/", new String(sps.getChars())); + + } else { + throw new RuntimeException("Invalid test.config.password instance id: " + id); + } + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SharedAliasTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SharedAliasTest.java new file mode 100755 index 000000000000..565e14bd20fa --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SharedAliasTest.java @@ -0,0 +1,39 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class SharedAliasTest extends ManagedTest { + + private final String firstName; + private final String lastName; + + public SharedAliasTest(String name, String firstName, String lastName) { + super(name); + this.firstName = firstName; + this.lastName = lastName; + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + assertEquals("kids", "5", properties.get("kids")); + assertEquals("lastName", lastName, properties.get("lastName")); + assertEquals("firstName", firstName, properties.get("firstName")); + assertEquals("fullName", firstName + " " + lastName, properties.get("fullName")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonAliasTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonAliasTest.java new file mode 100755 index 000000000000..c400a17442ae --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonAliasTest.java @@ -0,0 +1,35 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class SingletonAliasTest extends ManagedTest { + + public SingletonAliasTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + assertEquals("kids", new Integer(2), properties.get("kids")); + assertEquals("lastName", "Smith", properties.get("lastName")); + assertEquals("firstName", "Stan", properties.get("firstName")); + assertEquals("fullName", "Stan Smith", properties.get("fullName")); + assertEquals("others", "Roger Smith, Klaus Smith", properties.get("others")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonMetaTypeTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonMetaTypeTest.java new file mode 100755 index 000000000000..c3bf255ee7fc --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonMetaTypeTest.java @@ -0,0 +1,40 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Dictionary; +import java.util.Vector; + +import org.osgi.service.cm.ConfigurationException; + +public class SingletonMetaTypeTest extends ManagedTest { + + public SingletonMetaTypeTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + // all picked up directly from metatype + assertEquals("present", Boolean.TRUE, properties.get("present")); + assertArrayEquals("int array", new int[] { 1, 2, 3 }, (int[]) properties.get("intColl")); + assertEquals("long vector", new Vector(Arrays.asList(4l, 5l, 6l, 7l)), properties.get("longColl")); + + assertEquals("lastname", "Simpson", properties.get("lastname")); + assertEquals("spouse", "Marge Simpson", properties.get("spouse")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerMetaTypeTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerMetaTypeTest.java new file mode 100755 index 000000000000..726c6c4b9ed7 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerMetaTypeTest.java @@ -0,0 +1,44 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Dictionary; +import java.util.Vector; + +import org.osgi.service.cm.ConfigurationException; + +public class SingletonServerMetaTypeTest extends ManagedTest { + + public SingletonServerMetaTypeTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + // picked up directly from metatype + assertEquals("present", Boolean.TRUE, properties.get("present")); + assertArrayEquals("int array", new int[] { 1, 2, 3 }, (int[]) properties.get("intColl")); + assertEquals("long vector", new Vector(Arrays.asList(4l, 5l, 6l, 7l)), properties.get("longColl")); + + // from metatype + assertEquals("lastname", "Doe", properties.get("lastname")); + assertEquals("spouse", "Marge Doe", properties.get("spouse")); + + // from server config + assertArrayEquals("children", new String[] { "Jon Doe", "Jane Doe" }, (String[]) properties.get("children")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerTest.java new file mode 100755 index 000000000000..549e622ce1a6 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerTest.java @@ -0,0 +1,33 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class SingletonServerTest extends ManagedTest { + + public SingletonServerTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + assertEquals("simple attr", "abc", properties.get("simpleAttr")); + assertArrayEquals("collection attr", new String[] { "a", "b", "c" }, (String[]) properties.get("collAttr")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/Test.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/Test.java new file mode 100755 index 000000000000..c69c0fe48be7 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/Test.java @@ -0,0 +1,44 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import test.server.BaseTest; + +public abstract class Test extends BaseTest { + + protected CountDownLatch latch; + protected Throwable exception; + + public Test(String name) { + this(name, 1); + } + + public Test(String name, int count) { + super(name); + this.latch = new CountDownLatch(count); + } + + public Throwable getException() { + try { + if (!latch.await(10, TimeUnit.SECONDS)) { + return new RuntimeException("Timed out"); + } + } catch (InterruptedException e) { + return new RuntimeException("Interrupted"); + } + return exception; + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/TestRunner.java new file mode 100755 index 000000000000..e889b18a9c1b --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/TestRunner.java @@ -0,0 +1,119 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseHttpTest; + +public class TestRunner extends BaseHttpTest { + + private BundleContext bundleContext; + private final List tests = new ArrayList(); + + @Override + protected void activate(ComponentContext componentContext) throws Exception { + super.activate(componentContext); + + bundleContext = componentContext.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + ConfigurationAdmin configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + + addTest(new SingletonServerTest("test.config.singleton.server")); + addTest(new SingletonServerMetaTypeTest("test.config.singleton.server.metatype")); + addTest(new SingletonMetaTypeTest("test.config.singleton.metatype")); + + addTest(new FactorySimpleTest("test.config.factory.simple", 1)); + addTest(new FactoryMetaTypeTest("test.config.factory.metatype")); + + addTest(new VariableTest("test.config.variable")); + + addTest(new SingletonAliasTest("test.config.singleton.alias")); + addTest(new FactoryAliasTest("test.config.factory.alias", 2)); + + addTest(new SharedAliasTest("test.config.simpsons.alias", "Homer", "Simpson")); + addTest(new SharedAliasTest("test.config.griffins.alias", "Peter", "Griffin")); + + addTest(new NestedConfigElementTest("test.config.nested.elements", configAdmin)); + addTest(new NestedConfigComplexElementTest("test.config.complex.nested.elements", configAdmin)); + + addTest(new PasswordTypeTest("test.config.password")); + + addTest(new FinalTypeTest("test.config.final")); + + NestedSingletonTest nestedSingletonTest = new NestedSingletonTest("test.config.nested.managed", "test.config.nested.result", configAdmin); + nestedSingletonTest.setExpectedProperties(NestedSingletonTest.getExpectedProperties()); + addTest(nestedSingletonTest); + + NestedResultTest nestedResultTest = new NestedResultTest("test.config.nested.result.metatype", 2); + nestedResultTest.setExpectedProperties(NestedSingletonTest.getMetatypeExpectedProperties()); + + addTest(nestedResultTest); + + tests.add(new ConfigurationAdminTest("test.config.configAdmin", configAdmin)); + + addTest(new ConfigurationPluginTest("test.config.plugin")); + + registerServlet("/parser-test", new TestVerifierServlet(), null, null); + + System.out.println("Parser test servlet started"); + } + + private void addTest(Test test) { + Hashtable properties = new Hashtable(); + properties.put(Constants.SERVICE_PID, test.getName()); + tests.add(test); + bundleContext.registerService(test.getServiceClasses(), test, properties); + } + + class TestVerifierServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest rq, HttpServletResponse rsp) throws IOException { + int failedCount = 0; + boolean failed = false; + for (Test test : tests) { + Throwable t = test.getException(); + if (t != null) { + failed = true; + System.out.println("Test " + test.getName() + " failed:"); + t.printStackTrace(); + failedCount++; + } + } + PrintWriter pw = rsp.getWriter(); + rsp.setContentType("text/plain"); + if (failed) { + pw.println(failedCount + " of " + tests.size() + " tests " + "FAILED, check messages.log for information"); + } else { + pw.println("OK"); + } + } + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/VariableTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/VariableTest.java new file mode 100755 index 000000000000..a53cc62a7416 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/VariableTest.java @@ -0,0 +1,37 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class VariableTest extends ManagedTest { + + public VariableTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + assertEquals("lastname", "Potter", properties.get("lastname")); + assertEquals("name", "Harry Potter", properties.get("name")); + assertArrayEquals("names", new String[] { "Lisa Griffin", "Lois Griffin" }, (String[]) properties.get("names")); + assertEquals("testVariable should be the variable defined in bootstrap", "variableFromBootstrap", properties.get("testVariable")); + assertEquals("testVarNotExist should use the default from the metatype", "defaultFromMetaType", properties.get("testVarNotExist")); + assertEquals("testToken should use the default from the metatype", "default value", properties.get("testToken")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/defaults/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/defaults/TestRunner.java new file mode 100755 index 000000000000..14acf46a6643 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/defaults/TestRunner.java @@ -0,0 +1,106 @@ +/* +IBM Confidential + * +OCO Source Materials + * +Copyright IBM Corp. 2011 + * +The source code for this program is not published or otherwise divested of +its trade secrets, irrespective of what has been deposited with the U.S. +Copyright Office. + */ +package test.server.config.defaults; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; + +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; +import test.server.config.dynamic.SingletonTest; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +public class TestRunner extends BaseTestRunner { + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/default-config-test", new TestDynamicConfigServlet(), null, null); + } + + public void testDefaultConfigSingleton() throws Exception { + SingletonTest parent = new SingletonTest("test.config.default.singleton"); + addTest(parent); + + Dictionary dictionary; + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate(); + assertEquals("port", Integer.valueOf(5678), dictionary.get("port")); + assertArrayEquals("hostname", new String[] { "192.168.1.1", "192.168.1.2" }, (String[]) dictionary.get("hostname")); + + ConfigWriter writer; + + // STEP 1: update singleton to disable default configuration + writer = readConfiguration(); + writer.setValue("defaultSingleton", null, XMLConfigConstants.CONFIG_ENABLED_ATTRIBUTE, "false"); + writeConfiguration(writer); + + // wait for deleted configuration + dictionary = parent.waitForUpdate(); + assertNull(dictionary); + + // STEP 2: update singleton to enable default configuration + writer = readConfiguration(); + writer.setValue("defaultSingleton", null, XMLConfigConstants.CONFIG_ENABLED_ATTRIBUTE, "true"); + writeConfiguration(writer); + + // wait for updated configuration + dictionary = parent.waitForUpdate(); + assertEquals("port", Integer.valueOf(5678), dictionary.get("port")); + assertArrayEquals("hostname", new String[] { "192.168.1.1", "192.168.1.2" }, (String[]) dictionary.get("hostname")); + } + + public void testDefaultConfigFactory() throws Exception { + + FactoryTest parent = new FactoryTest("test.config.default.factory"); + addTest(parent); + + // wait for the initial configurations to be injected. + Dictionary oneDictionary = parent.waitForUpdate("one"); + assertEquals("port", Integer.valueOf(1234), oneDictionary.get("port")); + assertArrayEquals("hostname", new String[] { "192.168.1.1", "192.168.1.2" }, (String[]) oneDictionary.get("hostname")); + + Dictionary twoDictionary = parent.waitForUpdate("two"); + assertEquals("port", Integer.valueOf(9999), twoDictionary.get("port")); + assertArrayEquals("hostname", new String[] { "localhost", "ibm.com" }, (String[]) twoDictionary.get("hostname")); + + ConfigWriter writer; + + // STEP 1: update instance two to disable default configuration + writer = readConfiguration(); + writer.setValue("defaultFactory", "two", XMLConfigConstants.CONFIG_ENABLED_ATTRIBUTE, "false"); + writeConfiguration(writer); + + // wait for instance two delete + twoDictionary = parent.waitForUpdate("two"); + assertNull(twoDictionary); + + // STEP 2: update instance two to enable default configuration + writer = readConfiguration(); + writer.setValue("defaultFactory", "two", XMLConfigConstants.CONFIG_ENABLED_ATTRIBUTE, "true"); + writeConfiguration(writer); + + // wait for instance two update + twoDictionary = parent.waitForUpdate("two"); + assertEquals("port", Integer.valueOf(9999), twoDictionary.get("port")); + assertArrayEquals("hostname", new String[] { "localhost", "ibm.com" }, (String[]) twoDictionary.get("hostname")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/ConfigWriter.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/ConfigWriter.java new file mode 100755 index 000000000000..009e72beb1e9 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/ConfigWriter.java @@ -0,0 +1,182 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.dynamic; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.StringReader; +import java.io.Writer; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Result; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +public class ConfigWriter { + + private static DocumentBuilderFactory DOM_FACTORY = DocumentBuilderFactory.newInstance(); + + private final Document document; + + public ConfigWriter() throws Exception { + DocumentBuilder builder = DOM_FACTORY.newDocumentBuilder(); + document = builder.newDocument(); + document.appendChild(document.createElement("server")); + } + + public ConfigWriter(InputStream in) throws Exception { + DocumentBuilder builder = DOM_FACTORY.newDocumentBuilder(); + document = builder.parse(in); + } + + private static boolean matches(Node node, String nodeName, String id, String idAttribute) { + if (node instanceof Element && nodeName.equals(node.getNodeName())) { + if (id == null) { + return true; + } else { + Element element = (Element) node; + return id.equals(element.getAttribute(idAttribute)); + } + } + return false; + } + + private Element getConfigNode(String nodeName, String id, String idAttribute) { + Element root = document.getDocumentElement(); + NodeList children = root.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + if (matches(child, nodeName, id, idAttribute)) { + return (Element) child; + } + } + return null; + } + + private List getConfigNodes(String nodeName, String id, String idAttribute) { + Element root = document.getDocumentElement(); + NodeList children = root.getChildNodes(); + List nodes = new ArrayList(); + for (int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + if (matches(child, nodeName, id, idAttribute)) { + nodes.add((Element) child); + } + } + return nodes; + } + + public boolean deleteConfig(String nodeName, String id, boolean allInstances) { + return deleteConfig(nodeName, id, "id", allInstances); + } + + public boolean deleteConfig(String nodeName, String id, String idAttribute, boolean allInstances) { + boolean didSomething = false; + Element root = document.getDocumentElement(); + if (allInstances) { + List toRemove = getConfigNodes(nodeName, id, idAttribute); + for (Node node : toRemove) { + root.removeChild(node); + didSomething = true; + } + } else { + Node node = getConfigNode(nodeName, id, idAttribute); + if (node != null) { + root.removeChild(node); + didSomething = true; + } + } + return didSomething; + } + + public void addConfig(String element) throws Exception { + DocumentBuilder builder = DOM_FACTORY.newDocumentBuilder(); + Document doc = builder.parse(new InputSource(new StringReader(element))); + addConfig(doc.getDocumentElement()); + } + + public void addConfig(String pattern, Object... args) throws Exception { + addConfig(MessageFormat.format(pattern, args)); + } + + public void addConfig(Element element) { + Node node = document.importNode(element, true); + Element root = document.getDocumentElement(); + root.appendChild(node); + } + + public boolean setValue(String nodeName, String id, String propertyName, String value) { + return setValue(nodeName, id, "id", propertyName, value); + } + + public boolean setValue(String nodeName, String id, String idAttribute, String propertyName, String value) { + Element element = getConfigNode(nodeName, id, idAttribute); + if (element != null) { + element.setAttribute(propertyName, value); + return true; + } else { + return false; + } + } + + public boolean removeProperty(String nodeName, String id, String propertyName) { + return removeProperty(nodeName, id, "id", propertyName); + } + + public boolean removeProperty(String nodeName, String id, String idAttribute, String propertyName) { + Element element = getConfigNode(nodeName, id, idAttribute); + if (element != null) { + // TODO: check for subelement with this name + return (element.getAttributes().removeNamedItem(propertyName) != null); + } else { + return false; + } + } + + public void write(File file) throws Exception { + write(new StreamResult(file)); + } + + public void write(OutputStream out) throws Exception { + write(new StreamResult(out)); + } + + public void write(Writer writer) throws Exception { + write(new StreamResult(writer)); + } + + private void write(Result result) throws Exception { + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer transformer = tf.newTransformer(); + //transformer.setOutputProperty (OutputKeys.OMIT_XML_DECLARATION, "yes"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + + transformer.transform(new DOMSource(document), result); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryNestedTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryNestedTest.java new file mode 100755 index 000000000000..c89a8be5495b --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryNestedTest.java @@ -0,0 +1,85 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.dynamic; + +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; + +import test.server.BaseTest; + +public class FactoryNestedTest extends BaseTest implements ManagedServiceFactory { + + private final Map> dictionaries; + + public FactoryNestedTest(String name) { + super(name); + dictionaries = new HashMap>(); + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedServiceFactory.class.getName() }; + } + + @Override + public void updated(String pid, Dictionary properties) throws ConfigurationException { + notify(pid, properties); + } + + @Override + public void deleted(String pid) { + notify(pid, null); + } + + private void notify(String id, Dictionary properties) { + List list = getDictionaries(id); + synchronized (list) { + list.add(properties); + list.notifyAll(); + } + } + + private List getDictionaries(String pid) { + synchronized (dictionaries) { + List updates = dictionaries.get(pid); + if (updates == null) { + updates = new ArrayList(); + dictionaries.put(pid, updates); + } + return updates; + } + } + + public Dictionary waitForUpdate(String pid) { + List list = getDictionaries(pid); + synchronized (list) { + while (list.isEmpty()) { + try { + list.wait(TIMEOUT); + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted"); + } + if (list.isEmpty()) { + throw new RuntimeException("Timed out: " + pid); + } + } + return list.remove(0); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryTest.java new file mode 100755 index 000000000000..d17d4070bf15 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryTest.java @@ -0,0 +1,141 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.dynamic; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Dictionary; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; + +import test.server.BaseTest; + +public class FactoryTest extends BaseTest implements ManagedServiceFactory { + + private final Map pid2IdMapping; + private final Map id2PidMapping; + private final Map>> dictionaries; + private final String idAttribute; + + public FactoryTest(String name) { + this(name, "id"); + } + + public FactoryTest(String name, String idAttribute) { + super(name); + this.dictionaries = new HashMap>>(); + this.pid2IdMapping = Collections.synchronizedMap(new HashMap()); + this.id2PidMapping = Collections.synchronizedMap(new HashMap()); + this.idAttribute = idAttribute; + } + + public void reset() { + synchronized (dictionaries) { + dictionaries.clear(); + } + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedServiceFactory.class.getName() }; + } + + @SuppressWarnings("unchecked") + @Override + public void updated(String pid, @SuppressWarnings("rawtypes") Dictionary properties) throws ConfigurationException { + String id = (String) properties.get(idAttribute); + pid2IdMapping.put(pid, id); + id2PidMapping.put(id, pid); + notify(id, properties); + } + + @Override + public void deleted(String pid) { + String id = pid2IdMapping.get(pid); + notify(id, null); + } + + public String getPid(String id) { + return id2PidMapping.get(id); + } + + public Set getPids() { + return pid2IdMapping.keySet(); + } + + private void notify(String id, Dictionary properties) { + List> list = getDictionaries(id); + synchronized (list) { + list.add(properties); + list.notifyAll(); + } + } + + private List> getDictionaries(String id) { + synchronized (dictionaries) { + List> updates = dictionaries.get(id); + if (updates == null) { + updates = new ArrayList>(); + dictionaries.put(id, updates); + } + return updates; + } + } + + public Dictionary waitForUpdate(String id) { + return waitForUpdate(id, TIMEOUT); + } + + /** + * @param string + * @param i + * @return + */ + public Dictionary waitForUpdate(String id, long timeToWait) { + List> list = getDictionaries(id); + synchronized (list) { + while (list.isEmpty()) { + try { + list.wait(timeToWait); + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted"); + } + if (list.isEmpty()) { + throw new RuntimeException("Timed out"); + } + } + return list.remove(0); + } + } + + /** + * @param string + * @return + */ + public boolean hasDictionary(String id) { + List> list = getDictionaries(id); + synchronized (list) { + try { + list.wait(5000); + } catch (InterruptedException e) { + //Ignore, we're just waiting five seconds to make this method more accurate + } + return !list.isEmpty(); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/SingletonTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/SingletonTest.java new file mode 100755 index 000000000000..710a09c40c81 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/SingletonTest.java @@ -0,0 +1,81 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.dynamic; + +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; +import java.util.logging.Logger; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedService; + +import test.server.BaseTest; + +public class SingletonTest extends BaseTest implements ManagedService { + private final static String CLASS_NAME = SingletonTest.class.getName(); + private final static Logger LOGGER = Logger.getLogger(CLASS_NAME); + + private final List dictionaries; + + public SingletonTest(String name) { + super(name); + dictionaries = new ArrayList(); + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedService.class.getName() }; + } + + @Override + public void updated(Dictionary properties) throws ConfigurationException { + synchronized (dictionaries) { + LOGGER.finest("updated - " + properties); + dictionaries.add(properties); + dictionaries.notifyAll(); + } + } + + public Dictionary waitForUpdate() { + LOGGER.entering(CLASS_NAME, "waitForUpdate"); + synchronized (dictionaries) { + while (dictionaries.isEmpty()) { + try { + LOGGER.finest("waitForUpdate - waiting"); + dictionaries.wait(TIMEOUT); + } catch (InterruptedException e) { + LOGGER.finest("waitForUpdate - interrupted"); + throw new RuntimeException("Interrupted"); + } + if (dictionaries.isEmpty()) { + LOGGER.finest("waitForUpdate - timed out"); + throw new RuntimeException("Timed out"); + } + } + Dictionary d = dictionaries.remove(0); + LOGGER.exiting(CLASS_NAME, "waitForUpdate", d); + return d; + } + } + + /** + * + */ + public void reset() { + synchronized (dictionaries) { + dictionaries.clear(); + } + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/TestRunner.java new file mode 100755 index 000000000000..7dec335997da --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/TestRunner.java @@ -0,0 +1,300 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.dynamic; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; + +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; + +public class TestRunner extends BaseTestRunner { + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/dynamic-config-test", new TestDynamicConfigServlet(), null, null); + } + + public void testSingleton() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + SingletonTest singletonTest = new SingletonTest("test.config.dynamic.singleton"); + addTest(singletonTest); + + // step 1. wait for the initial configuration to be injected. + dictionary = singletonTest.waitForUpdate(); + assertEquals("testValue", "10", dictionary.get("testValue")); + + // step 2a. modify the configuration + writer = readConfiguration(); + writer.setValue("test.config.dynamic.singleton", null, "testValue", "15"); + writeConfiguration(writer); + // step 2b: wait for update + dictionary = singletonTest.waitForUpdate(); + assertEquals("testValue", "15", dictionary.get("testValue")); + + // step 3a. delete configuration + writer = readConfiguration(); + writer.deleteConfig("test.config.dynamic.singleton", null, false); + writeConfiguration(writer); + // step 3b. wait for update + dictionary = singletonTest.waitForUpdate(); + assertEquals("Test deleted", null, dictionary); + + // step 4a. add configuration back in + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + // step 4b. wait for update + dictionary = singletonTest.waitForUpdate(); + assertEquals("Test added", "hello", dictionary.get("message")); + } + + public void testFactory() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + FactoryTest factoryTest = new FactoryTest("test.config.dynamic.factory"); + addTest(factoryTest); + + // step 1. wait for the initial configuration to be injected. + dictionary = factoryTest.waitForUpdate("1"); + assertEquals("instance 1 testValue", "10", dictionary.get("testValue")); + + // step 2a. modify instance 1 configuration & add instance 2 configuration + writer = readConfiguration(); + writer.setValue("test.config.dynamic.factory", "1", "testValue", "15"); + writer.addConfig(""); + writeConfiguration(writer); + // step 2b: wait for updates + dictionary = factoryTest.waitForUpdate("1"); + assertEquals("instance 1 testValue", "15", dictionary.get("testValue")); + dictionary = factoryTest.waitForUpdate("2"); + assertEquals("instance 2 message", "bye", dictionary.get("message")); + + // step 3a. delete instance 1 configuration & modify instance 2 configuration + writer = readConfiguration(); + writer.deleteConfig("test.config.dynamic.factory", "1", false); + writer.setValue("test.config.dynamic.factory", "2", "message", "what's up"); + writeConfiguration(writer); + // step 3b. wait for updates + dictionary = factoryTest.waitForUpdate("1"); + assertEquals("instance 1 deleted", null, dictionary); + dictionary = factoryTest.waitForUpdate("2"); + assertEquals("instance 2 message", "what's up", dictionary.get("message")); + + // step 4a. add instance 1 configuration back in & delete instance 2 + writer = readConfiguration(); + writer.addConfig(""); + writer.deleteConfig("test.config.dynamic.factory", "2", false); + writeConfiguration(writer); + // step 4b. wait for updates + dictionary = factoryTest.waitForUpdate("1"); + assertEquals("instance 1 added", "hello", dictionary.get("message")); + dictionary = factoryTest.waitForUpdate("2"); + assertEquals("instance 2 deleted", null, dictionary); + } + + public void testSingletonMetatype() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + SingletonTest singletonMetatypeTest = new SingletonTest("test.config.dynamic.singleton.metatype"); + addTest(singletonMetatypeTest); + + // step 1. wait for the initial configuration to be injected. + // This singleton was not configured in server.xml -- It's created because all of its required + // fields have defaults + dictionary = singletonMetatypeTest.waitForUpdate(); + // Make sure auto-added singletons use the alias for the display id + assertEquals("singletonMetatype", dictionary.get("config.displayId")); + + // step 2a. modify the configuration using an alias + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + // step 2b: wait for update + dictionary = singletonMetatypeTest.waitForUpdate(); + assertEquals("version", "2.0", dictionary.get("version")); + assertEquals("threads", new Integer(100), dictionary.get("threads")); + + // step 3a. delete configuration using an alias + writer = readConfiguration(); + writer.deleteConfig("singletonMetatype", null, false); + writeConfiguration(writer); + // step 3b. wait for update - defaults should be injected + dictionary = singletonMetatypeTest.waitForUpdate(); + assertEquals("version", "1.0", dictionary.get("version")); + assertEquals("threads", new Integer(100), dictionary.get("threads")); + + // step 4a. add configuration back in + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + // step 4b. wait for update + dictionary = singletonMetatypeTest.waitForUpdate(); + assertEquals("version", "1.0", dictionary.get("version")); + assertEquals("threads", new Integer(500), dictionary.get("threads")); + } + + public void testFactoryMetatype() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + FactoryTest factoryTest = new FactoryTest("test.config.dynamic.factory.metatype"); + addTest(factoryTest); + + // step 1. wait for the initial configuration to be injected. + dictionary = factoryTest.waitForUpdate("one"); + + // step 2a. modify instance 1 configuration & add instance 2 configuration + // The timeout value is of type duration(s), so the value is in seconds instead of milliseconds + writer = readConfiguration(); + writer.setValue("test.config.dynamic.factory.metatype", "one", "timeout", "123m"); + writer.addConfig(""); + writeConfiguration(writer); + // step 2b: wait for updates + dictionary = factoryTest.waitForUpdate("one"); + assertEquals("instance one timeout", new Long(123 * 60), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(10), dictionary.get("minSize")); + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance two timeout", new Long(100), dictionary.get("timeout")); + assertEquals("instance two minSize", new Integer(456), dictionary.get("minSize")); + + // step 3a. delete instance 1 configuration & modify instance 2 configuration + writer = readConfiguration(); + writer.deleteConfig("test.config.dynamic.factory.metatype", "one", false); + writer.setValue("factoryMetatype", "two", "timeout", "7890ms"); + writeConfiguration(writer); + // step 3b. wait for updates + dictionary = factoryTest.waitForUpdate("one"); + assertEquals("instance one deleted", null, dictionary); + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance two timeout", new Long(7), dictionary.get("timeout")); + assertEquals("instance two minSize", new Integer(456), dictionary.get("minSize")); + + // step 4a. add instance 1 configuration back in & delete instance 2 + writer = readConfiguration(); + writer.addConfig(""); + writer.deleteConfig("factoryMetatype", "two", false); + writeConfiguration(writer); + // step 4b. wait for updates + dictionary = factoryTest.waitForUpdate("one"); + assertEquals("instance one timeout", new Long(100), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(91011), dictionary.get("minSize")); + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance 2 deleted", null, dictionary); + } + + public void testFactoryOptionalId() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + String idAttribute = "name"; + + FactoryTest factoryTest = new FactoryTest("test.config.dynamic.factory.optional.metatype", idAttribute); + addTest(factoryTest); + + // step 1a. wait for initial configuration of first instance + dictionary = factoryTest.waitForUpdate("one"); + assertEquals("instance one timeout", new Long(100), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(10), dictionary.get("minSize")); + assertNull(dictionary.get("id")); + + // step 1b. wait for initial configuration of second instance + dictionary = factoryTest.waitForUpdate("four"); + assertEquals("instance one timeout", new Long(5000), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(10), dictionary.get("minSize")); + assertNull(dictionary.get("id")); + + assertEquals(2, factoryTest.getPids().size()); + + // step 2a. modify default instance & add another instance + writer = readConfiguration(); + writer.setValue("factoryOptionalMetatype", "one", idAttribute, "timeout", "123"); + writer.addConfig(""); + writeConfiguration(writer); + + // step 2b. wait for updates on default instance + dictionary = factoryTest.waitForUpdate("one"); + assertEquals("instance one timeout", new Long(123), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(10), dictionary.get("minSize")); + assertNull(dictionary.get("id")); + + // step 2c. wait for updates on second instance + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance one timeout", new Long(100), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(456), dictionary.get("minSize")); + assertEquals("two", dictionary.get("id")); + + assertEquals(3, factoryTest.getPids().size()); + + // step 3a. delete the default instance + writer = readConfiguration(); + writer.deleteConfig("factoryOptionalMetatype", "one", idAttribute, false); + writeConfiguration(writer); + + // step 3a. wait for the update + dictionary = factoryTest.waitForUpdate("one"); + assertNull("default instance deleted", dictionary); + + assertEquals(3, factoryTest.getPids().size()); + + // step 4a. add a new default instance & update the second instance + writer = readConfiguration(); + writer.addConfig(""); + writer.setValue("factoryOptionalMetatype", "two", idAttribute, "timeout", "789"); + writeConfiguration(writer); + + // step 4b. wait for updates on the default instance + dictionary = factoryTest.waitForUpdate("three"); + assertEquals("instance one timeout", new Long(222), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(111), dictionary.get("minSize")); + assertNull(dictionary.get("id")); + + // step 4c. wait for updates on the two instance + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance one timeout", new Long(789), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(456), dictionary.get("minSize")); + assertEquals("two", dictionary.get("id")); + + assertEquals(4, factoryTest.getPids().size()); + + // step 5a. delete two & three, update four + writer = readConfiguration(); + writer.deleteConfig("factoryOptionalMetatype", "two", idAttribute, false); + writer.deleteConfig("factoryOptionalMetatype", "three", idAttribute, false); + writer.setValue("factoryOptionalMetatype", "four", idAttribute, "timeout", "6000"); + writeConfiguration(writer); + + // step 5b. wait for updates + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance 2 deleted", null, dictionary); + + // step 5c. wait for updates + dictionary = factoryTest.waitForUpdate("three"); + assertEquals("instance 2 deleted", null, dictionary); + + // step 5d. wait for updates + dictionary = factoryTest.waitForUpdate("four"); + assertEquals("instance one timeout", new Long(6000), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(10), dictionary.get("minSize")); + assertNull(dictionary.get("id")); + + assertEquals(4, factoryTest.getPids().size()); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/AttributeCopyTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/AttributeCopyTestRunner.java new file mode 100755 index 000000000000..b80a7a5dad8d --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/AttributeCopyTestRunner.java @@ -0,0 +1,255 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.Dictionary; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +/** + * + */ +public class AttributeCopyTestRunner extends BaseTestRunner { + + String parentName = "com.ibm.ws.config.attributeCopy"; + String childName = "com.ibm.ws.config.attributeCopy.child"; + String child2Name = "com.ibm.ws.config.attributeCopy.grandchild"; + String subTypeName = "com.ibm.ws.config.attributeCopy.subType"; + + private FactoryTest parent; + private FactoryTest child; + private FactoryTest child2; + private FactoryTest subType; + + private ConfigurationAdmin configAdmin; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/attribute-copy", new TestDynamicConfigServlet(), null, null); + + this.parent = new FactoryTest(parentName); + this.child = new FactoryTest(childName); + this.child2 = new FactoryTest(child2Name); + this.subType = new FactoryTest(subTypeName); + + addTest(parent); + addTest(child); + addTest(child2); + addTest(subType); + + BundleContext bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + this.configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + } + + public void testSimpleAttributeCopy() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + assertEquals("Bob", dictionary.get("copiedName")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("copyTest", "a", false); + writeConfiguration(writer); + } + } + + public void testSimpleAttributeCopyArray() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + String[] hobbies = (String[]) dictionary.get("hobbies"); + assertTrue("copiedHobbies should be the same as hobbies", Arrays.equals(hobbies, (String[]) dictionary.get("copiedHobbies"))); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("copyTest", "a", false); + writeConfiguration(writer); + } + } + + public void testNestedAttributeCopy() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + * + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("" + + "" + + ""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + assertEquals("Bob", dictionary.get("copiedName")); + assertEquals("Eleanor", dictionary.get("copiedChild")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("copyTest", "a", false); + writeConfiguration(writer); + } + } + + public void testDoubleNestedAttributeCopy() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + * + * + * + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("" + + "" + + "" + + "" + + ""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + assertEquals("Bob", dictionary.get("copiedName")); + assertEquals("Eleanor", dictionary.get("copiedChild")); + assertEquals("Ringo", dictionary.get("copiedGrandchild")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("copyTest", "a", false); + writeConfiguration(writer); + } + } + + public void testExtendsAttributeCopy() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = subType.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + assertEquals("subType value", dictionary.get("value")); + assertEquals("subType value", dictionary.get("valueCopy")); + assertEquals("supertype name", dictionary.get("name")); + assertEquals("supertype name", dictionary.get("nameCopy")); + assertEquals("supertype name", dictionary.get("superNameCopy")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("acSubType", "a", false); + writeConfiguration(writer); + } + } + + /** + * Reset factories to avoid test contamination + */ + private void resetFactoryTests() { + parent.reset(); + child.reset(); + child2.reset(); + subType.reset(); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/ChildFirstExtendsTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/ChildFirstExtendsTestRunner.java new file mode 100755 index 000000000000..83e7bb3556bb --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/ChildFirstExtendsTestRunner.java @@ -0,0 +1,140 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Dictionary; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +/** + * + */ +public class ChildFirstExtendsTestRunner extends BaseTestRunner { + + String parentName = "com.ibm.example.topLevelElement"; + String childName = "com.ibm.example.child.a"; + String child2Name = "com.ibm.example.child.b"; + String child3Name = "com.ibm.example.child.c"; + String topName = "com.ibm.example.top.d"; + String abstractName = "com.ibm.example.supertype"; + + private FactoryTest parent; + private FactoryTest child; + private FactoryTest child2; + private FactoryTest child3; + private FactoryTest top; + + private ConfigurationAdmin configAdmin; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/child-first-extends", new TestDynamicConfigServlet(), null, null); + + this.parent = new FactoryTest(parentName); + this.child = new FactoryTest(childName); + this.child2 = new FactoryTest(child2Name); + this.child3 = new FactoryTest(child3Name); + this.top = new FactoryTest(topName); + + addTest(parent); + addTest(child); + addTest(child2); + addTest(child3); + addTest(top); + + BundleContext bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + this.configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + } + + public void testChildFirstExtends() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("" + + "" + + ""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + + dictionary = child.waitForUpdate("child.a"); + assertEquals("a1", dictionary.get("attrA1")); + assertEquals("The child should inherit from the supertype", "value", dictionary.get("commonAttribute")); + + Configuration[] superTypes = configAdmin.listConfigurations("(service.factoryPid=" + abstractName + ")"); + assertNotNull(superTypes); + assertEquals(1, superTypes.length); + dictionary = superTypes[0].getProperties(); + assertEquals("value", dictionary.get("commonAttribute")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("topLevelElement", "a", false); + writeConfiguration(writer); + } + } + + /** + * Reset factories to avoid test contamination + */ + private void resetFactoryTests() { + parent.reset(); + child.reset(); + child2.reset(); + child3.reset(); + top.reset(); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/HiddenTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/HiddenTestRunner.java new file mode 100755 index 000000000000..14b340927b78 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/HiddenTestRunner.java @@ -0,0 +1,320 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; + +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +/** + * + */ +public class HiddenTestRunner extends BaseTestRunner { + private final String grandparentName = "test.config.hidden.grandparent"; + private final String parentName = "test.config.hidden.parent"; + private final String childName = "test.config.hidden.child"; + private final String childExtended = "test.config.hidden.child.extended"; + + private FactoryTest grandparent; + private FactoryTest parent; + private FactoryTest child; + private FactoryTest extendedChild; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/hidden-test", new TestDynamicConfigServlet(), null, null); + + this.grandparent = new FactoryTest(grandparentName); + this.parent = new FactoryTest(parentName); + this.child = new FactoryTest(childName); + this.extendedChild = new FactoryTest(childExtended); + + addTest(grandparent); + addTest(parent); + addTest(child); + addTest(extendedChild); + } + + public void testHiddenChildWithExtends() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + grandparent.reset(); + parent.reset(); + extendedChild.reset(); + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = grandparent.waitForUpdate("grandparent"); + assertEquals("name should be \"hidden grandparent\"", + "hidden grandparent", dictionary.get("name")); + + dictionary = parent.waitForUpdate("parent"); + assertEquals("name should be \"hidden parent\"", + "hidden parent", dictionary.get("name")); + + dictionary = extendedChild.waitForUpdate("child"); + assertEquals("The name for the child should be I am an extended element", "I am an extended element", dictionary.get("name")); + assertEquals("The child should inherit from the supertype", "inheritedProperty", dictionary.get("abstractProperty")); + + // *** STEP 2 *** + // Update child + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + dictionary = extendedChild.waitForUpdate("child"); + assertEquals("The child name should be Updated extended element", "Updated extended element", dictionary.get("name")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + // *** STEP 3 *** + // Update parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child wasn't updated + assertFalse("The child should not be updated", extendedChild.hasDictionary("child")); + + // Check parent update + dictionary = parent.waitForUpdate("parent"); + assertEquals("name should be \"hidden parent updated\"", + "hidden parent updated", dictionary.get("name")); + + // Check grandparent update + dictionary = grandparent.waitForUpdate("grandparent"); + assertEquals("name should be \"hidden grandparent\"", + "hidden grandparent", dictionary.get("name")); + + // *** STEP 4 *** + // Delete child -- This should not result in an update to the parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child was deleted + assertNull("The child dictionary should be null", extendedChild.waitForUpdate("child")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + // *** STEP 5 *** + // Put the child back -- This should not result in an update to the parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child was updated + dictionary = extendedChild.waitForUpdate("child"); + assertEquals("The name for the child should be Returned extended element", "Returned extended element", dictionary.get("name")); + assertEquals("The child should inherit from the supertype", "inheritedProperty", dictionary.get("abstractProperty")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writeConfiguration(writer); + try { + grandparent.waitForUpdate("grandparent"); + } catch (Exception ex) { + ex.printStackTrace(); + // We don't care. Just waiting to make sure server update has gone through. If something went wrong earlier, that might not happen. + } + } + } + + public void testHiddenChild() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + + // Reset to avoid contamination + grandparent.reset(); + parent.reset(); + child.reset(); + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = grandparent.waitForUpdate("grandparent"); + assertEquals("name should be \"hidden grandparent\"", + "hidden grandparent", dictionary.get("name")); + + dictionary = parent.waitForUpdate("parent"); + assertEquals("name should be \"hidden parent\"", + "hidden parent", dictionary.get("name")); + + dictionary = child.waitForUpdate("child"); + assertEquals("The name for the child should be I am stealthy!", "I am stealthy!", dictionary.get("name")); + + // *** STEP 2 *** + // Update child + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + dictionary = child.waitForUpdate("child"); + assertEquals("The child name should be You can't see me.", "You can't see me.", dictionary.get("name")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + // *** STEP 3 *** + // Update parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child wasn't updated + assertFalse("The child should not be updated", child.hasDictionary("child")); + + // Check parent update + dictionary = parent.waitForUpdate("parent"); + assertEquals("name should be \"hidden parent updated\"", + "hidden parent updated", dictionary.get("name")); + + // Check grandparent update + dictionary = grandparent.waitForUpdate("grandparent"); + assertEquals("name should be \"hidden grandparent\"", + "hidden grandparent", dictionary.get("name")); + + // *** STEP 4 *** + // Delete child -- This should not result in an update to the parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child wasn't updated + assertNull("The child dictionary should be null", child.waitForUpdate("child")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + // *** STEP 5 *** + // Put the child back -- This should not result in an update to the parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child was updated + dictionary = child.waitForUpdate("child"); + assertEquals("The name for the child should be I'm back!", "I'm back!", dictionary.get("name")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writeConfiguration(writer); + try { + grandparent.waitForUpdate("grandparent"); + parent.waitForUpdate("parent"); + } catch (Exception ex) { + ex.printStackTrace(); + // We don't care. Just waiting to make sure server update has gone through. If something went wrong earlier, that might not happen. + } + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedDefaultsTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedDefaultsTestRunner.java new file mode 100755 index 000000000000..666503ac3635 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedDefaultsTestRunner.java @@ -0,0 +1,117 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; +import java.util.Vector; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +public class NestedDefaultsTestRunner extends BaseTestRunner { + + private final String parentName = "test.config.nested.defaults"; + private FactoryTest parent; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/nested-defaults-test", new TestDynamicConfigServlet(), null, null); + + this.parent = new FactoryTest(parentName); + addTest(parent); + } + + public void testRemoveAttribute() throws Exception { + testNestedDefaults("cardPos"); + } + + public void testRemoveAttributeNegativeCardinality() throws Exception { + testNestedDefaults("cardNeg"); + } + + public void testRemoveAttributeZeroCardinality() throws Exception { + testNestedDefaults("cardZero"); + } + + private void testNestedDefaults(String childName) throws Exception { + + Dictionary dictionary; + ConfigWriter writer; + String[] pids = new String[] {}; + + try { + parent.reset(); + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("<{0} id=\"parent\" someAttribute=\"empty attributes test\">" + + " <{1} hello=\"hello\" enabled=\"true\"/>" + + "", parentName, childName); + writeConfiguration(writer); + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("parent"); + assertEquals("someAttribute should be \"empty attributes test\"", + "empty attributes test", dictionary.get("someAttribute")); + + // *** STEP 2 *** + // Remove attribute from child + writer = readConfiguration(); + writer.deleteConfig(parentName, "parent", false); + writer.addConfig("<{0} id=\"parent\" someAttribute=\"empty attributes test\">" + + " <{1}/>" + + "", parentName, childName); + writeConfiguration(writer); + + dictionary = parent.waitForUpdate("parent"); + assertEquals("someAttribute should be \"empty attributes test\"", + "empty attributes test", dictionary.get("someAttribute")); + + Object children = dictionary.get(childName); + if (children instanceof String) { + pids = new String[] { (String) children }; + } else if (children instanceof Vector) { + Vector v = (Vector) children; + pids = v.toArray(pids); + } else { + pids = (String[]) dictionary.get(childName); + } + + assertNotNull("There should be a child element", pids); + assertEquals("There should be only one child element", 1, pids.length); + + Configuration childConfig = configAdmin.getConfiguration(pids[0]); + + assertEquals("Enabled attribute should be true", Boolean.TRUE, childConfig.getProperties().get("enabled")); + assertNull("The attribute hello should be null", childConfig.getProperties().get("hello")); + assertEquals("The parent's child pid should equal the child's service.pid value", pids[0], childConfig.getProperties().get(XMLConfigConstants.CFG_SERVICE_PID)); + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig(parentName, "parent", false); + writeConfiguration(writer); + } + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedMergeRulesTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedMergeRulesTestRunner.java new file mode 100755 index 000000000000..4c907ea98e82 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedMergeRulesTestRunner.java @@ -0,0 +1,595 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.http.HttpService; + +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +/** + * + */ +@Component(service = NestedMergeRulesTestRunner.class, + name = "test.server.config.nestedMergeRules", + immediate = true, + property = { "service.vendor=IBM" }) +public class NestedMergeRulesTestRunner extends BaseTestRunner { + + private FactoryTest parentFactoryONE; + private FactoryTest parentFactoryMULTIPLE; + + private static final String parentName = "test.nestedmerge.parent"; + + private static final String XML_NEW_LINE = "\r\n"; + + private ConfigWriter writer; + + private ConfigurationAdmin configAdmin; + + @Override + @Reference(name = "locationService", service = WsLocationAdmin.class) + protected void setLocationService(WsLocationAdmin ref) { + this.locationService = ref; + } + + @Override + protected void unsetLocationService(WsLocationAdmin ref) { + if (ref == this.locationService) { + this.locationService = null; + } + } + + @Override + @Reference(name = "http", service = HttpService.class) + protected void setHttp(HttpService ref) { + this.http = ref; + } + + @Override + protected void unsetHttp(HttpService ref) { + if (ref == this.http) { + this.http = null; + } + } + + @Override + @Activate + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/nested-merge-rules", new TestDynamicConfigServlet(), null, null); + + this.parentFactoryONE = new FactoryTest(parentName + ".ONE"); + this.parentFactoryMULTIPLE = new FactoryTest(parentName + ".MULTIPLE"); + addTest(parentFactoryONE); + addTest(parentFactoryMULTIPLE); + + BundleContext bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + this.configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + + } + + private static class Child { + + Map attributes = new HashMap(); + + void addAttribute(String name, String value) { + attributes.put(name, value); + } + + void validateAttributes(Dictionary values) { + for (Map.Entry entry : attributes.entrySet()) { + if (!"id".equals(entry.getKey())) { + assertEquals(entry.getValue(), values.get(entry.getKey())); + } + } + } + + protected String getAlias() { + return "child"; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append('<'); + builder.append(getAlias()); + for (Map.Entry entry : attributes.entrySet()) { + builder.append(' '); + builder.append(entry.getKey()); + builder.append('='); + builder.append('"'); + builder.append(entry.getValue()); + builder.append('"'); + } + builder.append("/>"); + return builder.toString(); + } + + /** + * @return + */ + protected String getId() { + return attributes.get("id"); + } + + } + + private static class DefaultChild extends Child { + @Override + protected String getAlias() { + return "defaultChild"; + } + + @Override + protected String getId() { + return "childId"; + } + } + + private class Parent { + List children = new ArrayList(); + private final String id; + private final Cardinality cardinality; + private final String parentAliasName; + + public Parent(String id, Cardinality cardinality) { + this.id = id; + this.cardinality = cardinality; + parentAliasName = "nmrParent." + cardinality; + } + + void addChild(Child child) { + children.add(child); + } + + public String getId() { + return this.id; + } + + void validateAttributes(Dictionary values, Result expected) throws IOException { + assertEquals("id should be " + getId(), + getId(), values.get("id")); + + validateChildren(values, expected); + + } + + void validateChildren(Dictionary values, Result expected) throws IOException { + String childAliasName = "child"; + Object childValue = values.get(childAliasName); + assertNotNull(childValue); + + if (expected.getNumberOfChildren() == 1) { + if (cardinality == Cardinality.ONE) { + assertTrue("There should be one child pid", childValue instanceof String); + validateSingleChild((String) childValue); + } else { + assertEquals("There should be one child pid", 1, ((String[]) childValue).length); + validateChildren((String[]) childValue); + } + } else { + String[] childValues = (String[]) childValue; + assertEquals("The number of children should equal the number of evaluated pids", + expected.getNumberOfChildren(), childValues.length); + validateChildren(childValues); + } + + } + + /** + * @param childValue + * @throws IOException + */ + private void validateChildren(String[] childValues) throws IOException { + for (String pid : childValues) { + Configuration cfg = configAdmin.getConfiguration(pid); + Dictionary dictionary = cfg.getProperties(); + Child child = getChild(dictionary); + child.validateAttributes(dictionary); + } + + } + + /** + * @param object + * @return + */ + private Child getChild(Dictionary dictionary) { + String id = (String) dictionary.get("id"); + if (id == null) { + return null; + } else { + for (Child child : children) { + if (id.equals(child.getId())) { + return child; + } else if (id.contains("default-")) { + Enumeration keys = dictionary.keys(); + String key = keys.nextElement(); + if ("id".equals(key)) + key = keys.nextElement(); + if (child.attributes.containsKey(key)) + return child; + } + } + return null; + } + } + + /** + * @param childValue + * @throws IOException + */ + private void validateSingleChild(String childValue) throws IOException { + Configuration cfg = configAdmin.getConfiguration(childValue); + for (Child child : children) { + child.validateAttributes(cfg.getProperties()); + } + + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append('<'); + builder.append(parentAliasName); + builder.append(" id="); + builder.append('"'); + builder.append(id); + builder.append('"'); + builder.append('>'); + + for (Child child : children) { + builder.append(XML_NEW_LINE); + builder.append(child); + } + builder.append(XML_NEW_LINE); + builder.append('<'); + builder.append('/'); + builder.append(parentAliasName); + builder.append('>'); + return builder.toString(); + } + + public void addChildren(Child... children) { + for (Child child : children) { + addChild(child); + } + } + + /** + * + */ + public void write() throws Exception { + writer = readConfiguration(); + writer.addConfig(toString()); + writeConfiguration(writer); + } + + public void delete(Result expected) throws Exception { + // Clean up + writer = readConfiguration(); + writer.deleteConfig(parentAliasName, getId(), false); + writeConfiguration(writer); + if (expected.shouldSucceed()) + assertNull(getFactory().waitForUpdate(getId())); + else + assertFalse(getFactory().hasDictionary(getId())); + + } + + /** + * @throws IOException + * + */ + public void validate(Result expected) throws IOException { + if (expected.shouldSucceed()) { + Dictionary dictionary = getFactory().waitForUpdate(getId()); + validateAttributes(dictionary, expected); + } else { + assertFalse(getFactory().hasDictionary(getId())); + } + } + + /** + * @return + */ + private FactoryTest getFactory() { + if (cardinality == Cardinality.ONE) + return parentFactoryONE; + else + return parentFactoryMULTIPLE; + } + + /** + * + */ + public void test(Result result) throws Exception { + + try { + clean(); + write(); + validate(result); + } finally { + delete(result); + } + + } + + /** + * + */ + private void clean() { + parentFactoryONE.reset(); + parentFactoryMULTIPLE.reset(); + } + } + + /** + * Multiple children with null IDs should be merged when cardinality is zero + */ + public void testNullIDsCardinalityZero() throws Exception { + + Parent parent = new Parent("parent", Cardinality.ONE); + Child c1 = new Child(); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 1); + parent.test(r); + + } + + /** + * Multiple children with distinct IDs should be merged. This makes no sense to me whatsoever, but it was the + * resolution of the design issue. + * + * @throws Exception + */ + public void testMultipleIDsCardinalityZero() throws Exception { + Parent parent = new Parent("parent", Cardinality.ONE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("id", "id2"); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 1); + parent.test(r); + } + + /** + * Multiple children with the same ID should be merged when cardinality is zero. + * + * @throws Exception + */ + public void testSingleIDCardinalityZero() throws Exception { + Parent parent = new Parent("parent", Cardinality.ONE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("id", "id1"); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 1); + parent.test(r); + } + + /** + * Multiple distinct IDs with multiple cardinality should result in multiple children. + * + * @throws Exception + */ + public void testMultipleIDsCardinalityMultiple() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("id", "id2"); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 2); + parent.test(r); + } + + /** + * Multiple null IDs with multiple cardinality should result in multiple children. + * + * @throws Exception + */ + public void testNullIDsCardinalityMultiple() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + Child c1 = new Child(); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 2); + parent.test(r); + } + + /** + * Multiple children with the same ID should result in one merged element + * + * @throws Exception + */ + public void testSingleIDCardinalityMultiple() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("id", "id1"); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 1); + parent.test(r); + } + + public void testMixedIDsCardinalityMultiple() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + + Child c2 = new Child(); + c2.addAttribute("id", "id1"); + c2.addAttribute("attr2", "a2"); + + Child c3 = new Child(); + c3.addAttribute("id", "id2"); + c3.addAttribute("attr1", "b1"); + + parent.addChildren(c1, c2, c3); + + Result r = new Result(true, 2); + parent.test(r); + } + + public void testMultipleParentsNullIDsCardinalityZero() throws Exception { + Parent parent = new Parent("parent", Cardinality.ONE); + Child c1 = new Child(); + c1.addAttribute("attr1", "a1"); + parent.addChild(c1); + + Parent parent2 = new Parent("parent2", Cardinality.ONE); + Child c2 = new Child(); + c2.addAttribute("attr2", "a2"); + parent2.addChild(c2); + + Result r = new Result(true, 1); + parent.test(r); + parent2.test(r); + } + + public void testMultipleParentsSingleIDCardinalityZero() throws Exception { + Parent parent = new Parent("parent", Cardinality.ONE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + parent.addChild(c1); + + Parent parent2 = new Parent("parent2", Cardinality.ONE); + Child c2 = new Child(); + c2.addAttribute("id", "id1"); + c2.addAttribute("attr2", "a2"); + parent2.addChild(c2); + + Result r = new Result(true, 1); + parent.test(r); + parent2.test(r); + } + + public void testMultipleParentsMixedIDsCardinalityMultiple() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + Parent parent2 = new Parent("parent2", Cardinality.MULTIPLE); + + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + + Child c2 = new Child(); + c2.addAttribute("id", "id1"); + c2.addAttribute("attr2", "a2"); + + Child c3 = new Child(); + c3.addAttribute("id", "id2"); + c3.addAttribute("attr1", "b1"); + + parent.addChildren(c1, c2, c3); + + Child c4 = new Child(); + c4.addAttribute("id", "id1"); + c4.addAttribute("attr4", "a4"); + + Child c5 = new Child(); + c5.addAttribute("id", "id2"); + c5.addAttribute("attr5", "attr5"); + + parent2.addChildren(c4, c5); + + Result r = new Result(true, 2); + + parent.test(r); + } + + public void testDefaultIDMerging() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + DefaultChild c1 = new DefaultChild(); + c1.addAttribute("attr1", "a1"); + DefaultChild c2 = new DefaultChild(); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 1); + parent.test(r); + } + + private static class Result { + + private final int numberOfElements; + private final boolean shouldWork; + + public Result(boolean shouldWork, int elements) { + this.shouldWork = shouldWork; + this.numberOfElements = elements; + } + + public boolean shouldSucceed() { + return shouldWork; + } + + public int getNumberOfChildren() { + return numberOfElements; + } + } + + private static enum Cardinality { + ONE, MULTIPLE + }; +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedSingletonTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedSingletonTestRunner.java new file mode 100755 index 000000000000..cd909085bc77 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedSingletonTestRunner.java @@ -0,0 +1,179 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.SingletonTest; + +/** + * + */ +public class NestedSingletonTestRunner extends BaseTestRunner { + + private SingletonTest child; + private final String parentName = "test.config.nested.managed.metatype"; + private final String parentAlias = "singletonNested"; + private final String childName = "test.singleton.under.singleton"; + private final String nestedElementTwo = "resultTwo"; + private final String singletonElement = "singletonResult"; + private final String nestedElement = "testResult"; + private SingletonTest parent; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/nested-singleton-test", new TestDynamicConfigServlet(), null, null); + + this.child = new SingletonTest(childName); + this.parent = new SingletonTest(parentName); + addTest(child); + addTest(parent); + } + + public static Map> getMetatypeExpectedProperties() { + Map map1 = new HashMap(); + map1.put("pass", Integer.valueOf(9999)); + map1.put("fail", Integer.valueOf(7777)); + + Map map2 = new HashMap(); + map2.put("pass", Integer.valueOf(100)); + map2.put("fail", Integer.valueOf(0)); + + Map> expectedProperties = new Hashtable>(); + expectedProperties.put("one", map1); + expectedProperties.put("two", map2); + + return expectedProperties; + } + + /* + * Test that the initial configuration is parsed and transformed correctly. Moved from TestRunner + * because it can be affected by testUpdateReceived(). Both should be called from the same test. + */ + public void testInitialConfiguration() throws Exception { + Dictionary properties = parent.waitForUpdate(); + + String[] singleton = (String[]) properties.get(singletonElement); + if (singleton != null) { + Configuration singletonConfig = configAdmin.getConfiguration(singleton[0]); + Dictionary singletonProps = singletonConfig.getProperties(); + String singletonString = (String) singletonProps.get("someString"); + String[] singletonArray = (String[]) singletonProps.get("someArray"); + assertEquals("aSingleton", singletonString); + assertEquals(3, singletonArray.length); + } + String[] resultsTwo = (String[]) properties.get(nestedElementTwo); + assertNotNull(resultsTwo); + assertEquals("There should be three nested results", 3, resultsTwo.length); + for (int i = 0; i < resultsTwo.length; i++) { + Configuration config = configAdmin.getConfiguration(resultsTwo[i]); + Dictionary prop = config.getProperties(); + String someString = (String) prop.get("someString"); + String[] someArray = (String[]) prop.get("someArray"); + if ("notDefault".equals(someString)) { + assertEquals(3, someArray.length); + } else if ("zzz".equals(someString)) { + if (someArray.length == 2) { + assertEquals("Incorrect defined value for array", "ten", someArray[0]); + assertEquals("Incorrect defined value for array", "eleven", someArray[1]); + } else if (someArray.length == 3) { + assertEquals("Incorrect default value for array", "four", someArray[0]); + assertEquals("Incorrect default value for array", "five", someArray[1]); + assertEquals("Incorrect default value for array", "six", someArray[2]); + } else { + fail("Incorrect number of entries for someArray attribute: " + someArray.length); + } + + } else { + fail("Incorrect value for attribute someString: " + someString); + } + } + + String[] testResults = (String[]) properties.get(nestedElement); + assertNotNull(testResults); + assertEquals(2, testResults.length); + + Map> expectedProperties = getMetatypeExpectedProperties(); + for (int i = 0; i < testResults.length; i++) { + Configuration config = configAdmin.getConfiguration(testResults[i]); + Dictionary prop = config.getProperties(); + String innerName = (String) prop.get("name"); + Map expectedProps = expectedProperties.remove(innerName); + assertNotNull("Unexpected name: " + innerName, expectedProps); + for (Map.Entry entry : expectedProps.entrySet()) { + assertEquals("property " + entry.getKey() + " mismatch", entry.getValue(), prop.get(entry.getKey())); + } + } + + assertEquals(0, expectedProperties.size()); + } + + /** + * Make sure a cross bundle nested singleton update causes the ManagedService to be updated + * + * @throws Exception + */ + public void testUpdateReceived() throws Exception { + + ConfigWriter writer; + Dictionary dictionary; + + // *** STEP 1 *** + // Clear any previous updates + child.reset(); + + // Delete any existing elements + writer = readConfiguration(); + boolean updated = writer.deleteConfig(parentName, null, true); + updated |= writer.deleteConfig(parentAlias, null, true); + if (updated) { + // The update check here is just a convenience for debugging. When the test is run, there should + // always be an element to delete. + writeConfiguration(writer); + assertNotNull("Singleton deletion should result in a configuration with all default properties", child.waitForUpdate()); + } + + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("<{0} name=\"Jane Doe\">" + + " <{1} someString=\"hello\"/>" + + "", parentName, childName); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + + dictionary = child.waitForUpdate(); + assertEquals("someString should be \"hello\"", "hello", dictionary.get("someString")); + + // Clean up + writer = readConfiguration(); + writer.deleteConfig(parentName, null, true); + writer.deleteConfig(parentAlias, null, true); + writeConfiguration(writer); + assertNull("Singleton deletion should result in a null dictionary", child.waitForUpdate()); + + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/TestRunner.java new file mode 100755 index 000000000000..4a86375e42ab --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/TestRunner.java @@ -0,0 +1,650 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.Arrays; +import java.util.Dictionary; +import java.util.HashSet; +import java.util.Set; + +import org.osgi.framework.Constants; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryNestedTest; +import test.server.config.dynamic.FactoryTest; +import test.server.config.dynamic.SingletonTest; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +public class TestRunner extends BaseTestRunner { + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/nested-config-test", new TestDynamicConfigServlet(), null, null); + } + + public void testNested() throws Exception { + testNested("test.config.nested.singleton", "test.config.nested.singleton", + "test.config.nested.child", "test.config.nested.child"); + } + + public void testNestedMetatype() throws Exception { + testNested("nestedSingleton", "test.config.nested.singleton.metatype", + "nestedChildOne", "test.config.nested.child.one.metatype"); + } + + @SuppressWarnings("unchecked") + private void testNested(String parentName, String parentPid, String childName, String childPid) throws Exception { + Dictionary dictionary; + ConfigWriter writer; + String[] pids; + + SingletonTest parent = new SingletonTest(parentPid); + addTest(parent); + + FactoryNestedTest child = new FactoryNestedTest(childPid); + addTest(child); + + // *** STEP 1 *** + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate(); + + // *** STEP 2 *** + // add first nested child + writer = readConfiguration(); + writer.deleteConfig(parentName, null, false); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} name=\"myNestedChildOne\" a=\"b\" value=\"10\"/>" + + "", parentName, childName); + writeConfiguration(writer); + + // parent gets injected with the first child pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + String parentServicePid = (String) dictionary.get(XMLConfigConstants.CFG_SERVICE_PID); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + String firstChildPid = pids[0]; + + // first child instance is created + dictionary = child.waitForUpdate(firstChildPid); + assertEquals("name property", "myNestedChildOne", dictionary.get("name")); + assertEquals("value property", "10", dictionary.get("value")); + assertEquals("a property", "b", dictionary.get("a")); + + assertEquals("Nested Child config.parentPID should be equal to parent's service.pid", parentServicePid, + dictionary.get(XMLConfigConstants.CFG_PARENT_PID)); + + // *** STEP 3 *** + // add second nested child + writer = readConfiguration(); + writer.deleteConfig(parentName, null, false); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} name=\"myNestedChildOne\" a=\"b\" value=\"10\"/>" + + " <{1} name=\"myNestedChildTwo\" b=\"c\" value=\"20\"/>" + + "", parentName, childName); + writeConfiguration(writer); + + // parent gets injected with the second child pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 2, pids.length); + Set pidSet = toSet(pids); + assertTrue("first child pid", pidSet.contains(firstChildPid)); + pidSet.remove(firstChildPid); + String secondChildPid = pidSet.iterator().next(); + + // second child instance is created + dictionary = child.waitForUpdate(secondChildPid); + assertEquals("name property", "myNestedChildTwo", dictionary.get("name")); + assertEquals("value property", "20", dictionary.get("value")); + assertEquals("b property", "c", dictionary.get("b")); + + // *** STEP 4 *** + // update second child and remove first + writer = readConfiguration(); + writer.deleteConfig(parentName, null, false); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} name=\"myNestedChildTwo\" b=\"c\" value=\"40\"/>" + + "", parentName, childName); + writeConfiguration(writer); + + // parent gets updated with a single pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + + String deletedPid = null; + String updatedPid = null; + + if (firstChildPid.equals(pids[0])) { + updatedPid = firstChildPid; + deletedPid = secondChildPid; + } else if (secondChildPid.equals(pids[0])) { + updatedPid = secondChildPid; + deletedPid = firstChildPid; + } else { + fail("Unexpected child pid: " + pids[0]); + } + + // one child instance is removed + dictionary = child.waitForUpdate(deletedPid); + assertNull("child removed", dictionary); + + // one child instance is updated + dictionary = child.waitForUpdate(updatedPid); + assertEquals("name property", "myNestedChildTwo", dictionary.get("name")); + assertEquals("value property", "40", dictionary.get("value")); + assertNull("a property", dictionary.get("a")); + assertEquals("b property", "c", dictionary.get("b")); + + // *** STEP 5 *** + // delete parent configuration + writer = readConfiguration(); + writer.deleteConfig(parentName, null, false); + writeConfiguration(writer); + + // remaining child instance is removed + dictionary = child.waitForUpdate(updatedPid); + assertNull("child was not removed", dictionary); + + // parent is removed + dictionary = parent.waitForUpdate(); + assertNull("parent was not removed", dictionary); + } + + @SuppressWarnings("unchecked") + public void testNestedReferences() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + String[] pids; + + String parentName = "test.config.nested.singleton.ref"; + SingletonTest parent = new SingletonTest(parentName); + addTest(parent); + + String childName = "test.config.nested.child.ref.1"; + FactoryNestedTest child = new FactoryNestedTest(childName); + addTest(child); + + // *** STEP 1 *** + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate(); + + // *** STEP 2 *** + // add first nested child + writer = readConfiguration(); + writer.addConfig("<{0} id=\"1\" name=\"myNestedChildOne\" a=\"b\" value=\"10\"/>", childName); + writer.deleteConfig(parentName, null, false); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} ref=\"1\" />" + + "", parentName, childName); + writeConfiguration(writer); + + // parent gets injected with the first child pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + String firstChildPid = pids[0]; + + // first child instance is created + dictionary = child.waitForUpdate(firstChildPid); + assertEquals("name property", "myNestedChildOne", dictionary.get("name")); + assertEquals("value property", "10", dictionary.get("value")); + assertEquals("a property", "b", dictionary.get("a")); + + // *** STEP 3 *** + // add second nested child + writer = readConfiguration(); + writer.addConfig("<{0} id=\"2\" name=\"myNestedChildTwo\" b=\"c\" value=\"20\"/>", childName); + writer.deleteConfig(parentName, null, false); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} ref=\"1\" />" + + " <{1} ref=\"2\" />" + + "", parentName, childName); + writeConfiguration(writer); + + // parent gets injected with the second child pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 2, pids.length); + Set pidSet = toSet(pids); + assertTrue("first child pid", pidSet.contains(firstChildPid)); + pidSet.remove(firstChildPid); + String secondChildPid = pidSet.iterator().next(); + + // second child instance is created + dictionary = child.waitForUpdate(secondChildPid); + assertEquals("name property", "myNestedChildTwo", dictionary.get("name")); + assertEquals("value property", "20", dictionary.get("value")); + assertEquals("b property", "c", dictionary.get("b")); + + // *** STEP 4 *** + // update second child and remove first + writer = readConfiguration(); + writer.deleteConfig(childName, "1", false); + writer.setValue(childName, "2", "value", "40"); + writeConfiguration(writer); + + // parent gets updated with a single pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + + String deletedPid = null; + String updatedPid = null; + + if (firstChildPid.equals(pids[0])) { + updatedPid = firstChildPid; + deletedPid = secondChildPid; + } else if (secondChildPid.equals(pids[0])) { + updatedPid = secondChildPid; + deletedPid = firstChildPid; + } else { + fail("Unexpected child pid: " + pids[0]); + } + + // one child instance is removed + dictionary = child.waitForUpdate(deletedPid); + assertNull("child removed", dictionary); + + // one child instance is updated + dictionary = child.waitForUpdate(updatedPid); + assertEquals("name property", "myNestedChildTwo", dictionary.get("name")); + assertEquals("value property", "40", dictionary.get("value")); + assertNull("a property", dictionary.get("a")); + assertEquals("b property", "c", dictionary.get("b")); + + // *** STEP 5 *** + // delete parent configuration + writer = readConfiguration(); + writer.deleteConfig(parentName, null, false); + writeConfiguration(writer); + + // parent is removed + dictionary = parent.waitForUpdate(); + assertNull("parent was not removed", dictionary); + + // remaining child is still there + Configuration[] configs = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + updatedPid + ")"); + assertNotNull(configs); + assertEquals(1, configs.length); + } + + public void testNestedFactoryReferences() throws Exception { + testNestedFactoryReferences("test.config.nested.factory.ref", "test.config.nested.factory.ref", + "test.config.nested.child.ref.2", "test.config.nested.child.ref.2"); + } + + public void testNestedMetatypeFactoryReferences() throws Exception { + testNestedFactoryReferences("nestedFactory", "test.config.nested.factory.metatype", + "nestedChildTwo", "test.config.nested.child.two.metatype"); + } + + @SuppressWarnings("unchecked") + private void testNestedFactoryReferences(String parentName, String parentPid, String childName, String childPid) throws Exception { + Dictionary dictionary; + ConfigWriter writer; + String[] pids; + + FactoryTest parent = new FactoryTest(parentPid); + addTest(parent); + + FactoryNestedTest child = new FactoryNestedTest(childPid); + addTest(child); + + // *** STEP 1 *** + // add initial configurations + writer = readConfiguration(); + writer.addConfig("<{0} id=\"1\" name=\"myNestedChildOne\" a=\"b\" value=\"10\"/>", childName); + writer.deleteConfig(parentName, null, true); + writer.addConfig("<{0} id=\"one\" name=\"myNestedFactoryOne\">" + + " <{1} ref=\"1\" />" + + "", parentName, childName); + writer.addConfig("<{0} id=\"two\" name=\"myNestedFactoryTwo\">" + + " <{1} ref=\"1\" />" + + "", parentName, childName); + writeConfiguration(writer); + + // parents get injected with the first child pid + Dictionary dictionaryOne = parent.waitForUpdate("one"); + assertEquals("name property", "myNestedFactoryOne", dictionaryOne.get("name")); + String[] onePids = (String[]) dictionaryOne.get(childName); + assertNotNull("child pids", onePids); + assertEquals("child pids", 1, onePids.length); + + Dictionary dictionaryTwo = parent.waitForUpdate("two"); + assertEquals("name property", "myNestedFactoryTwo", dictionaryTwo.get("name")); + String[] twoPids = (String[]) dictionaryTwo.get(childName); + assertNotNull("child pids", twoPids); + assertEquals("child pids", 1, twoPids.length); + + // both pids should be the same + assertEquals("child pids are not the same", onePids[0], twoPids[0]); + + // child "1" is created + dictionary = child.waitForUpdate(onePids[0]); + assertEquals("name property", "myNestedChildOne", dictionary.get("name")); + assertEquals("value property", "10", dictionary.get("value")); + assertEquals("a property", "b", dictionary.get("a")); + + // *** STEP 2 *** + // add "2" child, modify "1" child, and add reference to "2" child to "one" parent + writer = readConfiguration(); + writer.addConfig("<{0} id=\"2\" name=\"myNestedChildTwo\" b=\"c\" value=\"20\"/>", childName); + writer.setValue(childName, "1", "value", "40"); + writer.deleteConfig(parentName, "one", false); + writer.addConfig("<{0} id=\"one\" name=\"myNestedFactoryOne\">" + + " <{1} ref=\"1\" />" + + " <{1} ref=\"2\" />" + + "", parentName, childName); + writeConfiguration(writer); + + // "two" parent should be notified and have no changes + dictionary = parent.waitForUpdate("two"); + dictionaryEquals(dictionaryTwo, dictionary); + + // "one" parent should be notified and have 2 pids + dictionary = parent.waitForUpdate("one"); + assertEquals("name property", "myNestedFactoryOne", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 2, pids.length); + Set pidSet = toSet(pids); + assertTrue(pidSet.contains(onePids[0])); + pidSet.remove(onePids[0]); + String child2Pid = pidSet.iterator().next(); + + // child "1" is updated + dictionary = child.waitForUpdate(onePids[0]); + assertEquals("name property", "myNestedChildOne", dictionary.get("name")); + assertEquals("value property", "40", dictionary.get("value")); + assertEquals("a property", "b", dictionary.get("a")); + + // child "2" is created + dictionary = child.waitForUpdate(child2Pid); + assertEquals("name property", "myNestedChildTwo", dictionary.get("name")); + assertEquals("value property", "20", dictionary.get("value")); + assertEquals("b property", "c", dictionary.get("b")); + + // *** STEP 3 **** + // delete "1" child + writer = readConfiguration(); + writer.deleteConfig(childName, "1", false); + writeConfiguration(writer); + + // child "1" is deleted + dictionary = child.waitForUpdate(onePids[0]); + assertNull(dictionary); + + // parent "two" has no pids + dictionary = parent.waitForUpdate("two"); + assertEquals("name property", "myNestedFactoryTwo", dictionary.get("name")); + assertEquals(Arrays.asList(), Arrays.asList((String[]) dictionary.get(childName))); + + // parent "one" has one pid + dictionary = parent.waitForUpdate("one"); + assertEquals("name property", "myNestedFactoryOne", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + assertEquals(child2Pid, pids[0]); + } + + @SuppressWarnings("unchecked") + public void testNestedNonUniqueReferences() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + String[] pids; + + String parentName = "test.config.nested.singleton.1"; + SingletonTest parent = new SingletonTest(parentName); + addTest(parent); + + String childOneName = "test.config.nested.child.ref.3"; + FactoryNestedTest childOne = new FactoryNestedTest(childOneName); + addTest(childOne); + + String childTwoName = "test.config.nested.child.ref.4"; + FactoryNestedTest childTwo = new FactoryNestedTest(childTwoName); + addTest(childTwo); + + dictionary = parent.waitForUpdate(); + + // *** STEP 1 *** + // add initial configurations - the references use the same id + writer = readConfiguration(); + writer.addConfig("<{0} id=\"1\" name=\"myChildOne\" a=\"b\" value=\"10\"/>", childOneName); + writer.addConfig("<{0} id=\"1\" name=\"myChildTwo\" a=\"b\" strValue=\"bob\"/>", childTwoName); + writer.deleteConfig(parentName, null, true); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} ref=\"1\" />" + + " <{2} ref=\"1\" />" + + "", parentName, childOneName, childTwoName); + writeConfiguration(writer); + + // parent gets injected with the children pids + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + + pids = (String[]) dictionary.get(childOneName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + String childOnePid = pids[0]; + + pids = (String[]) dictionary.get(childTwoName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + String childTwoPid = pids[0]; + + assertFalse("pids are the same: " + childOnePid, childOnePid.equals(childTwoPid)); + } + + @SuppressWarnings("unchecked") + public void testFactoryOptionalId() throws Exception { + ConfigWriter writer; + + FactoryTest parent = new FactoryTest("test.config.nested.factory.optional.metatype", "name"); + addTest(parent); + + FactoryNestedTest child = new FactoryNestedTest("test.config.nested.factory.optional.child.1"); + addTest(child); + + FactoryNestedTest childChild = new FactoryNestedTest("test.config.nested.factory.optional.child.2"); + addTest(childChild); + + String parentName = "nestedOptionalFactory"; + String firstChildName = "nestedOptionalChildOne"; + String secondChildName = "nestedOptionalChildTwo"; + + // write initial configuration + writer = readConfiguration(); + writer.addConfig("<{0} name=\"myOptionalFactory\">" + + " <{1} name=\"myNestedChild\" a=\"b\" value=\"10\">" + + " <{2} name=\"myDoubleNestedChild\" threads=\"15\"/>" + + " " + + "", parentName, firstChildName, secondChildName); + writeConfiguration(writer); + + // parent get injected with the child + Dictionary dictionaryOne = parent.waitForUpdate("myOptionalFactory"); + assertEquals(Short.valueOf("5"), dictionaryOne.get("poolSize")); + String[] onePids = (String[]) dictionaryOne.get(firstChildName); + assertNotNull("child pids", onePids); + assertEquals("child pids", 1, onePids.length); + + // first child is updated + Dictionary dictionaryTwo = child.waitForUpdate(onePids[0]); + assertEquals("name property", "myNestedChild", dictionaryTwo.get("name")); + assertEquals("value property", "10", dictionaryTwo.get("value")); + assertEquals("a property", "b", dictionaryTwo.get("a")); + assertEquals(Long.valueOf("5000"), dictionaryTwo.get("idleTime")); + String[] twoPids = (String[]) dictionaryTwo.get(secondChildName); + assertNotNull("child pids", twoPids); + assertEquals("child pids", 1, twoPids.length); + + // second child is updated + Dictionary dictionaryThree = childChild.waitForUpdate(twoPids[0]); + assertEquals("name property", "myDoubleNestedChild", dictionaryThree.get("name")); + assertEquals("value property", "15", dictionaryThree.get("threads")); + assertEquals(Integer.valueOf("1000"), dictionaryThree.get("timeout")); + + // update double nested configuration + writer = readConfiguration(); + writer.deleteConfig(parentName, "myOptionalFactory", "name", false); + writer.addConfig("<{0} name=\"myOptionalFactory\">" + + " <{1} name=\"myNestedChild\" a=\"b\" value=\"10\">" + + " <{2} name=\"myDoubleNestedChild\" threads=\"20\"/>" + + " " + + "", parentName, firstChildName, secondChildName); + writeConfiguration(writer); + + Dictionary dictionary = null; + + // top parent should be notified of the changes but have no differences + dictionary = parent.waitForUpdate("myOptionalFactory"); + dictionaryEquals(dictionaryOne, dictionary); + + // first child should be notified of the changes but have no differences + dictionary = child.waitForUpdate(onePids[0]); + dictionaryEquals(dictionaryTwo, dictionary); + + // second child should be notified of the changes + dictionary = childChild.waitForUpdate(twoPids[0]); + assertEquals("name property", "myDoubleNestedChild", dictionary.get("name")); + assertEquals("value property", "20", dictionary.get("threads")); + assertEquals(Integer.valueOf("1000"), dictionary.get("timeout")); + } + + public static class TimestampFactoryTest extends FactoryTest { + + private long sleep = -1; + + public TimestampFactoryTest(String name) { + super(name); + } + + public void setSleep(long sleep) { + this.sleep = sleep; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void updated(String pid, Dictionary properties) throws ConfigurationException { + properties.put("timestamp", System.currentTimeMillis()); + if (sleep > 0) { + try { + Thread.sleep(sleep); + } catch (InterruptedException e) { + // ignore + } + } + super.updated(pid, properties); + } + } + + @SuppressWarnings("unchecked") + public void testUpdateOrder() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + TimestampFactoryTest a = new TimestampFactoryTest("test.config.order.a"); + TimestampFactoryTest b = new TimestampFactoryTest("test.config.order.b"); + TimestampFactoryTest c = new TimestampFactoryTest("test.config.order.c"); + TimestampFactoryTest d = new TimestampFactoryTest("test.config.order.d"); + TimestampFactoryTest e = new TimestampFactoryTest("test.config.order.e"); + + addTest(a); + addTest(b); + addTest(c); + addTest(d); + addTest(e); + + // *** STEP 1 *** + // wait for the initial configuration to be injected. + dictionary = a.waitForUpdate("a"); + assertEquals("a", dictionary.get("name")); + dictionary = b.waitForUpdate("b"); + assertEquals("b", dictionary.get("name")); + dictionary = c.waitForUpdate("c"); + assertEquals("c", dictionary.get("name")); + dictionary = d.waitForUpdate("d"); + assertEquals("d", dictionary.get("name")); + dictionary = e.waitForUpdate("e"); + assertEquals("e", dictionary.get("name")); + + // *** STEP 2 *** + // update e and check for updates in right order + long timeout = 1000; + a.setSleep(timeout); + b.setSleep(timeout); + c.setSleep(timeout); + d.setSleep(timeout); + e.setSleep(timeout); + + writer = readConfiguration(); + writer.setValue("test.config.order.e", "e", "name", "ee"); + writeConfiguration(writer); + + long aTimeout, bTimeout, cTimeout, dTimeout, eTimeout; + + dictionary = a.waitForUpdate("a"); + assertEquals("a", dictionary.get("name")); + aTimeout = (Long) dictionary.get("timestamp"); + dictionary = b.waitForUpdate("b"); + assertEquals("b", dictionary.get("name")); + bTimeout = (Long) dictionary.get("timestamp"); + dictionary = c.waitForUpdate("c"); + assertEquals("c", dictionary.get("name")); + cTimeout = (Long) dictionary.get("timestamp"); + dictionary = d.waitForUpdate("d"); + assertEquals("d", dictionary.get("name")); + dTimeout = (Long) dictionary.get("timestamp"); + dictionary = e.waitForUpdate("e"); + assertEquals("ee", dictionary.get("name")); + eTimeout = (Long) dictionary.get("timestamp"); + + // expected update order, e, d, c, b, a + assertTrue(dTimeout > eTimeout); + assertTrue(cTimeout > dTimeout); + assertTrue(bTimeout > cTimeout); + assertTrue(aTimeout > bTimeout); + } + + private static Set toSet(String[] array) { + return new HashSet(Arrays.asList(array)); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/reference/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/reference/TestRunner.java new file mode 100755 index 000000000000..324c233c6182 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/reference/TestRunner.java @@ -0,0 +1,403 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.reference; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; +import java.util.Vector; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryNestedTest; +import test.server.config.dynamic.FactoryTest; +import test.server.config.dynamic.SingletonTest; + +public class TestRunner extends BaseTestRunner { + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/reference-config-test", new TestDynamicConfigServlet(), null, null); + + BundleContext bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + this.configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + + } + + public void testTwoReferencesOnePid() throws Exception { + + String id = "testTwoReferencesOnePid"; + + FactoryTest parent = new FactoryTest("test.config.reference.parent"); + addTest(parent); + + ConfigWriter writer = readConfiguration(); + + writer.addConfig("" + + " " + + " " + + ""); + writeConfiguration(writer); + + Dictionary dictionary = parent.waitForUpdate(id); + assertNotNull(dictionary.get("widget")); + assertNotNull(dictionary.get("part")); + + // Update a widget + + writer = readConfiguration(); + writer.deleteConfig("test.config.reference.parent", id, true); + writer.addConfig("" + + " " + + " " + + ""); + writeConfiguration(writer); + + dictionary = parent.waitForUpdate(id); + assertNotNull(dictionary.get("widget")); + assertNotNull(dictionary.get("part")); + + // Update a part + writer = readConfiguration(); + writer.deleteConfig("test.config.reference.parent", id, true); + writer.addConfig("" + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the final configuration is ok + dictionary = parent.waitForUpdate(id); + String[] widgets = (String[]) dictionary.get("widget"); + String[] parts = (String[]) dictionary.get("part"); + + assertNotNull(widgets); + assertNotNull(parts); + + assertEquals(1, widgets.length); + assertEquals(1, parts.length); + + String widgetPid = widgets[0]; + String partPid = parts[0]; + + Configuration[] widgetConfigs = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + widgetPid + ")"); + Configuration[] partConfigs = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + partPid + ")"); + assertNotNull(widgetConfigs); + assertNotNull(partConfigs); + + assertEquals("There should be one widget in CA", 1, widgetConfigs.length); + assertEquals("There should be one part in CA", 1, partConfigs.length); + + Dictionary widgetDictionary = widgetConfigs[0].getProperties(); + Dictionary partDictionary = partConfigs[0].getProperties(); + assertEquals("widget 2", widgetDictionary.get("someProperty")); + assertEquals("widget 2", partDictionary.get("someProperty")); + + } + + public void testReferenceAttribute() throws Exception { + SingletonTest parent = new SingletonTest("test.config.reference.attribute"); + addTest(parent); + + FactoryNestedTest child = new FactoryNestedTest("test.config.reference.attribute.child"); + addTest(child); + + // wait for the initial configuration to be injected. + Dictionary parentDictionary = parent.waitForUpdate(); + assertEquals("version property", "3.0", parentDictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(100), parentDictionary.get("maxThreads")); + String pid = (String) parentDictionary.get("reference"); + assertNotNull("reference pid", pid); + + // check the child info + Dictionary childDictionary = child.waitForUpdate(pid); + assertEquals("name property", "one", childDictionary.get("name")); + assertEquals("threads property", Integer.valueOf(100), childDictionary.get("threads")); + + Dictionary dictionary; + ConfigWriter writer; + + // STEP 1: update child and check if parent is updated + writer = readConfiguration(); + writer.setValue("childAttributeReference", "ref1", "threads", "500"); + writeConfiguration(writer); + + // check updated child info + dictionary = child.waitForUpdate(pid); + assertEquals("name property", "one", dictionary.get("name")); + assertEquals("threads property", Integer.valueOf(500), dictionary.get("threads")); + + // check parent got updated + dictionary = parent.waitForUpdate(); + dictionaryEquals(parentDictionary, dictionary); + + // STEP 2: delete child and check if parent is updated + writer = readConfiguration(); + writer.deleteConfig("childAttributeReference", "ref1", false); + writeConfiguration(writer); + + // check updated child info + dictionary = child.waitForUpdate(pid); + assertNull(dictionary); + + // check parent got updated + dictionary = parent.waitForUpdate(); + assertEquals("version property", "3.0", dictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(100), dictionary.get("maxThreads")); + assertNull(dictionary.get("reference")); + + // STEP 3: add child back up and check if parent is updated + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + parentDictionary = parent.waitForUpdate(); + assertEquals("version property", "3.0", parentDictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(100), parentDictionary.get("maxThreads")); + pid = (String) parentDictionary.get("reference"); + assertNotNull("reference pid", pid); + + // check updated child info + dictionary = child.waitForUpdate(pid); + assertEquals("name property", "noname", dictionary.get("name")); + assertEquals("threads property", Integer.valueOf(300), dictionary.get("threads")); + } + + public void testReferenceElement() throws Exception { + + SingletonTest parent = new SingletonTest("test.config.reference.element"); + addTest(parent); + + FactoryNestedTest child = new FactoryNestedTest("test.config.reference.element.child"); + addTest(child); + + // wait for the initial configuration to be injected. + Dictionary parentDictionary = parent.waitForUpdate(); + assertEquals("version property", "4.0", parentDictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(200), parentDictionary.get("maxThreads")); + // check pids in references + String[] pids = (String[]) parentDictionary.get("references"); + assertNotNull("reference pids", pids); + assertEquals("child pids", 4, pids.length); + // check pids in referenceList + Vector pidList = (Vector) parentDictionary.get("referenceList"); + assertNotNull("reference pids", pidList); + assertEquals("child pids", 4, pidList.size()); + assertEquals(pids[0], pidList.get(0)); + assertEquals(pids[1], pidList.get(2)); + assertEquals(pids[2], pidList.get(1)); + // check pids in childRef + String[] pids2 = (String[]) parentDictionary.get("childRef"); + assertNotNull(pids2); + assertEquals(2, pids2.length); + assertEquals(pids[0], pids2[1]); + assertEquals(pids[1], pids2[0]); + // these elements should not be in the dictionary + assertNull(parentDictionary.get("referencesRef")); + assertNull(parentDictionary.get("referenceListRef")); + assertNull(parentDictionary.get("child")); + + // check the first reference info + Dictionary childOneDictionary = child.waitForUpdate(pids[0]); + assertEquals("name property", "five", childOneDictionary.get("name")); + assertEquals("threads property", Integer.valueOf(5), childOneDictionary.get("threads")); + + // check the first reference info + Dictionary childTwoDictionary = child.waitForUpdate(pids[1]); + assertEquals("name property", "unavailable", childTwoDictionary.get("name")); + assertEquals("threads property", Integer.valueOf(300), childTwoDictionary.get("threads")); + + // check the second reference info + Dictionary childThreeDictionary = child.waitForUpdate(pids[2]); + assertEquals("name property", "two", childThreeDictionary.get("name")); + assertEquals("threads property", Integer.valueOf(200), childThreeDictionary.get("threads")); + + // check the nested reference from "references" + Dictionary childFourDictionary = child.waitForUpdate(pids[3]); + assertEquals("name property", "nested-one", childFourDictionary.get("name")); + assertEquals("threads property", Integer.valueOf(5000), childFourDictionary.get("threads")); + + // check the nested reference from "referenceList" + Dictionary childFiveictionary = child.waitForUpdate(pidList.get(3)); + assertEquals("name property", "nested-two", childFiveictionary.get("name")); + assertEquals("threads property", Integer.valueOf(6000), childFiveictionary.get("threads")); + + Dictionary dictionary; + ConfigWriter writer; + + // STEP 1: update child and check if parent is updated + writer = readConfiguration(); + writer.setValue("childElementReference", "ref2", "threads", "444"); + writeConfiguration(writer); + + // check updated child info + dictionary = child.waitForUpdate(pids[2]); + assertEquals("name property", "two", dictionary.get("name")); + assertEquals("threads property", Integer.valueOf(444), dictionary.get("threads")); + + // check parent got updated + dictionary = parent.waitForUpdate(); + dictionaryEquals(parentDictionary, dictionary); + + // STEP 2: delete child two and check if parent is updated + writer = readConfiguration(); + writer.deleteConfig("childElementReference", "ref3", false); + writeConfiguration(writer); + + // check updated child info + dictionary = child.waitForUpdate(pids[1]); + assertNull(dictionary); + + // check parent got updated + parentDictionary = parent.waitForUpdate(); + assertEquals("version property", "4.0", parentDictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(200), parentDictionary.get("maxThreads")); + // check pids in references + String[] newPids = (String[]) parentDictionary.get("references"); + assertNotNull("reference pids", newPids); + assertEquals("child pids", 3, newPids.length); + assertEquals(pids[0], newPids[0]); + assertEquals(pids[2], newPids[1]); + assertEquals(pids[3], newPids[2]); + // check pids in referenceList + Vector newPidList = (Vector) parentDictionary.get("referenceList"); + assertNotNull("reference pids", newPidList); + assertEquals("child pids", 3, newPidList.size()); + assertEquals(pidList.get(0), newPidList.get(0)); + assertEquals(pids[2], newPidList.get(1)); + assertEquals(pidList.get(3), newPidList.get(2)); + // check pids in childRef + String[] newPids2 = (String[]) parentDictionary.get("childRef"); + assertNotNull(newPids2); + assertEquals(1, newPids2.length); + assertEquals(pids[0], newPids2[0]); + // these elements should not be in the dictionary + assertNull(parentDictionary.get("referencesRef")); + assertNull(parentDictionary.get("referenceListRef")); + assertNull(parentDictionary.get("child")); + + // STEP 3: add child two back up and check if parent is updated + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // check parent got updated + parentDictionary = parent.waitForUpdate(); + assertEquals("version property", "4.0", parentDictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(200), parentDictionary.get("maxThreads")); + // check pids in references + pids = (String[]) parentDictionary.get("references"); + assertNotNull("reference pids", pids); + assertEquals("child pids", 4, pids.length); + assertEquals(newPids[0], pids[0]); + assertEquals(newPids[1], pids[2]); + assertEquals(newPids[2], pids[3]); + // check pids in referenceList + pidList = (Vector) parentDictionary.get("referenceList"); + assertNotNull("reference pids", pidList); + assertEquals("child pids", 4, pidList.size()); + assertEquals(pids[0], pidList.get(0)); + assertEquals(pids[1], pidList.get(2)); + assertEquals(pids[2], pidList.get(1)); + assertEquals(newPidList.get(2), pidList.get(3)); + // check pids in childRef + pids2 = (String[]) parentDictionary.get("childRef"); + assertNotNull(pids2); + assertEquals(2, pids2.length); + assertEquals(pids[0], pids2[1]); + assertEquals(pids[1], pids2[0]); + // these elements should not be in the dictionary + assertNull(parentDictionary.get("referencesRef")); + assertNull(parentDictionary.get("referenceListRef")); + assertNull(parentDictionary.get("child")); + + // check updated child info + dictionary = child.waitForUpdate(pids[1]); + assertEquals("name property", "noname", dictionary.get("name")); + assertEquals("threads property", Integer.valueOf(666), dictionary.get("threads")); + } + + public void testReferenceUpdates() throws Exception { + + FactoryTest nodeA = new FactoryTest("test.config.reference.node.a", "uniqueName"); + addTest(nodeA); + + FactoryTest nodeB = new FactoryTest("test.config.reference.node.b"); + addTest(nodeB); + + FactoryTest nodeC = new FactoryTest("test.config.reference.node.c"); + addTest(nodeC); + + Dictionary nodeADictionary = nodeA.waitForUpdate("foo"); + String nodeBOnePid = (String) nodeADictionary.get("nodeRef"); + assertNotNull(nodeBOnePid); + + Dictionary nodeCDictionary = nodeC.waitForUpdate("three"); + assertEquals("ford", nodeCDictionary.get("name")); + String nodeCPid = nodeC.getPid("three"); + + Dictionary nodeBOneDictionary = nodeB.waitForUpdate("one"); + assertEquals(Integer.valueOf(100), nodeBOneDictionary.get("value")); + assertEquals(nodeBOnePid, nodeB.getPid("one")); + assertEquals(nodeCPid, nodeBOneDictionary.get("nodeRef")); + + Dictionary nodeBTwoDictionary = nodeB.waitForUpdate("two"); + assertEquals(Integer.valueOf(200), nodeBTwoDictionary.get("value")); + assertEquals(nodeBOnePid, nodeB.getPid("one")); + assertEquals(nodeCPid, nodeBTwoDictionary.get("nodeRef")); + + ConfigWriter writer; + Dictionary dictionary; + + // Test 1: Update nodeB one - that should update nodeA + writer = readConfiguration(); + writer.setValue("nodeB", "one", "value", "5555"); + writeConfiguration(writer); + + nodeBOneDictionary = nodeB.waitForUpdate("one"); + assertEquals(Integer.valueOf(5555), nodeBOneDictionary.get("value")); + assertEquals(nodeBOnePid, nodeB.getPid("one")); + assertEquals(nodeCPid, nodeBOneDictionary.get("nodeRef")); + + dictionary = nodeA.waitForUpdate("foo"); + dictionaryEquals(nodeADictionary, dictionary); + + // Test 2: Update nodeC - that should update everything! + writer = readConfiguration(); + writer.setValue("nodeC", "three", "name", "honda"); + writeConfiguration(writer); + + nodeCDictionary = nodeC.waitForUpdate("three"); + assertEquals("honda", nodeCDictionary.get("name")); + + dictionary = nodeB.waitForUpdate("one"); + dictionaryEquals(nodeBOneDictionary, dictionary); + + dictionary = nodeB.waitForUpdate("two"); + dictionaryEquals(nodeBTwoDictionary, dictionary); + + dictionary = nodeA.waitForUpdate("foo"); + dictionaryEquals(nodeADictionary, dictionary); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/soc/ServiceObjectClassTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/soc/ServiceObjectClassTestRunner.java new file mode 100755 index 000000000000..6dd69492b77d --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/soc/ServiceObjectClassTestRunner.java @@ -0,0 +1,198 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.soc; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +/** + * + */ +public class ServiceObjectClassTestRunner extends BaseTestRunner { + + String simpleSOCPID = "com.ibm.ws.config.soc.simple"; + String applePID = "com.ibm.ws.config.soc.apple"; + String orangePID = "com.ibm.ws.config.soc.orange"; + + private FactoryTest simpleSOCTest; + + private ConfigurationAdmin configAdmin; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/serviceObjectClass-test", new TestDynamicConfigServlet(), null, null); + + this.simpleSOCTest = new FactoryTest(simpleSOCPID); + + addTest(simpleSOCTest); + + BundleContext bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + this.configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + } + + public void testSimpleServiceObjectClass() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + * + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig(""); + writer.addConfig(""); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = simpleSOCTest.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + + String referencePid = (String) dictionary.get("fruitRef"); + + Configuration[] references = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + referencePid + ")"); + assertNotNull(references); + assertEquals("There should be one reference", 1, references.length); + + Dictionary appleDictionary = references[0].getProperties(); + assertEquals("id should be apple", "apple", appleDictionary.get("id")); + assertNull("apple should not contain properties from orange metatype", appleDictionary.get("orangeType")); + assertEquals("apple should have properties from apple metatype", "macintosh", appleDictionary.get("appleType")); + + // *** STEP 2 *** + // Update apple->orange + writer = readConfiguration(); + writer.setValue("serviceObjectClassTest", "a", "fruitRef", "orange"); + writeConfiguration(writer); + + // wait for the dictionary update + dictionary = simpleSOCTest.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + referencePid = (String) dictionary.get("fruitRef"); + + references = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + referencePid + ")"); + assertNotNull(references); + assertEquals("There should be one reference", 1, references.length); + + Dictionary orangeDictionary = references[0].getProperties(); + assertEquals("id should be orange", "orange", orangeDictionary.get("id")); + assertNull("orange should not contain properties from apple metatype", orangeDictionary.get("appleType")); + assertEquals("orange should have properties from orange metatype", "clementine", orangeDictionary.get("orangeType")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("serviceObjectClassTest", "a", true); + writer.deleteConfig("apple", "apple", true); + writer.deleteConfig("orange", "orange", true); + writeConfiguration(writer); + } + } + + public void testServiceObjectClassConflict() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + * + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig(""); + writer.addConfig(""); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = simpleSOCTest.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + + // fruitRef should be null because we can't distinguish between apple/orange + assertNull(dictionary.get("fruitRef")); + + // *** STEP 2 *** + // Update apple->orange to eliminate conflict + writer = readConfiguration(); + writer.deleteConfig("orange", "apple", true); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the dictionary update + dictionary = simpleSOCTest.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + + String referencePid = (String) dictionary.get("fruitRef"); + + Configuration[] references = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + referencePid + ")"); + assertNotNull(references); + assertEquals("There should be one reference", 1, references.length); + + Dictionary appleDictionary = references[0].getProperties(); + assertEquals("id should be apple", "apple", appleDictionary.get("id")); + assertNull("apple should not contain properties from orange metatype", appleDictionary.get("orangeType")); + assertEquals("apple should have properties from apple metatype", "macintosh", appleDictionary.get("appleType")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("serviceObjectClassTest", "a", false); + writer.deleteConfig("apple", "apple", true); + writer.deleteConfig("orange", "orange", true); + writer.deleteConfig("orange", "apple", true); + writeConfiguration(writer); + } + } + + /** + * Reset factories to avoid test contamination + */ + private void resetFactoryTests() { + simpleSOCTest.reset(); + + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/variable/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/variable/TestRunner.java new file mode 100755 index 000000000000..a65b57209881 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/variable/TestRunner.java @@ -0,0 +1,90 @@ +/* +IBM Confidential + * +OCO Source Materials + * +Copyright IBM Corp. 2011 + * +The source code for this program is not published or otherwise divested of +its trade secrets, irrespective of what has been deposited with the U.S. +Copyright Office. + */ +package test.server.config.variable; + +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +public class TestRunner extends BaseTestRunner { + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/variable-config-test", new TestDynamicConfigServlet(), null, null); + } + + public void testVariableChange() throws Exception { + + FactoryTest parent = new FactoryTest("test.config.variable.factory"); + addTest(parent); + + // wait for the initial configurations to be injected. + Dictionary oneDictionary = parent.waitForUpdate("one"); + assertEquals("port", Integer.valueOf(1234), oneDictionary.get("port")); + assertEquals("host", "localhost", oneDictionary.get("host")); + assertEquals("ipAddress", "${localIpAddress}", oneDictionary.get("ipAddress")); + + Dictionary twoDictionary = parent.waitForUpdate("two"); + assertEquals("port", Integer.valueOf(5678), twoDictionary.get("port")); + assertEquals("host", "127.0.0.1", twoDictionary.get("host")); + assertEquals("ipAddress", "${localIpAddress}", twoDictionary.get("ipAddress")); + + ConfigWriter writer; + + // STEP 1: change hostname variable + writer = readConfiguration(); + writer.setValue("variable", "hostname", "name", "value", "ibm.com"); + writeConfiguration(writer); + + // wait for instance one to update + oneDictionary = parent.waitForUpdate("one"); + assertEquals("port", Integer.valueOf(1234), oneDictionary.get("port")); + assertEquals("host", "ibm.com", oneDictionary.get("host")); + assertEquals("ipAddress", "${localIpAddress}", oneDictionary.get("ipAddress")); + + // STEP 2: add localIpAdress variable + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for instance one update + oneDictionary = parent.waitForUpdate("one"); + assertEquals("port", Integer.valueOf(1234), oneDictionary.get("port")); + assertEquals("host", "ibm.com", oneDictionary.get("host")); + assertEquals("ipAddress", "192.168.1.1", oneDictionary.get("ipAddress")); + + // wait for instance two update + twoDictionary = parent.waitForUpdate("two"); + assertEquals("port", Integer.valueOf(5678), twoDictionary.get("port")); + assertEquals("host", "127.0.0.1", twoDictionary.get("host")); + assertEquals("ipAddress", "192.168.1.1", twoDictionary.get("ipAddress")); + + // STEP 3: set localHostNames variable + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for instance two update + twoDictionary = parent.waitForUpdate("two"); + assertEquals("port", Integer.valueOf(5678), twoDictionary.get("port")); + assertEquals("host", "w3.ibm.com", twoDictionary.get("host")); + assertEquals("ipAddress", "192.168.1.1", twoDictionary.get("ipAddress")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/SchemaGeneratorActivator.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/SchemaGeneratorActivator.java new file mode 100755 index 000000000000..6469831a933d --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/SchemaGeneratorActivator.java @@ -0,0 +1,108 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.schema; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.Writer; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseHttpTest; + +import com.ibm.websphere.metatype.SchemaGenerator; +import com.ibm.websphere.metatype.SchemaGeneratorOptions; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; +import com.ibm.wsspi.kernel.service.location.WsResource; + +public class SchemaGeneratorActivator extends BaseHttpTest { + + private BundleContext bundleContext; + private SchemaGenerator schemaGenerator; + private WsLocationAdmin locationService; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + this.bundleContext = context.getBundleContext(); + registerServlet("/schema", new SchemaGeneratorServlet(), null, null); + System.out.println("Schema generator servlet started"); + } + + protected void setSchemaGenerator(SchemaGenerator ref) { + this.schemaGenerator = ref; + } + + protected void unsetSchemaGenerator(SchemaGenerator ref) { + if (ref == this.schemaGenerator) { + this.schemaGenerator = null; + } + } + + protected void setLocationService(WsLocationAdmin ref) { + this.locationService = ref; + } + + protected void unsetLocationService(WsLocationAdmin ref) { + if (ref == this.locationService) { + this.locationService = null; + } + } + + class SchemaGeneratorServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest rq, HttpServletResponse rsp) throws IOException { + Bundle[] bundles = bundleContext.getBundles(); + + SchemaGeneratorOptions options = new SchemaGeneratorOptions(); + options.setEncoding("UTF-8"); + options.setBundles(bundles); + + if ("file".equals(rq.getParameter("output"))) { + // generate schema and output it to a file + WsResource resource = locationService.resolveResource("${server.config.dir}/schema.xsd"); + Writer writer = new OutputStreamWriter(resource.putStream(), "UTF-8"); + PrintWriter pw = rsp.getWriter(); + try { + schemaGenerator.generate(writer, options); + + // Generation didn't die, woohoo! + rsp.setContentType("text/plain"); + pw.println("OK. Wrote: " + resource.toExternalURI()); + } catch (Throwable t) { + System.err.println("Exception " + t); + t.printStackTrace(); + pw.println("ERROR. Exception occurred: " + t.toString()); + } finally { + writer.close(); + pw.close(); + } + } else { + // generate schema and output it back + rsp.setContentType("text/xml"); + rsp.setCharacterEncoding("UTF-8"); + PrintWriter pw = rsp.getWriter(); + schemaGenerator.generate(pw, options); + } + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/TestRunner.java new file mode 100755 index 000000000000..4bc24906d363 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/TestRunner.java @@ -0,0 +1,115 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.schema; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; + +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.w3c.dom.Document; + +import test.server.BaseHttpTest; + +import com.ibm.websphere.metatype.SchemaGenerator; +import com.ibm.websphere.metatype.SchemaGeneratorOptions; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; +import com.ibm.wsspi.kernel.service.location.WsLocationConstants; +import com.ibm.wsspi.kernel.service.location.WsResource; + +public class TestRunner extends BaseHttpTest { + + private BundleContext bundleContext; + private SchemaGenerator schemaGenerator; + private WsLocationAdmin locationService; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + + bundleContext = context.getBundleContext(); + + registerServlet("/schema-test", new TestVerifierServlet(), null, null); + } + + protected void setSchemaGenerator(SchemaGenerator ref) { + this.schemaGenerator = ref; + } + + protected void unsetSchemaGenerator(SchemaGenerator ref) { + if (ref == this.schemaGenerator) { + this.schemaGenerator = null; + } + } + + protected void setLocationService(WsLocationAdmin ref) { + this.locationService = ref; + } + + protected void unsetLocationService(WsLocationAdmin ref) { + if (ref == this.locationService) { + this.locationService = null; + } + } + + class TestVerifierServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest rq, HttpServletResponse rsp) throws IOException { + PrintWriter pw = rsp.getWriter(); + rsp.setContentType("text/plain"); + + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + SchemaGeneratorOptions options = new SchemaGeneratorOptions(); + options.setEncoding("UTF-8"); + options.setBundles(bundleContext.getBundles()); + schemaGenerator.generate(out, options); + out.flush(); + + SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + Schema schema = schemaFactory.newSchema(new StreamSource(new ByteArrayInputStream(out.toByteArray()))); + + DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); + domFactory.setNamespaceAware(true); + DocumentBuilder domBuilder = domFactory.newDocumentBuilder(); + + WsResource resource = locationService.resolveResource(WsLocationConstants.SYMBOL_SERVER_CONFIG_DIR + "test.xml"); + + Document document = domBuilder.parse(resource.get()); + + schema.newValidator().validate(new DOMSource(document)); + + pw.println("OK"); + } catch (Exception e) { + pw.println("FAILED"); + e.printStackTrace(pw); + } + } + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/FeatureListMBeanTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/FeatureListMBeanTest.java new file mode 100755 index 000000000000..f4e67ebccb18 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/FeatureListMBeanTest.java @@ -0,0 +1,149 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.bvt; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedLocationManager; + +import com.ibm.websphere.config.mbeans.FeatureListMBean; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; + +/** + * This test tests basic functionality of the com.ibm.websphere.config.mbeans.FeatureListMBean, + * i.e. whether a non-empty file is generated by the MBean + */ +public class FeatureListMBeanTest { + + private static Class logClass = FeatureListMBeanTest.class; + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + final String methodName = "setUpBeforeClass"; + Log.entering(logClass, methodName); + + String installDir = System.getProperty("install.dir"); + WsLocationAdmin locMgr = (WsLocationAdmin) SharedLocationManager.createDefaultLocations(installDir, getProfile()); + + outputDir = locMgr.resolveString("${server.output.dir}"); + Log.info(logClass, methodName, "serverRoot=" + outputDir); + + // Set up the trust store + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + HostnameVerifier hv = new HostnameVerifier() { + @Override + public boolean verify(String urlHostName, SSLSession session) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(hv); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + Log.info(logClass, methodName, "JMXServiceURL: " + url); + jmxConnector = JMXConnectorFactory.connect(url, environment); + connection = jmxConnector.getMBeanServerConnection(); + assertNotNull("MBeanServerConnection should not be null", connection); + } + + @Test + public void testFeatureListMBean() throws Exception { + String methodName = "testFeatureListMBean"; + Log.entering(logClass, methodName); + + //Invoke feature list generation + ObjectName name = new ObjectName(FeatureListMBean.OBJECT_NAME); + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String" }; + Object[] params = new String[] { "UTF-8", Locale.getDefault().toString(), null }; + @SuppressWarnings("unchecked") + Map returnedMap = (Map) connection.invoke(name, "generate", params, signature); + Log.info(logClass, methodName, returnedMap.toString()); + Log.info(logClass, methodName, "Return code from Returned Map should not be 0: " + returnedMap.get(FeatureListMBean.KEY_RETURN_CODE)); + + //Check return code + assertTrue("Return code is not 0", (Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = (String) returnedMap.get(FeatureListMBean.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/featurelist.xml"; + Log.info(logClass, methodName, "sourcePath: " + sourcePath + "targetPath " + targetPath); + + signature = new String[] { "java.lang.String", "java.lang.String" }; + params = new Object[] { sourcePath, targetPath }; + ObjectName objName = new ObjectName(FileTransferMBean.OBJECT_NAME); + connection.invoke(objName, "downloadFile", params, signature); + + //Check that file is not empty + File file = new File(targetPath); + Log.info(logClass, methodName, "Returned file (targetPath): " + file.length()); + assertTrue("Returned file is empty", file.length() > 0); + Log.exiting(logClass, methodName); + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } + + private static String getProfile() { + return System.getProperty("profile", "com.ibm.ws.config.bvt.schema"); + + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaMBeanTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaMBeanTest.java new file mode 100755 index 000000000000..ca159601a55c --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaMBeanTest.java @@ -0,0 +1,156 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.bvt; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.HashMap; +import java.util.Map; + +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedLocationManager; +import test.common.SharedOutputManager; + +import com.ibm.websphere.config.mbeans.FeatureListMBean; +import com.ibm.websphere.config.mbeans.ServerSchemaGenerator; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; + +/** + * + */ +public class SchemaMBeanTest { + + private static Class logClass = SchemaMBeanTest.class; + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + private static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestRule managerRule = outputMgr; + + @BeforeClass + public static void setUp() throws Exception { + final String methodName = "setUp"; + Log.entering(logClass, methodName); + + String installDir = System.getProperty("install.dir"); + WsLocationAdmin locMgr = (WsLocationAdmin) SharedLocationManager.createDefaultLocations(installDir, getProfile()); + + outputDir = locMgr.resolveString("${server.output.dir}"); + Log.info(logClass, methodName, "serverRoot=" + outputDir); + + // Set up the trust store + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + HostnameVerifier hv = new HostnameVerifier() { + @Override + public boolean verify(String urlHostName, SSLSession session) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(hv); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + Log.info(logClass, methodName, "JMXServiceURL: " + url); + jmxConnector = JMXConnectorFactory.connect(url, environment); + connection = jmxConnector.getMBeanServerConnection(); + assertNotNull("MBeanServerConnection should not be null", connection); + } + + @Test + public void testSchemaMBean() throws Exception { + String methodName = "testSchemaMBean"; + Log.entering(logClass, methodName); + + //Invoke schema generation + ObjectName name = new ObjectName(ServerSchemaGenerator.OBJECT_NAME); + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String" }; + Object[] params = new String[] { null, null, null, null }; + @SuppressWarnings("unchecked") + Map returnedMap = (Map) connection.invoke(name, "generateInstallSchema", params, signature); + Log.info(logClass, methodName, returnedMap.toString()); + Log.info(logClass, methodName, "Return code from Returned Map should not be 0: " + returnedMap.get(FeatureListMBean.KEY_RETURN_CODE)); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/schema.xsd"; + Log.info(logClass, methodName, "sourcePath: " + sourcePath + "targetPath " + targetPath); + + signature = new String[] { "java.lang.String", "java.lang.String" }; + params = new Object[] { sourcePath, targetPath }; + ObjectName objName = new ObjectName(FileTransferMBean.OBJECT_NAME); + connection.invoke(objName, "downloadFile", params, signature); + + //Ensure the file is bigger than 1 MB + File file = new File(targetPath); + Log.info(logClass, methodName, "Returned file (targetPath): " + file.length()); + assertTrue("Returned file is empty", file.length() > 1000000); + Log.exiting(logClass, methodName); + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } + + private static String getProfile() { + return System.getProperty("profile", "com.ibm.ws.config.bvt.schema"); + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaTest.java new file mode 100755 index 000000000000..36fde20df4c6 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaTest.java @@ -0,0 +1,68 @@ +package com.ibm.ws.config.bvt; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; + +public class SchemaTest { + + private static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestRule outputRule = outputMgr; + + private String getPort() { + return System.getProperty("HTTP_default", "8000"); + } + + private String read(InputStream in) throws IOException { + InputStreamReader isr = new InputStreamReader(in); + BufferedReader br = new BufferedReader(isr); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + return builder.toString(); + } + + @Test + public void testSchemaGeneratorAll() throws Exception { + test("/schema?output=file", "testSchemaGeneratorAll"); + } + + private void test(String testUri, String testName) throws Exception { + HttpURLConnection con = null; + try { + URL url = new URL("http://localhost:" + getPort() + testUri); + con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + assertNotNull(is); + + String output = read(is); + System.out.println(output); + assertTrue("Response should start with OK", output.trim().startsWith("OK")); + } finally { + if (con != null) { + con.disconnect(); + } + } + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/ServerXMLConfigurationMBeanTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/ServerXMLConfigurationMBeanTest.java new file mode 100755 index 000000000000..e4233b9f9357 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/ServerXMLConfigurationMBeanTest.java @@ -0,0 +1,113 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.bvt; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedLocationManager; +import test.common.SharedOutputManager; + +import com.ibm.websphere.config.mbeans.ServerXMLConfigurationMBean; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; + +/** + * This test tests the basic functionality of the com.ibm.websphere.config.mbeans.ServerXMLConfigurationMBean. + * It verifies that fetchConfigurationFilePaths() returns the expected collection of file paths and then checks + * that the files can be downloaded using the FileTransferMBean from those paths. + */ +public class ServerXMLConfigurationMBeanTest { + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + private static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestRule managerRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + String installDir = System.getProperty("install.dir"); + WsLocationAdmin locMgr = (WsLocationAdmin) SharedLocationManager.createDefaultLocations(installDir, getProfile()); + + outputDir = locMgr.resolveString("${server.output.dir}"); + + // Set up the trust store + System.setProperty("javax.net.ssl.trustStore", outputDir + "/resources/security/key.jks"); + System.setProperty("javax.net.ssl.trustStorePassword", "Liberty"); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + jmxConnector = JMXConnectorFactory.connect(url, environment); + connection = jmxConnector.getMBeanServerConnection(); + } + + @Test + public void testServerXMLConfigurationMBean() throws Exception { + ObjectName name = new ObjectName(ServerXMLConfigurationMBean.OBJECT_NAME); + @SuppressWarnings("unchecked") + Collection configFilePaths = (Collection) connection.invoke(name, "fetchConfigurationFilePaths", new Object[] {}, new String[] {}); + + // Check that the collection contains the expected file paths. + assertEquals("Config file path collection size is not 2.", 2, configFilePaths.size()); + assertTrue("server.xml is missing from the collection.", + configFilePaths.contains("${server.config.dir}/server.xml")); + assertTrue("bvtTestPorts.xml is missing from the collection.", + configFilePaths.contains("${shared.config.dir}/bvtTestPorts.xml")); + + // Download configuration files. + for (String sourcePath : configFilePaths) { + String targetPath = outputDir + "/download_target/" + + sourcePath.substring(sourcePath.lastIndexOf('/') + 1); + + String[] signature = new String[] { "java.lang.String", "java.lang.String" }; + Object[] params = new Object[] { sourcePath, targetPath }; + ObjectName objName = new ObjectName(FileTransferMBean.OBJECT_NAME); + connection.invoke(objName, "downloadFile", params, signature); + + // Check that file is not empty + File file = new File(targetPath); + assertTrue("Returned file is empty", file.length() > 0); + } + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } + + private static String getProfile() { + return System.getProperty("profile", "com.ibm.ws.config.bvt.schema"); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/delivery.sets b/dev/com.ibm.ws.config_bvt.schema/delivery.sets new file mode 100755 index 000000000000..9a2dcf02d119 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/delivery.sets @@ -0,0 +1 @@ +SLE \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/osgitck-bvt.xml.disabled b/dev/com.ibm.ws.config_bvt.schema/osgitck-bvt.xml.disabled new file mode 100755 index 000000000000..f73b8e4b4fad --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/osgitck-bvt.xml.disabled @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/publish/features/testschema-1.0.mf b/dev/com.ibm.ws.config_bvt.schema/publish/features/testschema-1.0.mf new file mode 100755 index 000000000000..dffbf68043b6 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/publish/features/testschema-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:testschema-1.0 +Subsystem-SymbolicName: testschema-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.server.schema; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/.gitignore b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/.gitignore new file mode 100644 index 000000000000..7f52d8f632f4 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/.gitignore @@ -0,0 +1 @@ +/download_target diff --git a/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/bootstrap.properties b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/bootstrap.properties new file mode 100755 index 000000000000..dee20e162ff3 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/bootstrap.properties @@ -0,0 +1,4 @@ +com.ibm.ws.logging.trace.specification=*=event=enabled:config=all=enabled +com.ibm.ws.logging.max.file.size=0 + +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/jvm.options b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/jvm.options new file mode 100755 index 000000000000..32354345ade5 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/jvm.options @@ -0,0 +1 @@ +-Xmx256M \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/server.xml b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/server.xml new file mode 100755 index 000000000000..d55c4a4e9678 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/server.xml @@ -0,0 +1,15 @@ + + + + + + httpservice-2.2 + testschema-1.0 + restConnector-1.0 + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/.classpath b/dev/com.ibm.ws.config_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/.classpath.gradle b/dev/com.ibm.ws.config_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/.gitignore b/dev/com.ibm.ws.config_fat/.gitignore new file mode 100644 index 000000000000..27e131e35a6b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.config_fat/.project b/dev/com.ibm.ws.config_fat/.project new file mode 100755 index 000000000000..c33ca1c04e7e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.config_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.config_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c92277a371a9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.config_fat/bnd.bnd b/dev/com.ibm.ws.config_fat/bnd.bnd new file mode 100644 index 000000000000..abe08945c206 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/bnd.bnd @@ -0,0 +1,14 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.filetransfer;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.config_fat/bnd.bnd.gradle b/dev/com.ibm.ws.config_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..abe08945c206 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/bnd.bnd.gradle @@ -0,0 +1,14 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.filetransfer;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.config_fat/build-test.xml b/dev/com.ibm.ws.config_fat/build-test.xml new file mode 100755 index 000000000000..d42ad7574427 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/build-test.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.install_test/build.nogradle b/dev/com.ibm.ws.config_fat/build.gradle similarity index 100% rename from dev/com.ibm.ws.install_test/build.nogradle rename to dev/com.ibm.ws.config_fat/build.gradle diff --git a/dev/com.ibm.ws.config_fat/delivery.sets b/dev/com.ibm.ws.config_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/BadConfigTests.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/BadConfigTests.java new file mode 100755 index 000000000000..05ffbca817e4 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/BadConfigTests.java @@ -0,0 +1,124 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.List; + +import org.junit.Test; + +import componenttest.annotation.ExpectedFFDC; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class BadConfigTests { + + @Test + public void testBadPortConfig() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.bad"); + server.startServer("badconfig.log"); + + try { + // Start the server with bad configuration + assertNotNull("There should be an error during server start", server.waitForStringInLog("CWWKG0075E.*missingbvt.prop.HTTP_default.*")); + assertNotNull("The server should start", server.waitForStringInLog("CWWKF0011I.*")); + assertNull("There should not be a cached instance used", server.waitForStringInLog("CWWKG0076W", 1000)); + + // Update the configuration to good values + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("badconfig/goodConfig.xml"); + + assertNotNull("The config should be updated", server.waitForStringInLogUsingMark("CWWKG0017I.*")); + assertNull("There should not be a validation error", server.waitForStringInLogUsingMark("CWWKG0075E", 1000)); + + // Update at runtime to an invalid configuration. The cached values should still be used + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("badconfig/badHttp.xml"); + + assertNotNull("There should be an error during server start", server.waitForStringInLogUsingMark("CWWKG0075E.*missingbvt.prop.HTTP_default.*")); + assertNotNull("There should be a cached instance used", server.waitForStringInLogUsingMark("CWWKG0076W")); + assertNotNull("The config should be updated", server.waitForStringInLogUsingMark("CWWKG0017I.*")); + + // Update a singleton () at runtime. The cached values should still be used + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("badconfig/badLogging.xml"); + + assertNotNull("There should be a warning during server start", server.waitForStringInLogUsingMark("CWWKG0083W.*maxFiles.*-1.*2.*")); + assertNotNull("The config should be updated", server.waitForStringInLogUsingMark("CWWKG0017I.*")); + + } finally { + server.stopServer(); + } + + } + + @Test + public void testUniqueValueConflictConfig() throws Exception { + + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.uniquevalueconflict"); + server.startServer("uniquevalueconflict.log"); + try { + // Update the configuration to good values + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("badconfig/UniqueValueConflict.xml"); + + assertNotNull(" Distinct values specified for the attribute", server.waitForStringInLogUsingMark("CWWKG0031E.*")); + assertNotNull(" ConfigUpdateException does not occur", server.waitForStringInLogUsingMark("CWWKG0074E.*")); + } + + finally { + server.stopServer(); + } + + } + + @Test + public void testInvalidOptionInJDBCConfig() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.invalidJDBCoption"); + server.startServer("invalidJDBCoption.log"); + + assertNotNull("The server should start", server.waitForStringInLog("CWWKF0011I.*")); + + // Clear log offsets so we can search for all warning messages + server.resetLogOffsets(); + + try { + List matches = server.findStringsInLogs("CWWKG0032W.*createDatabase.*whatever.*"); + // Start the server with invalid configuration and ensure that the warning is printed exactly once + assertEquals("There should be exactly one (1) warning for createDatabase", 1, matches.size()); + } finally { + server.stopServer(); + } + + } + + @Test + @ExpectedFFDC("java.net.MalformedURLException") + public void testInvalidOptionalInclude() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.invalidOptionalInclude"); + server.startServer("invalidOptionalInclude.log"); + + try { + // Start the server, skipping the optional include with a bad protocol - ensure warning message is printed + assertNotNull("There should be an error during server start", server.waitForStringInLog("CWWKG0084W.*bogus.*")); + } finally { + server.stopServer(); + } + + } +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ChildAliasTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ChildAliasTest.java new file mode 100755 index 000000000000..c518137022be --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ChildAliasTest.java @@ -0,0 +1,236 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ChildAliasTest { + + /** + * Utility to set the method name as a String before the test + */ + @Rule + public TestName name = new TestName(); + + public String testName = ""; + + @Before + public void setTestName() { + // set the current test name + testName = name.getMethodName(); + } + + private static final String CONTEXT_ROOT = "/childalias"; + + private static LibertyServer testServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.childalias"); + + @BeforeClass + public static void setUpForConfigExtensionsTests() throws Exception { + //copy the extensions tests features into the server features location + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/childAliasTest-1.0.mf"); + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/childAliasTestB-1.0.mf"); + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/childAliasTestC-1.0.mf"); + + // Copy the config fat internal feature + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + //copy the extensions tests bundles into the server lib location + testServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.childalias_1.0.0.jar"); + testServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.childalias.b_1.0.0.jar"); + testServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.childalias.c_1.0.0.jar"); + + testServer.startServer(); + //make sure the URL is available + assertNotNull(testServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(testServer.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + testServer.stopServer(); + testServer.deleteFileFromLibertyInstallRoot("lib/features/childAliasTest-1.0.mf"); + testServer.deleteFileFromLibertyInstallRoot("lib/features/childAliasTestB-1.0.mf"); + testServer.deleteFileFromLibertyInstallRoot("lib/features/childAliasTestC-1.0.mf"); + testServer.deleteFileFromLibertyInstallRoot("lib/test.config.childalias_1.0.0.jar"); + testServer.deleteFileFromLibertyInstallRoot("lib/test.config.childalias.b_1.0.0.jar"); + testServer.deleteFileFromLibertyInstallRoot("lib/test.config.childalias.c_1.0.0.jar"); + + testServer.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + } + + @Test + public void testChildAlias1() throws Exception { + test(testServer); + } + + @Test + public void testChildAlias2() throws Exception { + test(testServer); + } + + @Test + public void testChildAliasSingleton1() throws Exception { + test(testServer); + } + + @Test + public void testChildAliasSingleton2() throws Exception { + test(testServer); + } + + @Test + public void testBundleOrdering1() throws Exception { + // Because this test ensures bundle ordering with config elements defined + // in different bundles, a fresh start of the server with the config is needed + // so that this test can run in any order while simulating bundle start ordering. + testServer.stopServer(); + testServer.setServerConfigurationFile("childalias/server.xml"); + testServer.startServer(); + + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverB.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testBundleOrdering2() throws Exception { + // Because this test ensures bundle ordering with config elements defined + // in different bundles, a fresh start of the server with the config is needed + // so that this test can run in any order while simulating bundle start ordering. + testServer.stopServer(); + testServer.setServerConfigurationFile("childalias/serverB.xml"); + testServer.startServer(); + + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testBundleOrderingAliasConflict() throws Exception { + // Because this test ensures bundle ordering with config elements defined + // in different bundles, a fresh start of the server with the config is needed + // so that this test can run in any order while simulating bundle start ordering. + testServer.stopServer(); + testServer.setServerConfigurationFile("childalias/serverB.xml"); + testServer.startServer(); + + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testRemoveChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC2.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testAddNewChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC3.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testUpdateChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC4.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testRemoveSingletonChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC5.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testAddNewSingletonChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC6.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testUpdateSingletonChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC7.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + private void test(LibertyServer server) throws Exception { + HttpURLConnection con = null; + try { + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + + CONTEXT_ROOT + "/child-alias-test?" + "testName=" + testName); + con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + assertNotNull(is); + + String output = read(is); + System.out.println(output); + assertTrue(output, output.trim().startsWith("OK")); + } finally { + if (con != null) { + con.disconnect(); + } + } + } + + private static String read(InputStream in) throws IOException { + InputStreamReader isr = new InputStreamReader(in); + BufferedReader br = new BufferedReader(isr); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + return builder.toString(); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigExtensionsTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigExtensionsTest.java new file mode 100755 index 000000000000..87a0274de053 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigExtensionsTest.java @@ -0,0 +1,298 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +/** + * + */ +public class ConfigExtensionsTest { + + /** + * Utility to set the method name as a String before the test + */ + @Rule + public TestName name = new TestName(); + + public String testName = ""; + private static final String servicePidName = "service.pid"; + + @Before + public void setTestName() { + // set the current test name + testName = name.getMethodName(); + } + + private static final String CONTEXT_ROOT = "/config-extensions-test"; + private static final String PID_PASS = "PASSED: test bundle was called with properties for ID"; + private static LibertyServer extensionsServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.extensions"); + + @BeforeClass + public static void setUpForConfigExtensionsTests() throws Exception { + //copy the extensions tests features into the server features location + extensionsServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configExtensionsTest-1.0.mf"); + extensionsServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configExtensionsTestB-1.0.mf"); + //copy the extensions tests bundles into the server lib location + extensionsServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.extensions_1.0.0.jar"); + extensionsServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.extensions.b_1.0.0.jar"); + extensionsServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.extensions.schema.generator_1.0.0.jar"); + + //use our default server.xml to start with + extensionsServer.setServerConfigurationFile("extensions/server.xml"); + extensionsServer.startServer(); + //make sure the URL is available + extensionsServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT); + } + + @AfterClass + public static void shutdown() throws Exception { + extensionsServer.stopServer(); + // Delete the files we copied over + extensionsServer.deleteFileFromLibertyInstallRoot("lib/features/configExtensionsTest-1.0.mf"); + extensionsServer.deleteFileFromLibertyInstallRoot("lib/features/configExtensionsTestB-1.0.mf"); + + extensionsServer.deleteFileFromLibertyInstallRoot("lib/test.config.extensions_1.0.0.jar"); + extensionsServer.deleteFileFromLibertyInstallRoot("lib/test.config.extensions.b_1.0.0.jar"); + extensionsServer.deleteFileFromLibertyInstallRoot("lib/test.config.extensions.schema.generator_1.0.0.jar"); + + } + + /** + * Tests whether the ibm:extends works at runtime. + * The test verifies that the delegating factory service registered by the ExtendedMetatypeManager + * does make a call to the factory service that is provided by the super type + */ + @Test + public void testExtendsBasic() throws Exception { + String servicePid = servicePidName + "=test.config.extensions.super"; + //verify that the MSF was called with config for the correct id as expected + //If the ID property was incorrect, the delegating listener forwarded the wrong information or was provided the wrong information by config + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.config1&" + servicePid, PID_PASS); + } + + /** + * Tests whether the ibm:rename works at runtime. + * The test verifies that an attribute specified in the server.xml using an ibm:rename + * gets converted to the original name before being passed back to the super type. + */ + @Test + public void testExtendsRename() throws Exception { + String servicePid = servicePidName + "=test.config.extensions.super"; + //check that the renamed property came from test.config.extensions.sub configuration + //If the renamed property value was not correct, the delegating listener did not pass the value back to the original key name or did not detect the rename + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.config1&prop=testAttribute1&" + servicePid, "renamed value"); + } + + /** + * This is the same as testExtendsBasic, but for a sub type that ibm:extends another + * sub type, so it checks that the service factory call gets delegated all the way back to the + * top of the stack. + */ + @Test + public void testExtendsHierarchy() throws Exception { + String servicePid = servicePidName + "=test.config.extensions.super"; + //check that the properties supplied for next go through the hierarchy to the top parent + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.sub.config1&" + servicePid, PID_PASS); + + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.sub.config1&prop=testAttribute1&" + servicePid, "rqd"); + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.sub.config1&prop=testAttribute2&" + servicePid, "2"); + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.sub.config1&prop=testAttr3RenameSub&" + servicePid, "3"); + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.sub.config1&prop=testAttribute4&" + servicePid, "four"); + } + + /** + * This tests the error scenario where someone tries to use the ibm:extends + * attribute on a non-factory PID + */ + @Test + public void testExtendsNonFactory() throws Exception { + String id = "CWWKG0061E"; + assertNotNull("The error message " + id + " for trying to use ibm:extends on a non-factory PID was not found", + extensionsServer.waitForStringInLog(id + ".*test\\.config\\.extensions\\.sub\\.non\\.factorypid.*test\\.config\\.extensions\\.sub")); + } + + /** + * This tests the error scenario where someone tries uses the ibm:extends + * attribute on a factory PID, but the specified super is a non-factory PID + */ + @Test + public void testExtendsNonFactorySuper() { + String id = "CWWKG0062E"; + assertNotNull("The error message " + id + " for trying to use ibm:extends with a non-factory super was not found", + extensionsServer.waitForStringInLog(id + ".*test\\.config\\.extensions\\.parent\\.non\\.factorypid.*test\\.config\\.extensions\\.extends\\.non\\.factorypid")); + } + + /** + * This tests the scenario where ibm:extends provides a value that does not exist + */ + @Test + public void testInvalidSuper() { + String id = "CWWKG0059E"; + assertNotNull("The error message " + id + " for invalid super was not found", + extensionsServer.waitForStringInLog(id + ".*test\\.config\\.extensions\\.sub\\.error\\.no\\.parent\\.pid.*test\\.config\\.extensions\\.invalid\\.parent")); + } + + /** + * This tests the scenario where ibm:extends provides a value that does not exist + */ + @Test + public void testInvalidRename() { + String id = "CWWKG0067E"; + assertNotNull( + "The error message " + id + " for invalid rename was not found", + extensionsServer.waitForStringInLog(id + + ".*testInvalidAttribute.*testInvalidAttrRename.*test\\.config\\.extensions\\.sub\\.error\\.no\\.parent\\.override\\.attr")); + } + + @Test + public void testRequiredAttributes() { + String id = "CWWKG0058E"; + //[ERROR ] CWWKG0058E: test.config.extensions.extends.attr.required is missing required attribute testAttr4 + assertNotNull("The error message " + id + " for a missing required attribute defined on a sub type was not found", + extensionsServer.waitForStringInLog(id + ".*" + + "test\\.config\\.extensions\\.extends\\.attr\\.required" + + ".*" + + "testAttr4")); + + assertNotNull("The error message " + id + " for a missing required attribute defined on a super type was not found", + extensionsServer.waitForStringInLog(id + ".*" + + "test\\.config\\.extensions\\.extends\\.attr\\.required\\.parent" + + ".*" + + "testAttribute2")); + } + + @Test + public void testAttemptToOverrideFinalMeta() { + String id = "CWWKG0060E"; + assertNotNull("The error message " + id + " for attempting to re-assign a final value was not found", + extensionsServer.waitForStringInLog(id + ".*" + "testOverrideFinal" + ".*" + "test.config.extensions.override.final" + ".*" + "test.config.extensions.super")); + } + + /** + * This tests the scenario where ibm:extends is used on an OCD when the super type does not exist. + * A feature is then installed that provides the super. + * After the feature is installed it should be possible to use the sub type. + * + * This test requires a different server configuration, so it must restore + * the original that other tests rely upon. + */ + @Test + public void testLateArrivingSecondBundleSuper() throws Exception { + try { + //stop the server, collecting logs from any previous tests + //and switch to the alternate serverB1.xml config + extensionsServer.stopServer(true); + extensionsServer.setServerConfigurationFile("extensions/serverB1.xml"); + extensionsServer.startServer(); + String id = "CWWKG0059E"; + assertNotNull("The error message " + id + " for invalid super was not found", + extensionsServer.waitForStringInLog(id + ".*test\\.config\\.extensions\\.different\\.bundle.*test\\.config\\.extensions\\.super")); + //now switch on the bundle providing the super (and our test system wab) + //by setting the serverB2.xml config + extensionsServer.setMarkToEndOfLog(); + extensionsServer.setServerConfigurationFile("extensions/serverB2.xml"); + //wait for our test app to be available + extensionsServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT); + String servicePid = servicePidName + "=test.config.extensions.super"; + //now check that the super got a call for the sub defined in the other bundle + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.different.bundle.config&" + servicePid, PID_PASS); + } finally { + //stop and package up this server + extensionsServer.stopServer(true); + //restore the original server.xml + //by setting our original server.xml back again + extensionsServer.setServerConfigurationFile("extensions/server.xml"); + //and finally restart the server + extensionsServer.startServer(); + //make sure the URL is available + extensionsServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT); + } + } + + /** + * This test requires a different server configuration, so it must restore + * the original that other tests rely upon. + * + * @throws Exception + */ + @Test + public void testSchemaGeneratorErrorMessages() throws Exception { + try { + extensionsServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configExtensionsSchemaGeneratorTest-1.0.mf"); + extensionsServer.stopServer(true); + extensionsServer.setServerConfigurationFile("extensions/serverSchemaGenerator.xml"); + extensionsServer.startServer(); + + String msgId = "CWWKG0063E"; + assertNotNull("Expected message " + msgId + " not found in log.", extensionsServer.waitForStringInLog(msgId + ".*testInvalidAttribute")); + + msgId = "CWWKG0064E"; + assertNotNull("Expected message " + msgId + " not found in log.", extensionsServer.waitForStringInLog(msgId + ".*testAttr2Rename")); + + msgId = "CWWKG0065E"; + assertNotNull("Expected message " + msgId + " not found in log.", extensionsServer.waitForStringInLog(msgId + ".*test.config.extensions.parent.non.factorypid")); + + msgId = "CWWKG0066E"; + assertNotNull("Expected message " + msgId + " not found in log.", extensionsServer.waitForStringInLog(msgId + ".*test.config.extensions.sub.error.no.parent.pid")); + } finally { + //stop and package up this server + extensionsServer.stopServer(true); + //restore the original server.xml + //by setting our original server.xml back again + extensionsServer.setServerConfigurationFile("extensions/server.xml"); + //and finally restart the server + extensionsServer.startServer(); + //make sure the URL is available + extensionsServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT); + } + } + + /** + * This tests the scenario where a PID that extends another PID that has a name=internal attr, is configured correctly. + */ + @Test + public void testInternalExtension() throws Exception { + + String servicePid = servicePidName + "=test.config.extensions.internal.super"; + + //check that the required attribute has been set on the internal super class + HttpUtils.findStringInUrl(extensionsServer, + CONTEXT_ROOT + "/test?pid=test.config.extensions.internal.sub1&id=internal1&prop=internalAttr1&" + servicePid, + "sub1Attr1"); + } + + /** + * This tests the scenario where a PID that extends another PID that has a name=internal attr, and is missing a required attr, issues the + * expected error message. + */ + @Test + public void testInternalExtensionWithMissingRequiredAttribute() throws Exception { + + String id = "CWWKG0058E"; + assertNotNull( + "The error message " + id + " for internal required attribute was not found", + extensionsServer.waitForStringInLog(id + ".*internalsub2.*internalAttr1")); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigValidatorTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigValidatorTest.java new file mode 100755 index 000000000000..a84ea7cb8ac6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigValidatorTest.java @@ -0,0 +1,112 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import componenttest.annotation.ExpectedFFDC; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Tests the XML signing and validation functions, ensuring correct behavior when signing is enforced + * and invalid documents are encountered. + */ +public class ConfigValidatorTest { + + // Since we have tracing enabled give server longer timeout to start up. + private static final long SERVER_START_TIMEOUT = 30 * 1000; + + @Test + @ExpectedFFDC({ "com.ibm.websphere.config.ConfigValidationException", "java.lang.ClassNotFoundException" }) + public void testValidator() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.validator"); + String jarName = "com.ibm.ws.config.ext_1.0." + server.getMicroVersion() + ".jar"; + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + // Backup fragment and bring in embedder validation fragment + LibertyFileManager.renameLibertyFile(server.getMachine(), + server.getInstallRoot() + "/lib/" + jarName, + server.getInstallRoot() + "/lib/" + jarName + ".bak"); + server.copyFileToLibertyInstallRoot("lib", "validator/" + jarName); + + try { + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + server.startServer("goodSignature.log", true, true, false); + assertNotNull("Configuration validation should be issued", + server.waitForStringInLog("CWWKG0043I:.*EmbeddedXMLConfigValidator")); + + // Copy in invalid server.xml, trigger refresh + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("validator/bad-signature.xml"); + assertNotNull("An error message should be issued with invalid config refresh", + server.waitForStringInLog("CWWKG0047E:.*")); + assertNotNull("A warning message should be issued with invalid config refresh", + server.waitForStringInLog("CWWKG0057W:.*")); + assertTrue(server.isStarted()); + + // Stop server, don't clean up. + server.stopServer(false); + + try { + server.startServerExpectFailure("badSignature.log", false, false); + } catch (Exception e) { + System.out.println("Caught exception of type " + e.getClass()); + } + assertNotNull("An error message should be issued on invalid config startup", + server.waitForStringInLog("CWWKG0047E:.*")); + assertNotNull("A fatal message should be issued on invalid config startup", + server.waitForStringInLog("CWWKG0044E:.*")); + assertNotNull("The server should be stopped after invalid config startup", + server.waitForStringInLog("CWWKE0036I:.*")); + + // Stop server, don't clean up. + server.stopServer(false); + + // Copy in invalid server.xml + server.setServerConfigurationFile("validator/dropins-enabled.xml"); + + try { + server.startServerExpectFailure("dropinsEnabled.log", false, false); + } catch (Exception e) { + System.out.println("Caught exception of type " + e.getClass()); + } + assertNotNull("There should be a message about a valid signature", + server.waitForStringInLog("CWWKG0055I:.*")); + assertNotNull("There should be a fatal message because dropins are enabled", + server.waitForStringInLog("CWWKG0056E:.*")); + assertNotNull("The server should be stopped after invalid config startup", + server.waitForStringInLog("CWWKE0036I:.*")); + + } finally { + // Just in case one of the conditions above failed, make sure the server + // stops. Skip the server archive here (it would get skipped for already stopped) + server.stopServer(false); + + // Make sure we *do* capture the data for these attempts + server.postStopServerArchive(); + + // Restore default validation fragment + LibertyFileManager.deleteLibertyFile(server.getMachine(), + server.getInstallRoot() + "/lib/" + jarName); + LibertyFileManager.renameLibertyFile(server.getMachine(), + server.getInstallRoot() + "/lib/" + jarName + ".bak", + server.getInstallRoot() + "/lib/" + jarName); + } + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DelayedVariableTests.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DelayedVariableTests.java new file mode 100755 index 000000000000..bc10c617f117 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DelayedVariableTests.java @@ -0,0 +1,56 @@ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class DelayedVariableTests extends ServletRunner { + + private static final String CONTEXT_ROOT = "varmergedconfig"; + + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + @Override + protected String getServletMapping() { + return "delayedVarTests"; + } + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.delayedVar"); + + @Test + public void testVariableDelay() throws Exception { + test(server); + } + + @BeforeClass + public static void setUpForMergedConfigTests() throws Exception { + //copy the config feature into the server features location + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/delayedVariable-1.0.mf"); + + //copy the bundle into the server lib location + server.copyFileToLibertyInstallRoot("lib", "bundles/test.config.variables_1.0.0.jar"); + + server.startServer("delayedVariables.log"); + //make sure the URL is available + assertNotNull(server.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(server.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + server.deleteFileFromLibertyInstallRoot("lib/test.config.variables_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/features/delayedVariable-1.0.mf"); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DropinsTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DropinsTest.java new file mode 100755 index 000000000000..bcb4ce55d854 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DropinsTest.java @@ -0,0 +1,240 @@ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.annotation.ExpectedFFDC; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class DropinsTest extends ServletRunner { + + private static final String CONTEXT_ROOT = "configdropins"; + + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + @Override + protected String getServletMapping() { + return "dropinsTest"; + } + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.dropins"); + + @Test + public void testNonXmlFile() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple.notxml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple.notxml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + @ExpectedFFDC("com.ibm.websphere.config.ConfigParserException") + public void testBrokenDropin() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple.xml"); + server.addDropinDefaultConfiguration("dropins/aBrokenFile.xml"); + server.addDropinOverrideConfiguration("dropins/aBrokenFile.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + assertEquals("There should be two CWWKG0014E errors", 2, server.waitForMultipleStringsInLog(2, "CWWKG0014E")); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple.xml"); + server.deleteDropinDefaultConfiguration("aBrokenFile.xml"); + server.deleteDropinOverrideConfiguration("aBrokenFile.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testSimpleDefaults() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testSimpleOverrides() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testSimpleOverrides2() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testDefaultsOrdering() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testOverridesOrdering() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testNoServerValue1() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testNoServerValue2() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testNoServerValue3() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/blibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("blibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @BeforeClass + public static void setUpForDropinsTests() throws Exception { + //copy the feature into the server features location + + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + // Delete dropin configurations just in case + server.deleteAllDropinConfigurations(); + + server.startServer("configDropins.log"); + + //make sure the URL is available + assertNotNull(server.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(server.waitForStringInLog("CWWKF0011I")); + + } + + @AfterClass + public static void shutdown() throws Exception { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FATSuite.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FATSuite.java new file mode 100755 index 000000000000..845f3c16802e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FATSuite.java @@ -0,0 +1,39 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ + ServerConfigTest.class, + ConfigExtensionsTest.class, + ConfigValidatorTest.class, + ChildAliasTest.class, + ProductExtensionsTest.class, + BadConfigTests.class, + MergedConfigTests.class, + VariableMergeTests.class, + MetatypeProviderTest.class, + WSConfigurationHelperTest.class, + SchemaGeneratorMBeanTest.class, + FeaturelistGeneratorMBeanTest.class, + ServerXMLConfigurationMBeanTest.class, + DropinsTest.class, + DelayedVariableTests.class + +}) +public class FATSuite { + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeatureUpdateTests.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeatureUpdateTests.java new file mode 100755 index 000000000000..64da2e209a9c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeatureUpdateTests.java @@ -0,0 +1,107 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Collections; +import java.util.Set; + +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class FeatureUpdateTests { + private void test(LibertyServer server, String testUri) throws Exception { + HttpURLConnection con = null; + try { + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + testUri); + con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + assertNotNull(is); + + String output = read(is); + System.out.println(output); + assertTrue(output, output.trim().startsWith("Test Passed")); + } finally { + if (con != null) { + con.disconnect(); + } + } + } + + private static String read(InputStream in) throws IOException { + InputStreamReader isr = new InputStreamReader(in); + BufferedReader br = new BufferedReader(isr); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + return builder.toString(); + } + + private final Set emptySet = Collections.emptySet(); + + // Just make sure we don't get an FFDC when we remove a feature that something else has a reference to. + // In this test, the reference is also ibm:flat + @Test + public void testFeatureRemovalFlat() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.features"); + server.startServer("removeJDBCFeature.log"); + + try { + // switch to new configuration to remove jdbc-4.0 feature + server.setServerConfigurationFile("featureRemove/serverRemoveJDBC.xml"); + assertNotNull("The server configuration update should complete", + server.waitForConfigUpdateInLogUsingMark(emptySet)); + } finally { + server.stopServer(); + } + + } + + // Just make sure we don't get an FFDC when we remove a feature that something else has a reference to. + // In this test, the reference is not marked ibm:flat + // We're also removing the configuration that the OpenID feature config points to. + @Test + public void testFeatureRemoval() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.features"); + server.startServer("removeOpenIDFeature.log"); + + try { + // switch to new configuration to remove jdbc-4.0 feature + server.setServerConfigurationFile("featureRemove/serverRemoveOpenID.xml"); + assertNotNull("The server configuration update should complete", + server.waitForConfigUpdateInLogUsingMark(emptySet)); + } finally { + server.stopServer(); + } + + } +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeaturelistGeneratorMBeanTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeaturelistGeneratorMBeanTest.java new file mode 100755 index 000000000000..08210a096c27 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeaturelistGeneratorMBeanTest.java @@ -0,0 +1,376 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import javax.management.JMX; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.config.mbeans.FeatureListMBean; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * FAT-Tests to test the functionality of com.ibm.websphere.config.mbeans.FeatureListMBean + */ +public class FeaturelistGeneratorMBeanTest { + + private static Class logClass = FeaturelistGeneratorMBeanTest.class; + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.schemaGen.mbean"); + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + + private static ObjectName featurelistGenObjName; + private static ObjectName fileTranObjectName; + + @BeforeClass + public static void setUp() throws Exception { + final String methodName = "setUp"; + Log.entering(logClass, methodName); + + outputDir = server.getServerRoot(); + Log.info(logClass, methodName, "serverRoot=" + outputDir); + + Log.info(logClass, methodName, "Starting server=" + server.getServerName()); + server.startServer(); + + Log.info(logClass, methodName, "Waiting for 'CWWKT0016I.*IBMJMXConnectorREST'"); + assertNotNull("'CWWKT0016I.*IBMJMXConnectorREST' was not received on server", + server.waitForStringInLog("CWWKT0016I.*IBMJMXConnectorREST")); + + Log.info(logClass, methodName, "Waiting for 'CWWKO0219I.*ssl'"); + assertNotNull("'CWWKO0219I.*ssl' was not recieved on server", + server.waitForStringInLog("CWWKO0219I.*ssl")); + + Log.info(logClass, methodName, "Waiting for 'CWPKI0803A.*ssl'"); + assertNotNull("'CWPKI0803A.*ssl' was not generated on server", + server.waitForStringInLog("CWPKI0803A")); + + Log.info(logClass, methodName, "Waiting for 'CWWKS0008I: The security service is ready'"); + assertNotNull("'CWWKS0008I: The security service is ready' was not generated on server", + server.waitForStringInLog("CWWKS0008I")); + + Log.info(logClass, methodName, "Waiting for 'CWWKS4105I: LTPA configuration is ready'"); + assertNotNull("'CWWKS4105I: LTPA configuration is ready' was not generated on server", + server.waitForStringInLog("CWWKS4105I")); + + // Set up the trust store + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + HostnameVerifier hv = new HostnameVerifier() { + @Override + public boolean verify(String urlHostName, SSLSession session) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(hv); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + Log.info(logClass, methodName, "JMXServiceURL=" + url.toString()); + jmxConnector = JMXConnectorFactory.connect(url, environment); + assertNotNull("JMXConnector should not be null", jmxConnector); + connection = jmxConnector.getMBeanServerConnection(); + assertNotNull("MBeanServerConnection should not be null", connection); + + featurelistGenObjName = new ObjectName(FeatureListMBean.OBJECT_NAME); + fileTranObjectName = new ObjectName(FileTransferMBean.OBJECT_NAME); + + Log.exiting(logClass, "setUp"); + } + + @AfterClass + public static void cleanUp() throws Exception { + String methodName = "tearDown"; + Log.entering(logClass, methodName); + + if (server != null && server.isStarted()) { + Log.finer(logClass, methodName, "Server is up, stopping it"); + jmxConnector.close(); + server.stopServer(); + } + Log.exiting(logClass, methodName); + } + + /** + * Invoke FeaturelistMBean.generate method + * + * @param params + * @return response from MBean invoke + * @throws Exception + */ + private Map invokeFeatureListMBeanGenerate(Object[] params) throws Exception { + Log.entering(logClass, "invokeFeatureListMBeanGenerate", params); + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String" }; + + @SuppressWarnings("unchecked") + Map returnedMap = (Map) connection.invoke(featurelistGenObjName, "generate", params, signature); + Log.info(logClass, "invokeFeatureListMBeanGenerate", returnedMap.toString()); + Log.exiting(logClass, "invokeFeatureListMBeanGenerate", returnedMap); + return returnedMap; + } + + /** + * Invoke FileTransferMBean.downloadFile method + * + * @param params + * @throws Exception + */ + private void invokeFileTransferMBeanDownloadFile(Object[] params) throws Exception { + Log.entering(logClass, "invokeFileTransferMBeanDownloadFile", params); + String[] signature = new String[] { "java.lang.String", "java.lang.String" }; + connection.invoke(fileTranObjectName, "downloadFile", params, signature); + Log.exiting(logClass, "invokeFileTransferMBeanDownloadFile"); + } + + /** + * Invoke FileTransferMBean.deleteFile method + * + * @param params + * @throws Exception + */ + private void invokeFileTransferMBeanDeleteFile(Object[] params) throws Exception { + Log.entering(logClass, "invokeFileTransferMBeanDeleteFile", params); + String[] signature = new String[] { "java.lang.String" }; + connection.invoke(fileTranObjectName, "deleteFile", params, signature); + Log.exiting(logClass, "invokeFileTransferMBeanDeleteFile"); + } + + /** + * Invoke FeaturelistMBean.generate method + * + * @param encoding, locale, productExtension is empty + * @throws Exception + */ + @Test + public void testEmptyStrings() throws Exception { + //Invoke featureList generation + Object[] params = new String[] { "", "", "" }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue((Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Ensure generated file is bigger than 0.1 MB + String filePath = returnedMap.get(FeatureListMBean.KEY_FILE_PATH).toString(); + File file = new File(filePath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath(), file.length() > 100000); + } + + /** + * Invoke FeaturelistMBean.generate method + * + * @param encoding, locale, productExtension is empty + * @throws Exception + */ + @Test + public void testInvalidEncoding() throws Exception { + final String encodingValue = "en-Test"; + + Object[] params = new String[] { encodingValue, null, null }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue("Return Code should be 21 and not 0", (Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) != 0); + + //Retrieve output + String output = (String) returnedMap.get(FeatureListMBean.KEY_OUTPUT); + assertTrue("Output does not contain expected UnsupportedEncodingException. output=" + output, output.contains("java.io.UnsupportedEncodingException: " + encodingValue)); + } + + /** + * Invoke FeaturelistMBean.generate method + * + * @param encoding, locale is invalid, productExtension + * @throws Exception + */ + @Test + public void testInvalidLocale() throws Exception { + final String localeValue = "localeTest"; + + Object[] params = new String[] { null, localeValue, null }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue("Return Code should be 0", (Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Ensure generated file is bigger than 0.1 MB + String filePath = returnedMap.get(FeatureListMBean.KEY_FILE_PATH).toString(); + File file = new File(filePath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath(), file.length() > 100000); + } + + /** + * Invoke FeaturelistMBean.generate method + * + * @param encoding, locale, productExtension is invalid + * @throws Exception + */ + @Test + public void testInvalidProductExt() throws Exception { + final String productExtValue = "productExt"; + + Object[] params = new String[] { null, null, productExtValue }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue("Return Code should be 21 and not 0", (Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 21); + + //Retrieve output + String output = (String) returnedMap.get(FeatureListMBean.KEY_OUTPUT); + assertTrue("Output does not contain expected CWWKG0080E. output=" + output, + output.contains("CWWKG0080E")); + } + + /** + * Invoke FeaturelistMBean.generate method and using FileTransferMBean remotely to download + * feature list file and deletes it + * + * @param encoding, locale, productExtension is empty + * @throws Exception + */ + @Test + public void testGenerateDownloadAndDelete() throws Exception { + Object[] params = new String[] { "UTF-16", "fr", "" }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue((Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = returnedMap.get(FeatureListMBean.KEY_FILE_PATH).toString(); + String targetPath = outputDir + "/download_target/featurelistNonDefault.xml"; + + params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than 0.1 MB + File file = new File(targetPath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath(), file.length() > 100000); + + // Remotely delete the generated featurelist file + RemoteFile remoteFile = server.getMachine().getFile(sourcePath); + + //first check if the file exists + assertTrue("Generated featurelist file should exist at this point. remoteFile=" + remoteFile.getAbsolutePath(), remoteFile.exists()); + + params = new Object[] { remoteFile.getAbsolutePath() }; + invokeFileTransferMBeanDeleteFile(params); + + //Verify the file is deleted + assertFalse("Generated featurelist file should have been deleted. remoteFile=" + remoteFile.getAbsolutePath(), remoteFile.exists()); + } + + /** + * Invoke FeaturelistMBean.generate method with correct parameters + * + * @param encoding, locale, productExtension + * @throws Exception + */ + @Test + public void testGenerateSuccessfulFeaturelist() throws Exception { + Object[] params = new String[] { "UTF-8", Locale.getDefault().toString(), null }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue((Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Ensure generated file is bigger than 0.1 MB + String filePath = returnedMap.get(FeatureListMBean.KEY_FILE_PATH).toString(); + File file = new File(filePath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath(), file.length() > 100000); + + } + + /** + * Invoke FeaturelistMBean.generate method using the JMX MBean API + * downloads the feature list and transfers it over using FileTransfer MBean + * + * @param encoding, locale, productExtension + * @throws Exception + */ + @Test + public void testFeaturelistGenMBeanCallAPI() throws Exception { + FeatureListMBean featurelistGenMbean = JMX.newMBeanProxy(connection, featurelistGenObjName, FeatureListMBean.class); + assertNotNull("We should have got access to the FeatureListMBean API", featurelistGenMbean); + + Map returnedMap = featurelistGenMbean.generate(null, null, null); //encoding, locale, productExtension + + //Check return code + assertTrue((Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = returnedMap.get(FeatureListMBean.KEY_FILE_PATH).toString(); + String targetPath = outputDir + "/download_target/featurelistNonDefault.xml"; + + Object[] params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than 0.1 MB + File file = new File(targetPath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath(), file.length() > 100000); + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MergedConfigTests.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MergedConfigTests.java new file mode 100755 index 000000000000..2d490b5b5905 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MergedConfigTests.java @@ -0,0 +1,141 @@ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class MergedConfigTests extends ServletRunner { + + private static final String CONTEXT_ROOT = "mergedconfig"; + private static final String ALL_IN_ONE_SERVER = "merge/allInOne.xml"; + private static final String IGNORE_SERVER = "merge/ignore.xml"; + private static final String REPLACE_SERVER = "merge/replace.xml"; + private static final String MERGE_SERVER = "merge/merge.xml"; + private static final String IGNORE_REPLACE_SERVER = "merge/ignoreReplace.xml"; + private static final String FOUR_LEVEL_REPLACE_SERVER = "merge/fourLevelReplace.xml"; + private static final String FOUR_LEVEL_IGNORE_SERVER = "merge/fourLevelIgnore.xml"; + + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + @Override + protected String getServletMapping() { + return "mergedConfigTest"; + } + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.merging"); + + @Test + public void testMergedConfig() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(ALL_IN_ONE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + + } + + @Test + public void testMergedIncludesReplace() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(REPLACE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesIgnore() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(IGNORE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesMerge() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(MERGE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesIgnoreReplace() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(IGNORE_REPLACE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesFourLevelReplace() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(FOUR_LEVEL_REPLACE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesFourLevelIgnore() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(FOUR_LEVEL_IGNORE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testDefaultInstances1() throws Exception { + // Test that a normal defaultInstances file was read. This works with any of the server.xml files, so no need to + // update. + test(server); + } + + @Test + public void testDefaultInstances2() throws Exception { + // Verify onConflict="merge_when_exists". Works with any server.xml from these tests, so no need to update it. + test(server); + } + + @Test + public void testDefaultInstances3() throws Exception { + // Verify onConflict="merge_when_does_not_exist". Works with any server.xml from these tests, so no need to update it. + test(server); + } + + @BeforeClass + public static void setUpForMergedConfigTests() throws Exception { + //copy the feature into the server features location + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/mergedConfigTest-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + //copy the bundle into the server lib location + server.copyFileToLibertyInstallRoot("lib", "bundles/test.merged.config_1.0.0.jar"); + + server.startServer("mergedConfig.log"); + //make sure the URL is available + assertNotNull(server.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(server.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/features/mergedConfigTest-1.0.mf"); + server.deleteFileFromLibertyInstallRoot("lib/test.merged.config_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MetatypeProviderTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MetatypeProviderTest.java new file mode 100755 index 000000000000..702bbe38371f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MetatypeProviderTest.java @@ -0,0 +1,88 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +//@Mode(TestMode.FULL) +public class MetatypeProviderTest extends ServletRunner { + + private static final String CONTEXT_ROOT = "metatypeprovider"; + private static final String NO_METATYPE_SERVER = "metatype/noMetatypeServer.xml"; + private static final String ORIGINAL_SERVER = "metatype/server.xml"; + + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + @Override + protected String getServletMapping() { + return "providerTest"; + } + + private static LibertyServer testServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.metatype.provider"); + + @BeforeClass + public static void setUpForMetatypeProviderTests() throws Exception { + //copy the feature into the server features location + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/metatypeProviderTest-1.0.mf"); + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + //copy the bundle into the server lib location + testServer.copyFileToLibertyInstallRoot("lib", "bundles/test.metatype.provider_1.0.0.jar"); + + testServer.startServer(); + //make sure the URL is available + assertNotNull(testServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(testServer.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + testServer.stopServer(); + testServer.deleteFileFromLibertyInstallRoot("lib/features/metatypeProviderTest-1.0.mf"); + testServer.deleteFileFromLibertyInstallRoot("lib/test.metatype.provider_1.0.0.jar"); + testServer.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + } + + @Test + public void testMetatypeProvider1() throws Exception { + test(testServer); + } + + @Test + public void testMetatypeProvider2() throws Exception { + test(testServer); + } + + @Test + public void testMetatypeProvider3() throws Exception { + + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile(NO_METATYPE_SERVER); + testServer.waitForConfigUpdateInLogUsingMark(null); + + test(testServer); + + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile(ORIGINAL_SERVER); + testServer.waitForConfigUpdateInLogUsingMark(null); + } +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ProductExtensionsTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ProductExtensionsTest.java new file mode 100755 index 000000000000..314891cd1229 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ProductExtensionsTest.java @@ -0,0 +1,384 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +/** + * Schema product extension tests. + */ +public class ProductExtensionsTest { + public static final Class c = ProductExtensionsTest.class; + public static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.product.extension"); + public static String javaExc; + public static String installRoot; + + // Product extension variables. + public static final String PRODUCT_FEATURE_PATH = "producttest/lib/features/"; + public static final String PRODUCT_BUNDLE_PATH = "producttest/lib/"; + public static final String PRODUCT_EXTENSIONS_PATH = "etc/extensions/"; + public static final String PRODUCT_EXT_NAME = "testproduct"; + public static final String PRODUCT_FEATURE_PROPERTIES_FILE = "productExtensions/propertiesFiles/testproduct.properties"; + public static final String PRODUCT_FEATURE_PRODTEST_MF = "productExtensions/features/prodtest1-1.0.mf"; + public static final String PRODUCT_FEATURE_PRODTEST_JAR = "bundles/test.prod.extensions_1.0.0.jar"; + public static final String PROD_EXT_CONTEXT_ROOT = "/product1-extensions-test"; + public static final String PRODUCT_CONFIG_ALIAS = "prodtest1Config"; + public static final String PRODUCT_SERVER_XML_INVALID = "productExtensions/config/prod.ext.invalid.server.xml"; + public static final String PRODUCT_SERVER_XML_VALID = "productExtensions/config/prod.ext.valid.server.xml"; + public static final String PRODUCT_SERVER_XML_USING_FACTORY_PID = "productExtensions/config/prod.ext.factory.pid.server.xml"; + + // User product extension variables. + public static final String USER_FEATURE_PATH = "usr/extension/lib/features/"; + public static final String USER_BUNDLE_PATH = "usr/extension/lib/"; + public static final String USER_FEATURE_PRODTEST_MF = "productExtensions/features/userProdtest1-1.0.mf"; + public static final String USER_BUNDLE_JAR = "bundles/test.user.prod.extensions_1.0.0.jar"; + public static final String USER_CONFIG_ALIAS = "userProdtest1Config"; + public static final String USER_PRODUCT_SERVER_XML_INVALID = "productExtensions/config/user.prod.ext.invalid.server.xml"; + public static final String USER_PRODUCT_SERVER_XML_VALID = "productExtensions/config/user.prod.ext.valid.server.xml"; + public static final String USER_PRODUCT_SERVER_XML_USING_FACTORY_PID = "productExtensions/config/user.prod.ext.factory.pid.server.xml"; + private static final String USER_PROD_EXT_CONTEXT_ROOT = "/user.product1-extensions-test"; + + // Other variables. + public static final String CORE_PRODUCT_NAME = "core"; + public static final String USR_PRODUCT_NAME = "usr"; + private static final String PASS_STRING = "TEST_PASSED"; + + /** + * Setup the environment. + * + * @param svr The server instance. + * + * @throws Exception + */ + @BeforeClass + public static void setupEnv() throws Exception { + final String METHOD_NAME = "setup"; + Log.entering(c, METHOD_NAME); + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.product.extension"); + installRoot = server.getInstallRoot(); + javaExc = System.getProperty("java.home") + "/bin/java"; + Log.info(c, METHOD_NAME, "java: " + javaExc); + Log.info(c, METHOD_NAME, "installRoot: " + installRoot); + + // Install product extensions. + installProductExtension(); + installUserProductExtension(); + + // Create a directory to store the output files. + File toolsOutputDir = new File(installRoot + "/tool.output.dir"); + toolsOutputDir.mkdir(); + } + + /** + * Cleans up the installation from any files that may have been left around. + * + * @throws Exception + */ + @AfterClass + public static void AfterClassCleanup() throws Exception { + final String METHOD_NAME = "cleanup"; + Log.entering(c, METHOD_NAME); + + tidyup(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests that the ws-schema.jar tool accounts for product extensions. + * The test is expected successfully complete and the product names must be tagged appropriately in the + * serverType section of the generated schema. + * + * @throws Exception + */ + @Test + public void testSchemaGeneratorToolOutputForTaggedProdExtEntries() throws Exception { + final String METHOD_NAME = "testFeatureToolWithProdExtArgument"; + Log.entering(c, METHOD_NAME); + + String[] parms = new String[] { "-jar", installRoot + "/bin/tools/ws-schemagen.jar", installRoot + "/tool.output.dir/schema.xml" }; + ProgramOutput po = server.getMachine().execute(javaExc, parms, installRoot); + logInfo(po, "tool.output.dir/prodExtFeaturelist.xml"); + + RemoteFile rf = server.getFileFromLibertyInstallRoot("tool.output.dir/schema.xml"); + + InputStream in = rf.openForReading(); + DataInputStream dis = new DataInputStream(in); + BufferedReader br = new BufferedReader(new InputStreamReader(dis)); + String line; + + boolean foundUsrConfigElement = false; + boolean foundProdConfigElement = false; + int prefixedElementsCount = 0; + boolean foundServerTypeElement = false; + while ((line = br.readLine()) != null) { + if (!foundServerTypeElement && line.contains("name=\"serverType\"")) { + foundServerTypeElement = true; + } + + if (foundServerTypeElement) { + if (line.contains("name=\"" + USR_PRODUCT_NAME + "_" + USER_CONFIG_ALIAS + "\"")) { + prefixedElementsCount++; + foundUsrConfigElement = true; + } else if (line.contains("name=\"" + PRODUCT_EXT_NAME + "_" + PRODUCT_CONFIG_ALIAS + "\"")) { + prefixedElementsCount++; + foundProdConfigElement = true; + } + } + } + + assertTrue("There should have been only 2 elements prefixed with _", (prefixedElementsCount == 2)); + assertTrue("There should have been a " + USR_PRODUCT_NAME + "_" + USER_CONFIG_ALIAS + " element in the schemaOutput.", foundUsrConfigElement); + assertTrue("There should have been a " + PRODUCT_EXT_NAME + "_" + PRODUCT_CONFIG_ALIAS + " element in the schemaOutput.", foundProdConfigElement); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Test a product extension installation with metatype configuration. + * The test is expected to successfully complete. + * + * @throws Exception + */ + @Test + public void testProductInstallWithMetatypeConfig() throws Exception { + String method = "testProductInstallWithMetatypeConfig"; + Log.entering(c, method); + + server.setServerConfigurationFile(PRODUCT_SERVER_XML_VALID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, PROD_EXT_CONTEXT_ROOT + "/test", PASS_STRING); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Test a product extension installation with the an invalid OCD alias configuration. + * + * @throws Exception + */ + @Test + public void testProductInstallWithInvalidAliasConfig() throws Exception { + String method = "testProductInstallWithInvalidAliasConfig"; + Log.entering(c, method); + + server.setServerConfigurationFile(PRODUCT_SERVER_XML_INVALID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, PROD_EXT_CONTEXT_ROOT + "/test", "TEST_FAILED: getAttribute1 returned: null"); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Test a user product extension installation with metatype configuration. + * The test is expected to successfully complete. + * + * @throws Exception + */ + @Test + public void testUserProductInstallWithMetatypeConfig() throws Exception { + String method = "testUserProductInstallWithMetatypeConfig"; + Log.entering(c, method); + + server.setServerConfigurationFile(USER_PRODUCT_SERVER_XML_VALID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + USER_PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, USER_PROD_EXT_CONTEXT_ROOT + "/test", PASS_STRING); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Test a product extension installation with the an invalid OCD alias configuration. + * + * @throws Exception + */ + @Test + public void testUserProductInstallWithInvalidAliasConfig() throws Exception { + String method = "testUserProductInstallWithInvalidAliasConfig"; + Log.entering(c, method); + + server.setServerConfigurationFile(USER_PRODUCT_SERVER_XML_INVALID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + USER_PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, USER_PROD_EXT_CONTEXT_ROOT + "/test", "TEST_FAILED: getAttribute1 returned: null"); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Test a product extension installation with metatype configuration using the factory pid + * The test is expected to successfully complete. + * + * @throws Exception + */ + @Test + public void testProductInstallWithMetatypeConfigUsingFactoryPid() throws Exception { + String method = "testProductInstallWithMetatypeConfigUsingFactoryPid"; + Log.entering(c, method); + + server.setServerConfigurationFile(PRODUCT_SERVER_XML_USING_FACTORY_PID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, PROD_EXT_CONTEXT_ROOT + "/test", PASS_STRING); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Test a user product extension installation with metatype configuration using the factory pid. + * The test is expected to successfully complete. + * + * @throws Exception + */ + @Test + public void testUserProductInstallWithMetatypeConfigUsingFactoryPid() throws Exception { + String method = "testUserProductInstallWithMetatypeConfigUsingFactoryPid"; + Log.entering(c, method); + + server.setServerConfigurationFile(USER_PRODUCT_SERVER_XML_USING_FACTORY_PID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + USER_PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, USER_PROD_EXT_CONTEXT_ROOT + "/test", PASS_STRING); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Prints an extended debug output. + * + * @param po The programOutput + * @param fileName + * @throws Exception + */ + public void logInfo(ProgramOutput po, String fileName) throws Exception { + String methodName = "logInfo"; + Log.info(c, methodName, "Return Code: " + po.getReturnCode() + ". STDOUT: " + po.getStdout()); + + if (po.getReturnCode() != 0) { + Log.info(c, methodName, "STDERR: " + po.getStderr()); + RemoteFile rf = server.getFileFromLibertyInstallRoot(fileName); + BufferedReader br = new BufferedReader(new InputStreamReader(rf.openForReading())); + StringBuffer sb = new StringBuffer(); + String line = null; + while ((line = br.readLine()) != null) { + sb.append(line); + sb.append("\n"); + } + Log.info(c, methodName, "File " + fileName + " content:\n" + sb.toString()); + br.close(); + } + } + + /** + * Installs a specific product extension. + * + * @throws Exception + */ + public static void installProductExtension() throws Exception { + String method = "installProductExtension"; + Log.entering(c, method, "Intalling product extension: " + PRODUCT_EXT_NAME + "."); + + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_FEATURE_PRODTEST_MF); + assertTrue("Product feature: " + PRODUCT_FEATURE_PRODTEST_MF + " should have been copied to: " + PRODUCT_FEATURE_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_FEATURE_PATH + "prodtest1-1.0.mf")); + + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, PRODUCT_FEATURE_PRODTEST_JAR); + assertTrue("Product bundle: " + PRODUCT_FEATURE_PRODTEST_JAR + " should have been copied to: " + PRODUCT_BUNDLE_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_BUNDLE_PATH + "test.prod.extensions_1.0.0.jar")); + + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + assertTrue("Product extension props file: " + PRODUCT_FEATURE_PROPERTIES_FILE + " should have been copied to: " + PRODUCT_EXTENSIONS_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + "testproduct.properties")); + + Log.exiting(c, method, "Product extension: " + PRODUCT_EXT_NAME + " has been installed."); + + } + + /** + * Installs a specific product extension if the default USR location. + * + * @throws Exception + */ + public static void installUserProductExtension() throws Exception { + String method = "installUserProductExtension"; + Log.entering(c, method, "Intalling user product extension."); + + server.copyFileToLibertyInstallRoot(USER_FEATURE_PATH, USER_FEATURE_PRODTEST_MF); + assertTrue("User product feature: " + USER_FEATURE_PRODTEST_MF + " should have been copied to: " + USER_FEATURE_PATH, + server.fileExistsInLibertyInstallRoot(USER_FEATURE_PATH + "userProdtest1-1.0.mf")); + + server.copyFileToLibertyInstallRoot(USER_BUNDLE_PATH, USER_BUNDLE_JAR); + assertTrue("User product bundle: " + USER_BUNDLE_JAR + " should have been copied to: " + USER_BUNDLE_PATH, + server.fileExistsInLibertyInstallRoot(USER_BUNDLE_PATH + "test.user.prod.extensions_1.0.0.jar")); + + Log.exiting(c, method, "User product extension using feature: " + USER_FEATURE_PRODTEST_MF + " has been installed."); + } + + /** + * Cleans up the installation from any dirs/files that this test may have created. + * + * @throws Exception + */ + public static void tidyup() throws Exception { + if (server.isStarted()) + server.stopServer(); + + server.deleteDirectoryFromLibertyInstallRoot("producttest"); + server.deleteDirectoryFromLibertyInstallRoot("etc/extensions"); + server.deleteDirectoryFromLibertyInstallRoot("usr/extension/"); + server.deleteDirectoryFromLibertyInstallRoot("tool.output.dir"); + } +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/SchemaGeneratorMBeanTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/SchemaGeneratorMBeanTest.java new file mode 100755 index 000000000000..b89083a69bcb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/SchemaGeneratorMBeanTest.java @@ -0,0 +1,455 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import javax.management.JMX; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HttpsURLConnection; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.config.mbeans.ServerSchemaGenerator; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import componenttest.annotation.ExpectedFFDC; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +/** + * FAT-Tests to test the functionality of com.ibm.websphere.config.mbeans.ServerSchemaGenerator MBean + */ +public class SchemaGeneratorMBeanTest { + + private static Class logClass = SchemaGeneratorMBeanTest.class; + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.schemaGen.mbean"); + + private static final String SUCCESS_MESSAGE = "Setup completed successfully."; + private static final long MIN_FILE_SIZE = 500000; + private static final long SERVER_FILE_SIZE = 5000; + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + + private static ObjectName schemaGenObjName; + private static ObjectName fileTranObjectName; + + @BeforeClass + public static void setUp() throws Exception { + final String methodName = "setUp"; + Log.entering(logClass, methodName); + + outputDir = server.getServerRoot(); + Log.info(logClass, methodName, "serverRoot=" + outputDir); + + Log.info(logClass, methodName, "Starting server=" + server.getServerName()); + server.startServer(); + + Log.info(logClass, methodName, "Waiting for 'CWWKT0016I.*IBMJMXConnectorREST'"); + assertNotNull("'CWWKT0016I.*IBMJMXConnectorREST' was not received on server", + server.waitForStringInLog("CWWKT0016I.*IBMJMXConnectorREST")); + + Log.info(logClass, methodName, "Waiting for 'CWWKO0219I.*ssl'"); + assertNotNull("'CWWKO0219I.*ssl' was not recieved on server", + server.waitForStringInLog("CWWKO0219I.*ssl")); + + // Set up the trust store + System.setProperty("javax.net.ssl.trustStore", outputDir + "/resources/security/key.jks"); + System.setProperty("javax.net.ssl.trustStorePassword", "Liberty"); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + Log.info(logClass, methodName, "JMXServiceURL=" + url.toString()); + jmxConnector = JMXConnectorFactory.connect(url, environment); + assertNotNull("JMXConnector should not be null", jmxConnector); + connection = jmxConnector.getMBeanServerConnection(); + assertNotNull("MBeanServerConnection should not be null", connection); + + schemaGenObjName = new ObjectName(ServerSchemaGenerator.OBJECT_NAME); + fileTranObjectName = new ObjectName(FileTransferMBean.OBJECT_NAME); + + Log.exiting(logClass, "setUp"); + } + + @AfterClass + public static void cleanUp() throws Exception { + String methodName = "tearDown"; + Log.entering(logClass, methodName); + + if (server != null && server.isStarted()) { + Log.finer(logClass, methodName, "Server is up, stopping it"); + jmxConnector.close(); + server.stopServer(); + } + Log.exiting(logClass, methodName); + } + + /** + * Invoke ServerSchemaGenerator.generateInstallSchema method + * + * @param params + * @return response from MBean invoke + * @throws Exception + */ + private Map invokeGenerateInstallSchema(Object[] params) throws Exception { + Log.entering(logClass, "invokeGenerateInstallSchema", params); + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String" }; + + @SuppressWarnings("unchecked") + Map returnedMap = (Map) connection.invoke(schemaGenObjName, "generateInstallSchema", params, signature); + + Log.exiting(logClass, "invokeGenerateInstallSchema", returnedMap); + return returnedMap; + } + + /** + * Invoke ServerSchemaGenerator.generateServerSchema method + * + * @param params + * @return response from MBean invoke + * @throws Exception + */ + private Map invokeGenerateServerSchema(Object[] params) throws Exception { + Log.entering(logClass, "invokeGenerateServerSchema", params); + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String" }; + + @SuppressWarnings("unchecked") + Map returnedMap = (Map) connection.invoke(schemaGenObjName, "generateServerSchema", params, signature); + + Log.exiting(logClass, "invokeGenerateServerSchema", returnedMap); + return returnedMap; + } + + /** + * Invoke ServerSchemaGenerator.generate method + * + * @param params + * @return response from MBean invoke + * @throws Exception + */ + private String invokeSchemaGenMBeanGenerate() throws Exception { + + Object[] params = new String[] {}; + String[] signature = new String[] {}; + + String response = (String) connection.invoke(schemaGenObjName, "generate", params, signature); + + Log.finest(logClass, "invokeSchemaGenMBeanGenerate", "response=" + response); + return response; + } + + /** + * Invoke FileTransferMBean.downloadFile method + * + * @param params + * @throws Exception + */ + private void invokeFileTransferMBeanDownloadFile(Object[] params) throws Exception { + Log.entering(logClass, "invokeFileTransferMBeanDownloadFile", params); + String[] signature = new String[] { "java.lang.String", "java.lang.String" }; + connection.invoke(fileTranObjectName, "downloadFile", params, signature); + Log.exiting(logClass, "invokeFileTransferMBeanDownloadFile"); + } + + /** + * Invoke FileTransferMBean.deleteFile method + * + * @param params + * @throws Exception + */ + private void invokeFileTransferMBeanDeleteFile(Object[] params) throws Exception { + Log.entering(logClass, "invokeFileTransferMBeanDeleteFile", params); + String[] signature = new String[] { "java.lang.String" }; + connection.invoke(fileTranObjectName, "deleteFile", params, signature); + Log.exiting(logClass, "invokeFileTransferMBeanDeleteFile"); + } + + @Test + public void testDefaultValuesRestartServer() throws Exception { + String methodName = "testDefaultValuesRestartServer"; + + //Invoke schema generation + Object[] params = new String[] { "1.0", "1", "UTF-8", Locale.getDefault().toString() }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/schemaDefaultValues.xsd"; + + params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than expected minimum size + File file = new File(targetPath); + assertTrue("targetPath file is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > MIN_FILE_SIZE); + + Log.info(logClass, methodName, "Restarting server"); + server.restartServer(); + + Log.info(logClass, methodName, "Waiting for 'CWWKT0016I.*IBMJMXConnectorREST'"); + assertNotNull("'CWWKT0016I.*IBMJMXConnectorREST' was not received on server", + server.waitForStringInLog("CWWKT0016I.*IBMJMXConnectorREST")); + + Log.info(logClass, methodName, "Waiting for 'CWWKO0219I.*ssl'"); + assertNotNull("'CWWKO0219I.*ssl' was not recieved on server", + server.waitForStringInLog("CWWKO0219I.*ssl")); + + // Verify that the file was cleaned up after server restart + assertFalse("Generated schema file was not deleted after server restart. File=" + sourcePath, new File(sourcePath).exists()); + } + + @Test + public void testEmptyStrings() throws Exception { + //Invoke schema generation + Object[] params = new String[] { "", "", "", "" }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Ensure generated file is bigger than expected minimum size + String filePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + File file = new File(filePath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > MIN_FILE_SIZE); + } + + @Test + public void testGenerateDownloadAndDelete() throws Exception { + Object[] params = new String[] { "1.1", "2", "UTF-16", "fr" }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/schemaNonDefault.xsd"; + + params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than expected minimum size + File file = new File(targetPath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > MIN_FILE_SIZE); + + // Remotely delete the generated schema file + RemoteFile remoteFile = server.getMachine().getFile(sourcePath); + + //first check if the file exists + assertTrue("Generated schema file should exist at this point. remoteFile=" + remoteFile.getAbsolutePath(), remoteFile.exists()); + + params = new Object[] { remoteFile.getAbsolutePath() }; + invokeFileTransferMBeanDeleteFile(params); + + //Verify the file is deleted + assertFalse("Generated schema file should have been deleted. remoteFile=" + remoteFile.getAbsolutePath() + " : size" + remoteFile.length(), remoteFile.exists()); + } + + @Test + public void testGenerateServerSchema() throws Exception { + Object[] params = new String[] { null, null, null, null }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateServerSchema(params); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + //Download generated file + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/serverschema.xsd"; + + params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than expected minimum size + File file = new File(targetPath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > SERVER_FILE_SIZE); + + } + + @ExpectedFFDC("java.lang.IllegalArgumentException") + @Test + public void testInvalidSchemaVersion() throws Exception { + final String schemaVersion = "9876"; + Object[] params = new String[] { schemaVersion, null, null, null }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue("Return code should not be 0", (Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0); + + //Retrieve output + String output = (String) returnedMap.get(ServerSchemaGenerator.KEY_OUTPUT); + + assertTrue("Output does not contain expected IllegalArgumentException. output=" + output, output.contains("java.lang.IllegalArgumentException: " + schemaVersion)); + } + + @ExpectedFFDC("java.lang.IllegalArgumentException") + @Test + public void testInvalidOutputVersion() throws Exception { + final String outputVersion = "312"; + Object[] params = new String[] { null, outputVersion, null, null }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue("Return code should not be 0", (Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0); + + //Retrieve output + String output = (String) returnedMap.get(ServerSchemaGenerator.KEY_OUTPUT); + + assertTrue("Output does not contain expected IllegalArgumentException. output=" + output, output.contains("java.lang.IllegalArgumentException: " + outputVersion)); + } + + @Test + public void testInvalidEncoding() throws Exception { + final String encodingValue = "encodingABC"; + Object[] params = new String[] { null, null, encodingValue, null }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue("Return code should not be 0", (Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0); + + //Retrieve output + String output = (String) returnedMap.get(ServerSchemaGenerator.KEY_OUTPUT); + + assertTrue("Output does not contain expected UnsupportedEncodingException. output=" + output, output.contains("java.io.UnsupportedEncodingException: " + encodingValue)); + } + + /** + * Schema Generator replaces invalid locale with the default locale. So an output should be generated. + * + * @throws Exception + */ + @Test + public void testInvalidLocale() throws Exception { + //Invoke schema generation + final String localeValue = "localeXYZ"; + Object[] params = new String[] { null, null, null, localeValue }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Ensure generated file is bigger than expected minimum size + String filePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + File file = new File(filePath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > MIN_FILE_SIZE); + } + + @Test + public void testSchemaGenMBeanCallAPI() throws Exception { + ServerSchemaGenerator schemaGenMBean = JMX.newMBeanProxy(connection, schemaGenObjName, ServerSchemaGenerator.class); + assertNotNull("We should have got access to the ServerSchemaGenerator API", schemaGenMBean); + + Map returnedMap = schemaGenMBean.generateInstallSchema(null, null, null, null); //schemaVersion, outputVersion, encoding, locale + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/schemaNonDefaultAPI.xsd"; + + Object[] params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than expected minimum size + File file = new File(targetPath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > MIN_FILE_SIZE); + } + + @Test + public void testInvokeGenerateMethod() throws Exception { + //Invoke schema generation using the ServerSchemaGenerator.generate method + String returnedVal = invokeSchemaGenMBeanGenerate(); + assertTrue(returnedVal != null && returnedVal.length() > 0); + } + + /** + * Calls a servlet that uses the JMX REST client to connect to the server + * and check a few MBeanServerConnection methods and MBean API calls. + */ + @Test + public void testSchemaGenAppClient() throws Exception { + // Call AppClientServletSchemaGen, check for good result + String encodedServerRoot = URLEncoder.encode(server.getServerRoot(), "UTF-8"); + URL url = new URL("https", server.getHostname(), server.getHttpDefaultSecurePort(), "/mbeans/appClient?serverRoot=" + encodedServerRoot); + HttpsURLConnection con = (HttpsURLConnection) HttpUtils.getHttpConnection(url, HttpURLConnection.HTTP_OK, 60); + HttpUtils.findStringInHttpConnection(con, SUCCESS_MESSAGE); + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } + + /** + * Schema Generator for server throws illegalargument exception for a invalid locale. + * + * @throws Exception + */ + @Test + public void testServerSchemaInvalidLocale() throws Exception { + //Invoke schema generation + final String localeValue = "localeXYZ"; + Object[] params = new String[] { null, null, null, localeValue }; //schemaVersion, outputVersion, encoding, locale + try { + Map returnedMap = invokeGenerateServerSchema(params); + } catch (Exception ie) { + assertTrue(true); + } + + } + + @Test + @ExpectedFFDC("java.io.UnsupportedEncodingException") + public void testServerSchemaInvalidEncoding() throws Exception { + final String encodingValue = "encodingABC"; + Object[] params = new String[] { null, null, encodingValue, null }; //schemaVersion, outputVersion, encoding, locale + + Map returnedMap = invokeGenerateServerSchema(params); + + //Check return code + assertTrue("Return code should not be 0", (Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0); + + //Retrieve output + String output = (String) returnedMap.get(ServerSchemaGenerator.KEY_OUTPUT); + + assertTrue("Output does not contain expected IOException. output=" + output, output.contains("java.io.IOException: " + encodingValue)); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerConfigTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerConfigTest.java new file mode 100755 index 000000000000..38de7b0016f8 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerConfigTest.java @@ -0,0 +1,656 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2014 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ + +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.List; + +import org.junit.Test; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.config.ConfigMonitorElement; +import com.ibm.websphere.simplicity.config.ServerConfiguration; + +import componenttest.exception.TopologyException; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ServerConfigTest { + + // Since we have tracing enabled give server longer timeout to start up. + private static final long SERVER_START_TIMEOUT = 30 * 1000; + + @Test + public void testRestart() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.restart"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer("before.log"); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKF0008I")); // Feature update completed + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + try { + // run the test one + test(server, "/restart/restart?testName=before"); + + server.stopServer(false); + + // switch to new configuration + server.copyFileToLibertyServerRoot("restart/server.xml"); + + server.startServer("after.log", false); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up the second time", server.waitForStringInLog("CWWKF0008I")); // Feature update completed + assertNotNull("The restart application never came up the second time", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // run the test two + test(server, "/restart/restart?testName=after"); + } finally { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/com.ibm.ws.config.metatype_1.0.jar"); + } + } + + @Test + public void testRefresh() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.refresh"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer("refresh.log"); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + try { + // run the test one + test(server, "/restart/restart?testName=before"); + + // switch to new configuration + server.copyFileToLibertyServerRoot("refresh/server.xml"); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // run the test two + test(server, "/restart/restart?testName=after"); + } finally { + server.stopServer(); + } + } + + @Test + public void testVariableRestart() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.restart.var"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer("restart-var-before.log"); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + try { + // run the test one + test(server, "/restart/restart?testName=beforeVariable"); + + server.stopServer(false); + + // switch to new bootstrap.properties + server.copyFileToLibertyServerRoot("restart.var/bootstrap.properties"); + + server.startServer("restart-var-after.log", false); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // run the test two + test(server, "/restart/restart?testName=afterVariable"); + } finally { + server.stopServer(); + } + } + + @Test + public void testValidate() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.validate"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + server.copyFileToLibertyInstallRoot("lib/features", "metatype/metatype-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib", "metatype/com.ibm.ws.config.metatype_1.0.jar"); + + server.startServer(); + + try { + assertStringsPresentInLog(server, new String[] { ".*CWWKG0011W.*person.*", ".*firstName.*Jane.*" }); + assertStringsPresentInLog(server, new String[] { ".*CWWKG0011W.*ejb.*threadPool.*", ".*minThreads.*5.*" }); + assertStringsPresentInLog(server, new String[] { ".*CWWKG0011W.*quickStartSecurity.*" }); + } finally { + server.stopServer(); + } + } + + @Test + public void testValidateUpdateFileTag() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.validateConfig"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer(); + + try { + assertASCIIFileTag(server.getDefaultLogFile()); + } finally { + server.stopServer(); + } + } + + @Test + public void testRelativeImports() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer("imports.log"); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + try { + // run the test one + test(server, "/restart/restart?testName=checkImport"); + } finally { + server.stopServer(); + } + } + + @Test + public void testRefreshError() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.refresh.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer("refresh-error.log"); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + try { + // run the test one + test(server, "/restart/restart?testName=before"); + + // switch to new (bad) configuration + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("refresh/bad-server.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // wait for error + assertNotNull("No refresh error", server.waitForStringInLog("CWWKG0014E.*")); + + // run the test one again since nothing has changed + test(server, "/restart/restart?testName=before"); + + // switch to new (good) configuration + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("refresh/server.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // run the test two + test(server, "/restart/restart?testName=after"); + } finally { + server.stopServer(); + } + } + + /** + * This test makes sure that you can update the server configuration and that the changes will be picked up when using a polled style of update trigger. It will then disable + * the polling to make sure changes are no longer picked up. + * + * @throws Exception + */ + @Test + public void testServerConfigUpdating() throws Exception { + LibertyServer server = LibertyServerFactory.getStartedLibertyServer("com.ibm.ws.config.update"); + + try { + // The server has no update trigger so first set one to polled. Polled is the default so this change should be picked up + ServerConfiguration config = server.getServerConfiguration(); + ConfigMonitorElement configMonitor = config.getConfig(); + configMonitor.setUpdateTrigger("polled"); + server.updateServerConfiguration(config); + assertNotNull("The server configuration was not updated when setting it to polled", server.waitForStringInLog("CWWKG0017I")); + + long startTime = System.currentTimeMillis(); + // Now update the server configuration to make sure that still works + server.setMarkToEndOfLog(); + config.addApplication("inexistent", ".", "war"); + server.updateServerConfiguration(config); + assertNotNull("The server configuration was not updated when adding a feature", server.waitForStringInLog("CWWKG0017I")); + + // Now turn off server config monitoring and make sure the updating stops + server.setMarkToEndOfLog(); + configMonitor.setUpdateTrigger("disabled"); + server.updateServerConfiguration(config); + assertNotNull("The server configuration was not updated for disabling monitoring", server.waitForStringInLog("CWWKG0017I")); + + /* + * Updating is now turned off so do another update and make sure that the message is NOT displayed in the log (we wait for 4 messages but expect 3). The default wait + * time for this is 30s which is a bit long but also machine specific so make a note of how long it took to update the config during the last 2 updates and wait for + * that long. + */ + long updateDuration = System.currentTimeMillis() - startTime; + server.setMarkToEndOfLog(); + config.removeApplicationsByName("inexistent"); + server.updateServerConfiguration(config); + assertNull("The server configuration was updated even though monitoring is disabled", server.waitForStringInLog("CWWKG0017I", updateDuration)); + } finally { + server.stopServer(); + } + } + + /** + * This test just makes sure that if the server config update trigger is set to mbean then it doesn't monitor the file. + * + * @throws Exception + */ + @Test + public void testMbeanConfigUpdate() throws Exception { + LibertyServer server = LibertyServerFactory.getStartedLibertyServer("com.ibm.ws.config.update.mbean"); + + try { + // This server has and update trigger set to mbean so the file should not be monitored, update it and make sure a config update isn't triggered + ServerConfiguration config = server.getServerConfiguration(); + config.getFeatureManager().getFeatures().add("servlet-3.0"); + server.updateServerConfiguration(config); + //we are waiting for a message not to appear in the log - 10 seconds is probably long enough instead of the default 2 min + // (note that, for whatever reason, LibertyServer doubles the timeout we pass in) + assertNull("The server configuration was updated when it shouldn't of been monitoring the file", server.waitForStringInLog("CWWKG0017I", 5000)); + } finally { + server.stopServer(); + } + } + + private void test(LibertyServer server, String testUri) throws Exception { + HttpURLConnection con = null; + try { + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + testUri); + con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + assertNotNull(is); + + String output = read(is); + System.out.println(output); + assertTrue(output, output.trim().startsWith("Test Passed")); + } finally { + if (con != null) { + con.disconnect(); + } + } + } + + private static String read(InputStream in) throws IOException { + InputStreamReader isr = new InputStreamReader(in); + BufferedReader br = new BufferedReader(isr); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + return builder.toString(); + } + + private void assertStringsPresentInLog(LibertyServer server, String[] patterns) throws IOException { + for (String pattern : patterns) { + String match = server.waitForStringInLog(pattern); + // Wait for the application to be installed before proceeding + assertNotNull("No lines found matching the pattern: " + pattern, match); + } + } + + private void assertASCIIFileTag(RemoteFile file) throws Exception { + + String systemOS = System.getProperty("os.name"); + if (systemOS.equals("z/OS")) { + String[] cmdArray = new String[] { "chtag", "-p", file.getAbsolutePath() }; + Process p = Runtime.getRuntime().exec(cmdArray); + p.waitFor(); + String line = ""; + StringBuffer exMsg = new StringBuffer(); + BufferedReader buferr = new BufferedReader(new InputStreamReader(p.getInputStream())); + while ((line = buferr.readLine()) != null) { + exMsg.append(line + ". "); + } + buferr.close(); + + String result[] = exMsg.toString().split("\\s"); + assertEquals("t", result[0]); + assertEquals("ISO8859-1", result[1]); + } + } + + @Test + public void testCaseSensitivity() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.casesensitivity"); + // shouldn't take long to fail but it should start pretty fast + server.setServerStartTimeout(5000); + try { + server.startServer("casesensitivity.log"); + } finally { + server.stopServer(); + } + } + + /** + * Test a bad required include () + * for startup and update. When the variable onError is set to FAIL, the runtime should + * bring down the server on startup and not recognize ANY config changes on update. + * + * @throws Exception + */ + @Test + public void testBadRequiredIncludeFAIL() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getServerRoot(), "bootstrap.properties", + server.pathToAutoFVTTestFiles + "/import.error/bootstrap-onError-FAIL.properties", false, + server.getServerRoot()); + server.setServerConfigurationFile("import.error/original.xml"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + try { + // Start out with bad include and onError=FAIL + server.startServerExpectFailure("include-error.log", true, true); + + // Now swap in a valid server.xml to test dynamic config update with onError=FAIL + server.setServerConfigurationFile("import.error/server.xml"); + + server.startServer("include-update-error.log"); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // ensure that the config elements work + test(server, "/restart/restart?testName=before"); + + // switch to new (bad) configuration to test a config update with a bad include + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("import.error/bad-include-server2.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // make sure that both errors messages are present, CWWKG0015E is the summary message + // that comes out on an update with errors and onError=FAIL + assertNotNull(server.waitForStringInLogUsingMark("CWWKG0015E")); + assertNotNull(server.waitForStringInLogUsingMark("CWWKG0090E")); + + // ensure that the config elements were not updated + test(server, "/restart/restart?testName=before"); + + } finally { + if (server.isStarted()) { + server.stopServer(); + } + } + } + + /** + * Test a bad required include () + * for startup and update. When the variable onError is not set to FAIL (i.e. INFO, WARN), + * the runtime should be tolerant and keep the server running while ignoring the bad + * required include. + * + * For a config update, all changes made to the config should be recognized and only + * the bad required include should be ignored. + * + * @throws Exception + */ + @Test + public void testBadRequiredIncludeWARN() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + try { + // Change to default setting of onError=WARN, but swap in a server.xml that has + // malformed xml. + server.copyFileToLibertyServerRoot("import.error/bootstrap.properties"); + server.setServerConfigurationFile("import.error/malformed-server.xml"); + + // Start server with malformed xml and onError=WARN. The server will come up with no configuration, + // which results in an exception because timed exit isn't enabled. + boolean caught = false; + try { + server.startServer("malformed-xml.log", true, true); + } catch (TopologyException ex) { + caught = true; + server.stopServer(); + } + + assertTrue("There should be an exception because timedexit is not enabled", caught); + + // Now provide the original server.xml with a bad required include to ensure + // that the server comes up and reports the bad include. + server.setServerConfigurationFile("import.error/bad-include-server.xml"); + server.startServer("include-warn.log"); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // find the warning in messages.log CWWKG0090E + List includeErrors = server.findStringsInLogs("CWWKG0090E"); + assertEquals("Should have only seen the include error 1 time upon server startup: " + includeErrors, 1, includeErrors.size()); + + // ensure that the config elements work + test(server, "/restart/restart?testName=before"); + + // switch to new (bad) configuration to test a config update with a bad include + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("import.error/bad-include-server2.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // ensure that the error message indicating a bad include was provided is there + includeErrors = server.findStringsInLogs("CWWKG0090E"); + assertEquals("Should have only seen the include error 2 times since starting the server: " + includeErrors, 2, includeErrors.size()); + + // ensure that the modified config elements work + test(server, "/restart/restart?testName=after"); + + } finally { + if (server.isStarted()) { + server.stopServer(); + } + } + } + + @Test + public void testBadRequiredIncludeModifyOnError() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + try { + // Change to default setting of onError=WARN, but swap in a server.xml that has + // malformed xml. + server.copyFileToLibertyServerRoot("import.error/bootstrap.properties"); + + // Now provide the original server.xml with a bad required include to ensure + // that the server comes up and reports the bad include. + server.setServerConfigurationFile("import.error/bad-include-server.xml"); + server.startServer("include-warn.log"); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // find the warning in messages.log CWWKG0090E + List includeErrors = server.findStringsInLogs("CWWKG0090E"); + assertEquals("Should have only seen the include error 1 time upon server startup: " + includeErrors, 1, includeErrors.size()); + + // ensure that the config elements work + test(server, "/restart/restart?testName=before"); + + // Update onError to IGNORE + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("import.error/bad-include-server-onError-ignore.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // ensure that the error message indicating a bad include was provided is there + includeErrors = server.findStringsInLogs("CWWKG0090E"); + assertEquals("Should have only seen the include error 2 times since starting the server: " + includeErrors, 2, includeErrors.size()); + + // switch to new (bad) configuration to test a config update with a bad include + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("import.error/bad-include-server-onError-ignore2.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // ensure that the error message indicating a bad include was provided is there + includeErrors = server.findStringsInLogs("CWWKG0090E"); + assertEquals("Should not see an include error with onError=IGNORE" + includeErrors, 2, includeErrors.size()); + + // ensure that the modified config elements work + test(server, "/restart/restart?testName=after"); + + } finally { + if (server.isStarted()) { + server.stopServer(); + } + } + } + + @Test + public void testVariableMissingName() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + try { + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getServerRoot(), "bootstrap.properties", + server.pathToAutoFVTTestFiles + "/import.error/bootstrap-onError-FAIL.properties", false, + server.getServerRoot()); + server.setServerConfigurationFile("variable.error/missing-name.xml"); + + // With OnError=FAIL, the server should fail to start + server.startServerExpectFailure("variable-name-fail.log", true, true); + + // Change OnError to WARN and try again + server.copyFileToLibertyServerRoot("import.error/bootstrap.properties"); + + server.startServer("variable-name-warn.log", true, true); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // find the warning in messages.log CWWKG0091E + List includeErrors = server.findStringsInLogs("CWWKG0091E"); + assertEquals("Should have only seen the include error 1 time upon server startup: " + includeErrors, 1, includeErrors.size()); + + // ensure that the config elements work + test(server, "/restart/restart?testName=before"); + + // switch to new (bad) configuration to test a config update with a bad variable + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("variable.error/missing-name2.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // ensure that the error message indicating a bad variable was provided is there + includeErrors = server.findStringsInLogs("CWWKG0091E"); + assertEquals("Should have only seen the include error 2 times since starting the server: " + includeErrors, 2, includeErrors.size()); + + // ensure that the modified config elements work + test(server, "/restart/restart?testName=after"); + + } finally { + if (server.isStarted()) { + server.stopServer(); + } + } + } + + @Test + public void testVariableMissingValue() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + try { + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getServerRoot(), "bootstrap.properties", + server.pathToAutoFVTTestFiles + "/import.error/bootstrap-onError-FAIL.properties", false, + server.getServerRoot()); + server.setServerConfigurationFile("variable.error/missing-value.xml"); + + // With OnError=FAIL, the server should fail to start + server.startServerExpectFailure("variable-value-fail.log", true, true); + + // Change OnError to WARN and try again + server.copyFileToLibertyServerRoot("import.error/bootstrap.properties"); + + server.startServer("variable-name-warn.log", true, true); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // find the warning in messages.log CWWKG0092E + List includeErrors = server.findStringsInLogs("CWWKG0092E"); + assertEquals("Should have only seen the include error 1 time upon server startup: " + includeErrors, 1, includeErrors.size()); + + // ensure that the config elements work + test(server, "/restart/restart?testName=before"); + + // switch to new (bad) configuration to test a config update with a bad variable + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("variable.error/missing-value2.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // ensure that the error message indicating a bad variable was provided is there + includeErrors = server.findStringsInLogs("CWWKG0092E"); + assertEquals("Should have only seen the include error 2 times since starting the server: " + includeErrors, 2, includeErrors.size()); + + // ensure that the modified config elements work + test(server, "/restart/restart?testName=after"); + + } finally { + if (server.isStarted()) { + server.stopServer(); + } + } + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerXMLConfigurationMBeanTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerXMLConfigurationMBeanTest.java new file mode 100755 index 000000000000..5f46f8b83dae --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerXMLConfigurationMBeanTest.java @@ -0,0 +1,171 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import javax.management.JMX; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.config.mbeans.ServerXMLConfigurationMBean; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Tests that ServerXMLConfigurationMBean can be accessed through a proxy. Note that the + * BVT tests that the configuration files can be downloaded through the FileTransferMBean + * so not going to include a redundant test for that here. + */ +public class ServerXMLConfigurationMBeanTest { + + private static Class logClass = ServerXMLConfigurationMBeanTest.class; + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.schemaGen.mbean"); + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + + private static ObjectName serverXMLConfigurationMBeanObjName; + + @BeforeClass + public static void setUp() throws Exception { + final String methodName = "setUp"; + Log.entering(logClass, methodName); + + outputDir = server.getServerRoot(); + Log.info(logClass, methodName, "serverRoot=" + outputDir); + + Log.info(logClass, methodName, "Starting server=" + server.getServerName()); + server.startServer(); + + Log.info(logClass, methodName, "Waiting for 'CWWKT0016I.*IBMJMXConnectorREST'"); + assertNotNull("'CWWKT0016I.*IBMJMXConnectorREST' was not received on server", + server.waitForStringInLog("CWWKT0016I.*IBMJMXConnectorREST")); + + Log.info(logClass, methodName, "Waiting for 'CWWKO0219I.*ssl'"); + assertNotNull("'CWWKO0219I.*ssl' was not recieved on server", + server.waitForStringInLog("CWWKO0219I.*ssl")); + + Log.info(logClass, methodName, "Waiting for 'CWPKI0803A.*ssl'"); + assertNotNull("'CWPKI0803A.*ssl' was not generated on server", + server.waitForStringInLog("CWPKI0803A")); + + Log.info(logClass, methodName, "Waiting for 'CWWKS0008I: The security service is ready'"); + assertNotNull("'CWWKS0008I: The security service is ready' was not generated on server", + server.waitForStringInLog("CWWKS0008I")); + + Log.info(logClass, methodName, "Waiting for 'CWWKS4105I: LTPA configuration is ready'"); + assertNotNull("'CWWKS4105I: LTPA configuration is ready' was not generated on server", + server.waitForStringInLog("CWWKS4105I")); + + // Set up the trust store + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + HostnameVerifier hv = new HostnameVerifier() { + @Override + public boolean verify(String urlHostName, SSLSession session) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(hv); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + Log.info(logClass, methodName, "JMXServiceURL=" + url.toString()); + jmxConnector = JMXConnectorFactory.connect(url, environment); + assertNotNull("JMXConnector should not be null", jmxConnector); + connection = jmxConnector.getMBeanServerConnection(); + assertNotNull("MBeanServerConnection should not be null", connection); + + serverXMLConfigurationMBeanObjName = new ObjectName(ServerXMLConfigurationMBean.OBJECT_NAME); + + Log.exiting(logClass, "setUp"); + } + + @AfterClass + public static void cleanUp() throws Exception { + String methodName = "tearDown"; + Log.entering(logClass, methodName); + + if (server != null && server.isStarted()) { + Log.finer(logClass, methodName, "Server is up, stopping it"); + jmxConnector.close(); + server.stopServer(); + } + Log.exiting(logClass, methodName); + } + + @Test + public void testServerXMLConfigurationMBeanCallAPI() throws Exception { + ServerXMLConfigurationMBean serverXMLConfigMBean = JMX.newMBeanProxy(connection, serverXMLConfigurationMBeanObjName, ServerXMLConfigurationMBean.class); + assertNotNull("ServerXMLConfigurationMBean is unexpectedly null.", serverXMLConfigMBean); + + Collection configFilePaths = serverXMLConfigMBean.fetchConfigurationFilePaths(); + assertNotNull("Configuration file path collection should not be null.", configFilePaths); + + // Check that the collection contains the expected file paths. + assertEquals("Config file path collection size is not 3.", 3, configFilePaths.size()); + assertTrue("server.xml is missing from the collection.", + configFilePaths.contains("${server.config.dir}/server.xml")); + assertTrue("fatTestPorts.xml is missing from the collection.", + configFilePaths.contains("${wlp.user.dir}/servers/fatTestPorts.xml")); + assertTrue("fatTestCommon.xml is missing from the collection.", + configFilePaths.contains("${wlp.user.dir}/servers/fatTestCommon.xml")); + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServletRunner.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServletRunner.java new file mode 100755 index 000000000000..e00fd7606861 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServletRunner.java @@ -0,0 +1,74 @@ +package test.server.config; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.TestName; + +import componenttest.topology.impl.LibertyServer; + +public abstract class ServletRunner { + + /** + * Utility to set the method name as a String before the test + */ + @Rule + public TestName name = new TestName(); + + public String testName = ""; + + @Before + public void setTestName() { + // set the current test name + testName = name.getMethodName(); + } + + protected abstract String getContextRoot(); + + protected abstract String getServletMapping(); + + protected void test(LibertyServer server) throws Exception { + HttpURLConnection con = null; + try { + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/" + + getContextRoot() + "/" + getServletMapping() + "?" + "testName=" + testName); + con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + assertNotNull(is); + + String output = read(is); + System.out.println(output); + assertTrue(output, output.trim().startsWith("OK")); + } finally { + if (con != null) { + con.disconnect(); + } + } + } + + private static String read(InputStream in) throws IOException { + InputStreamReader isr = new InputStreamReader(in); + BufferedReader br = new BufferedReader(isr); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + return builder.toString(); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/VariableMergeTests.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/VariableMergeTests.java new file mode 100755 index 000000000000..fc2c188fca30 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/VariableMergeTests.java @@ -0,0 +1,88 @@ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class VariableMergeTests extends ServletRunner { + + private static final String CONTEXT_ROOT = "varmergedconfig"; + private static final String ALL_IN_ONE_SERVER = "varmerge/allInOne.xml"; + private static final String BREAK_SERVER = "varmerge/break.xml"; + private static final String BREAK_2_SERVER = "varmerge/break2.xml"; + private static final String IGNORE_SERVER = "varmerge/ignore.xml"; + private static final String REPLACE_SERVER = "varmerge/replace.xml"; + private static final String MERGE_SERVER = "varmerge/merge.xml"; + + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + @Override + protected String getServletMapping() { + return "varMergeTest"; + } + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.varmerging"); + + @Test + public void testMergedVariables() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(ALL_IN_ONE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + + } + + @Test + public void testMergedIncludesReplace() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(REPLACE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesIgnore() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(IGNORE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesMerge() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(MERGE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @BeforeClass + public static void setUpForMergedConfigTests() throws Exception { + //copy the config feature into the server features location + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + server.startServer("varmerge.log"); + //make sure the URL is available + assertNotNull(server.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(server.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/WSConfigurationHelperTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/WSConfigurationHelperTest.java new file mode 100755 index 000000000000..aa85dbe4da80 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/WSConfigurationHelperTest.java @@ -0,0 +1,125 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ + +@Mode(TestMode.FULL) +public class WSConfigurationHelperTest extends ServletRunner { + + private static final String CONTEXT_ROOT = "confighelper"; + + /* + * (non-Javadoc) + * + * @see test.server.config.ServletRunner#getContextRoot() + */ + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + /* + * (non-Javadoc) + * + * @see test.server.config.ServletRunner#getServletMapping() + */ + @Override + protected String getServletMapping() { + return "helperTest"; + } + + @BeforeClass + public static void setUpForMetatypeProviderTests() throws Exception { + + // Use the feature/bundle from the merged config tests + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/mergedConfigTest-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib", "bundles/test.merged.config_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + server.startServer("helperTest.log"); + //make sure the URL is available + assertNotNull(server.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(server.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + } + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.helper"); + + @Test + public void testGetDefaultProperties() throws Exception { + test(server); + } + + @Test + public void testGetDefaultPropertiesWithRequired() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration1() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration2() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration4() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration3() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration5() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration6() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration7() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration8() throws Exception { + test(server); + } +} diff --git a/dev/com.ibm.ws.config_fat/publish/.gitignore b/dev/com.ibm.ws.config_fat/publish/.gitignore new file mode 100644 index 000000000000..0968b1bceb64 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.config_fat/publish/files/.gitignore b/dev/com.ibm.ws.config_fat/publish/files/.gitignore new file mode 100644 index 000000000000..d4a71b1abe01 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/.gitignore @@ -0,0 +1,7 @@ +/bundles +/childalias.zip +/confighelper.zip +/dropins.zip +/mergedconfig.zip +/metatypeprovider.zip +/varmerge.zip diff --git a/dev/com.ibm.ws.config_fat/publish/files/badconfig/UniqueValueConflict.xml b/dev/com.ibm.ws.config_fat/publish/files/badconfig/UniqueValueConflict.xml new file mode 100755 index 000000000000..b86b30476763 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/badconfig/UniqueValueConflict.xml @@ -0,0 +1,16 @@ + + + + + + + jsp-2.2 + jdbc-4.0 + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/badconfig/badHttp.xml b/dev/com.ibm.ws.config_fat/publish/files/badconfig/badHttp.xml new file mode 100755 index 000000000000..ba1cc2db5512 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/badconfig/badHttp.xml @@ -0,0 +1,18 @@ + + + + + servlet-3.0 + osgiconsole-1.0 + timedexit-1.0 + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/badconfig/badLogging.xml b/dev/com.ibm.ws.config_fat/publish/files/badconfig/badLogging.xml new file mode 100755 index 000000000000..82e64a44031b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/badconfig/badLogging.xml @@ -0,0 +1,13 @@ + + + + + + + servlet-3.0 + osgiconsole-1.0 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/badconfig/goodConfig.xml b/dev/com.ibm.ws.config_fat/publish/files/badconfig/goodConfig.xml new file mode 100755 index 000000000000..d72781208d2a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/badconfig/goodConfig.xml @@ -0,0 +1,12 @@ + + + + + servlet-3.0 + osgiconsole-1.0 + timedexit-1.0 + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/server.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/server.xml new file mode 100755 index 000000000000..b866f31c32fc --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/server.xml @@ -0,0 +1,42 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverB.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverB.xml new file mode 100755 index 000000000000..cb8acb009cbb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverB.xml @@ -0,0 +1,44 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC.xml new file mode 100755 index 000000000000..5c9503cdec56 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC.xml @@ -0,0 +1,46 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC2.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC2.xml new file mode 100755 index 000000000000..8bb5e698aff6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC2.xml @@ -0,0 +1,41 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC3.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC3.xml new file mode 100755 index 000000000000..ca75e6cc47a4 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC3.xml @@ -0,0 +1,44 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC4.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC4.xml new file mode 100755 index 000000000000..e8a3157c2401 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC4.xml @@ -0,0 +1,44 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC5.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC5.xml new file mode 100755 index 000000000000..8525e00c57e7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC5.xml @@ -0,0 +1,42 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC6.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC6.xml new file mode 100755 index 000000000000..0eb20773e2f6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC6.xml @@ -0,0 +1,44 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC7.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC7.xml new file mode 100755 index 000000000000..d6465ea0f461 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC7.xml @@ -0,0 +1,44 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/aBrokenFile.xml b/dev/com.ibm.ws.config_fat/publish/files/dropins/aBrokenFile.xml new file mode 100755 index 000000000000..b35c826f3cfa --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/aBrokenFile.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/alibrary.xml b/dev/com.ibm.ws.config_fat/publish/files/dropins/alibrary.xml new file mode 100755 index 000000000000..6b757cb4c210 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/alibrary.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/blibrary.xml b/dev/com.ibm.ws.config_fat/publish/files/dropins/blibrary.xml new file mode 100755 index 000000000000..4aec61a7f86f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/blibrary.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.notxml b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.notxml new file mode 100755 index 000000000000..c68456f952b2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.notxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.xml b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.xml new file mode 100755 index 000000000000..c68456f952b2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/simple2.xml b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple2.xml new file mode 100755 index 000000000000..50cab62ebaeb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple2.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/extensions/server.xml b/dev/com.ibm.ws.config_fat/publish/files/extensions/server.xml new file mode 100755 index 000000000000..ae3c77b37c77 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/extensions/server.xml @@ -0,0 +1,29 @@ + + + + + + configExtensionsTest-1.0 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB1.xml b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB1.xml new file mode 100755 index 000000000000..83eff7671c65 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB1.xml @@ -0,0 +1,13 @@ + + + + + + configExtensionsTestB-1.0 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB2.xml b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB2.xml new file mode 100755 index 000000000000..34236ecee931 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB2.xml @@ -0,0 +1,14 @@ + + + + + + configExtensionsTest-1.0 + configExtensionsTestB-1.0 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/extensions/serverSchemaGenerator.xml b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverSchemaGenerator.xml new file mode 100755 index 000000000000..fb544c9ade2e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverSchemaGenerator.xml @@ -0,0 +1,11 @@ + + + + + + configExtensionsSchemaGeneratorTest-1.0 + configExtensionsTest-1.0 + configExtensionsTestB-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveJDBC.xml b/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveJDBC.xml new file mode 100755 index 000000000000..a4730385b75c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveJDBC.xml @@ -0,0 +1,37 @@ + + + + + osgiConsole-1.0 + servlet-3.0 + localConnector-1.0 + oauth-2.0 + ssl-1.0 + openidConnectServer-1.0 + + + + + + + + + + + + + + + + + client01 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveOpenID.xml b/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveOpenID.xml new file mode 100755 index 000000000000..2d1d54c9eee7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveOpenID.xml @@ -0,0 +1,27 @@ + + + + + osgiConsole-1.0 + servlet-3.0 + jdbc-4.0 + localConnector-1.0 + oauth-2.0 + ssl-1.0 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore.xml new file mode 100755 index 000000000000..c7168bfde9d8 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore.xml @@ -0,0 +1,28 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore2.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore2.xml new file mode 100755 index 000000000000..c6a27e52250f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore2.xml @@ -0,0 +1,33 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server.xml new file mode 100755 index 000000000000..9585b789821a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server.xml @@ -0,0 +1,27 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server2.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server2.xml new file mode 100755 index 000000000000..762079f99a77 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server2.xml @@ -0,0 +1,32 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap-onError-FAIL.properties b/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap-onError-FAIL.properties new file mode 100755 index 000000000000..a43b26d2a24b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap-onError-FAIL.properties @@ -0,0 +1,4 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +relativeLocation=relative.xml +onError=FAIL \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap.properties new file mode 100755 index 000000000000..84bdd909d921 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +relativeLocation=relative.xml diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/malformed-server.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/malformed-server.xml new file mode 100755 index 000000000000..9037d1d7cdac --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/malformed-server.xml @@ -0,0 +1,23 @@ + + + + + + + + + servlet-3.0 + configfatlibertyinternals-1.0 + + + + + + + + + + < + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/original.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/original.xml new file mode 100755 index 000000000000..654abb21f835 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/original.xml @@ -0,0 +1,21 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/server.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/server.xml new file mode 100755 index 000000000000..030e6d887099 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/server.xml @@ -0,0 +1,23 @@ + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTest-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTest-1.0.mf new file mode 100755 index 000000000000..a1a5efb92498 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: childAliasTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.childalias; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestB-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestB-1.0.mf new file mode 100755 index 000000000000..8668eb7b1b4c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestB-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: childAliasTestB-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.childalias.b; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestC-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestC-1.0.mf new file mode 100755 index 000000000000..52408615ef99 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestC-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: childAliasTestC-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.childalias.c; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsSchemaGeneratorTest-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsSchemaGeneratorTest-1.0.mf new file mode 100755 index 000000000000..43f5edccc919 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsSchemaGeneratorTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: configExtensionsSchemaGeneratorTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.extensions.schema.generator; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTest-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTest-1.0.mf new file mode 100755 index 000000000000..d953d105e9bb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTest-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: configExtensionsTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.extensions; version="[1,1.0.100)", + com.ibm.wsspi.appserver.webBundle-1.0; type="osgi.subsystem.feature" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTestB-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTestB-1.0.mf new file mode 100755 index 000000000000..0f458816a93d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTestB-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: configExtensionsTestB-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.extensions.b; version="[1,1.0.100)", + com.ibm.wsspi.appserver.webBundle-1.0; type="osgi.subsystem.feature" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configfatlibertyinternals-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configfatlibertyinternals-1.0.mf new file mode 100755 index 000000000000..602b78293591 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configfatlibertyinternals-1.0.mf @@ -0,0 +1,12 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: configfatlibertyinternals-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +IBM-API-Package: org.osgi.service.cm; type="internal", + com.ibm.ws.jmx; type="internal", + org.osgi.framework; type="internal", + org.osgi.util.tracker; type="internal", + com.ibm.websphere.config; type="internal", + com.ibm.wsspi.kernel.service.utils; type="internal", + com.ibm.wsspi.kernel.service.location; type="internal" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/delayedVariable-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/delayedVariable-1.0.mf new file mode 100755 index 000000000000..8c6dcd7ade98 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/delayedVariable-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: delayedVariable-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.variables; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/mergedConfigTest-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/mergedConfigTest-1.0.mf new file mode 100755 index 000000000000..20e4f39e8d19 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/mergedConfigTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: mergedConfigTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.merged.config; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/metatypeProviderTest-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/metatypeProviderTest-1.0.mf new file mode 100755 index 000000000000..f11c82b456d7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/metatypeProviderTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: metatypeProviderTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.metatype.provider; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/allInOne.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/allInOne.xml new file mode 100755 index 000000000000..0a7f9edbf875 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/allInOne.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/break.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/break.xml new file mode 100755 index 000000000000..e9a94c8b012c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/break.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/break2.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/break2.xml new file mode 100755 index 000000000000..7f80e024f67a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/break2.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelIgnore.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelIgnore.xml new file mode 100755 index 000000000000..7f9a98221c05 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelIgnore.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelReplace.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelReplace.xml new file mode 100755 index 000000000000..fdc4b5c5be10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelReplace.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/ignore.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/ignore.xml new file mode 100755 index 000000000000..deeaa1b53e8a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/ignore.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/ignoreReplace.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/ignoreReplace.xml new file mode 100755 index 000000000000..d130b7ba1722 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/ignoreReplace.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/merge.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/merge.xml new file mode 100755 index 000000000000..7e3c9e30ccdc --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/merge.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/replace.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/replace.xml new file mode 100755 index 000000000000..5d13ba07de90 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/replace.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/metatype/.gitignore b/dev/com.ibm.ws.config_fat/publish/files/metatype/.gitignore new file mode 100644 index 000000000000..6070719c4e47 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/metatype/.gitignore @@ -0,0 +1 @@ +/com.ibm.ws.config.metatype_1.0.jar diff --git a/dev/com.ibm.ws.config_fat/publish/files/metatype/metatype-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/metatype/metatype-1.0.mf new file mode 100755 index 000000000000..0284236b04ca --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/metatype/metatype-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: metatype-1.0 +Subsystem-SymbolicName: com.ibm.ws.config.metatype-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.config.metatype; location:="lib/com.ibm.ws.config.metatype_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/metatype/noMetatypeServer.xml b/dev/com.ibm.ws.config_fat/publish/files/metatype/noMetatypeServer.xml new file mode 100755 index 000000000000..9ceeb7720fb2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/metatype/noMetatypeServer.xml @@ -0,0 +1,20 @@ + + + + + + + servlet-3.0 + osgiconsole-1.0 + httpservice-2.2 + configfatlibertyinternals-1.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/metatype/server.xml b/dev/com.ibm.ws.config_fat/publish/files/metatype/server.xml new file mode 100755 index 000000000000..2fc260e93b78 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/metatype/server.xml @@ -0,0 +1,21 @@ + + + + + + + servlet-3.0 + osgiconsole-1.0 + httpservice-2.2 + metatypeProviderTest-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.factory.pid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.factory.pid.server.xml new file mode 100755 index 000000000000..02fd41b02359 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.factory.pid.server.xml @@ -0,0 +1,21 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + testproduct:prodtest1-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.invalid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.invalid.server.xml new file mode 100755 index 000000000000..b0ccaa6c8ac6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.invalid.server.xml @@ -0,0 +1,22 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + testproduct:prodtest1-1.0 + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.valid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.valid.server.xml new file mode 100755 index 000000000000..ea8d784ac477 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.valid.server.xml @@ -0,0 +1,21 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + testproduct:prodtest1-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.factory.pid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.factory.pid.server.xml new file mode 100755 index 000000000000..a68ca5708fe0 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.factory.pid.server.xml @@ -0,0 +1,21 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + usr:userProdtest1-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.invalid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.invalid.server.xml new file mode 100755 index 000000000000..5a6ed9ab59a9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.invalid.server.xml @@ -0,0 +1,22 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + usr:userProdtest1-1.0 + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.valid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.valid.server.xml new file mode 100755 index 000000000000..502875504bcb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.valid.server.xml @@ -0,0 +1,21 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + usr:userProdtest1-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/prodtest1-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/prodtest1-1.0.mf new file mode 100755 index 000000000000..151b88aa1a16 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/prodtest1-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtest1-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.prod.extensions; location:="lib/test.prod.extensions_1.0.0.jar", + com.ibm.wsspi.appserver.webBundle-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/userProdtest1-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/userProdtest1-1.0.mf new file mode 100755 index 000000000000..86604b524a09 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/userProdtest1-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:userProdtest1-1.0 +Subsystem-SymbolicName: userProdtest1-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.user.prod.extensions; version="[1,2)", + com.ibm.wsspi.appserver.webBundle-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/propertiesFiles/testproduct.properties b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/propertiesFiles/testproduct.properties new file mode 100755 index 000000000000..1b80aa40d231 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/propertiesFiles/testproduct.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall=wlp/producttest/ diff --git a/dev/com.ibm.ws.config_fat/publish/files/refresh/bad-server.xml b/dev/com.ibm.ws.config_fat/publish/files/refresh/bad-server.xml new file mode 100755 index 000000000000..4d368c7d5ebc --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/refresh/bad-server.xml @@ -0,0 +1,5 @@ + + + < + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/refresh/server.xml b/dev/com.ibm.ws.config_fat/publish/files/refresh/server.xml new file mode 100755 index 000000000000..57f7a83ea645 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/refresh/server.xml @@ -0,0 +1,27 @@ + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/restart.var/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/files/restart.var/bootstrap.properties new file mode 100755 index 000000000000..f8560d4219d9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/restart.var/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +myHttpPort=5678 diff --git a/dev/com.ibm.ws.config_fat/publish/files/restart/server.xml b/dev/com.ibm.ws.config_fat/publish/files/restart/server.xml new file mode 100755 index 000000000000..2bdbb516161b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/restart/server.xml @@ -0,0 +1,26 @@ + + + + + + servlet-3.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/validator/.gitignore b/dev/com.ibm.ws.config_fat/publish/files/validator/.gitignore new file mode 100644 index 000000000000..c50fb0152d1d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/validator/.gitignore @@ -0,0 +1 @@ +/com.ibm.ws.config.ext_1.0.*.jar diff --git a/dev/com.ibm.ws.config_fat/publish/files/validator/bad-signature.xml b/dev/com.ibm.ws.config_fat/publish/files/validator/bad-signature.xml new file mode 100755 index 000000000000..28042958e004 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/validator/bad-signature.xml @@ -0,0 +1,32 @@ + + + + + + + + + + ${minVersion} + ${maxVersion} + ${minVersion} - ${maxVersion} + ${jdkVersion} + ${myMaxVersion} + + v1 + v2 + v3,v4 + v\5 + + + + + + + + + + + + +5FUDKaf7vzcTb2J4Gf//7IzVvaw=Uv6vpn399+UxEt8ORk1EAbEilfULajdkZE8KPxiEvZRalYP2T6heP6pAtZ9edMAF4F3SfggLCSjtG/rsAs0xFfTL/YWjsDND6OSRyw077j7eB9jlvyytRvza1fKUQiHoci8R5bUDlhc73m4JGJVsk7uWnFvlJmff0rdAayqb/pGo6yH55umx1CBVlap3GwP1tNIlB3gBGZ3FPZKY0IRi0Hb3fyemfwlWgNs/2O2G10KtDQiDyGNhdiyq12h4Ms0j6mbVfSVhNYKCp2GCizb7bmv1BGBeCiYTyJvESE4AaODCKmaKdAeiWU2Zdwf+hBqu28195ISZZ7uZc7vQUp0x0w==CN=WebSphere Application Server Liberty Profile,OU=Software Group,O=IBM Corp.,L=Armonk,ST=New York,C=US \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/validator/dropins-enabled.xml b/dev/com.ibm.ws.config_fat/publish/files/validator/dropins-enabled.xml new file mode 100755 index 000000000000..ff26fbf81765 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/validator/dropins-enabled.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + ${minVersion} + ${maxVersion} + ${minVersion} - ${maxVersion} + ${jdkVersion} + ${myMaxVersion} + + v1 + v2 + v3,v4 + v\5 + + + + + + + + + + + +f+lmvF8PXX/4/eNTplGpqNSPaJ4=jnopKWvOoQocYPJYhoYZpjSNeJRH9IQaba2loveEuTJVaHKdY4LQmDfBF8uy+kzNjL84y6VtxrsQAjHRdvzSFckg2FZfA0EbryQNwYgIZlnWrmO/QbXlb+CuMA1ITu3hhjg0toIygphzJZEk3TgxpqzxxFLvYQJ1JSIVS5Jt0eYN6Tfi5MiL5aqG8xOfBUPVSZZoYHczUq+FfMNeoFl6DO8o/0EDnXAEz1r+iQbu+Uufjic3tvVvyQ14Yji4lc/IZdtodjUciCz9DHee8C7xq2kbomWXvXLzFLiWBZT7pdxOFIjaNPxPgnb+7vZc/D7yLnAyh0cSuIY8d/2FAlFCOA==CN=WebSphere Application Server Liberty Profile,OU=Software Group,O=IBM Corp.,L=Armonk,ST=New York,C=USMIIDqDCCApCgAwIBAgIEUMJaljANBgkqhkiG9w0BAQsFADCBlTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCE5ldyBZb3JrMQ8wDQYDVQQHEwZBcm1vbmsxEjAQBgNVBAoTCUlCTSBDb3JwLjEXMBUGA1UECxMOU29mdHdhcmUgR3JvdXAxNTAzBgNVBAMTLFdlYlNwaGVyZSBBcHBsaWNhdGlvbiBTZXJ2ZXIgTGliZXJ0eSBQcm9maWxlMB4XDTEyMTIwNzIxMDczNFoXDTMyMTIwMjIxMDczNFowgZUxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhOZXcgWW9yazEPMA0GA1UEBxMGQXJtb25rMRIwEAYDVQQKEwlJQk0gQ29ycC4xFzAVBgNVBAsTDlNvZnR3YXJlIEdyb3VwMTUwMwYDVQQDEyxXZWJTcGhlcmUgQXBwbGljYXRpb24gU2VydmVyIExpYmVydHkgUHJvZmlsZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ8l5a67C3jNwuS9g0rYYJ3dDjnykECQGXgQ7sP5i9ixF0Gg6NYesjn6VUBhf8ziC/4R4yrflPID+C1nM9SsUQld5QyAjbboRCXbW6+oIofzQKzWUHQQavXOXkH3i765GlsuME2qHYT+H8SQ0S0Z2ZMQGr8PXA8lzTSvExozx+oXRXaqG97cpfNDjVZVswxR9QL5h5GdZ7INtN6OcNiKalz5cF95G4VvL1sjtRkPaupNV7C09hnw+UzdPjmxmIOkw6BbS/J0gkE+NSDjQCt1O4EalCOy1ERKMZIb3QsKyYQvebaXCm7u3aEy/yszaCwIIldSjYjM15SUQw20L5vbn/UCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAeJICZmkkBYgMqcq17+GRTWaDvKkcmBdBaIi6DDuRM31FNI7AzB2uLX2vJzXrrxPW41YturXKAZf25uKbgZOikO8e3djjCUhiLYhIm4aTJxPlrh+MejaNAwAVeZBunNrZL9VI8jtU/a1Vd9bEdQ305yXWzt5c5mfJB3Yrn0LmwYKiSfG2pERy0TVnCpNLM6iQ7O2lQLVXXwlxNthWyOavEqlK54LR1GoklhC4k1r4d/5Cc2tjsoIi1y9gZj0qZptJCM2o1RtWf/xa+MgIavH+M/FqLzphvGOoxkPOqOfgpLPhM7bpLM6xqhiqexE5Xxq0JiNaxDi5iVUoDDxXG8ZslA== \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name.xml b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name.xml new file mode 100755 index 000000000000..6f0f5cb813e3 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name.xml @@ -0,0 +1,26 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name2.xml b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name2.xml new file mode 100755 index 000000000000..8719b4721076 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name2.xml @@ -0,0 +1,28 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value.xml b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value.xml new file mode 100755 index 000000000000..4bd1cfa4558e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value.xml @@ -0,0 +1,26 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value2.xml b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value2.xml new file mode 100755 index 000000000000..dde0025c93f2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value2.xml @@ -0,0 +1,28 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/allInOne.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/allInOne.xml new file mode 100755 index 000000000000..721fa5c2a4f1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/allInOne.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/break.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/break.xml new file mode 100755 index 000000000000..f8e8688d41c4 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/break.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/break2.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/break2.xml new file mode 100755 index 000000000000..3160ed96667b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/break2.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/ignore.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/ignore.xml new file mode 100755 index 000000000000..f6937e461375 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/ignore.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/merge.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/merge.xml new file mode 100755 index 000000000000..7b5d41c8760c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/merge.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/replace.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/replace.xml new file mode 100755 index 000000000000..62c4f51c15eb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/replace.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.bad/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.bad/server.xml new file mode 100755 index 000000000000..ba1cc2db5512 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.bad/server.xml @@ -0,0 +1,18 @@ + + + + + servlet-3.0 + osgiconsole-1.0 + timedexit-1.0 + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.casesensitivity/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.casesensitivity/server.xml new file mode 100755 index 000000000000..b9e7ee808070 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.casesensitivity/server.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/server.xml new file mode 100755 index 000000000000..b866f31c32fc --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/server.xml @@ -0,0 +1,42 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/server.xml new file mode 100755 index 000000000000..09a8015de23b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/server.xml @@ -0,0 +1,20 @@ + + + + + + jsp-2.2 + osgiconsole-1.0 + configfatlibertyinternals-1.0 + delayedVariable-1.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/server.xml new file mode 100755 index 000000000000..3a13b483a637 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/server.xml @@ -0,0 +1,22 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + jdbc-4.0 + + + configfatlibertyinternals-1.0 + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.extensions/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.extensions/bootstrap.properties new file mode 100755 index 000000000000..4f1ae5a2e104 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.extensions/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/server.xml new file mode 100755 index 000000000000..ae5eafe0b2f9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/server.xml @@ -0,0 +1,38 @@ + + + + + osgiConsole-1.0 + servlet-3.0 + jdbc-4.0 + localConnector-1.0 + oauth-2.0 + ssl-1.0 + openidConnectServer-1.0 + + + + + + + + + + + + + + + + + client01 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/server.xml new file mode 100755 index 000000000000..331d606b15b1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/server.xml @@ -0,0 +1,25 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + + + mergedConfigTest-1.0 + + + configfatlibertyinternals-1.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/bootstrap.properties new file mode 100755 index 000000000000..9449ad31bc29 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/bootstrap.properties @@ -0,0 +1,4 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +relativeLocation=relative.xml +onError=FAIL diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/common.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/common.xml new file mode 100755 index 000000000000..eae2d7b79ceb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/common.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/relative.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/relative.xml new file mode 100755 index 000000000000..3135a5d29dd3 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/relative.xml @@ -0,0 +1,3 @@ + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/shared.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/shared.xml new file mode 100755 index 000000000000..46748c72e4a9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/shared.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/server.xml new file mode 100755 index 000000000000..654abb21f835 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/server.xml @@ -0,0 +1,21 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/shared.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/shared.xml new file mode 100755 index 000000000000..90be6e110405 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/shared.xml @@ -0,0 +1,4 @@ + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/bootstrap.properties new file mode 100755 index 000000000000..84bdd909d921 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +relativeLocation=relative.xml diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/common.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/common.xml new file mode 100755 index 000000000000..eae2d7b79ceb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/common.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/relative.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/relative.xml new file mode 100755 index 000000000000..3135a5d29dd3 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/relative.xml @@ -0,0 +1,3 @@ + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/shared.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/shared.xml new file mode 100755 index 000000000000..46748c72e4a9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/shared.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/server.xml new file mode 100755 index 000000000000..41bee0d180f2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/server.xml @@ -0,0 +1,16 @@ + + + + + + servlet-3.0 + configfatlibertyinternals-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/shared.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/shared.xml new file mode 100755 index 000000000000..90be6e110405 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/shared.xml @@ -0,0 +1,4 @@ + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/server.xml new file mode 100755 index 000000000000..84857d23bf8b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/server.xml @@ -0,0 +1,22 @@ + + + + + + jdbc-4.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidOptionalInclude/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidOptionalInclude/server.xml new file mode 100755 index 000000000000..bca129e7c185 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidOptionalInclude/server.xml @@ -0,0 +1,24 @@ + + + + + + + + + jdbc-4.0 + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/common.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/common.xml new file mode 100755 index 000000000000..e3b36e57ce73 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/common.xml @@ -0,0 +1,22 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + mergedConfigTest-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/conflict.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/conflict.xml new file mode 100755 index 000000000000..938c46720b5e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/conflict.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB.xml new file mode 100755 index 000000000000..34596140a856 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB2.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB2.xml new file mode 100755 index 000000000000..b031d93067b5 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC.xml new file mode 100755 index 000000000000..fa48b6a6de1d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC2.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC2.xml new file mode 100755 index 000000000000..df7c921921f0 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC2.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/intermediateReplace.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/intermediateReplace.xml new file mode 100755 index 000000000000..af7b9f26f9e6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/intermediateReplace.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/noConflict.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/noConflict.xml new file mode 100755 index 000000000000..02a08e80505d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/noConflict.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/server.xml new file mode 100755 index 000000000000..7829758b3050 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/server.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/server.xml new file mode 100755 index 000000000000..2fc260e93b78 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/server.xml @@ -0,0 +1,21 @@ + + + + + + + servlet-3.0 + osgiconsole-1.0 + httpservice-2.2 + metatypeProviderTest-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/bootstrap.properties new file mode 100755 index 000000000000..c554088bab6d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/bootstrap.properties @@ -0,0 +1,2 @@ +osgi.console=localhost:5678 +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/server.xml new file mode 100755 index 000000000000..15ad3318664a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/server.xml @@ -0,0 +1,9 @@ + + + + + osgiconsole-1.0 + jsp-2.2 + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/server.xml new file mode 100755 index 000000000000..cac904e50da9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/server.xml @@ -0,0 +1,22 @@ + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/server.xml new file mode 100755 index 000000000000..cac904e50da9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/server.xml @@ -0,0 +1,22 @@ + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/bootstrap.properties new file mode 100755 index 000000000000..6be023c08985 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +myHttpPort=1234 diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/server.xml new file mode 100755 index 000000000000..99b80c2053e5 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/server.xml @@ -0,0 +1,18 @@ + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/server.xml new file mode 100755 index 000000000000..d73ddfa9a3a9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/server.xml @@ -0,0 +1,21 @@ + + + + + + servlet-3.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/.gitignore new file mode 100644 index 000000000000..5c38c69748db --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/.gitignore @@ -0,0 +1,2 @@ +/download_target +/dropins diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/bootstrap.properties new file mode 100755 index 000000000000..72a1c9ce337b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/bootstrap.properties @@ -0,0 +1,20 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:\ +com.ibm.ws.config.schemagen.internal.ServerSchemaGeneratorImpl=all=enabled :\ +com.ibm.ws.jmx.connector.client.*=all=enabled:\ +com.ibm.ws.filetransfer.*=all=enabled:\ +com.ibm.ws.security.*=all=enabled:\ +com.ibm.websphere.security.*=all=enabled:\ +com.ibm.ws.webcontainer.*=all=enabled:\ +com.ibm.ws.webcontainer.security.*=all=enabled:\ +com.ibm.ws.webcontainer.security.internal.*=all=enabled:\ +com.ibm.ws.ssl.*=all=enabled:\ +SSL=all=enabled:\ +jmx.rest.server.connector=all=enabled:\ +FileTransfer=all=enabled:\ +web.*=all=enabled:\ +jmx.rest.server.connector=all=enabled:\ +logservice=all=enabled + +com.ibm.ws.logging.max.file.size=0 + +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/server.xml new file mode 100755 index 000000000000..df41d8e53ebc --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/server.xml @@ -0,0 +1,17 @@ + + + + restConnector-1.0 + servlet-3.0 + + + + + + + + + + ${server.output.dir} + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.uniquevalueconflict/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.uniquevalueconflict/server.xml new file mode 100755 index 000000000000..366f01211daf --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.uniquevalueconflict/server.xml @@ -0,0 +1,19 @@ + + + + + + + jsp-2.2 + jdbc-4.0 + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/bootstrap.properties new file mode 100755 index 000000000000..4f1ae5a2e104 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/server.xml new file mode 100755 index 000000000000..f58a679c61d4 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/server.xml @@ -0,0 +1,9 @@ + + + + localConnector-1.0 + servlet-3.0 + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/bootstrap.properties new file mode 100755 index 000000000000..4f1ae5a2e104 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/server.xml new file mode 100755 index 000000000000..1ff1cba56a84 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/server.xml @@ -0,0 +1,9 @@ + + + + localConnector-1.0 + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/common/common.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/common/common.xml new file mode 100755 index 000000000000..e1b01a740cf6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/common/common.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/full.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/full.xml new file mode 100755 index 000000000000..1bd852b91f98 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/full.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/server.xml new file mode 100755 index 000000000000..0c4fe350831e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/server.xml @@ -0,0 +1,22 @@ + + + + + + metatype-1.0 + configfatlibertyinternals-1.0 + servlet-3.0 + appSecurity-2.0 + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/bootstrap.properties new file mode 100755 index 000000000000..4f1ae5a2e104 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/server.xml new file mode 100755 index 000000000000..9253415a30a5 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/server.xml @@ -0,0 +1,10 @@ + + + + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/server.xml new file mode 100755 index 000000000000..0ef4ffe19bd6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/server.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + ${minVersion} + ${maxVersion} + ${minVersion} - ${maxVersion} + ${jdkVersion} + ${myMaxVersion} + + v1 + v2 + v3,v4 + v\5 + + + + + + + + + + + +p1oS139FKjDhhBuzB/5HicsDCYc=WQhTMFkWpJcuqaHGLRU4yL4yNm++CxJW4BkTQu71cQgSTSrOsCyYR3lzYqEntqI6vHoaiA1t/6yKzwQ0m9L0WkgkQeWwKjWa6xgQNa2oSar/KkPkXcMVTY3KqlfgL29Vlg0Ac0Ph3F9tRPLOp6SbVrGvvEHAApjMD/5YyDLtVIB127K18yrNTRhvMQ/bzqVLLFKjdiqXF4rMXG1urqD2HWx+CS8G5T1FOoDAP0BhROD4dXbDaiiIOlTAiSwEeddRVdi2HdShi423N3eE8o7iXSBk4yXk5nneYP02mb5vBlxjxHXpdBkcJ0fnR9OdFjpOiX96bOGK+VnVbQadfoYacg==CN=WebSphere Application Server Liberty Profile,OU=Software Group,O=IBM Corp.,L=Armonk,ST=New York,C=USMIIDqDCCApCgAwIBAgIEUMJaljANBgkqhkiG9w0BAQsFADCBlTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCE5ldyBZb3JrMQ8wDQYDVQQHEwZBcm1vbmsxEjAQBgNVBAoTCUlCTSBDb3JwLjEXMBUGA1UECxMOU29mdHdhcmUgR3JvdXAxNTAzBgNVBAMTLFdlYlNwaGVyZSBBcHBsaWNhdGlvbiBTZXJ2ZXIgTGliZXJ0eSBQcm9maWxlMB4XDTEyMTIwNzIxMDczNFoXDTMyMTIwMjIxMDczNFowgZUxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhOZXcgWW9yazEPMA0GA1UEBxMGQXJtb25rMRIwEAYDVQQKEwlJQk0gQ29ycC4xFzAVBgNVBAsTDlNvZnR3YXJlIEdyb3VwMTUwMwYDVQQDEyxXZWJTcGhlcmUgQXBwbGljYXRpb24gU2VydmVyIExpYmVydHkgUHJvZmlsZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ8l5a67C3jNwuS9g0rYYJ3dDjnykECQGXgQ7sP5i9ixF0Gg6NYesjn6VUBhf8ziC/4R4yrflPID+C1nM9SsUQld5QyAjbboRCXbW6+oIofzQKzWUHQQavXOXkH3i765GlsuME2qHYT+H8SQ0S0Z2ZMQGr8PXA8lzTSvExozx+oXRXaqG97cpfNDjVZVswxR9QL5h5GdZ7INtN6OcNiKalz5cF95G4VvL1sjtRkPaupNV7C09hnw+UzdPjmxmIOkw6BbS/J0gkE+NSDjQCt1O4EalCOy1ERKMZIb3QsKyYQvebaXCm7u3aEy/yszaCwIIldSjYjM15SUQw20L5vbn/UCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAeJICZmkkBYgMqcq17+GRTWaDvKkcmBdBaIi6DDuRM31FNI7AzB2uLX2vJzXrrxPW41YturXKAZf25uKbgZOikO8e3djjCUhiLYhIm4aTJxPlrh+MejaNAwAVeZBunNrZL9VI8jtU/a1Vd9bEdQ305yXWzt5c5mfJB3Yrn0LmwYKiSfG2pERy0TVnCpNLM6iQ7O2lQLVXXwlxNthWyOavEqlK54LR1GoklhC4k1r4d/5Cc2tjsoIi1y9gZj0qZptJCM2o1RtWf/xa+MgIavH+M/FqLzphvGOoxkPOqOfgpLPhM7bpLM6xqhiqexE5Xxq0JiNaxDi5iVUoDDxXG8ZslA== \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/bootstrap.properties new file mode 100755 index 000000000000..95e4f6aa26f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/common.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/common.xml new file mode 100755 index 000000000000..1bf222e99000 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/common.xml @@ -0,0 +1,19 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + configfatlibertyinternals-1.0 + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/conflict.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/conflict.xml new file mode 100755 index 000000000000..d8293e3f6d65 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/conflict.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/noConflict.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/noConflict.xml new file mode 100755 index 000000000000..2cb9eb36fbd5 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/noConflict.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/server.xml new file mode 100755 index 000000000000..7829758b3050 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/server.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..dac908a02fb9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..5888d2ec00d6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..95bbc2c1c95f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + ChildAliasTestServlet + test.server.config.childalias.ChildAliasTestServlet + + + + + ChildAliasTestServlet + /child-alias-test + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/childalias/src/test/server/config/childalias/ChildAliasTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/childalias/src/test/server/config/childalias/ChildAliasTestServlet.java new file mode 100755 index 000000000000..b1a6c01a2be2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/childalias/src/test/server/config/childalias/ChildAliasTestServlet.java @@ -0,0 +1,443 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.childalias; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +/** + * + */ +public class ChildAliasTestServlet extends HttpServlet { + + private static final String CHILD_1_PID = "test.config.childalias.child.1"; + private static final String CHILD_2_PID = "test.config.childalias.child.2"; + private static final String CHILD_3_PID = "test.config.childalias.child.3"; + private static final String CHILD_4_PID = "test.config.childalias.child.4"; + private static final String CHILD_5_PID = "test.config.childalias.child.5"; + private static final String CHILD_6_PID = "test.config.childalias.child.6"; + private static final String PARENT_1_PID = "test.config.childalias.parent.1"; + private static final String PARENT_2_PID = "test.config.childalias.parent.2"; + private static final String PARENT_3_PID = "test.config.childalias.parent.3"; + private static final String PARENT_4_PID = "test.config.childalias.parent.4"; + private static final String PARENT_5_PID = "test.config.childalias.parent.5"; + private static final String PARENT_6_PID = "test.config.childalias.parent.6"; + private static final String TOP_LEVEL_PID = "test.config.childalias.toplevel"; + + private final ArrayList references = new ArrayList(); + private BundleContext bundleContext; + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + if (testName.equals("dump")) { + // Just for debugging + dump(writer); + } else { + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + } + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + /** + * Just for manual debugging + * + * @param writer + * @throws Exception + */ + private void dump(PrintWriter writer) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configurations; + try { + configurations = ca.listConfigurations(null); + for (Configuration c : configurations) { + writer.print("

"); + String pid = c.getFactoryPid() == null ? c.getPid() : c.getFactoryPid(); + if (pid.startsWith("test")) { + writer.println(pid); + } + } + } catch (InvalidSyntaxException e1) { + throw new IOException(e1); + } + + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } + + public void testChildAlias1() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(CHILD_1_PID, true); + Configuration[] children1 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + CHILD_1_PID + " should exist", children1); + assertEquals("There should only be one instance of PID " + CHILD_1_PID, 1, children1.length); + + Configuration child1 = children1[0]; + Dictionary childProperties = child1.getProperties(); + assertEquals("The attribute value should be the correct metatype translated value", + "defaultValue", childProperties.get("defaultAttribute")); + + filter = getFilter(PARENT_1_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_1_PID + " should exist", parents); + assertEquals("There should be only one instance of PID " + PARENT_1_PID, 1, parents.length); + Configuration parent = parents[0]; + Dictionary parentProperties = parent.getProperties(); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + childProperties.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + public void testChildAlias2() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(CHILD_2_PID, true); + Configuration[] children2 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + CHILD_2_PID + " should exist", children2); + assertEquals("There should only be one instance of PID " + CHILD_2_PID, 1, children2.length); + + Configuration child2 = children2[0]; + Dictionary child2Properties = child2.getProperties(); + assertEquals("The attribute value should be the correct metatype translated value", + "square", child2Properties.get("shape")); + assertEquals("The attribute value should be the correct value from the config", + "orange", child2Properties.get("color")); + + filter = getFilter(PARENT_2_PID, true); + Configuration[] parents2 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_2_PID + " should exist", parents2); + assertEquals("There should be only one instance of PID " + PARENT_2_PID, 1, parents2.length); + Configuration parent2 = parents2[0]; + Dictionary parent2Properties = parent2.getProperties(); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parent2Properties.get(XMLConfigConstants.CFG_SERVICE_PID), + child2Properties.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + public void testChildAliasSingleton1() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = "(" + Constants.SERVICE_PID + "=" + CHILD_3_PID + ")"; + Configuration[] children3 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + CHILD_3_PID + " should exist", children3); + assertEquals("There should only be one instance of PID " + CHILD_3_PID, 1, children3.length); + + Configuration child3 = children3[0]; + Dictionary childProperties = child3.getProperties(); + assertEquals("The attribute value should be the correct metatype translated value", + "coconut", childProperties.get("defaultAttribute")); + assertNull("There should be no contamination from other singletons", childProperties.get("state")); + + filter = "(" + Constants.SERVICE_PID + "=" + PARENT_3_PID + ")"; + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_3_PID + " should exist", parents); + assertEquals("There should be only one instance of PID " + PARENT_3_PID, 1, parents.length); + Configuration parent = parents[0]; + Dictionary parentProperties = parent.getProperties(); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + childProperties.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + public void testChildAliasSingleton2() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = "(" + Constants.SERVICE_PID + "=" + CHILD_4_PID + ")"; + Configuration[] children4 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + CHILD_4_PID + " should exist", children4); + assertEquals("There should only be one instance of PID " + CHILD_4_PID, 1, children4.length); + + Configuration child4 = children4[0]; + Dictionary childProperties = child4.getProperties(); + assertEquals("The attribute value should be the correct metatype translated value", + "washington", childProperties.get("state")); + assertNull("There should be no contamination from other singletons", childProperties.get("defaultAttribute")); + + filter = "(" + Constants.SERVICE_PID + "=" + PARENT_4_PID + ")"; + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_4_PID + " should exist", parents); + assertEquals("There should be only one instance of PID " + PARENT_4_PID, 1, parents.length); + Configuration parent = parents[0]; + Dictionary parentProperties = parent.getProperties(); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + childProperties.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + /** + * Simulate bundle ordering issues by loading a new feature that forces a new bundle to load. + * + * Bundle B has a parent with an unloaded child and a child with an unloaded parent. At this point, + * nothing much will be resolved, but we can verify that there is no contamination with other child + * elements with the same childAlias. + * + * @throws Exception + */ + public void testBundleOrdering1() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(CHILD_5_PID, true); + Configuration[] children5 = ca.listConfigurations(filter); + assertNull("The configuration for " + CHILD_5_PID + " should not exist", children5); + + filter = getFilter(PARENT_5_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNull("The configuration for " + PARENT_5_PID + " should not exist", parents); + + Configuration[] children6 = ca.listConfigurations(getFilter(CHILD_6_PID, true)); + assertNull("The configuration for " + CHILD_6_PID + " should not exist", children6); + + dump(new PrintWriter(System.out)); + + Configuration[] parents6 = ca.listConfigurations(getFilter(PARENT_6_PID, true)); + assertNotNull("The configuration for " + PARENT_6_PID + " should exist", parents6); + assertEquals("There should be only one instance of PID " + PARENT_6_PID, 1, parents6.length); + Configuration parent = parents6[0]; + Dictionary parentProperties = parent.getProperties(); + String[] child6Pids = (String[]) parentProperties.get("testCAChild"); + assertNotNull(PARENT_6_PID + " should have a child element testCAChild", child6Pids); + assertEquals("There should be 1 child pid", 1, child6Pids.length); + Configuration child6Config = ca.getConfiguration(child6Pids[0]); + assertNotNull("The child for " + PARENT_6_PID + " should be available in the configuration", child6Config); + Dictionary child6Props = child6Config.getProperties(); + assertEquals("The child should not be metatype processed", "Not Default", child6Props.get("testAttribute6")); + assertNull("The child should not be metatype processed", child6Props.get("defaultSix")); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + child6Props.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + /** + * Simulate bundle ordering issues by loading a new feature that forces a new bundle to load. + * + * Bundle C has a parent with a child in Bundle B and a child with a parent in Bundle B. All + * elements should be resolved correctly at this point. + * + * @throws Exception + */ + public void testBundleOrdering2() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(CHILD_5_PID, true); + Configuration[] children5 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + CHILD_5_PID + " should exist", children5); + + filter = getFilter(PARENT_5_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_5_PID + " should exist", parents); + + Configuration[] children6 = ca.listConfigurations(getFilter(CHILD_6_PID, true)); + assertNotNull("The configuration for " + CHILD_6_PID + " should exist", children6); + + Configuration[] parents6 = ca.listConfigurations(getFilter(PARENT_6_PID, true)); + assertNotNull("The configuration for " + PARENT_6_PID + " should exist", parents6); + assertEquals("There should be only one instance of PID " + PARENT_6_PID, 1, parents6.length); + Configuration parent = parents6[0]; + Dictionary parentProperties = parent.getProperties(); + String[] child6Pids = (String[]) parentProperties.get("testCAChild"); + assertNotNull(PARENT_6_PID + " should have a child element testCAChild", child6Pids); + assertEquals("There should be only one child pid", 1, child6Pids.length); + Configuration child6Config = ca.getConfiguration(child6Pids[0]); + assertNotNull("The child for " + PARENT_6_PID + " should be available in the configuration", child6Config); + Dictionary child6Props = child6Config.getProperties(); + assertEquals("The child should have correct properties", "Not Default", child6Props.get("testAttribute6")); + assertEquals("The child should be metatype processed", "defaultValueSix", child6Props.get("defaultSix")); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + child6Props.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + /** + * Same scenario as testBundleOrdering2, but asserting that there are no contamination issues between the + * top level element and the child alias elements. + * + * @throws Exception + */ + public void testBundleOrderingAliasConflict() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(TOP_LEVEL_PID, true); + Configuration[] topLevel = ca.listConfigurations(filter); + assertNotNull("The configuration for " + TOP_LEVEL_PID + " should exist", topLevel); + assertEquals("There should be only one instance of PID " + TOP_LEVEL_PID, 1, topLevel.length); + Configuration topLevelConfig = topLevel[0]; + Dictionary topLevelProperties = topLevelConfig.getProperties(); + + assertEquals("The element should have correct properties", "topLevel", topLevelProperties.get("location")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("testAttribute6")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("defaultSix")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("country")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("state")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("defaultAttribute")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("testAttribute3")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("color")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("shape")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("testAttribute1")); + + assertNull("The parent pid should be null", + topLevelProperties.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + public void testRemoveChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] parents6 = ca.listConfigurations(getFilter(PARENT_6_PID, true)); + assertNull(PARENT_6_PID + " should be removed", parents6); + + Configuration[] children6 = ca.listConfigurations(getFilter(CHILD_6_PID, true)); + assertNull(CHILD_6_PID + " should be removed", children6); + } + + public void testAddNewChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] parents6 = ca.listConfigurations(getFilter(PARENT_6_PID, true)); + assertNotNull(PARENT_6_PID + " should be added", parents6); + assertEquals("There should be one parent", 1, parents6.length); + Configuration parent = parents6[0]; + Dictionary parentProperties = parent.getProperties(); + String[] child6Pids = (String[]) parentProperties.get("testCAChild"); + assertNotNull(PARENT_6_PID + " should have a child element testCAChild", child6Pids); + assertEquals("There should be only one child pid", 1, child6Pids.length); + Configuration child6Config = ca.getConfiguration(child6Pids[0]); + assertNotNull("The child for " + PARENT_6_PID + " should be available in the configuration", child6Config); + Dictionary child6Props = child6Config.getProperties(); + assertEquals("The child should have correct properties", "New Child", child6Props.get("testAttribute6")); + assertEquals("The child should be metatype processed", "defaultValueSix", child6Props.get("defaultSix")); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + child6Props.get(XMLConfigConstants.CFG_PARENT_PID)); + + } + + public void testUpdateChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] children6 = ca.listConfigurations(getFilter(CHILD_6_PID, true)); + assertNotNull("The child for " + PARENT_6_PID + " should be available in the configuration", children6); + assertEquals("There should be only one child pid", 1, children6.length); + Configuration child6Config = children6[0]; + Dictionary child6Props = child6Config.getProperties(); + assertEquals("The child should have correct properties", "Updated Child", child6Props.get("testAttribute6")); + assertEquals("The child should be metatype processed", "defaultValueSix", child6Props.get("defaultSix")); + } + + public void testRemoveSingletonChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] parents3 = ca.listConfigurations(getFilter(PARENT_3_PID, false)); + assertNotNull(PARENT_3_PID + " should exist", parents3); + assertEquals("There should be one parent", 1, parents3.length); + + Configuration[] children3 = ca.listConfigurations(getFilter(CHILD_3_PID, false)); + // CHILD_3 has defaults. Instead of a remove taking place, the defaults will be used + assertNotNull(CHILD_3_PID + " should not be removed", children3); + assertEquals("There should be one child", 1, children3.length); + Configuration child3 = children3[0]; + Dictionary properties = child3.getProperties(); + assertEquals("Default values should be used", "coconut", properties.get("defaultAttribute")); + assertEquals("Default values should be used", "Attribute 3", properties.get("testAttribute3")); + } + + public void testAddNewSingletonChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] parents3 = ca.listConfigurations(getFilter(PARENT_3_PID, false)); + assertNotNull(PARENT_3_PID + " should exist", parents3); + assertEquals("There should be one parent", 1, parents3.length); + Configuration parent = parents3[0]; + Dictionary parentProperties = parent.getProperties(); + String[] child3Pids = (String[]) parentProperties.get("testCAChild"); + assertNotNull(PARENT_3_PID + " should have a child element testCAChild", child3Pids); + assertEquals("There should be only one child pid", 1, child3Pids.length); + Configuration child3Config = ca.getConfiguration(child3Pids[0]); + assertNotNull("The child for " + PARENT_3_PID + " should be available in the configuration", child3Config); + Dictionary child3Props = child3Config.getProperties(); + assertEquals("The child should have correct properties", "New Singleton Child", child3Props.get("testAttribute3")); + assertEquals("The child should be metatype processed", "coconut", child3Props.get("defaultAttribute")); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + child3Props.get(XMLConfigConstants.CFG_PARENT_PID)); + + } + + public void testUpdateSingletonChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] children3 = ca.listConfigurations(getFilter(CHILD_3_PID, false)); + assertNotNull("The child for " + PARENT_3_PID + " should be available in the configuration", children3); + assertEquals("There should be only one child pid", 1, children3.length); + Configuration child3Config = children3[0]; + Dictionary child3Props = child3Config.getProperties(); + assertEquals("The child should have correct properties", "Updated Singleton Child", child3Props.get("testAttribute3")); + assertNull("The child should not be contaminated with other singletons", child3Props.get("testAttribute1")); + assertEquals("The child should be metatype processed", "coconut", child3Props.get("defaultAttribute")); + } +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..9fa09933ae2e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm, com.ibm.websphere.config diff --git a/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..5888d2ec00d6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..acc50e1908c1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + WSConfigurationHelperTestServlet + test.config.helper.WSConfigurationHelperTestServlet + + + + + WSConfigurationHelperTestServlet + /helperTest + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/confighelper/src/test/config/helper/WSConfigurationHelperTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/confighelper/src/test/config/helper/WSConfigurationHelperTestServlet.java new file mode 100755 index 000000000000..3d76cf52fc2c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/confighelper/src/test/config/helper/WSConfigurationHelperTestServlet.java @@ -0,0 +1,483 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package test.config.helper; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +import com.ibm.websphere.config.WSConfigurationHelper; +import com.ibm.wsspi.kernel.service.utils.OnErrorUtil.OnError; + +/** + * + */ +public class WSConfigurationHelperTestServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = 1L; + private final ArrayList> references = new ArrayList>(); + private BundleContext bundleContext; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + if (testName.equals("dump")) { + // Just for debugging + dump(writer); + } else { + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + } + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + /** + * Just for manual debugging + * + * @param writer + * @throws Exception + */ + private void dump(PrintWriter writer) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configurations; + try { + configurations = ca.listConfigurations(null); + for (Configuration c : configurations) { + writer.print("

"); + String pid = c.getFactoryPid() == null ? c.getPid() : c.getFactoryPid(); + if (pid.startsWith("test")) { + writer.println(pid); + } + } + } catch (InvalidSyntaxException e1) { + throw new IOException(e1); + } + + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List> references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private WSConfigurationHelper getHelper() { + ServiceReference ref = bundleContext.getServiceReference(WSConfigurationHelper.class); + if (ref == null) { + fail("Reference to WSConfigurationHelper not found"); + return null; + } else { + return bundleContext.getService(ref); + } + } + + public void testGetDefaultProperties() throws Exception { + + String factoryPid = "com.ibm.ws.config"; + + Dictionary dictionary = getHelper().getMetaTypeDefaultProperties(factoryPid); + assertEquals(new Long(500), dictionary.get("monitorInterval")); + assertEquals("polled", dictionary.get("updateTrigger")); + assertEquals(OnError.WARN, dictionary.get("onError")); + + } + + public void testGetDefaultPropertiesWithRequired() throws Exception { + String factoryPid = "com.ibm.ws.config.test.helper"; + + Dictionary dictionary = getHelper().getMetaTypeDefaultProperties(factoryPid); + assertEquals("hello", dictionary.get("defaultVal")); + assertNull(dictionary.get("requiredVal")); + + } + + /** + * Add a default singleton, replacing a "default" singleton (not specified in server.xml, but has all required metatype defaults) + * + * @throws Exception + */ + public void testAddDefaultConfiguration1() throws Exception { + String pid = "com.ibm.ws.config"; + + Dictionary dictionary = new Hashtable(); + dictionary.put("monitorInterval", "700"); + + getHelper().addDefaultConfiguration(pid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration c = ca.getConfiguration(pid); + assertEquals(new Long(700), c.getProperties().get("monitorInterval")); + + // Remove the default config we added, see that the singleton has returned to the original + getHelper().removeDefaultConfiguration(pid); + c = ca.getConfiguration(pid); + assertEquals(new Long(500), c.getProperties().get("monitorInterval")); + } + + /** + * Add a default factory config for a pid that didn't previously exist + * + * @throws Exception + */ + public void testAddDefaultConfiguration2() throws Exception { + String factoryPid = "com.ibm.ws.config.test.helper"; + Dictionary dictionary = new Hashtable(); + dictionary.put("requiredVal", "goodbye"); + + getHelper().addDefaultConfiguration(factoryPid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(1, configs.length); + Dictionary props = configs[0].getProperties(); + assertEquals("goodbye", props.get("requiredVal")); + assertEquals("hello", props.get("defaultVal")); + + // Remove the default configuration, verify that the config goes away + getHelper().removeDefaultConfiguration(factoryPid); + configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertNull(configs); + + } + + /** + * Add a default factory config for a pid that did exist. Values should be merged + * + * @throws Exception + */ + public void testAddDefaultConfiguration3() throws Exception { + String factoryPid = "com.ibm.example.topLevelElement"; + + Dictionary dictionary = new Hashtable(); + dictionary.put("id", "top"); + dictionary.put("drink", "coffee"); + + getHelper().addDefaultConfiguration(factoryPid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(1, configs.length); + Dictionary props = configs[0].getProperties(); + assertEquals("top", props.get("id")); + // From new default config + assertEquals("coffee", props.get("drink")); + // From server.xml + assertEquals("scone", props.get("food")); + // From metatype defaults, both instances + assertEquals("value", props.get("attribute")); + + // Remove the default configuration, see that the config has returned to the values in server.xml + getHelper().removeDefaultConfiguration(factoryPid); + + configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(1, configs.length); + props = configs[0].getProperties(); + assertEquals("top", props.get("id")); + // From new default config + assertNull(props.get("drink")); + // From server.xml + assertEquals("scone", props.get("food")); + // From metatype defaults, both instances + assertEquals("value", props.get("attribute")); + } + + /** + * Add two default configurations, same pid, distinct ids + * + * @throws Exception + */ + public void testAddDefaultConfiguration4() throws Exception { + String factoryPid = "com.ibm.example.topLevelElement"; + + Dictionary dictionary = new Hashtable(); + dictionary.put("id", "top"); + dictionary.put("drink", "coffee"); + + WSConfigurationHelper helper = getHelper(); + helper.addDefaultConfiguration(factoryPid, dictionary); + dictionary.put("id", "top2"); + dictionary.put("drink", "tea"); + helper.addDefaultConfiguration(factoryPid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(2, configs.length); + + for (Configuration config : configs) { + Dictionary props = config.getProperties(); + String id = (String) props.get("id"); + if ("top".equals(id)) { + // From new default config + assertEquals("coffee", props.get("drink")); + // From server.xml + assertEquals("scone", props.get("food")); + // From metatype defaults, both instances + assertEquals("value", props.get("attribute")); + } else if ("top2".equals(id)) { + assertEquals("tea", props.get("drink")); + assertNull(props.get("food")); + assertEquals("value", props.get("attribute")); + } else { + fail("Unrecognized id: " + id); + } + } + + // Remove the default configuration, see that the config has returned to the values in server.xml + getHelper().removeDefaultConfiguration(factoryPid); + + configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(1, configs.length); + Dictionary props = configs[0].getProperties(); + assertEquals("top", props.get("id")); + // From new default config + assertNull(props.get("drink")); + // From server.xml + assertEquals("scone", props.get("food")); + // From metatype defaults, both instances + assertEquals("value", props.get("attribute")); + } + + /** + * Add factory pid with default id and ibm:extends + * + * @throws Exception + */ + public void testAddDefaultConfiguration5() throws Exception { + String factoryPid = "com.ibm.example.child.a"; + String superPid = "com.ibm.example.supertype"; + Dictionary dictionary = new Hashtable(); + dictionary.put("attrA1", "goodbye"); + + getHelper().addDefaultConfiguration(factoryPid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(1, configs.length); + Dictionary props = configs[0].getProperties(); + assertEquals("goodbye", props.get("attrA1")); + assertEquals("value2", props.get("attrA2")); + + configs = ca.listConfigurations(getFilter(superPid, true)); + assertEquals(1, configs.length); + props = configs[0].getProperties(); + assertEquals("goodbye", props.get("attrA1")); + assertEquals("value2", props.get("attrA2")); + + // Remove the default configuration, verify that the config goes away + getHelper().removeDefaultConfiguration(factoryPid); + configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertNull(configs); + configs = ca.listConfigurations(getFilter(superPid, true)); + assertNull(configs); + + } + + /** + * Add default configuration for a pid that doesn't have metatype. It shouldn't exist in + * config admin. Then remove the default configuration and verify that it still isn't there. + * + * @throws Exception + */ + public void testAddDefaultConfiguration6() throws Exception { + String factoryPid = "nonMetatype"; + Dictionary dictionary = new Hashtable(); + dictionary.put("attrA1", "goodbye"); + + getHelper().addDefaultConfiguration(factoryPid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertNull("The non-metatype configuration should not exist", configs); + + // Remove the default configuration, verify that the config still doesn't exist + getHelper().removeDefaultConfiguration(factoryPid); + configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertNull(configs); + } + + /** + * Add a default factory nested config for a parent that did exist. Values should be merged + * + * Using metatype from metatype-nested-merge.xml + * + * @throws Exception + */ + public void testAddDefaultConfiguration7() throws Exception { + String parentPid = "test.nestedmerge.parent.ONE"; + String childPid = "test.nestedmerge.child"; + + String xml = "" + + " " + + "" + + "" + + ""; + + ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes()); + + getHelper().addDefaultConfiguration(bais); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(childPid, true)); + assertNotNull("The child configuration should exist", configs); + assertEquals(1, configs.length); + Dictionary props = configs[0].getProperties(); + assertEquals("child", props.get("id")); + // From new default config + assertEquals("coffee", props.get("someAttr")); + + // Remove the default configuration, see that the config has returned to the values in server.xml + + getHelper().removeDefaultConfiguration(parentPid); + + configs = ca.listConfigurations(getFilter(parentPid, true)); + assertEquals(1, configs.length); + props = configs[0].getProperties(); + assertEquals("one", props.get("id")); + + assertNull("The child element should not exist as a property on the parent", props.get("child")); + + configs = ca.listConfigurations(getFilter(childPid, true)); + assertNull("The child element should not exist", configs); + } + + /** + * Add a default factory nested config for a parent that doesn't exist with the same id. An instance of the + * parent and child should be added by addDefaultConfiguration, and both should be removed by remove + * + * Using metatype from metatype-nested-merge.xml + * + * @throws Exception + */ + public void testAddDefaultConfiguration8() throws Exception { + String parentPid = "test.nestedmerge.parent.ONE"; + String childPid = "test.nestedmerge.child"; + + String xml = "" + + " " + + "" + + "" + + ""; + + ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes()); + + getHelper().addDefaultConfiguration(bais); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(parentPid, true)); + assertNotNull("the parent configurations should exist", configs); + assertEquals(2, configs.length); + + // Get the properties for the parent with id "two" + Dictionary props = configs[0].getProperties(); + if ("one".equals(props.get("id"))) + props = configs[1].getProperties(); + assertEquals("two", props.get("id")); + String childServicePid = (String) props.get("child"); + assertNotNull("The child should exist as a property on the parent", childServicePid); + + // Get the child configuration + configs = ca.listConfigurations(getFilter(childPid, true)); + assertNotNull("The child configuration should exist", configs); + assertEquals(1, configs.length); + props = configs[0].getProperties(); + assertEquals("child", props.get("id")); + // From new default config + assertEquals("coffee", props.get("someAttr")); + assertEquals(childServicePid, props.get("service.pid")); + + // Remove the default configuration, see that the config has returned to the values in server.xml + + getHelper().removeDefaultConfiguration(parentPid); + + configs = ca.listConfigurations(getFilter(parentPid, true)); + assertEquals(1, configs.length); + props = configs[0].getProperties(); + assertEquals("one", props.get("id")); + + assertNull("The child element should not exist as a property on the parent", props.get("child")); + + configs = ca.listConfigurations(getFilter(childPid, true)); + assertNull("The child element should not exist", configs); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..dac908a02fb9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..5888d2ec00d6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..5b8510ae6c75 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + ConfigDropinsTestServlet + test.config.dropins.ConfigDropinsServlet + + + + + ConfigDropinsTestServlet + /dropinsTest + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/dropins/src/test/config/dropins/ConfigDropinsServlet.java b/dev/com.ibm.ws.config_fat/test-applications/dropins/src/test/config/dropins/ConfigDropinsServlet.java new file mode 100755 index 000000000000..d44face709c6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/dropins/src/test/config/dropins/ConfigDropinsServlet.java @@ -0,0 +1,218 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package test.config.dropins; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * + */ +public class ConfigDropinsServlet extends HttpServlet { + + private static final String LIBRARY_PID = "com.ibm.ws.classloading.sharedlibrary"; + private final ArrayList> references = new ArrayList>(); + private BundleContext bundleContext; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + if (testName.equals("dump")) { + // Just for debugging + dump(writer); + } else { + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + } + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + /** + * Just for manual debugging + * + * @param writer + * @throws Exception + */ + private void dump(PrintWriter writer) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configurations; + try { + configurations = ca.listConfigurations(null); + for (Configuration c : configurations) { + writer.print("

"); + String pid = c.getFactoryPid() == null ? c.getPid() : c.getFactoryPid(); + if (pid.startsWith("test")) { + writer.println(pid); + } + } + } catch (InvalidSyntaxException e1) { + throw new IOException(e1); + } + + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List> references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } + + public void testNonXmlFile() throws Exception { + // Make sure that we don't load files with extensions other than .xml + checkLibraryValue(TEST1, SERVER); + } + + public void testBrokenDropin() throws Exception { + // We should continue to parse server.xml and dropins after encountering a broken file + checkLibraryValue(TEST1, SIMPLE); + } + + public void testSimpleDefaults() throws Exception { + // Value specified for library description in dropin defaults is overridden + checkLibraryValue(TEST1, SERVER); + } + + public void testSimpleOverrides() throws Exception { + // Value specified for library description in dropin overrides is used instead of server.xml + checkLibraryValue(TEST1, SIMPLE); + } + + public void testSimpleOverrides2() throws Exception { + // Value specified for library description in dropin overrides is used instead of server.xml or default dropins + checkLibraryValue(TEST1, SIMPLE2); + } + + public void testDefaultsOrdering() throws Exception { + // Value from server.xml is used. Not testing much here, just sanity. + checkLibraryValue(TEST1, SERVER); + } + + public void testOverridesOrdering() throws Exception { + // Value from simple2.xml in overrides is used rather than simple.xml from overrides or server.xml. + checkLibraryValue(TEST1, SIMPLE2); + } + + public void testNoServerValue1() throws Exception { + // File in defaults, no value in server.xml, use default value + checkLibraryValue(TEST2, A); + } + + public void testNoServerValue2() throws Exception { + // File in overrides, no value in server.xml, use overrides value + checkLibraryValue(TEST2, A); + } + + public void testNoServerValue3() throws Exception { + // Files in defaults and overrides, no value in server.xml, use overrides value + checkLibraryValue(TEST2, B); + } + + private void checkLibraryValue(String libraryID, String description) throws Exception { + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(LIBRARY_PID, true)); + if (configs == null) + fail("Could not find library configuration"); + + boolean found = false; + for (Configuration config : configs) { + Dictionary props = config.getProperties(); + String id = (String) props.get("id"); + if (libraryID.equals(id)) { + assertEquals("The description should be from simple.xml", description, props.get("description")); + found = true; + } + } + + assertTrue("The configuration for the library with ID testLibrary should exist", found); + + } + + private static final String TEST1 = "testLibrary"; + private static final String TEST2 = "testLibrary2"; + + private static final String SIMPLE = "Library From Simple.xml"; + private static final String SIMPLE2 = "Library from simple2.xml"; + private static final String SERVER = "Library from server.xml"; + private static final String A = "Library A"; + private static final String B = "Library B"; +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..5ff6e91bf81d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, java.net, javax.management, com.ibm.websphere.config.mbeans, com.ibm.ws.jmx.connector.client.rest diff --git a/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..5888d2ec00d6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..5ee7921067fc --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/WEB-INF/web.xml @@ -0,0 +1,16 @@ + + + + + AppClientServletSchemaGen + web.AppClientServletSchemaGen + + + + + AppClientServletSchemaGen + /appClient + + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/mbeans/src/web/AppClientServletSchemaGen.java b/dev/com.ibm.ws.config_fat/test-applications/mbeans/src/web/AppClientServletSchemaGen.java new file mode 100755 index 000000000000..155fb8fffe72 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mbeans/src/web/AppClientServletSchemaGen.java @@ -0,0 +1,163 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package web; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.URLDecoder; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import javax.management.JMX; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.ibm.websphere.config.mbeans.ServerSchemaGenerator; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; + +@SuppressWarnings("serial") +public class AppClientServletSchemaGen extends HttpServlet { + + private static MBeanServerConnection mbsc; + private static final String SUCCESS_MESSAGE = "Setup completed successfully."; + + private static final long MIN_FILE_SIZE = 500000; + + /** + * Uses the JMX REST connector client from within a user-application to test + * the functionality of com.ibm.websphere.config.mbeans.ServerSchemaGenerator + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + boolean successful = false; + String failureMessage = null; + + try { + + String serverRoot = URLDecoder.decode(request.getParameter("serverRoot"), "UTF-8"); + System.out.println("Server root:" + serverRoot); + System.setProperty("javax.net.ssl.trustStore", serverRoot + "/resources/security/key.jks"); + System.setProperty("javax.net.ssl.trustStorePassword", "Liberty"); + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", request.getServerName(), request.getServerPort(), "/IBMJMXConnectorREST"); + JMXConnector jmxConnector = JMXConnectorFactory.connect(url, environment); + mbsc = jmxConnector.getMBeanServerConnection(); + + //---------------------------------------===== + // Invoke MBean using MBeanServerConnection + //---------------------------------------===== + + //Invoke schema generation + Object[] params = new String[] { "1.0", "1", "UTF-8", Locale.getDefault().toString() }; //schemaVersion, outputVersion, encoding, locale + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String" }; + + final ObjectName SCHEMA_GEN_MBEAN = new ObjectName(ServerSchemaGenerator.OBJECT_NAME); + + @SuppressWarnings("unchecked") + Map returnedMap = (Map) mbsc.invoke(SCHEMA_GEN_MBEAN, "generateInstallSchema", params, signature); + + //Check return code + if ((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0) { + throw new RuntimeException("Invoke MBean - Generate schema call did not return successful return_code"); + } + + //Ensure the file is bigger than expected minimum size + String filePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + File file = new File(filePath); + if (file.length() < MIN_FILE_SIZE) { + throw new RuntimeException("Invoke MBean - Generated schema file is less than expected size. File=" + file.getAbsolutePath() + + " : size=" + file.length()); + } + + //--------------------------------------- + // Call operations using the API + //--------------------------------------- + + ServerSchemaGenerator schemaGenMBean = JMX.newMBeanProxy(mbsc, SCHEMA_GEN_MBEAN, ServerSchemaGenerator.class); + returnedMap = schemaGenMBean.generateInstallSchema(null, null, null, null); //schemaVersion, outputVersion, encoding, locale + + if ((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0) { + throw new RuntimeException("MBean via API - Generate schema call did not return successful return_code"); + } + + //Ensure the file is bigger than expected minimum size + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + file = new File(sourcePath); + + if (file.length() < MIN_FILE_SIZE) { + throw new RuntimeException("MBean via API - Generated schema file is less than expected size. File=" + file.getAbsolutePath() + + " : size=" + file.length()); + } + + //Download generated file (typical user operation) + String targetPath = serverRoot + "/download_target/schemaServletCallAPI.xsd"; + + final ObjectName FILE_TRN_MBEAN = new ObjectName(FileTransferMBean.OBJECT_NAME); + FileTransferMBean fileTrnMBean = JMX.newMBeanProxy(mbsc, FILE_TRN_MBEAN, FileTransferMBean.class); + fileTrnMBean.downloadFile(sourcePath, targetPath); + + //Ensure downloaded file is bigger than expected minimum size + file = new File(targetPath); + + if (file.length() < MIN_FILE_SIZE) { + throw new RuntimeException("MBean via API - Downloaded schema file is less than expected size. File=" + file.getAbsolutePath() + + " : size=" + file.length()); + } + + // Delete the source file under logs/state + file = new File(sourcePath); + + // First check if the file exists + if (!file.exists()) { + throw new RuntimeException("MBean via API - Generated schema file does not exist (before deletion). File=" + file.getAbsolutePath()); + } + + fileTrnMBean.deleteFile(sourcePath); + + //Verify the file is deleted + if (file.exists()) { + throw new RuntimeException("MBean via API - Generated schema file was not deleted. File=" + file.getAbsolutePath() + " : size=" + file.length()); + } + + jmxConnector.close(); + + successful = true; + + } catch (Throwable t) { + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw)); + failureMessage = sw.toString(); + } + + PrintWriter writer = response.getWriter(); + writer.println(successful ? SUCCESS_MESSAGE : failureMessage); + writer.flush(); + writer.close(); + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..dac908a02fb9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..5888d2ec00d6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..b19c07b70cb2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + MergedConfigTestServlet + test.config.merged.MergedConfigTestServlet + + + + + MergedConfigTestServlet + /mergedConfigTest + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/src/test/config/merged/MergedConfigTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/src/test/config/merged/MergedConfigTestServlet.java new file mode 100755 index 000000000000..b194ec66d898 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/src/test/config/merged/MergedConfigTestServlet.java @@ -0,0 +1,304 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package test.config.merged; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * + */ +public class MergedConfigTestServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = 4084916808353306371L; + private final ArrayList> references = new ArrayList>(); + private BundleContext bundleContext; + + public static final String PARENT_PID = "com.ibm.example.topLevelElement"; + public static final String CHILD_A_PID = "com.ibm.example.child.a"; + public static final String CHILD_B_PID = "com.ibm.example.child.b"; + public static final String CHILD_C_PID = "com.ibm.example.child.c"; + public static final String PARENT_D_PID = "com.ibm.example.top.d"; + private static final String DEFAULT_PID = "com.ibm.example.default"; + private static final String DEFAULT_MISSING_PID = "com.ibm.example.default.missing"; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + if (testName.equals("dump")) { + // Just for debugging + dump(writer); + } else { + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + } + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + /** + * Just for manual debugging + * + * @param writer + * @throws Exception + */ + private void dump(PrintWriter writer) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configurations; + try { + configurations = ca.listConfigurations(null); + for (Configuration c : configurations) { + writer.print("

"); + String pid = c.getFactoryPid() == null ? c.getPid() : c.getFactoryPid(); + if (pid.startsWith("test")) { + writer.println(pid); + } + } + } catch (InvalidSyntaxException e1) { + throw new IOException(e1); + } + + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List> references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } + + private enum Behavior { + MERGE, REPLACE, IGNORE + } + + private void verify(Behavior behavior) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(PARENT_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_PID + " should exist", parents); + + assertEquals("There should be four instances of PID " + PARENT_PID, 4, parents.length); + + for (Configuration parent : parents) { + Dictionary properties = parent.getProperties(); + String id = (String) properties.get("id"); + if ("a".equals(id)) { + String[] pids = (String[]) properties.get("child.a"); + assertNotNull("The child pids should exist", pids); + assertEquals("There should be one child pid", 1, pids.length); + Configuration child = ca.getConfiguration(pids[0]); + assertNotNull("The child should exist", child); + Dictionary childProps = child.getProperties(); + if (behavior == Behavior.MERGE || behavior == Behavior.REPLACE) { + assertEquals("a1", childProps.get("attrA1")); + } else { + assertNull(childProps.get("attrA1")); + } + if (behavior == Behavior.MERGE || behavior == Behavior.IGNORE) { + assertEquals("a2", childProps.get("attrA2")); + } else { + // We replaced the top level (attrA2=a2) with the include (attr1=a1), but attrA2 has a default value. + assertEquals("value2", childProps.get("attrA2")); + } + } else if ("b".equals(id)) { + String[] pids = (String[]) properties.get("child.b"); + assertNotNull("the child pids should exist", pids); + assertEquals("there should be one child pid", 1, pids.length); + Configuration child = ca.getConfiguration(pids[0]); + assertNotNull("The child should exist", child); + Dictionary childProps = child.getProperties(); + assertEquals("b1", childProps.get("attrB1")); + assertEquals("b2", childProps.get("attrB2")); + } else if ("c".equals(id) || "common".equals(id)) { + } else { + fail("Something went horribly wrong."); + } + } + } + + public void testMergedConfig() throws Exception { + // All config in one file, verify it's merged correctly. If this isn't working, fix this first, because + // whatever is broken here would break the other tests. + verify(Behavior.MERGE); + } + + public void testMergedIncludesMerge() throws Exception { + // Same set of assumptions as the all in one case + verify(Behavior.MERGE); + } + + public void testMergedIncludesBreak() throws Exception { + // The config doesn't get updated, so verify we're still using the all in one config + verify(Behavior.MERGE); + } + + public void testMergedIncludesBreak2() throws Exception { + // Test is arranged so that the assumptions here are the same as for merge.. What would normally be + // merged in is specified in the top level file. The included file has the non conflicting elements, which + // should all get added despite onConflict="break" + verify(Behavior.MERGE); + } + + public void testMergedIncludesReplace() throws Exception { + // Verify that the attribute in the top level file gets replaced by the include + verify(Behavior.REPLACE); + } + + public void testMergedIncludesIgnore() throws Exception { + // Verify that the attribute in the included file gets ignored + verify(Behavior.IGNORE); + + } + + public void testMergedIncludesIgnoreReplace() throws Exception { + // Verify that none of the level 3 (REPLACE) or level 2 (IGNORE) elements are used + verify(Behavior.IGNORE); + } + + public void testMergedIncludesFourLevelReplace() throws Exception { + // Conflict is between level 2 (fourLevelB.xml) and level 4 (conflict.xml). Verify that the "replace" behavior from + // level 2 is used instead of the "ignore" behavior from level 3. + verify(Behavior.REPLACE); + } + + public void testMergedIncludesFourLevelIgnore() throws Exception { + // Conflict is between level 2 (fourLevelB2.xml) and level 4 (conflict.xml). Verify that the "ignore" behavior from + // level 2 is used instead of the "replace" behavior from level 3. + verify(Behavior.IGNORE); + } + + public void testDefaultInstances1() throws Exception { + // Check to make sure a default instance marked requiresExisting=true gets merged into an existing + // configuration + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + PARENT_PID + ")(id=common))"; + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_PID + "with the ID 'common' should exist", parents); + assertEquals("There should be one instance " + PARENT_PID, 1, parents.length); + + Dictionary properties = parents[0].getProperties(); + String[] pids = (String[]) properties.get("child.a"); + assertNotNull("the child pid should exist", pids); + assertEquals("there should be one child pid", 1, pids.length); + + } + + public void testDefaultInstances2() throws Exception { + // Check to make sure that a default instance without a requiresExisting attribute gets merged in and that one + // with requiresExisting=true does not. + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(DEFAULT_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + DEFAULT_PID + " should exist", parents); + assertEquals("There should be one instance of PID " + DEFAULT_PID, 1, parents.length); + + Dictionary properties = parents[0].getProperties(); + String id = (String) properties.get("id"); + assertEquals("The ID should be 'two'", "two", id); + + } + + public void testDefaultInstances3() throws Exception { + // Check to make sure a default instance marked addIfMissing=true gets added when an existing + // configuration is not specified. Also checks that an instance does not get added when there is an existing configuration. + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(DEFAULT_MISSING_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + DEFAULT_MISSING_PID + " should exist", parents); + assertEquals("There should be two instances of PID " + DEFAULT_MISSING_PID, 2, parents.length); + + for (Configuration config : parents) { + Dictionary properties = config.getProperties(); + String id = (String) properties.get("id"); + String someProperty = (String) properties.get("someProperty"); + if ("one".equals(id)) { + assertNull("someProperty should be null because the default instance should not be merged", someProperty); + } else if ("two".equals(id)) { + assertEquals("someProperty should be defined because the default instance should be merged", someProperty, "from default instances"); + } else { + fail("Something went horribly wrong -- default instance with ID " + id + " found when 'one' or 'two' was expected"); + } + } + + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..826e67ac344d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: com.ibm.ws.config.metatype +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..5888d2ec00d6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/OSGI-INF/metatype/metatype.xml b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/OSGI-INF/metatype/metatype.xml new file mode 100755 index 000000000000..da1f74436eb1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/OSGI-INF/metatype/metatype.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatype/src/test/server/config/metatype/TestRunner.java b/dev/com.ibm.ws.config_fat/test-applications/metatype/src/test/server/config/metatype/TestRunner.java new file mode 100755 index 000000000000..f6a0f503ef0e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatype/src/test/server/config/metatype/TestRunner.java @@ -0,0 +1,7 @@ +package test.server.config.metatype; + +// just a dummy class so that things get compiled + +public class TestRunner { + +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..dac908a02fb9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..5888d2ec00d6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..c0aded3cc2de --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + MetatypeProviderTestServlet + test.metatype.provider.MetatypeProviderTestServlet + + + + + MetatypeProviderTestServlet + /providerTest + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/src/test/metatype/provider/MetatypeProviderTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/src/test/metatype/provider/MetatypeProviderTestServlet.java new file mode 100755 index 000000000000..7078d5c5ecfe --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/src/test/metatype/provider/MetatypeProviderTestServlet.java @@ -0,0 +1,198 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.metatype.provider; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * + */ +public class MetatypeProviderTestServlet extends HttpServlet { + + /** */ + private static final String LIFESPAN_ATTRIBUTE = "lifespan"; + + /** */ + private static final String NAME_ATTRIBUTE = "name"; + + /** */ + private static final long serialVersionUID = -1977276153574893730L; + + private final ArrayList references = new ArrayList(); + private BundleContext bundleContext; + + public static final String PLANT_PID = "test.metatype.provider.plant"; + public static final String ANIMAL_PID = "test.metatype.provider.animal"; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + if (testName.equals("dump")) { + // Just for debugging + dump(writer); + } else { + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + } + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + /** + * Just for manual debugging + * + * @param writer + * @throws Exception + */ + private void dump(PrintWriter writer) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configurations; + try { + configurations = ca.listConfigurations(null); + for (Configuration c : configurations) { + writer.print("

"); + String pid = c.getFactoryPid() == null ? c.getPid() : c.getFactoryPid(); + if (pid.startsWith("test")) { + writer.println(pid); + } + } + } catch (InvalidSyntaxException e1) { + throw new IOException(e1); + } + + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } + + public void testMetatypeProvider1() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(PLANT_PID, true); + Configuration[] children1 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PLANT_PID + " should exist", children1); + assertEquals("There should only be one instance of PID " + PLANT_PID, 1, children1.length); + + } + + public void testMetatypeProvider2() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(ANIMAL_PID, true); + Configuration[] children1 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + ANIMAL_PID + " should exist", children1); + assertEquals("There should only be one instance of PID " + ANIMAL_PID, 1, children1.length); + + Configuration child = children1[0]; + Dictionary dictionary = child.getProperties(); + assertNotNull("The dictionary should exist", dictionary); + + Object lifespan = dictionary.get(LIFESPAN_ATTRIBUTE); + assertNotNull("The lifespan attribute should exist", lifespan); + + assertEquals("The lifespan attribute should be 1000 days", 86400000000L, lifespan); + + Object name = dictionary.get(NAME_ATTRIBUTE); + assertNotNull("The name attribute should exist", name); + assertEquals("The name should be marmot", "marmot", name); + } + + /** + * Test that metatype converted config is removed when its corresponding metatype is removed + * + * PLANT_PID should not exist in config admin even though it was specified using the full pid. + * We don't recreate the pre-metatype config when the metatype is removed. + * + * ANIMAL_PID should not exist. + * + * @throws Exception + */ + public void testMetatypeProvider3() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(PLANT_PID, true); + Configuration[] children1 = ca.listConfigurations(filter); + assertNull("The configuration for " + PLANT_PID + " should not exist", children1); + + filter = getFilter(ANIMAL_PID, true); + children1 = ca.listConfigurations(filter); + assertNull("The configuration for " + ANIMAL_PID + " should not exist", children1); + } +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..dac908a02fb9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..5888d2ec00d6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/restart/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..d92e42649f39 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + ConfigRestartTestServlet + test.server.config.restart.ConfigRestartTestServlet + + + + + ConfigRestartTestServlet + /restart + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/restart/src/test/server/config/restart/ConfigRestartTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/restart/src/test/server/config/restart/ConfigRestartTestServlet.java new file mode 100755 index 000000000000..83c989c7e8f6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/restart/src/test/server/config/restart/ConfigRestartTestServlet.java @@ -0,0 +1,250 @@ +package test.server.config.restart; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import javax.management.MBeanServer; +import javax.management.ObjectName; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.util.tracker.ServiceTracker; + +import com.ibm.ws.jmx.PlatformMBeanService; + +@SuppressWarnings("serial") +public class ConfigRestartTestServlet extends HttpServlet { + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + List references = new ArrayList(); + BundleContext bundleContext = bundle.getBundleContext(); + try { + if ("before".equals(testName)) { + testConfigurationBefore(bundleContext, references); + } else if ("after".equals(testName)) { + testConfigurationAfter(bundleContext, references); + } else if ("beforeVariable".equals(testName)) { + testBeforeVariable(bundleContext, references); + } else if ("afterVariable".equals(testName)) { + testAfterVariable(bundleContext, references); + } else if ("checkImport".equals(testName)) { + testCheckImport(bundleContext, references); + } else if ("refresh".equals(testName)) { + testRefresh(bundleContext, references); + } else { + fail("Invalid test name: " + testName); + } + writer.println("Test Passed"); + } catch (Throwable e) { + e.printStackTrace(writer); + } finally { + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + } + + writer.flush(); + writer.close(); + } + + private void testConfigurationBefore(BundleContext ctx, List references) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(ctx, references); + testSingletonBefore(ca); + testFactoryBefore(ca); + } + + private void testConfigurationAfter(BundleContext ctx, List references) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(ctx, references); + testSingletonAfter(ca); + testFactoryAfter(ca); + } + + private void testSingletonBefore(ConfigurationAdmin ca) { + Configuration[] configs = null; + String filter = null; + + filter = "(" + Constants.SERVICE_PID + "=" + "singleton-one" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration value property", "abc", configs[0].getProperties().get("value")); + + filter = "(" + Constants.SERVICE_PID + "=" + "singleton-two" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration value property", "def", configs[0].getProperties().get("value")); + } + + private void testSingletonAfter(ConfigurationAdmin ca) { + Configuration[] configs = null; + String filter = null; + + // deleted after restart + filter = "(" + Constants.SERVICE_PID + "=" + "singleton-one" + ")"; + configs = getConfiguration(ca, filter); + assertNull("There should not be a configuration found for filter " + filter, configs); + + // unchanged after restart + filter = "(" + Constants.SERVICE_PID + "=" + "singleton-two" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration value property", "def", configs[0].getProperties().get("value")); + } + + private void testFactoryBefore(ConfigurationAdmin ca) { + Configuration[] configs = null; + String filter = null; + + filter = "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 2 configurations for filter " + filter, 2, configs.length); + + filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")(id=1))"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration name property", "one", configs[0].getProperties().get("name")); + + filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")(id=2))"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration name property", "two", configs[0].getProperties().get("name")); + } + + private void testFactoryAfter(ConfigurationAdmin ca) { + Configuration[] configs = null; + String filter = null; + + filter = "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 2 configurations for filter " + filter, 2, configs.length); + + filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")(id=1))"; + configs = getConfiguration(ca, filter); + assertNull("There should not be a configuration found for filter " + filter, configs); + + filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")(id=2))"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration name property", "two", configs[0].getProperties().get("name")); + + filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")(id=3))"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration name property", "three", configs[0].getProperties().get("name")); + + } + + private void testBeforeVariable(BundleContext ctx, List references) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(ctx, references); + + Configuration[] configs = null; + String filter = null; + + filter = "(" + Constants.SERVICE_PID + "=" + "myPort" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration type property", "http", configs[0].getProperties().get("type")); + assertEquals("Configuration value property", "1234", configs[0].getProperties().get("value")); + } + + private void testAfterVariable(BundleContext ctx, List references) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(ctx, references); + + Configuration[] configs = null; + String filter = null; + + filter = "(" + Constants.SERVICE_PID + "=" + "myPort" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration type property", "http", configs[0].getProperties().get("type")); + assertEquals("Configuration value property", "5678", configs[0].getProperties().get("value")); + } + + private void testCheckImport(BundleContext ctx, List references) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(ctx, references); + + Configuration[] configs = null; + String filter = null; + + filter = "(" + Constants.SERVICE_PID + "=" + "person" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration firstName property", "Joe", configs[0].getProperties().get("firstName")); + assertEquals("Configuration lastName property", "Doe", configs[0].getProperties().get("lastName")); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private Configuration[] getConfiguration(ConfigurationAdmin ca, String filter) { + try { + return ca.listConfigurations(filter); + } catch (InvalidSyntaxException e) { + throw new RuntimeException("Invalid filter: " + filter, e); + } catch (IOException e) { + throw new RuntimeException("Error listing configurations", e); + } + } + + private void testRefresh(BundleContext ctx, List references) throws Exception { + ServiceTracker tracker = new ServiceTracker(ctx, PlatformMBeanService.class.getName(), null); + tracker.open(); + try { + PlatformMBeanService service = (PlatformMBeanService) tracker.waitForService(60 * 1000); + assertNotNull("No Platform MBean service", service); + + List serverXML = new ArrayList(); + serverXML.add(new File("server.xml").getAbsolutePath()); + + MBeanServer server = service.getMBeanServer(); + ObjectName configServices = new ObjectName("WebSphere", "service", "com.ibm.ws.kernel.filemonitor.FileNotificationMBean"); + server.invoke(configServices, "notifyFileChanges", new Object[] { Collections.emptyList(), serverXML, Collections.EMPTY_LIST }, + new String[] { Collection.class.getName(), Collection.class.getName(), Collection.class.getName() }); + } finally { + tracker.close(); + } + } +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..f49fb55181f4 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm, com.ibm.wsspi.kernel.service.location diff --git a/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..5888d2ec00d6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..1b0ab41efc89 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/WEB-INF/web.xml @@ -0,0 +1,26 @@ + + + + + VarMergeTestServlet + test.config.merged.VarMergeTestServlet + + + + + VarMergeTestServlet + /varMergeTest + + + + DelayedVariableTestServlet + test.config.merged.DelayedVariableTestServlet + + + + + DelayedVariableTestServlet + /delayedVarTests + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/DelayedVariableTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/DelayedVariableTestServlet.java new file mode 100755 index 000000000000..0a714c2dd15d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/DelayedVariableTestServlet.java @@ -0,0 +1,138 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package test.config.merged; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * + */ +public class DelayedVariableTestServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = 6784264217930725272L; + private static final String DELAYED_VAR_PID = "com.ibm.ws.config.variable.delay"; + + private static final String DELAYED_VAR_ATTR = "delayedVariable"; + private static final String DELAYED_IBM_VAR_ATTR = "delayedIBMVar"; + private static final String IMMEDIATE_VAR_ATTR = "immediateVar"; + private static final String IMMEDIATE_VAR_TWO = "immediateVarTwo"; + + private static final String VARIABLE_STRING = "${variableDelayTest}"; + private static final String EVALUATED_VARIABLE = "evaluated"; + + private final ArrayList> references = new ArrayList>(); + private BundleContext bundleContext; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List> references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } + + public void testVariableDelay() throws Exception { + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(DELAYED_VAR_PID, true); + Configuration[] varDelay = ca.listConfigurations(filter); + assertNotNull("The configuration for " + DELAYED_VAR_PID + " should exist", varDelay); + + assertEquals("There should be one instance of PID " + DELAYED_VAR_PID, 1, varDelay.length); + + Dictionary properties = varDelay[0].getProperties(); + + assertEquals(VARIABLE_STRING, properties.get(DELAYED_VAR_ATTR)); + assertEquals(VARIABLE_STRING, properties.get(DELAYED_IBM_VAR_ATTR)); + assertEquals(EVALUATED_VARIABLE, properties.get(IMMEDIATE_VAR_ATTR)); + assertEquals(EVALUATED_VARIABLE, properties.get(IMMEDIATE_VAR_TWO)); + + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/VarMergeTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/VarMergeTestServlet.java new file mode 100755 index 000000000000..3d3d0f0f964a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/VarMergeTestServlet.java @@ -0,0 +1,137 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package test.config.merged; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; + +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; + +/** + * + */ +public class VarMergeTestServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = 6784264217930725272L; + private final ArrayList> references = new ArrayList>(); + private BundleContext bundleContext; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private enum Behavior { + MERGE, REPLACE, IGNORE + } + + private void verify(Behavior behavior) throws Exception { + + ServiceReference ref = bundleContext.getServiceReference(WsLocationAdmin.class); + assertNotNull("No location service", ref); + references.add(ref); + WsLocationAdmin locationAdmin = bundleContext.getService(ref); + + String value = locationAdmin.resolveString("${var1}"); + switch (behavior) { + case MERGE: + assertEquals("fromInclude", value); + break; + case REPLACE: + assertEquals("fromInclude", value); + break; + case IGNORE: + assertEquals("fromServerXml", value); + break; + + } + + } + + public void testMergedVariables() throws Exception { + verify(Behavior.MERGE); + } + + public void testMergedIncludesMerge() throws Exception { + verify(Behavior.MERGE); + } + + public void testMergedIncludesReplace() throws Exception { + verify(Behavior.REPLACE); + } + + public void testMergedIncludesIgnore() throws Exception { + // Verify that the attribute in the included file gets ignored + verify(Behavior.IGNORE); + + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/bnd.bnd new file mode 100755 index 000000000000..be640d8c4eda --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/bnd.bnd @@ -0,0 +1,11 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Child Alias B +Bundle-SymbolicName: test.config.childalias.b +Bundle-Description: Test bundle B for IBM childAlias extension, version=${bVersion} + +Include-Resource:\ + OSGI-INF/metatype/metatype-childalias-b.xml=resources/metatype-childalias-b.xml \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/resources/metatype-childalias-b.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/resources/metatype-childalias-b.xml new file mode 100755 index 000000000000..81687352d660 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/resources/metatype-childalias-b.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/bnd.bnd new file mode 100755 index 000000000000..96c93b1d8a11 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/bnd.bnd @@ -0,0 +1,11 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Child Alias C +Bundle-SymbolicName: test.config.childalias.c +Bundle-Description: Test bundle C for IBM childAlias extension, version=${bVersion} + +Include-Resource:\ + OSGI-INF/metatype/metatype-childalias-c.xml=resources/metatype-childalias-c.xml \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/resources/metatype-childalias-c.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/resources/metatype-childalias-c.xml new file mode 100755 index 000000000000..54d7abce803a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/resources/metatype-childalias-c.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/bnd.bnd new file mode 100755 index 000000000000..b215a44ac080 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/bnd.bnd @@ -0,0 +1,11 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Child Alias +Bundle-SymbolicName: test.config.childalias +Bundle-Description: Test bundle for IBM childAlias extension, version=${bVersion} + +Include-Resource:\ + OSGI-INF/metatype/metatype-childalias.xml=resources/metatype-childalias.xml \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/resources/metatype-childalias.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/resources/metatype-childalias.xml new file mode 100755 index 000000000000..b1a27ca1227b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/resources/metatype-childalias.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/bnd.bnd new file mode 100755 index 000000000000..ee9601e5052c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/bnd.bnd @@ -0,0 +1,11 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Extensions B +Bundle-SymbolicName: test.config.extensions.b; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +Include-Resource:\ + OSGI-INF/metatype/metatype-extensions-two.xml=resources/metatype-extensions-two.xml \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/resources/metatype-extensions-two.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/resources/metatype-extensions-two.xml new file mode 100755 index 000000000000..fb6ec51a0f78 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/resources/metatype-extensions-two.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/bnd.bnd new file mode 100755 index 000000000000..a58b3b7b92d1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Schema Generator Config Extensions +Bundle-SymbolicName: test.config.extensions.schema.generator; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +Private-Package: test.config.extensions.schema.generator + +Service-Component:\ + test.config.extensions.schema.generator;\ + implementation:=test.config.extensions.schema.generator.GeneratorTest;\ + schemaGenerator="com.ibm.websphere.metatype.SchemaGenerator" diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/src/test/config/extensions/schema/generator/GeneratorTest.java b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/src/test/config/extensions/schema/generator/GeneratorTest.java new file mode 100755 index 000000000000..cf43d467b59b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/src/test/config/extensions/schema/generator/GeneratorTest.java @@ -0,0 +1,59 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.config.extensions.schema.generator; + +import java.io.ByteArrayOutputStream; +import java.util.ArrayList; +import java.util.List; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import com.ibm.websphere.metatype.SchemaGenerator; +import com.ibm.websphere.metatype.SchemaGeneratorOptions; + +public class GeneratorTest { + + private SchemaGenerator schemaGenerator = null; + + public void activate(ComponentContext compContext) { + + BundleContext bundleContext = compContext.getBundleContext(); + List metatypeBundles = new ArrayList(); + for (Bundle bundle : bundleContext.getBundles()) { + if (bundle.getSymbolicName().startsWith("test.config.extensions")) + metatypeBundles.add(bundle); + } + + SchemaGeneratorOptions options = new SchemaGeneratorOptions(); + options.setEncoding("UTF-8"); + options.setBundles(metatypeBundles.toArray(new Bundle[] {})); + + // generate schema. We don't do anything with the generated schema, but use this to generate + // the error messages that + try { + if (schemaGenerator != null) + schemaGenerator.generate(new ByteArrayOutputStream(), options); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void deactivate(ComponentContext context) { + //NOP + } + + public void setSchemaGenerator(SchemaGenerator generator) { + this.schemaGenerator = generator; + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/bnd.bnd new file mode 100755 index 000000000000..4020ea77765c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/bnd.bnd @@ -0,0 +1,27 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Extensions +Bundle-SymbolicName: test.config.extensions; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +Web-ContextPath: config-extensions-test + +# export the interface packages +Export-Package: \ + test.config.extensions;provide:=true + +Service-Component:\ + test.config.extensions.super.component;\ + provide:='org.osgi.service.cm.ManagedServiceFactory,test.config.extensions.ConfigPropertiesProvider';\ + implementation:=test.config.extensions.ExtensionsTest;\ + properties:="service.pid=test.config.extensions.super,service.vendor=IBM",\ + test.config.extensions.internal.super.component;\ + provide:='org.osgi.service.cm.ManagedServiceFactory,test.config.extensions.ConfigPropertiesProvider';\ + implementation:=test.config.extensions.ExtensionsTest;\ + properties:="service.pid=test.config.extensions.internal.super,service.vendor=IBM" + +Include-Resource:\ + OSGI-INF/metatype/metatype-extensions.xml=resources/metatype-extensions.xml \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/resources/metatype-extensions.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/resources/metatype-extensions.xml new file mode 100755 index 000000000000..54eb6ed20ff5 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/resources/metatype-extensions.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ConfigPropertiesProvider.java b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ConfigPropertiesProvider.java new file mode 100755 index 000000000000..efd177e7b7fd --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ConfigPropertiesProvider.java @@ -0,0 +1,26 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2013 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.config.extensions; + +import java.util.Dictionary; + +interface ConfigPropertiesProvider { + /** + * Waits for a call to the ManagedServiceFactory with + * the specified config id + * + * + * @param pidStartsWith + * @return the properties that the ManagedServiceFactory was called with + */ + Dictionary getPropertiesForId(String id); +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ExtensionsTest.java b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ExtensionsTest.java new file mode 100755 index 000000000000..b0aa1952b16b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ExtensionsTest.java @@ -0,0 +1,90 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.config.extensions; + +import java.util.Dictionary; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; + +/** + * + */ +public class ExtensionsTest implements ManagedServiceFactory, ConfigPropertiesProvider { + + //timeout if the service hasn't been called in 15 seconds + private final long TIMEOUT = 15000; + + Map> propSets = new ConcurrentHashMap>(); + + public Dictionary getPropertiesForId(String id) { + Dictionary props = getPropsForId(id); + synchronized (propSets) { + while (props == null) { + try { + propSets.wait(TIMEOUT); + props = getPropsForId(id); + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted"); + } + if (props == null) + throw new RuntimeException("Extensions test timed out waiting for ManagedServiceFactory updated call starting with config id " + id); + } + } + return props; + } + + Dictionary getPropsForId(String id) { + return propSets.get(id); + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#deleted(java.lang.String) + */ + @Override + public void deleted(String pid) { + // TODO Auto-generated method stub + + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#updated(java.lang.String, java.util.Dictionary) + */ + @Override + public void updated(String pid, Dictionary properties) throws ConfigurationException { + System.out.println("ExtensionsTest (mock ManagedServiceFactory) updated called with pid: " + pid + " and properties: " + properties); + if (pid != null && properties != null) { + synchronized (propSets) { + String id; + propSets.put(((id = (String) properties.get("id")) == null) ? pid : id, properties); + propSets.notifyAll(); + } + } + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#getName() + */ + @Override + public String getName() { + // TODO Auto-generated method stub + return null; + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/TestResultsServlet.java b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/TestResultsServlet.java new file mode 100755 index 000000000000..0d87e0a34ef2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/TestResultsServlet.java @@ -0,0 +1,102 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.config.extensions; + +import java.io.IOException; +import java.util.Collection; +import java.util.Dictionary; +import java.util.HashSet; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +/** + * + */ +@WebServlet(urlPatterns = { "test" }) +public class TestResultsServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = -4913608474531994493L; + private static final String servicePIDName = "service.pid"; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + BundleContext ctxt = (BundleContext) req.getServletContext().getAttribute("osgi-bundlecontext"); + // Get the ManagedServiceFactory identifier so we can look up the correct service. + String servicePid = req.getParameter(servicePIDName); + Collection> refs = new HashSet>(); + ServiceReference ref = null; + + try { + + System.out.println("Looking up services with filter of (" + servicePIDName + "=" + servicePid + ")"); + // Find all services that match the relevant service.pid attr. There should only be one of these. + refs = ctxt.getServiceReferences(ConfigPropertiesProvider.class, "(" + servicePIDName + "=" + servicePid + ")"); + // If we don't find any then issue warning in the response. + if (!refs.isEmpty()) { + // There should only be one service, so pick the 1st one. + ref = refs.iterator().next(); + ConfigPropertiesProvider propsProvider = ctxt.getService(ref); + if (propsProvider != null) { + String id = req.getParameter("id"); + Dictionary props = propsProvider.getPropertiesForId(id); + if (props != null) { + String configId = (String) props.get(XMLConfigConstants.CFG_CONFIG_INSTANCE_ID); + if (configId != null && configId.startsWith(servicePid)) { + resp.getWriter().print("PASSED: test bundle was called with properties for ID " + id); + String propName; + if ((propName = req.getParameter("prop")) != null) { + resp.getWriter().print("Prop value: " + props.get(propName)); + } + resp.setStatus(HttpServletResponse.SC_OK); + return; + + } else { + resp.getWriter().print("FAILED: incorrect config.id in properties for ID " + id + ". Value: " + configId); + resp.setStatus(HttpServletResponse.SC_OK); + return; + } + } else { + resp.getWriter().print("FAILED: test bundle was not called with properties for PID starting with " + id); + resp.setStatus(HttpServletResponse.SC_OK); + return; + } + } + } else { + System.out.println("No service"); + resp.getWriter().print("FAILED: unable to find ConfigPropertiesProvider service"); + resp.setStatus(HttpServletResponse.SC_OK); + } + } catch (InvalidSyntaxException ise) { + resp.getWriter().print("Exception thrown whilst getting Config Property Provider service references: " + ise); + } finally { + // If the reference isn't null, release the service. + if (ref != null) + ctxt.ungetService(ref); + } + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/bnd.bnd new file mode 100755 index 000000000000..50b1b97f6ec0 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/bnd.bnd @@ -0,0 +1,12 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Tests for variable behavior +Bundle-SymbolicName: test.config.variables +Bundle-Description: Test bundle for variable behavior, version=${bVersion} + + +Include-Resource: \ + OSGI-INF=resources/OSGI-INF diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/resources/OSGI-INF/metatype/metatype-variables.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/resources/OSGI-INF/metatype/metatype-variables.xml new file mode 100755 index 000000000000..4343011b3f0b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/resources/OSGI-INF/metatype/metatype-variables.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/bnd.bnd new file mode 100755 index 000000000000..e4a5a3e06a62 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Merging +Bundle-SymbolicName: test.merged.config +Bundle-Description: Test bundle for config merging, version=${bVersion} + +IBM-Default-Config: OSGI-INF/wlp/defaultInstances.xml, \ + OSGI-INF/wlp/defaultInstances2.xml; requireExisting=true, \ + OSGI-INF/wlp/defaultInstances3.xml; addIfMissing=true + +Include-Resource: \ + OSGI-INF=resources/OSGI-INF diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/metatype/metatype-mergedconfig.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/metatype/metatype-mergedconfig.xml new file mode 100755 index 000000000000..7fd7305b5775 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/metatype/metatype-mergedconfig.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances.xml new file mode 100755 index 000000000000..e0a77cf718ca --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances2.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances2.xml new file mode 100755 index 000000000000..f9ad45d42720 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances2.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances3.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances3.xml new file mode 100755 index 000000000000..647420217a83 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances3.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/bnd.bnd new file mode 100755 index 000000000000..f448e82fefec --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test MetatypeProvider +Bundle-SymbolicName: test.metatype.provider +Bundle-Description: Test bundle for MetatypeProvider, version=${bVersion} + +-dsannotations: com.ibm.ws.config.metatype.provider.Plant,\ + com.ibm.ws.config.metatype.provider.Animal,\ + com.ibm.ws.config.metatype.provider.AnimalToo + +Private-Package: com.ibm.ws.config.metatype.provider.* + +Import-Package: * diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Animal.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Animal.java new file mode 100755 index 000000000000..33139f3efbc1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Animal.java @@ -0,0 +1,157 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Dictionary; +import java.util.List; + +import org.osgi.framework.Constants; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ConfigurationPolicy; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.metatype.AttributeDefinition; +import org.osgi.service.metatype.MetaTypeProvider; +import org.osgi.service.metatype.ObjectClassDefinition; + +import com.ibm.websphere.metatype.AttributeDefinitionProperties; +import com.ibm.websphere.metatype.MetaTypeFactory; +import com.ibm.websphere.metatype.ObjectClassDefinitionProperties; + +/** + * + */ +@Component(service = { Animal.class, ManagedServiceFactory.class, MetaTypeProvider.class }, immediate = true, + configurationPolicy = ConfigurationPolicy.IGNORE, + property = { Constants.SERVICE_VENDOR + "=" + "IBM", + Constants.SERVICE_PID + "=" + Animal.ANIMAL_PID }) +public class Animal implements ManagedServiceFactory, MetaTypeProvider { + + public static final String ANIMAL_PID = "test.metatype.provider.animal"; + private ObjectClassDefinition ocd; + private MetaTypeFactory metaTypeFactoryService; + + @Reference(service = MetaTypeFactory.class, + cardinality = ReferenceCardinality.MANDATORY) + protected void setMetaTypeFactoryService(MetaTypeFactory mtpService) { + this.metaTypeFactoryService = mtpService; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.MetaTypeProvider#getLocales() + */ + @Override + public String[] getLocales() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.MetaTypeProvider#getObjectClassDefinition(java.lang.String, java.lang.String) + */ + @Override + public ObjectClassDefinition getObjectClassDefinition(String arg0, String arg1) { + if (this.ocd == null) { + AttributeDefinition nameAttr = new AnimalNameAttr(); + AttributeDefinition lifespanAttr = metaTypeFactoryService.createAttributeDefinition(getLifespanProps()); + AttributeDefinition eatsAttr = metaTypeFactoryService.createAttributeDefinition(getEatsProperties()); + List attributeList = new ArrayList(); + attributeList.add(lifespanAttr); + attributeList.add(nameAttr); + attributeList.add(eatsAttr); + this.ocd = metaTypeFactoryService.createObjectClassDefinition(getOCDProperties(), attributeList, Collections. emptyList()); + + } + + return this.ocd; + + } + + /** + * @return + */ + private AttributeDefinitionProperties getEatsProperties() { + AttributeDefinitionProperties props = new AttributeDefinitionProperties("eats"); + props.setName("eats"); + props.setDescription("What an animal eats"); + props.setType(MetaTypeFactory.PID_TYPE); + props.setReferencePid(Plant.PLANT_PID); + props.setCardinality(10); + return props; + } + + /** + * @return + */ + private AttributeDefinitionProperties getLifespanProps() { + AttributeDefinitionProperties props = new AttributeDefinitionProperties("lifespan"); + props.setName("Lifespan"); + props.setDescription("The animal's lifespan"); + props.setType(MetaTypeFactory.DURATION_TYPE); + props.setCardinality(0); + + return props; + } + + /** + * @param ocd2 + */ + private ObjectClassDefinitionProperties getOCDProperties() { + ObjectClassDefinitionProperties properties = new ObjectClassDefinitionProperties("test.metatype.provider.animal"); + properties.setDescription("An animal"); + properties.setName("test.metatype.provider.animal"); + properties.setAlias("animal"); + + return properties; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#deleted(java.lang.String) + */ + @Override + public void deleted(String arg0) { + System.out.println("Deleted"); + + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#getName() + */ + @Override + public String getName() { + return "Animal MetatypeProvider"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#updated(java.lang.String, java.util.Dictionary) + */ + @Override + public void updated(String arg0, Dictionary arg1) throws ConfigurationException { + System.out.println("Updated"); + + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalNameAttr.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalNameAttr.java new file mode 100755 index 000000000000..6612a203eef3 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalNameAttr.java @@ -0,0 +1,116 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import org.osgi.service.metatype.AttributeDefinition; + +import com.ibm.websphere.metatype.MetaTypeFactory; + +/** + * + */ +public class AnimalNameAttr implements AttributeDefinition { + + /** */ + public static final String ID_ATTRIBUTE = "name"; + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getCardinality() + */ + @Override + public int getCardinality() { + return 0; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getDefaultValue() + */ + @Override + public String[] getDefaultValue() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getDescription() + */ + @Override + public String getDescription() { + return "The animal name"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getID() + */ + @Override + public String getID() { + return ID_ATTRIBUTE; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getName() + */ + @Override + public String getName() { + return "Name"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getOptionLabels() + */ + @Override + public String[] getOptionLabels() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getOptionValues() + */ + @Override + public String[] getOptionValues() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getType() + */ + @Override + public int getType() { + return MetaTypeFactory.TOKEN_TYPE; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#validate(java.lang.String) + */ + @Override + public String validate(String arg0) { + return ""; + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalToo.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalToo.java new file mode 100755 index 000000000000..287758ec60b9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalToo.java @@ -0,0 +1,57 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import java.util.Map; + +import org.osgi.framework.Constants; +import org.osgi.service.cm.ConfigurationEvent; +import org.osgi.service.cm.ConfigurationListener; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; + +/** + * + */ +@Component(service = { AnimalToo.class, ConfigurationListener.class }, immediate = true, + property = { Constants.SERVICE_VENDOR + "=" + "IBM" }) +public class AnimalToo implements ConfigurationListener { + + @Activate + protected void activate(ComponentContext ctx, Map config) { + System.out.println("Activate"); + } + + @Deactivate + protected void deactivate(ComponentContext ctx) { + System.out.println("Deactivate"); + } + + @Modified + protected void modified(Map config) { + System.out.println("MOdified"); + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ConfigurationListener#configurationEvent(org.osgi.service.cm.ConfigurationEvent) + */ + @Override + public void configurationEvent(ConfigurationEvent arg0) { + System.out.println("config event"); + + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Plant.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Plant.java new file mode 100755 index 000000000000..18868a4013c2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Plant.java @@ -0,0 +1,89 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import java.util.Dictionary; + +import org.osgi.framework.Constants; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ConfigurationPolicy; +import org.osgi.service.metatype.MetaTypeProvider; +import org.osgi.service.metatype.ObjectClassDefinition; + +/** + * + */ +@Component(service = { Plant.class, ManagedServiceFactory.class, MetaTypeProvider.class }, immediate = true, + configurationPolicy = ConfigurationPolicy.IGNORE, + property = { Constants.SERVICE_VENDOR + "=" + "IBM", + Constants.SERVICE_PID + "=" + Plant.PLANT_PID }) +public class Plant implements ManagedServiceFactory, MetaTypeProvider { + + public static final String PLANT_PID = "test.metatype.provider.plant"; + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.MetaTypeProvider#getLocales() + */ + @Override + public String[] getLocales() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.MetaTypeProvider#getObjectClassDefinition(java.lang.String, java.lang.String) + */ + @Override + public ObjectClassDefinition getObjectClassDefinition(String arg0, String arg1) { + return new PlantObjectClassDefinition(); + + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#deleted(java.lang.String) + */ + @Override + public void deleted(String arg0) { + System.out.println("Deleted"); + + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#getName() + */ + @Override + public String getName() { + return "Plant MetatypeProvider"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#updated(java.lang.String, java.util.Dictionary) + */ + @Override + public void updated(String arg0, Dictionary arg1) throws ConfigurationException { + System.out.println("Updated"); + + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantNameAttr.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantNameAttr.java new file mode 100755 index 000000000000..5a699f6b2779 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantNameAttr.java @@ -0,0 +1,111 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import org.osgi.service.metatype.AttributeDefinition; + +/** + * + */ +public class PlantNameAttr implements AttributeDefinition { + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getCardinality() + */ + @Override + public int getCardinality() { + return 0; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getDefaultValue() + */ + @Override + public String[] getDefaultValue() { + return new String[] { "orchid" }; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getDescription() + */ + @Override + public String getDescription() { + return "The plant name"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getID() + */ + @Override + public String getID() { + return "name"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getName() + */ + @Override + public String getName() { + return "Name"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getOptionLabels() + */ + @Override + public String[] getOptionLabels() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getOptionValues() + */ + @Override + public String[] getOptionValues() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getType() + */ + @Override + public int getType() { + return AttributeDefinition.STRING; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#validate(java.lang.String) + */ + @Override + public String validate(String arg0) { + return ""; + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantObjectClassDefinition.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantObjectClassDefinition.java new file mode 100755 index 000000000000..fe9eb611913a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantObjectClassDefinition.java @@ -0,0 +1,77 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import java.io.IOException; +import java.io.InputStream; + +import org.osgi.service.metatype.AttributeDefinition; +import org.osgi.service.metatype.ObjectClassDefinition; + +/** + * + */ +public class PlantObjectClassDefinition implements ObjectClassDefinition { + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.ObjectClassDefinition#getAttributeDefinitions(int) + */ + @Override + public AttributeDefinition[] getAttributeDefinitions(int arg0) { + AttributeDefinition nameAttr = new PlantNameAttr(); + return new AttributeDefinition[] { nameAttr }; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.ObjectClassDefinition#getDescription() + */ + @Override + public String getDescription() { + return "A Plant."; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.ObjectClassDefinition#getID() + */ + @Override + public String getID() { + return "test.metatype.provider.plant"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.ObjectClassDefinition#getIcon(int) + */ + @Override + public InputStream getIcon(int arg0) throws IOException { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.ObjectClassDefinition#getName() + */ + @Override + public String getName() { + return "test.metatype.provider.plant"; + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/bnd.bnd new file mode 100755 index 000000000000..3819e8dc20fb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/bnd.bnd @@ -0,0 +1,24 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config For Product Extensions +Bundle-SymbolicName: test.prod.extensions; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +# export the interface packages +Export-Package: \ + test.prod.extensions;provide:=true + +Private-Package: test.prod.extensions.internal.* + +Web-ContextPath: product1-extensions-test + +Include-Resource:\ + OSGI-INF/metatype/metatype.xml=resources/metatype.xml + +Service-Component:\ + test.prod.extensions;\ + provide:='test.prod.extensions.ProductExtension1';\ + implementation:=test.prod.extensions.internal.ProductExtension1ServiceImpl \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/resources/metatype.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/resources/metatype.xml new file mode 100755 index 000000000000..5ba90d49327c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/resources/metatype.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1.java b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1.java new file mode 100755 index 000000000000..822dc1084d91 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1.java @@ -0,0 +1,40 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.prod.extensions; + +/** + * Product extension service interface. + */ +public interface ProductExtension1 { + + /** + * Say Hello. + * + * @param input + * @return + */ + public String sayHello(String input); + + /** + * Retrieves configured attribute 1. + * + * @return A Long value. + */ + public Long getAttribute1(); + + /** + * Retrieves configured attribute 1. + * + * @return A String value. + */ + public String getAttribute2(); +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1TestServlet.java b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1TestServlet.java new file mode 100755 index 000000000000..7060f9df518c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1TestServlet.java @@ -0,0 +1,124 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.prod.extensions; + +import java.io.IOException; +import java.lang.reflect.Method; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +/** + * ProductExtension1TestServlet. + */ +@WebServlet(urlPatterns = { "test" }) +public class ProductExtension1TestServlet extends HttpServlet { + + private static final long serialVersionUID = -4913608474531994493L; + public static final String SAY_HELLO_INPUT = "HelloYou"; + public static final String EXPECTED_SAY_HELLO = "you.said." + SAY_HELLO_INPUT + ".i.say." + SAY_HELLO_INPUT + ".back"; + public static final Long EXPECTED_ATTRB1 = 999999L; + public static final String EXPECTED_ATTRB2 = "HELLOWORLD"; + + /** + * doGet. + */ + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + ServiceReference prod1SvcRef = null; + BundleContext bundleContext = (BundleContext) req.getServletContext().getAttribute("osgi-bundlecontext"); + + // Unable to get bundle context. + if (bundleContext == null) { + String reply = "TEST_FAILED: Unable to obtain a bundle context reference."; + System.out.println(reply); + resp.getWriter().print(reply); + resp.setStatus(HttpServletResponse.SC_OK); + return; + } + + try { + prod1SvcRef = bundleContext.getServiceReference("test.prod.extensions.ProductExtension1"); + if (prod1SvcRef == null) { + printOutput(resp, "TEST_FAILED: Unable to get a UserProductExtension1 service reference."); + return; + } + + final Object prod1Svc = bundleContext.getService(prod1SvcRef); + if (prod1Svc != null) { + final Method sayHello_method = prod1Svc.getClass().getMethod("sayHello", String.class); + final Method getAtrib1Method = prod1Svc.getClass().getMethod("getAttribute1"); + final Method getAtrib2Method = prod1Svc.getClass().getMethod("getAttribute2"); + + if (sayHello_method == null || getAtrib1Method == null || getAtrib2Method == null) { + printOutput(resp, "TEST_FAILED: Unable get a method reference from the UserProductExtension1 service."); + return; + } + + // Call sayHello on the service. + String sayHelloOut = (String) sayHello_method.invoke(prod1Svc, SAY_HELLO_INPUT); + if (!sayHelloOut.equals(EXPECTED_SAY_HELLO)) { + printOutput(resp, "TEST_FAILED: sayHello returned: " + sayHelloOut + ". Expected: " + EXPECTED_SAY_HELLO); + return; + } + + // Call getAttribute1 on the service. + Long attrib1Out = (Long) getAtrib1Method.invoke(prod1Svc); + if (attrib1Out == null || attrib1Out.longValue() != EXPECTED_ATTRB1.longValue()) { + printOutput(resp, "TEST_FAILED: getAttribute1 returned: " + attrib1Out + ". Expected: " + EXPECTED_ATTRB1 + + ". Possible configuration error. The OCD alias under which attribute1 is defined must be prefixed by: \"productName_\"."); + return; + } + + // Call getAttribute2 on the service. + String attrib2Out = (String) getAtrib2Method.invoke(prod1Svc); + if (attrib2Out == null || !attrib2Out.equals(EXPECTED_ATTRB2)) { + printOutput(resp, "TEST_FAILED: getAttribute2 returned: " + attrib2Out + ". Expected: " + EXPECTED_ATTRB2 + + ". Possible configuration error. The OCD alias under which attribute2 is defined must be prefixed by: \"productName_\"."); + return; + } + + printOutput(resp, "TEST_PASSED: sayHello returned: " + sayHelloOut + ". getAttribute2 returned: " + attrib2Out); + } else { + printOutput(resp, "TEST_FAILED:Product1 service not found."); + } + } catch (Throwable t) { + printOutput(resp, "TEST_FAILED: Exception while processing test: " + t); + } finally { + if (prod1SvcRef != null) + bundleContext.ungetService(prod1SvcRef); + } + } + + /** + * Prints the output to the HTTP call. + * + * @param resp HttpServletResponse + * @param reply The repply. + */ + private void printOutput(HttpServletResponse resp, String reply) { + System.out.println(reply); + + try { + resp.getWriter().print(reply); + } catch (IOException ioe) { + System.out.println("Failed setting the reply in the HttpServletResponse" + ioe); + } + resp.setStatus(HttpServletResponse.SC_OK); + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/internal/ProductExtension1ServiceImpl.java b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/internal/ProductExtension1ServiceImpl.java new file mode 100755 index 000000000000..cf1e11823104 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/internal/ProductExtension1ServiceImpl.java @@ -0,0 +1,85 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.prod.extensions.internal; + +import java.util.Map; + +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import test.prod.extensions.ProductExtension1; + +/** + * Product Extension Service. + */ +public class ProductExtension1ServiceImpl implements ProductExtension1 { + + Long attribute1; + String attribute2; + + /** + * Declarative Services method to deactivate this component. + * Best practice: this should be a protected method, not public or private + * + * @param context context for this component + */ + protected void activate(BundleContext bundleContext, Map properties) { + System.out.println("@ed: attributeMap: " + properties.size()); + + for (Map.Entry entry : properties.entrySet()) { + System.out.println("key: " + entry.getKey() + ", value: " + entry.getValue()); + } + + attribute1 = (Long) properties.get("attribute1"); + System.out.println("@ed: attribute1: " + attribute1); + attribute2 = (String) properties.get("attribute2"); + System.out.println("@ed: attribute2: " + attribute2); + } + + /** + * Declarative Services method to deactivate this component. + * Best practice: this should be a protected method, not public or private + * + * @param context context for this component + */ + protected void deactivate(ComponentContext context) {} + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#sayHello(java.lang.String) + */ + @Override + public String sayHello(String input) { + return "you.said." + input + ".i.say." + input + ".back"; + } + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#getAttribute1() + */ + @Override + public Long getAttribute1() { + return attribute1; + } + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#getAttribute1() + */ + @Override + public String getAttribute2() { + return attribute2; + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/bnd.bnd new file mode 100755 index 000000000000..695ffef979e7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/bnd.bnd @@ -0,0 +1,24 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config For User Product Extensions +Bundle-SymbolicName: test.user.prod.extensions; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +# export the interface packages +Export-Package: \ + test.user.prod.extensions;provide:=true + +Private-Package: test.user.prod.extensions.internal.* + +Web-ContextPath: user.product1-extensions-test + +Include-Resource:\ + OSGI-INF/metatype/metatype.xml=resources/metatype.xml + +Service-Component:\ + test.user.prod.extensions;\ + provide:='test.user.prod.extensions.UserProductExtension1';\ + implementation:=test.user.prod.extensions.internal.UserProductExtension1ServiceImpl \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/resources/metatype.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/resources/metatype.xml new file mode 100755 index 000000000000..6e73ff6287ee --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/resources/metatype.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1.java b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1.java new file mode 100755 index 000000000000..8e9410b57b0d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1.java @@ -0,0 +1,40 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.user.prod.extensions; + +/** + * User product extension service interface. + */ +public interface UserProductExtension1 { + + /** + * Say Hello. + * + * @param input + * @return + */ + public String sayHello(String input); + + /** + * Retrieves configured attribute 1. + * + * @return A Long value. + */ + public Long getAttribute1(); + + /** + * Retrieves configured attribute 1. + * + * @return A String value. + */ + public String getAttribute2(); +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1TestServlet.java b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1TestServlet.java new file mode 100755 index 000000000000..33cc2c7c312f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1TestServlet.java @@ -0,0 +1,123 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.user.prod.extensions; + +import java.io.IOException; +import java.lang.reflect.Method; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +/** + * UserProductExtension1TestServlet. + */ +@WebServlet(urlPatterns = { "test" }) +public class UserProductExtension1TestServlet extends HttpServlet { + private static final long serialVersionUID = -4913608474531994493L; + public static final String SAY_HELLO_INPUT = "HelloYou"; + public static final String EXPECTED_SAY_HELLO = "you.said." + SAY_HELLO_INPUT + ".i.say." + SAY_HELLO_INPUT + ".back"; + public static final Long EXPECTED_ATTRB1 = 999999L; + public static final String EXPECTED_ATTRB2 = "HELLOWORLD"; + + /** + * doGet. + */ + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + ServiceReference prod1SvcRef = null; + BundleContext bundleContext = (BundleContext) req.getServletContext().getAttribute("osgi-bundlecontext"); + + // Unable to get bundle context. + if (bundleContext == null) { + String reply = "TEST_FAILED: Unable to obtain a bundle context reference."; + System.out.println(reply); + resp.getWriter().print(reply); + resp.setStatus(HttpServletResponse.SC_OK); + return; + } + + try { + prod1SvcRef = bundleContext.getServiceReference("test.user.prod.extensions.UserProductExtension1"); + if (prod1SvcRef == null) { + printOutput(resp, "TEST_FAILED: Unable to get a UserProductExtension1 service reference."); + return; + } + + final Object prod1Svc = bundleContext.getService(prod1SvcRef); + if (prod1Svc != null) { + final Method sayHello_method = prod1Svc.getClass().getMethod("sayHello", String.class); + final Method getAtrib1Method = prod1Svc.getClass().getMethod("getAttribute1"); + final Method getAtrib2Method = prod1Svc.getClass().getMethod("getAttribute2"); + + if (sayHello_method == null || getAtrib1Method == null || getAtrib2Method == null) { + printOutput(resp, "TEST_FAILED: Unable get a method reference from the UserProductExtension1 service."); + return; + } + + // Call sayHello on the service. + String sayHelloOut = (String) sayHello_method.invoke(prod1Svc, SAY_HELLO_INPUT); + if (!sayHelloOut.equals(EXPECTED_SAY_HELLO)) { + printOutput(resp, "TEST_FAILED: sayHello returned: " + sayHelloOut + ". Expected: " + EXPECTED_SAY_HELLO); + return; + } + + // Call getAttribute1 on the service. + Long attrib1Out = (Long) getAtrib1Method.invoke(prod1Svc); + if (attrib1Out == null || attrib1Out.longValue() != EXPECTED_ATTRB1.longValue()) { + printOutput(resp, "TEST_FAILED: getAttribute1 returned: " + attrib1Out + ". Expected: " + EXPECTED_ATTRB1 + + ". Possible configuration error. The OCD alias under which attribute1 is defined must be prefixed by: \"productName_\"."); + return; + } + + // Call getAttribute2 on the service. + String attrib2Out = (String) getAtrib2Method.invoke(prod1Svc); + if (attrib2Out == null || !attrib2Out.equals(EXPECTED_ATTRB2)) { + printOutput(resp, "TEST_FAILED: getAttribute2 returned: " + attrib2Out + ". Expected: " + EXPECTED_ATTRB2 + + ". Possible configuration error. The OCD alias under which attribute2 is defined must be prefixed by: \"productName_\"."); + return; + } + + printOutput(resp, "TEST_PASSED: sayHello returned: " + sayHelloOut + ". getAttribute2 returned: " + attrib2Out); + } else { + printOutput(resp, "TEST_FAILED:Product1 service not found."); + } + } catch (Throwable t) { + printOutput(resp, "TEST_FAILED: Exception while processing test: " + t); + } finally { + if (prod1SvcRef != null) + bundleContext.ungetService(prod1SvcRef); + } + } + + /** + * Prints the output to the HTTP call. + * + * @param resp HttpServletResponse + * @param reply The repply. + */ + private void printOutput(HttpServletResponse resp, String reply) { + System.out.println(reply); + + try { + resp.getWriter().print(reply); + } catch (IOException ioe) { + System.out.println("Failed setting the reply in the HttpServletResponse" + ioe); + } + resp.setStatus(HttpServletResponse.SC_OK); + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/internal/UserProductExtension1ServiceImpl.java b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/internal/UserProductExtension1ServiceImpl.java new file mode 100755 index 000000000000..bebb0d80f22d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/internal/UserProductExtension1ServiceImpl.java @@ -0,0 +1,77 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.user.prod.extensions.internal; + +import java.util.Map; + +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import test.user.prod.extensions.UserProductExtension1; + +/** + * User Product Extension Service. + */ +public class UserProductExtension1ServiceImpl implements UserProductExtension1 { + + Long attribute1; + String attribute2; + + /** + * Declarative Services method to deactivate this component. + * Best practice: this should be a protected method, not public or private + * + * @param context context for this component + */ + protected void activate(BundleContext bundleContext, Map properties) { + attribute1 = (Long) properties.get("attribute1"); + attribute2 = (String) properties.get("attribute2"); + } + + /** + * Declarative Services method to deactivate this component. + * Best practice: this should be a protected method, not public or private + * + * @param context context for this component + */ + protected void deactivate(ComponentContext context) {} + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#sayHello(java.lang.String) + */ + @Override + public String sayHello(String input) { + return "you.said." + input + ".i.say." + input + ".back"; + } + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#getAttribute1() + */ + @Override + public Long getAttribute1() { + return attribute1; + } + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#getAttribute1() + */ + @Override + public String getAttribute2() { + return attribute2; + } +} diff --git a/dev/com.ibm.ws.config_fat/test/logging.properties b/dev/com.ibm.ws.config_fat/test/logging.properties new file mode 100755 index 000000000000..0b4c1bbfca6a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test/logging.properties @@ -0,0 +1,76 @@ +############################################################ +# Logging Configuration File +# +# You can use a different file by specifying a filename +# with the java.util.logging.config.file system property. +# For example java -Djava.util.logging.config.file=myfile +############################################################ + +############################################################ +# Global properties +############################################################ + +# "handlers" specifies a comma separated list of log Handler +# classes. These handlers will be installed during VM startup. +# Note that these classes must be on the system classpath. +# By default we only configure a ConsoleHandler, which will only +# show messages at the INFO and above levels. +handlers=com.ibm.ws.fat.util.GenericHandler, java.util.logging.FileHandler + +# Default global logging level. +# This specifies which kinds of events are logged across +# all loggers. For any given facility this global level +# can be overriden by a facility specific level +# Note that the GenericHandler also has a separate level +# setting to limit messages printed to the underlying stream. +.level=INFO + +############################################################ +# Handler specific properties. +# Describes specific configuration info for Handlers. +############################################################ + +# The GenericHandler will log all messages printed at any logging level +com.ibm.ws.fat.util.GenericHandler.level=ALL +com.ibm.ws.fat.util.GenericHandler.formatter=com.ibm.ws.fat.util.GenericFormatter +com.ibm.ws.fat.util.GenericHandler.stream=system.out +com.ibm.ws.fat.util.GenericHandler.flush=true + +# The FileHandler will log all messages printed at any logging level to exactly one file located in results/output.txt +java.util.logging.FileHandler.level=ALL +java.util.logging.FileHandler.formatter=com.ibm.ws.fat.util.GenericFormatter +java.util.logging.FileHandler.limit=0 +java.util.logging.FileHandler.count=1 +java.util.logging.FileHandler.pattern=results/output.txt +java.util.logging.FileHandler.append=true + +############################################################ +# Formatter specific properties. +# Describes specific configuration info for Formatters. +############################################################ + +com.ibm.ws.fat.util.GenericFormatter.class.full=false +com.ibm.ws.fat.util.GenericFormatter.class.length=30 +com.ibm.ws.fat.util.GenericFormatter.class.log=true +com.ibm.ws.fat.util.GenericFormatter.level.log=true +com.ibm.ws.fat.util.GenericFormatter.method.length=30 +com.ibm.ws.fat.util.GenericFormatter.method.log=true +com.ibm.ws.fat.util.GenericFormatter.thread.length=3 +com.ibm.ws.fat.util.GenericFormatter.thread.log=true +com.ibm.ws.fat.util.GenericFormatter.time.format=[MM/dd/yyyy HH:mm:ss:SSS z] +com.ibm.ws.fat.util.GenericFormatter.time.log=true + +############################################################ +# Facility specific properties. +# Provides extra control for each logger. +############################################################ +com.ibm.ws.webcontainer.fvt.level=INFO +com.ibm.websphere.simplicity.level=INFO +com.ibm.ws.jmx.connector.client.level=FINEST +com.ibm.ws.jmx.connector.client.rest.internal.level=FINEST +com.ibm.ws.filetransfer.mbean.level=FINEST +test.server.config.level=FINER +#com.ibm.websphere.jiiws.level=FINER +#httpclient.wire.level=FINEST +#httpclient.wire.header.level=FINEST +#org.apache.commons.httpclient.level=FINEST diff --git a/dev/com.ibm.ws.config_fat/validator.exclude.xml b/dev/com.ibm.ws.config_fat/validator.exclude.xml new file mode 100644 index 000000000000..b8795817794d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/validator.exclude.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_test/.classpath b/dev/com.ibm.ws.config_test/.classpath index 686513adc2d4..bd880329225d 100644 --- a/dev/com.ibm.ws.config_test/.classpath +++ b/dev/com.ibm.ws.config_test/.classpath @@ -1,16 +1,7 @@ - - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.config_test/.classpath.gradle b/dev/com.ibm.ws.config_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.config_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_test/.project b/dev/com.ibm.ws.config_test/.project index b1c112b5c56c..3a029cd9a532 100755 --- a/dev/com.ibm.ws.config_test/.project +++ b/dev/com.ibm.ws.config_test/.project @@ -11,13 +11,13 @@ - com.ibm.ws.rasplugin.RASValidationBuilder + bndtools.core.bndbuilder org.eclipse.jdt.core.javanature - com.ibm.ws.rasplugin.RASValidationNature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.config_test/bnd.bnd b/dev/com.ibm.ws.config_test/bnd.bnd new file mode 100755 index 000000000000..1fbb0b3716ee --- /dev/null +++ b/dev/com.ibm.ws.config_test/bnd.bnd @@ -0,0 +1,24 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.wsspi.org.osgi.service.metatype.1.3.0;version=latest, \ + com.ibm.ws.org.eclipse.equinox.metatype.1.4.200;version=latest, \ + com.ibm.ws.kernel.service.location;version=latest, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.config_test/bnd.bnd.gradle b/dev/com.ibm.ws.config_test/bnd.bnd.gradle new file mode 100755 index 000000000000..1fbb0b3716ee --- /dev/null +++ b/dev/com.ibm.ws.config_test/bnd.bnd.gradle @@ -0,0 +1,24 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.wsspi.org.osgi.service.metatype.1.3.0;version=latest, \ + com.ibm.ws.org.eclipse.equinox.metatype.1.4.200;version=latest, \ + com.ibm.ws.kernel.service.location;version=latest, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.jmx_test/build.nogradle b/dev/com.ibm.ws.config_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.jmx_test/build.nogradle rename to dev/com.ibm.ws.config_test/build.gradle diff --git a/dev/com.ibm.ws.crypto.certificateutil/bnd.bnd b/dev/com.ibm.ws.crypto.certificateutil/bnd.bnd index 2dbd16a7ea03..f2e661addcf0 100755 --- a/dev/com.ibm.ws.crypto.certificateutil/bnd.bnd +++ b/dev/com.ibm.ws.crypto.certificateutil/bnd.bnd @@ -5,6 +5,8 @@ Bundle-Name: Certificate Utilities Bundle-SymbolicName: com.ibm.ws.crypto.certificateutil Bundle-Description: Certificate Utilities; version=${bVersion} +Import-Package: !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * + Export-Package: \ com.ibm.ws.crypto.certificateutil;provide:=true, \ com.ibm.ws.crypto.certificateutil.keytool;provide:=true diff --git a/dev/com.ibm.ws.crypto.certificateutil_bvt/.classpath b/dev/com.ibm.ws.crypto.certificateutil_bvt/.classpath index e3fa0a94441e..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.crypto.certificateutil_bvt/.classpath +++ b/dev/com.ibm.ws.crypto.certificateutil_bvt/.classpath @@ -1,15 +1,7 @@ - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.crypto.certificateutil_bvt/.classpath.gradle b/dev/com.ibm.ws.crypto.certificateutil_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.crypto.certificateutil_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.crypto.certificateutil_bvt/.project b/dev/com.ibm.ws.crypto.certificateutil_bvt/.project index bf08b8aeec16..b4afa01ba26f 100755 --- a/dev/com.ibm.ws.crypto.certificateutil_bvt/.project +++ b/dev/com.ibm.ws.crypto.certificateutil_bvt/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.crypto.certificateutil_bvt/bnd.bnd b/dev/com.ibm.ws.crypto.certificateutil_bvt/bnd.bnd new file mode 100755 index 000000000000..28fc71ce9f6d --- /dev/null +++ b/dev/com.ibm.ws.crypto.certificateutil_bvt/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.crypto.certificateutil;version=latest diff --git a/dev/com.ibm.ws.crypto.certificateutil_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.crypto.certificateutil_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..28fc71ce9f6d --- /dev/null +++ b/dev/com.ibm.ws.crypto.certificateutil_bvt/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.crypto.certificateutil;version=latest diff --git a/dev/com.ibm.ws.kernel.boot_bvt/build.nogradle b/dev/com.ibm.ws.crypto.certificateutil_bvt/build.gradle similarity index 100% rename from dev/com.ibm.ws.kernel.boot_bvt/build.nogradle rename to dev/com.ibm.ws.crypto.certificateutil_bvt/build.gradle diff --git a/dev/com.ibm.ws.crypto.certificateutil_test/.classpath b/dev/com.ibm.ws.crypto.certificateutil_test/.classpath index ba28ffa57ca6..bd880329225d 100755 --- a/dev/com.ibm.ws.crypto.certificateutil_test/.classpath +++ b/dev/com.ibm.ws.crypto.certificateutil_test/.classpath @@ -1,15 +1,7 @@ - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.crypto.certificateutil_test/.classpath.gradle b/dev/com.ibm.ws.crypto.certificateutil_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.crypto.certificateutil_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.crypto.certificateutil_test/.project b/dev/com.ibm.ws.crypto.certificateutil_test/.project index 2fa0534acb43..dac24222f542 100755 --- a/dev/com.ibm.ws.crypto.certificateutil_test/.project +++ b/dev/com.ibm.ws.crypto.certificateutil_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.crypto.certificateutil_test/bnd.bnd b/dev/com.ibm.ws.crypto.certificateutil_test/bnd.bnd new file mode 100755 index 000000000000..5b213fc183eb --- /dev/null +++ b/dev/com.ibm.ws.crypto.certificateutil_test/bnd.bnd @@ -0,0 +1,19 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.ws.crypto.certificateutil;version=latest diff --git a/dev/com.ibm.ws.crypto.certificateutil_test/bnd.bnd.gradle b/dev/com.ibm.ws.crypto.certificateutil_test/bnd.bnd.gradle new file mode 100755 index 000000000000..5b213fc183eb --- /dev/null +++ b/dev/com.ibm.ws.crypto.certificateutil_test/bnd.bnd.gradle @@ -0,0 +1,19 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.ws.crypto.certificateutil;version=latest diff --git a/dev/com.ibm.ws.kernel.cmdline_test/build.nogradle b/dev/com.ibm.ws.crypto.certificateutil_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.kernel.cmdline_test/build.nogradle rename to dev/com.ibm.ws.crypto.certificateutil_test/build.gradle diff --git a/dev/com.ibm.ws.crypto.ltpakeyutil/bnd.bnd b/dev/com.ibm.ws.crypto.ltpakeyutil/bnd.bnd index 8b57d0229c86..fcafa119b5cb 100755 --- a/dev/com.ibm.ws.crypto.ltpakeyutil/bnd.bnd +++ b/dev/com.ibm.ws.crypto.ltpakeyutil/bnd.bnd @@ -8,8 +8,7 @@ Bundle-Description: LTPA Key Crypto Utilities; version=${bVersion} Export-Package: \ com.ibm.ws.crypto.ltpakeyutil;provide:=true -Private-Package: \ - com.ibm.ws.common.internal.encoder +Import-Package: com.ibm.ws.common.internal.encoder, !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * instrument.disabled: true diff --git a/dev/com.ibm.ws.crypto.ltpakeyutil_test/.classpath b/dev/com.ibm.ws.crypto.ltpakeyutil_test/.classpath index 40c1b35a5ea7..bd880329225d 100755 --- a/dev/com.ibm.ws.crypto.ltpakeyutil_test/.classpath +++ b/dev/com.ibm.ws.crypto.ltpakeyutil_test/.classpath @@ -1,14 +1,7 @@ - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.crypto.ltpakeyutil_test/.classpath.gradle b/dev/com.ibm.ws.crypto.ltpakeyutil_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.crypto.ltpakeyutil_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.crypto.ltpakeyutil_test/.project b/dev/com.ibm.ws.crypto.ltpakeyutil_test/.project index 401e2d73d3b0..ba10c0cf1607 100755 --- a/dev/com.ibm.ws.crypto.ltpakeyutil_test/.project +++ b/dev/com.ibm.ws.crypto.ltpakeyutil_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.crypto.ltpakeyutil_test/bnd.bnd b/dev/com.ibm.ws.crypto.ltpakeyutil_test/bnd.bnd new file mode 100755 index 000000000000..574d636261b9 --- /dev/null +++ b/dev/com.ibm.ws.crypto.ltpakeyutil_test/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.crypto.ltpakeyutil;version=latest diff --git a/dev/com.ibm.ws.crypto.ltpakeyutil_test/bnd.bnd.gradle b/dev/com.ibm.ws.crypto.ltpakeyutil_test/bnd.bnd.gradle new file mode 100755 index 000000000000..574d636261b9 --- /dev/null +++ b/dev/com.ibm.ws.crypto.ltpakeyutil_test/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.crypto.ltpakeyutil;version=latest diff --git a/dev/com.ibm.ws.kernel.feature_bvt/build.nogradle b/dev/com.ibm.ws.crypto.ltpakeyutil_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.kernel.feature_bvt/build.nogradle rename to dev/com.ibm.ws.crypto.ltpakeyutil_test/build.gradle diff --git a/dev/com.ibm.ws.crypto.passwordutil/bnd.bnd b/dev/com.ibm.ws.crypto.passwordutil/bnd.bnd index d7cc62c1de64..02e1297c8138 100755 --- a/dev/com.ibm.ws.crypto.passwordutil/bnd.bnd +++ b/dev/com.ibm.ws.crypto.passwordutil/bnd.bnd @@ -10,8 +10,9 @@ Export-Package: \ com.ibm.wsspi.security.crypto;provide:=true, \ com.ibm.ws.crypto.util;provide:=true +Import-Package: com.ibm.ws.common.internal.encoder, !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * + Private-Package: \ - com.ibm.ws.common.internal.encoder, \ com.ibm.ws.crypto.util.custom, \ com.ibm.ws.crypto.util.internal.resources diff --git a/dev/com.ibm.ws.crypto.passwordutil_test/.classpath b/dev/com.ibm.ws.crypto.passwordutil_test/.classpath index d984bede3f1b..bd880329225d 100755 --- a/dev/com.ibm.ws.crypto.passwordutil_test/.classpath +++ b/dev/com.ibm.ws.crypto.passwordutil_test/.classpath @@ -1,15 +1,7 @@ - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.crypto.passwordutil_test/.classpath.gradle b/dev/com.ibm.ws.crypto.passwordutil_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.crypto.passwordutil_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.crypto.passwordutil_test/.project b/dev/com.ibm.ws.crypto.passwordutil_test/.project index 62bd218a569d..113399f8e896 100755 --- a/dev/com.ibm.ws.crypto.passwordutil_test/.project +++ b/dev/com.ibm.ws.crypto.passwordutil_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.crypto.passwordutil_test/bnd.bnd b/dev/com.ibm.ws.crypto.passwordutil_test/bnd.bnd new file mode 100755 index 000000000000..78f10ee6e37f --- /dev/null +++ b/dev/com.ibm.ws.crypto.passwordutil_test/bnd.bnd @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.ws.crypto.passwordutil;version=latest diff --git a/dev/com.ibm.ws.crypto.passwordutil_test/bnd.bnd.gradle b/dev/com.ibm.ws.crypto.passwordutil_test/bnd.bnd.gradle new file mode 100755 index 000000000000..78f10ee6e37f --- /dev/null +++ b/dev/com.ibm.ws.crypto.passwordutil_test/bnd.bnd.gradle @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.ws.crypto.passwordutil;version=latest diff --git a/dev/com.ibm.ws.kernel.filemonitor_test/build.nogradle b/dev/com.ibm.ws.crypto.passwordutil_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.kernel.filemonitor_test/build.nogradle rename to dev/com.ibm.ws.crypto.passwordutil_test/build.gradle diff --git a/dev/com.ibm.ws.event_bvt/.classpath b/dev/com.ibm.ws.event_bvt/.classpath index 3ddbf2d24435..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.event_bvt/.classpath +++ b/dev/com.ibm.ws.event_bvt/.classpath @@ -1,14 +1,7 @@ - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.event_bvt/.classpath.gradle b/dev/com.ibm.ws.event_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.event_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.event_bvt/.project b/dev/com.ibm.ws.event_bvt/.project index bff285d0bda4..014172337341 100755 --- a/dev/com.ibm.ws.event_bvt/.project +++ b/dev/com.ibm.ws.event_bvt/.project @@ -11,8 +11,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.event_bvt/bnd.bnd b/dev/com.ibm.ws.event_bvt/bnd.bnd new file mode 100755 index 000000000000..a48aeaeac20e --- /dev/null +++ b/dev/com.ibm.ws.event_bvt/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.event;version=latest diff --git a/dev/com.ibm.ws.event_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.event_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..a48aeaeac20e --- /dev/null +++ b/dev/com.ibm.ws.event_bvt/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.event;version=latest diff --git a/dev/com.ibm.ws.kernel.service_bvt/build.nogradle b/dev/com.ibm.ws.event_bvt/build.gradle similarity index 100% rename from dev/com.ibm.ws.kernel.service_bvt/build.nogradle rename to dev/com.ibm.ws.event_bvt/build.gradle diff --git a/dev/com.ibm.ws.event_test/.classpath b/dev/com.ibm.ws.event_test/.classpath index 7bf85df0ac44..bd880329225d 100755 --- a/dev/com.ibm.ws.event_test/.classpath +++ b/dev/com.ibm.ws.event_test/.classpath @@ -1,14 +1,7 @@ - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.event_test/.classpath.gradle b/dev/com.ibm.ws.event_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.event_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.event_test/.project b/dev/com.ibm.ws.event_test/.project index c684b1c0a1a2..96d1622064dd 100755 --- a/dev/com.ibm.ws.event_test/.project +++ b/dev/com.ibm.ws.event_test/.project @@ -11,8 +11,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.event_test/bnd.bnd b/dev/com.ibm.ws.event_test/bnd.bnd new file mode 100755 index 000000000000..13037e486020 --- /dev/null +++ b/dev/com.ibm.ws.event_test/bnd.bnd @@ -0,0 +1,19 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/jmock/2.6.0/hamcrest-all-1.3.jar;version=file, \ + ../build.sharedResources/lib/jmock/2.6.0/jmock-junit4-2.6.0.jar;version=file, \ + ../build.sharedResources/lib/jmock/2.6.0/jmock-2.6.0.jar;version=file, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.org.osgi.service.log.1.3.0;version=latest,\ + com.ibm.ws.event;version=latest diff --git a/dev/com.ibm.ws.event_test/bnd.bnd.gradle b/dev/com.ibm.ws.event_test/bnd.bnd.gradle new file mode 100755 index 000000000000..13037e486020 --- /dev/null +++ b/dev/com.ibm.ws.event_test/bnd.bnd.gradle @@ -0,0 +1,19 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/jmock/2.6.0/hamcrest-all-1.3.jar;version=file, \ + ../build.sharedResources/lib/jmock/2.6.0/jmock-junit4-2.6.0.jar;version=file, \ + ../build.sharedResources/lib/jmock/2.6.0/jmock-2.6.0.jar;version=file, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.org.osgi.service.log.1.3.0;version=latest,\ + com.ibm.ws.event;version=latest diff --git a/dev/com.ibm.ws.kernel.service_test/build.nogradle b/dev/com.ibm.ws.event_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.kernel.service_test/build.nogradle rename to dev/com.ibm.ws.event_test/build.gradle diff --git a/dev/com.ibm.ws.httpservice/.classpath b/dev/com.ibm.ws.httpservice/.classpath index 57e40b199a1f..2876090f9036 100755 --- a/dev/com.ibm.ws.httpservice/.classpath +++ b/dev/com.ibm.ws.httpservice/.classpath @@ -1,15 +1,7 @@ - - - - - - - - - - - + + + diff --git a/dev/com.ibm.ws.httpservice/.classpath.gradle b/dev/com.ibm.ws.httpservice/.classpath.gradle new file mode 100644 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.httpservice/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.httpservice/.project b/dev/com.ibm.ws.httpservice/.project index 076229b10ab5..dff5ad4ae24c 100755 --- a/dev/com.ibm.ws.httpservice/.project +++ b/dev/com.ibm.ws.httpservice/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.httpservice/bnd.bnd b/dev/com.ibm.ws.httpservice/bnd.bnd index 445cd857e5a2..e8118dd553a0 100755 --- a/dev/com.ibm.ws.httpservice/bnd.bnd +++ b/dev/com.ibm.ws.httpservice/bnd.bnd @@ -41,3 +41,20 @@ Service-Component: com.ibm.ws.httpservice; \ httpContainer=com.ibm.ws.httpsvc.internal.HttpServiceContainer; \ servicefactory:=true; \ properties:="service.vendor=IBM" + +instrument.disabled: true + +publish.wlp.jar.disabled: true + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + lib/org.apache.felix.http.api-2.2.0.jar;version=file,\ + lib/org.apache.felix.http.base-2.2.0.jar;version=file,\ + ../com.ibm.websphere.javaee.servlet.3.1/lib/javax.servlet-api-3.1.0.jar;version=file,\ + com.ibm.websphere.appserver.spi.logging;version=latest, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.websphere.org.osgi.service.http.1.2.1;version=latest,\ + com.ibm.wsspi.org.osgi.service.log.1.3.0;version=latest,\ + com.ibm.ws.event;version=latest,\ + com.ibm.ws.transport.http;version=latest diff --git a/dev/com.ibm.ws.logging.hpel_bvt/build.nogradle b/dev/com.ibm.ws.httpservice/build.gradle similarity index 100% rename from dev/com.ibm.ws.logging.hpel_bvt/build.nogradle rename to dev/com.ibm.ws.httpservice/build.gradle diff --git a/dev/com.ibm.ws.httpservice_bvt/.classpath b/dev/com.ibm.ws.httpservice_bvt/.classpath index f29c72328bd6..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.httpservice_bvt/.classpath +++ b/dev/com.ibm.ws.httpservice_bvt/.classpath @@ -1,16 +1,7 @@ - - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.httpservice_bvt/.classpath.gradle b/dev/com.ibm.ws.httpservice_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.httpservice_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.httpservice_bvt/.project b/dev/com.ibm.ws.httpservice_bvt/.project index bfa49142719d..d2a72db1b34e 100755 --- a/dev/com.ibm.ws.httpservice_bvt/.project +++ b/dev/com.ibm.ws.httpservice_bvt/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.httpservice_bvt/bnd.bnd b/dev/com.ibm.ws.httpservice_bvt/bnd.bnd new file mode 100755 index 000000000000..df45604f2727 --- /dev/null +++ b/dev/com.ibm.ws.httpservice_bvt/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.threading;version=latest diff --git a/dev/com.ibm.ws.httpservice_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.httpservice_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..df45604f2727 --- /dev/null +++ b/dev/com.ibm.ws.httpservice_bvt/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.threading;version=latest diff --git a/dev/com.ibm.ws.logging.hpel_test/build.nogradle b/dev/com.ibm.ws.httpservice_bvt/build.gradle similarity index 100% rename from dev/com.ibm.ws.logging.hpel_test/build.nogradle rename to dev/com.ibm.ws.httpservice_bvt/build.gradle diff --git a/dev/com.ibm.ws.httpservice_test/.classpath b/dev/com.ibm.ws.httpservice_test/.classpath index 6513423df8b1..bd880329225d 100755 --- a/dev/com.ibm.ws.httpservice_test/.classpath +++ b/dev/com.ibm.ws.httpservice_test/.classpath @@ -1,16 +1,7 @@ - - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.httpservice_test/.classpath.gradle b/dev/com.ibm.ws.httpservice_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.httpservice_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.httpservice_test/.project b/dev/com.ibm.ws.httpservice_test/.project index 3eb08197bedf..b03bf0638098 100755 --- a/dev/com.ibm.ws.httpservice_test/.project +++ b/dev/com.ibm.ws.httpservice_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.httpservice_test/bnd.bnd b/dev/com.ibm.ws.httpservice_test/bnd.bnd new file mode 100755 index 000000000000..0bc4b62d4c91 --- /dev/null +++ b/dev/com.ibm.ws.httpservice_test/bnd.bnd @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../com.ibm.websphere.javaee.servlet.3.1/lib/javax.servlet-api-3.1.0.jar;version=file, \ + com.ibm.websphere.appserver.spi.httptransport;version=latest, \ + com.ibm.ws.httpservice;version=latest diff --git a/dev/com.ibm.ws.httpservice_test/bnd.bnd.gradle b/dev/com.ibm.ws.httpservice_test/bnd.bnd.gradle new file mode 100755 index 000000000000..0bc4b62d4c91 --- /dev/null +++ b/dev/com.ibm.ws.httpservice_test/bnd.bnd.gradle @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../com.ibm.websphere.javaee.servlet.3.1/lib/javax.servlet-api-3.1.0.jar;version=file, \ + com.ibm.websphere.appserver.spi.httptransport;version=latest, \ + com.ibm.ws.httpservice;version=latest diff --git a/dev/com.ibm.ws.logging_bvt/build.nogradle b/dev/com.ibm.ws.httpservice_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.logging_bvt/build.nogradle rename to dev/com.ibm.ws.httpservice_test/build.gradle diff --git a/dev/com.ibm.ws.install.utility/bnd.bnd b/dev/com.ibm.ws.install.utility/bnd.bnd index c11e4d17b9d5..463906c7b64d 100755 --- a/dev/com.ibm.ws.install.utility/bnd.bnd +++ b/dev/com.ibm.ws.install.utility/bnd.bnd @@ -5,6 +5,8 @@ Bundle-Name: Install Utility Project Bundle-SymbolicName: com.ibm.ws.install.utility Bundle-Description: WebSphere Liberty Install Utility, version ${bVersion} +Import-Package: !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * + Private-Package: com.ibm.ws.install.utility.* instrument.disabled: true diff --git a/dev/com.ibm.ws.install/bnd.bnd b/dev/com.ibm.ws.install/bnd.bnd index 2f05e0bc9394..23f0a4f43719 100755 --- a/dev/com.ibm.ws.install/bnd.bnd +++ b/dev/com.ibm.ws.install/bnd.bnd @@ -8,6 +8,8 @@ Bundle-Description: WebSphere Liberty Install Kernel, version ${bVersion} Export-Package: \ com.ibm.ws.install;provide:=true +Import-Package: !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * + Private-Package: \ com.ibm.ws.install.* diff --git a/dev/com.ibm.ws.install_test/.classpath b/dev/com.ibm.ws.install_test/.classpath index 31a7e51b6f78..bd880329225d 100755 --- a/dev/com.ibm.ws.install_test/.classpath +++ b/dev/com.ibm.ws.install_test/.classpath @@ -1,12 +1,7 @@ - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.install_test/.classpath.gradle b/dev/com.ibm.ws.install_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.install_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.install_test/.project b/dev/com.ibm.ws.install_test/.project index 60ad67a44ed5..91e9ec460ce0 100755 --- a/dev/com.ibm.ws.install_test/.project +++ b/dev/com.ibm.ws.install_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.install_test/bnd.bnd b/dev/com.ibm.ws.install_test/bnd.bnd new file mode 100755 index 000000000000..e4e2b776be6b --- /dev/null +++ b/dev/com.ibm.ws.install_test/bnd.bnd @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.cmdline;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.product.utility;version=latest, \ + com.ibm.ws.repository;version=latest, \ + wlp.lib.extract;version=latest, \ + com.ibm.ws.install;version=latest diff --git a/dev/com.ibm.ws.install_test/bnd.bnd.gradle b/dev/com.ibm.ws.install_test/bnd.bnd.gradle new file mode 100755 index 000000000000..e4e2b776be6b --- /dev/null +++ b/dev/com.ibm.ws.install_test/bnd.bnd.gradle @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.cmdline;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.product.utility;version=latest, \ + com.ibm.ws.repository;version=latest, \ + wlp.lib.extract;version=latest, \ + com.ibm.ws.install;version=latest diff --git a/dev/com.ibm.ws.logging_test/build.nogradle b/dev/com.ibm.ws.install_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.logging_test/build.nogradle rename to dev/com.ibm.ws.install_test/build.gradle diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.classpath b/dev/com.ibm.ws.jmx.connector.client.rest/.classpath new file mode 100755 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.classpath.gradle b/dev/com.ibm.ws.jmx.connector.client.rest/.classpath.gradle new file mode 100644 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.gitignore b/dev/com.ibm.ws.jmx.connector.client.rest/.gitignore new file mode 100644 index 000000000000..57b341172a1b --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/generated/ diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.project b/dev/com.ibm.ws.jmx.connector.client.rest/.project new file mode 100755 index 000000000000..364b0f3a64aa --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.jmx.connector.client.rest + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..845c3083c7df --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c874b5816985 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/bnd.bnd b/dev/com.ibm.ws.jmx.connector.client.rest/bnd.bnd new file mode 100755 index 000000000000..fc1d262a3724 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/bnd.bnd @@ -0,0 +1,35 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: JMX Connector Client +Bundle-SymbolicName: com.ibm.ws.jmx.connector.client.rest +Bundle-Description: JMX Connector Client and common converter code; version=${bVersion} + +Private-Package: \ + com.ibm.ws.jmx.connector.client.rest.internal.* + +Export-Package: \ + com.ibm.websphere.jmx.connector.rest, \ + com.ibm.ws.jmx.connector.client.rest;thread-context=true, \ + com.ibm.ws.jmx.connector.converter, \ + com.ibm.ws.jmx.connector.datatypes + +Import-Package: \ + javax.management.*, \ + com.ibm.json.java.*, \ + com.ibm.ws.ffdc.*, \ + com.ibm.websphere.ras.*, \ + com.ibm.ws.ssl.protocol, \ + javax.net.ssl + +Include-Resource: \ + META-INF=resources/META-INF + +-dsannotations: com.ibm.ws.jmx.connector.client.rest.internal.Activator + +instrument.disabled: true + +-buildpath: \ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0,\ + com.ibm.websphere.appserver.api.json, \ + com.ibm.ws.org.osgi.annotation.versioning.1.0.0;version=latest diff --git a/dev/com.ibm.ws.product.utility_bvt/build.nogradle b/dev/com.ibm.ws.jmx.connector.client.rest/build.gradle similarity index 100% rename from dev/com.ibm.ws.product.utility_bvt/build.nogradle rename to dev/com.ibm.ws.jmx.connector.client.rest/build.gradle diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/build.xml b/dev/com.ibm.ws.jmx.connector.client.rest/build.xml new file mode 100755 index 000000000000..01c35e904135 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/build.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + Building ${clients.dir}/restConnector.jar with @{bnd} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/findbugs.exclude.xml b/dev/com.ibm.ws.jmx.connector.client.rest/findbugs.exclude.xml new file mode 100755 index 000000000000..9019b5841b7b --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/findbugs.exclude.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/legal/copyright.properties b/dev/com.ibm.ws.jmx.connector.client.rest/legal/copyright.properties new file mode 100755 index 000000000000..c3eead2ff1e9 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/legal/copyright.properties @@ -0,0 +1,13 @@ +#This properties describes files that have non-standard (i.e. non-OCO) copyright notices +# +#The name of property is the basename of the file (e.g., permissions.perm, MyJavaClass.java. +# +#The value of the property is why the file is non-standard: +# +# none - The file does not have or need a copyright notice +# apache - The file has an apache copyright notice +# sun - The file has a SUN copyright notice (which is valid as we are complying with the CDDL license) +# unclassified - The file is copyrighted by IBM, but is not Confidential or OCO +# restricted - This file is NOT OCO, but has the "Restricted Materials of IBM" notice +# +javax.management.remote.JMXConnectorProvider=none \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/META-INF/services/javax.management.remote.JMXConnectorProvider b/dev/com.ibm.ws.jmx.connector.client.rest/resources/META-INF/services/javax.management.remote.JMXConnectorProvider new file mode 100755 index 000000000000..84f96986bd37 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/META-INF/services/javax.management.remote.JMXConnectorProvider @@ -0,0 +1 @@ +com.ibm.ws.jmx.connector.client.rest.ClientProvider \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops new file mode 100755 index 000000000000..dc6e60b7ab07 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: A new file transfer client has connected with connection identifier {0}. +filetransfer.client.init.explanation=A new file transfer client has connected with the specified connection identifier. +filetransfer.client.init.useraction=This is an informational message, and no action is required. + +filetransfer.client.error=CWWKX7952E: A client-side error message "{0}" has occurred for connection {1}. +filetransfer.client.error.explanation=The client-side of the JMX REST connector encountered an error, and the specified message was generated. +filetransfer.client.error.useraction=Use the generated error message to identify, and correct the issue that caused this error, and rerun the operation. + +filetransfer.server.error=CWWKX7953E: Server-side error message "{0}" has occurred for connection {1}. +filetransfer.server.error.explanation=The server-side of the JMX REST connector encountered an error, and generated the specified message. +filetransfer.server.error.useraction=Use the generated error message to identify, and correct the issue that caused this error, and rerun the operation. + +filetransfer.client.bad.credentials=CWWKX7954E: The specified user name or password are not authorized. The server responded with code {0} and message "{1}" for connection {2}. +filetransfer.client.bad.credentials.explanation=The credentials provided when obtaining the connection are incorrect. The user may not exist, may not have authority to access the server, or the password may be incorrect. +filetransfer.client.bad.credentials.useraction=Correct the user name or password, then obtain a new connection. + +filetransfer.response.code.error=CWWKX7955E: The file transfer client received response code {0} with message "{1}" for connection {2}. +filetransfer.response.code.error.explanation=The file transfer client received an unexpected response code from the server. +filetransfer.response.code.error.useraction=Use the client response code to identify, and resolve the cause of this issue, and rerun the operation. + +filetransfer.download.file=CWWKX7956I: The request to download file {0} has been successful and its contents have been written into file {1} using connection {2}. +filetransfer.download.file.explanation=The download request of the specified file was successful. +filetransfer.download.file.useraction=This is an informational message, and no action is required. + +filetransfer.unsupported.operation=CWWKX7957E: The operation {0} is not supported by the file transfer client for connection {1}. +filetransfer.unsupported.operation.explanation=The specified operation is not supported by the file transfer client. +filetransfer.unsupported.operation.useraction=Request an operation that is supported by the file transfer client. + +filetransfer.upload.file=CWWKX7958I: The request to upload file {0} has been successful and its contents have been written into file {1} using connection {2}. +filetransfer.upload.file.explanation=The upload request of the specified file was successful. +filetransfer.upload.file.useraction=This is an informational message, and no action is required. + +filetransfer.delete.file=CWWKX7959I: The request to delete file {0} has been successful using connection {1}. +filetransfer.delete.file.explanation=The delete request of the specified file was successful. +filetransfer.delete.file.useraction=This is an informational message, and no action is required. + +filetransfer.delete.all=CWWKX7960I: The request to delete all files and folders from collection {0} succeeded using connection {1}. +filetransfer.delete.all.explanation=The delete request of the specified collection was successful. +filetransfer.delete.all.useraction=This is an informational message, and no action is required. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_cs.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_cs.nlsprops new file mode 100755 index 000000000000..a785a8c44827 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_cs.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Nov\u00fd klient p\u0159enosu soubor\u016f se spojil s identifik\u00e1torem p\u0159ipojen\u00ed {0}. +filetransfer.client.init.explanation=Nov\u00fd klient p\u0159enosu soubor\u016f se spojil s ur\u010den\u00fdm identifik\u00e1torem p\u0159ipojen\u00ed. +filetransfer.client.init.useraction=Toto je informativn\u00ed zpr\u00e1va a nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + +filetransfer.client.error=CWWKX7952E: Do\u0161lo k chybov\u00e1 zpr\u00e1v\u011b "{0}" na stran\u011b klienta pro p\u0159ipojen\u00ed {1}. +filetransfer.client.error.explanation=Do\u0161lo k chyb\u011b konektoru JMX REST na stran\u011b klienta a byla generov\u00e1na ur\u010den\u00e1 zpr\u00e1va. +filetransfer.client.error.useraction=Pomoc\u00ed generovan\u00e9 chybov\u00e9 zpr\u00e1vy identifikujte a opravte probl\u00e9m, kter\u00fd tuto chybu zp\u016fsobil, a spus\u0165te operaci znovu. + +filetransfer.server.error=CWWKX7953E: Do\u0161lo k chybov\u00e1 zpr\u00e1v\u011b "{0}" na stran\u011b serveru pro p\u0159ipojen\u00ed {1}. +filetransfer.server.error.explanation=Do\u0161lo k chyb\u011b konektoru JMX REST na stran\u011b serveru a byla generov\u00e1na uveden\u00e1 zpr\u00e1va. +filetransfer.server.error.useraction=Pomoc\u00ed generovan\u00e9 chybov\u00e9 zpr\u00e1vy identifikujte a opravte probl\u00e9m, kter\u00fd tuto chybu zp\u016fsobil, a spus\u0165te operaci znovu. + +filetransfer.client.bad.credentials=CWWKX7954E: Zadan\u00e9 u\u017eivatelsk\u00e9 jm\u00e9no a heslo nen\u00ed autorizovan\u00e9. Server odpov\u011bd\u011bl k\u00f3dem {0} a zpr\u00e1vou "{1}" pro p\u0159ipojen\u00ed {2}. +filetransfer.client.bad.credentials.explanation=Pov\u011b\u0159en\u00ed zadan\u00e1 p\u0159i z\u00edsk\u00e1v\u00e1n\u00ed p\u0159ipojen\u00ed jsou nespr\u00e1vn\u00e1. Je mo\u017en\u00e9, \u017ee u\u017eivatel neexistuje, nem\u00e1 opr\u00e1vn\u011bn\u00ed pro p\u0159\u00edstup na server nebo je nespr\u00e1vn\u00e9 heslo. +filetransfer.client.bad.credentials.useraction=Opravte jm\u00e9no u\u017eivatele nebo heslo a pot\u00e9 z\u00edskejte nov\u00e9 p\u0159ipojen\u00ed. + +filetransfer.response.code.error=CWWKX7955E: Klient p\u0159enosu soubor\u016f p\u0159ijal k\u00f3d odezvy {0} se zpr\u00e1vou "{1}" pro p\u0159ipojen\u00ed {2}. +filetransfer.response.code.error.explanation=Klient p\u0159enosu soubor\u016f p\u0159ijal neo\u010dek\u00e1van\u00fd k\u00f3d odezvy ze serveru. +filetransfer.response.code.error.useraction=Pomoc\u00ed k\u00f3du odezvy klienta ur\u010dete a vy\u0159e\u0161te p\u0159\u00ed\u010dinu tohoto probl\u00e9mu a spus\u0165te operaci znovu. + +filetransfer.download.file=CWWKX7956I: Po\u017eadavek na sta\u017een\u00ed souboru {0} byl \u00fasp\u011b\u0161n\u011b proveden a obsah byl zaps\u00e1n do souboru {1} pomoc\u00ed p\u0159ipojen\u00ed {2}. +filetransfer.download.file.explanation=Po\u017eadavek na sta\u017een\u00ed uveden\u00e9ho souboru byl \u00fasp\u011b\u0161n\u011b proveden. +filetransfer.download.file.useraction=Toto je informativn\u00ed zpr\u00e1va a nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + +filetransfer.unsupported.operation=CWWKX7957E: Operaci {0} klient p\u0159enosu soubor\u016f nepodporuje pro p\u0159ipojen\u00ed {1}. +filetransfer.unsupported.operation.explanation=Uvedenou operaci klient p\u0159enosu soubor\u016f nepodporuje. +filetransfer.unsupported.operation.useraction=Vy\u017e\u00e1dejte si operaci, kterou klient p\u0159enosu soubor\u016f podporuje. + +filetransfer.upload.file=CWWKX7958I: Po\u017eadavek na odesl\u00e1n\u00ed souboru {0} byl \u00fasp\u011b\u0161n\u011b proveden a obsah byl zaps\u00e1n do souboru {1} pomoc\u00ed p\u0159ipojen\u00ed {2}. +filetransfer.upload.file.explanation=Po\u017eadavek na odesl\u00e1n\u00ed uveden\u00e9ho souboru byl \u00fasp\u011b\u0161n\u011b proveden. +filetransfer.upload.file.useraction=Toto je informativn\u00ed zpr\u00e1va a nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + +filetransfer.delete.file=CWWKX7959I: Po\u017eadavek na odstran\u011bn\u00ed souboru {0} byl proveden \u00fasp\u011b\u0161n\u011b pomoc\u00ed p\u0159ipojen\u00ed {1}. +filetransfer.delete.file.explanation=Po\u017eadavek na odstran\u011bn\u00ed uveden\u00e9ho souboru byl \u00fasp\u011b\u0161n\u00fd. +filetransfer.delete.file.useraction=Toto je informativn\u00ed zpr\u00e1va a nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + +filetransfer.delete.all=CWWKX7960I: Po\u017eadavek na odstran\u011bn\u00ed v\u0161ech soubor\u016f a slo\u017eek z kolekce {0} byl \u00fasp\u011b\u0161n\u011b proveden pomoc\u00ed p\u0159ipojen\u00ed {1}. +filetransfer.delete.all.explanation=Po\u017eadavek na odstran\u011bn\u00ed uveden\u00e9 kolekce byl \u00fasp\u011b\u0161n\u00fd. +filetransfer.delete.all.useraction=Toto je informativn\u00ed zpr\u00e1va a nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_de.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_de.nlsprops new file mode 100755 index 000000000000..c734ddb8fc3d --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_de.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Ein neuer Datei\u00fcbertragungsclient hat eine Verbindung mit der Verbindungs-ID {0} hergestellt. +filetransfer.client.init.explanation=Ein neuer Datei\u00fcbertragungsclient hat eine Verbindung mit der angegebenen Verbindungs-ID hergestellt. +filetransfer.client.init.useraction=Dies ist eine Informationsnachricht. Es ist keine Aktion erforderlich. + +filetransfer.client.error=CWWKX7952E: Der clientseitige Fehler "{0}" ist f\u00fcr die Verbindung {1} aufgetreten. +filetransfer.client.error.explanation=Auf der Clientseite des JMX-REST-Connectors ist ein Fehler aufgetreten, und es wurde die angegebene Nachricht generiert. +filetransfer.client.error.useraction=Verwenden Sie die generierte Fehlernachricht, um das Problem, das diesen Fehler verursacht, zu identifizieren und zu beheben, und f\u00fchren Sie anschlie\u00dfend die Operation erneut aus. + +filetransfer.server.error=CWWKX7953E: Der serverseitige Fehler "{0}" ist f\u00fcr die Verbindung {1} aufgetreten. +filetransfer.server.error.explanation=Auf der Serverseite des JMX-REST-Connectors ist ein Fehler aufgetreten, und es wurde die angegebene Nachricht generiert. +filetransfer.server.error.useraction=Verwenden Sie die generierte Fehlernachricht, um das Problem, das diesen Fehler verursacht, zu identifizieren und zu beheben, und f\u00fchren Sie anschlie\u00dfend die Operation erneut aus. + +filetransfer.client.bad.credentials=CWWKX7954E: Der angegebene Benutzername oder das angegebene Kennwort ist nicht berechtigt. Der Server hat mit dem Code {0} und der Nachricht "{1}" f\u00fcr die Verbindung {2} geantwortet. +filetransfer.client.bad.credentials.explanation=Die beim Anfordern der Verbindung angegebenen Berechtigungsnachweise sind nicht g\u00fcltig. M\u00f6glicherweise ist der Benutzer nicht vorhanden, oder er hat keine Berechtigung f\u00fcr den Zugriff auf den Server, oder das Kennwort ist ung\u00fcltig. +filetransfer.client.bad.credentials.useraction=Korrigieren Sie den Benutzernamen bzw. das Kennwort, und fordern Sie dann eine neue Verbindung an. + +filetransfer.response.code.error=CWWKX7955E: Der Datei\u00fcbertragungsclient hat den Antwortcode {0} mit der Nachricht "{1}" f\u00fcr die Verbindung {2} empfangen. +filetransfer.response.code.error.explanation=Der Datei\u00fcbertragungsclient hat einen unerwarteten Antwortcode vom Server empfangen. +filetransfer.response.code.error.useraction=Verwenden Sie den Antwortcode des Clients, um die Ursache f\u00fcr dieses Problem zu identifizieren und zu beheben, und f\u00fchren Sie anschlie\u00dfend die Operation erneut aus. + +filetransfer.download.file=CWWKX7956I: Die Anforderung zum Herunterladen der Datei {0} war erfolgreich, und der Inhalt der Datei wurde in die Datei {1} geschrieben. Die Verbindung {2} wurde daf\u00fcr verwendet. +filetransfer.download.file.explanation=Die Downloadanforderung f\u00fcr die angegebene Datei war erfolgreich. +filetransfer.download.file.useraction=Dies ist eine Informationsnachricht. Es ist keine Aktion erforderlich. + +filetransfer.unsupported.operation=CWWKX7957E: Die Operation {0} wird vom Datei\u00fcbertragungsclient f\u00fcr die Verbindung {1} nicht unterst\u00fctzt. +filetransfer.unsupported.operation.explanation=Die angegebene Operation wird vom Datei\u00fcbertragungsclient nicht unterst\u00fctzt. +filetransfer.unsupported.operation.useraction=Fordern Sie eine Operation an, die vom Datei\u00fcbertragungsclient unterst\u00fctzt wird. + +filetransfer.upload.file=CWWKX7958I: Die Anforderung zum Hochladen der Datei {0} war erfolgreich, und der Inhalt der Datei wurde in die Datei {1} geschrieben. Die Verbindung {2} wurde daf\u00fcr verwendet. +filetransfer.upload.file.explanation=Die Uploadanforderung f\u00fcr die angegebene Datei war erfolgreich. +filetransfer.upload.file.useraction=Dies ist eine Informationsnachricht. Es ist keine Aktion erforderlich. + +filetransfer.delete.file=CWWKX7959I: Die Anforderung zum L\u00f6schen der Datei {0} \u00fcber die Verbindung {1} war erfolgreich. +filetransfer.delete.file.explanation=Die Anforderung zum L\u00f6schen der angegebenen Datei war erfolgreich. +filetransfer.delete.file.useraction=Dies ist eine Informationsnachricht. Es ist keine Aktion erforderlich. + +filetransfer.delete.all=CWWKX7960I: Die Anforderung zum L\u00f6schen aller Dateien und Ordner aus der Sammlung {0} \u00fcber die Verbindung {1} war erfolgreich. +filetransfer.delete.all.explanation=Die L\u00f6schanforderung f\u00fcr die angegebene Sammlung war erfolgreich. +filetransfer.delete.all.useraction=Dies ist eine Informationsnachricht. Es ist keine Aktion erforderlich. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_es.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_es.nlsprops new file mode 100755 index 000000000000..df6c915a4dfa --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_es.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Un nuevo cliente de transferencia de archivos se ha conectado con el ID de conexi\u00f3n {0}. +filetransfer.client.init.explanation=Un nuevo cliente de transferencia de archivos se ha conectado con el ID de conexi\u00f3n especificado. +filetransfer.client.init.useraction=Este es un mensaje informativo y no es necesaria ninguna acci\u00f3n. + +filetransfer.client.error=CWWKX7952E: Se ha generado un mensaje de error del lado de cliente "{0}" para la conexi\u00f3n {1}. +filetransfer.client.error.explanation=El lado del cliente del conector JMX REST ha encontrado un error y se ha generado el mensaje especificado. +filetransfer.client.error.useraction=Utilice el mensaje de error generado para identificar y corregir el problema que ha provocado este error, y vuelva a ejecutar la operaci\u00f3n. + +filetransfer.server.error=CWWKX7953E: Se ha generado un mensaje de error del lado de servidor "{0}" para la conexi\u00f3n {1}. +filetransfer.server.error.explanation=El lado del servidor del conector JMX REST ha encontrado un error y se ha generado el mensaje especificado. +filetransfer.server.error.useraction=Utilice el mensaje de error generado para identificar y corregir el problema que ha provocado este error, y vuelva a ejecutar la operaci\u00f3n. + +filetransfer.client.bad.credentials=CWWKX7954E: El nombre de usuario o la contrase\u00f1a especificados no est\u00e1n autorizados. El servidor ha respondido con el c\u00f3digo {0} y el mensaje "{1}" para la conexi\u00f3n {2}. +filetransfer.client.bad.credentials.explanation=Las credenciales proporcionadas al obtener la conexi\u00f3n son incorrectas. El usuario puede que no exista, puede que no tenga autoridad para acceder al servidor o que la contrase\u00f1a sea incorrecta. +filetransfer.client.bad.credentials.useraction=Corrija el nombre de usuario o la contrase\u00f1a y despu\u00e9s obtenga una nueva conexi\u00f3n. + +filetransfer.response.code.error=CWWKX7955E: El cliente de transferencia de archivos ha recibido un c\u00f3digo de respuesta {0} con el mensaje "{1}" para la conexi\u00f3n {2}. +filetransfer.response.code.error.explanation=El cliente de transferencia de archivos ha recibido un c\u00f3digo de respuesta inesperado del servidor. +filetransfer.response.code.error.useraction=Utilice el c\u00f3digo de respuesta del cliente para identificar y resolver la causa del problema, y vuelva a ejecutar la operaci\u00f3n. + +filetransfer.download.file=CWWKX7956I: La solicitud de descarga del archivo {0} ha sido satisfactoria y su contenido se ha escrito en el archivo {1} utilizando la conexi\u00f3n {2}. +filetransfer.download.file.explanation=La solicitud de descarga del archivo especificado ha sido satisfactoria. +filetransfer.download.file.useraction=Este es un mensaje informativo y no es necesaria ninguna acci\u00f3n. + +filetransfer.unsupported.operation=CWWKX7957E: La operaci\u00f3n {0} no est\u00e1 soportada por el cliente de transferencia de archivos para la conexi\u00f3n {1}. +filetransfer.unsupported.operation.explanation=La operaci\u00f3n especificada no est\u00e1 soportada por el cliente de transferencia de archivos. +filetransfer.unsupported.operation.useraction=Solicite una operaci\u00f3n que est\u00e9 soportada por el cliente de transferencia de archivos. + +filetransfer.upload.file=CWWKX7958I: La solicitud de carga del archivo {0} ha sido satisfactoria y su contenido se ha escrito en el archivo {1} utilizando la conexi\u00f3n {2}. +filetransfer.upload.file.explanation=La solicitud de carga del archivo especificado ha sido satisfactoria. +filetransfer.upload.file.useraction=Este es un mensaje informativo y no es necesaria ninguna acci\u00f3n. + +filetransfer.delete.file=CWWKX7959I: La solicitud de supresi\u00f3n del archivo {0} ha sido satisfactoria utilizando conexi\u00f3n {1}. +filetransfer.delete.file.explanation=La solicitud de supresi\u00f3n del archivo especificado ha sido satisfactoria. +filetransfer.delete.file.useraction=Este es un mensaje informativo y no es necesaria ninguna acci\u00f3n. + +filetransfer.delete.all=CWWKX7960I: La solicitud de supresi\u00f3n de todos los archivos y carpetas de la colecci\u00f3n {0} ha sido satisfactoria utilizando la conexi\u00f3n {1}. +filetransfer.delete.all.explanation=La solicitud de supresi\u00f3n de la colecci\u00f3n especificada ha sido satisfactoria. +filetransfer.delete.all.useraction=Este es un mensaje informativo y no es necesaria ninguna acci\u00f3n. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_fr.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_fr.nlsprops new file mode 100755 index 000000000000..d2c482d796f5 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_fr.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Un nouveau client de transfert de fichier a \u00e9t\u00e9 connect\u00e9 avec l''identificateur de connexion {0}. +filetransfer.client.init.explanation=Un nouveau client de transfert de fichier a \u00e9t\u00e9 connect\u00e9 avec l'identificateur de connexion indiqu\u00e9. +filetransfer.client.init.useraction=Il s'agit d'un message d'information et aucune action n'est requise. + +filetransfer.client.error=CWWKX7952E: Un message d''erreur "{0}" a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 c\u00f4t\u00e9 client pour la connexion {1}. +filetransfer.client.error.explanation=Une erreur s'est produite pour le connecteur JMX REST c\u00f4t\u00e9 client et le message indiqu\u00e9 a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9. +filetransfer.client.error.useraction=Utilisez le message d'erreur g\u00e9n\u00e9r\u00e9 pour identifier et corriger le probl\u00e8me \u00e0 l'origine de cette erreur, puis relancez l'op\u00e9ration. + +filetransfer.server.error=CWWKX7953E: Le message d''erreur "{0}" a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 c\u00f4t\u00e9 serveur pour la connexion {1}. +filetransfer.server.error.explanation=Une erreur s'est produite sur le connecteur JMX REST c\u00f4t\u00e9 serveur et a g\u00e9n\u00e9r\u00e9 le message indiqu\u00e9. +filetransfer.server.error.useraction=Utilisez le message d'erreur g\u00e9n\u00e9r\u00e9 pour identifier et corriger le probl\u00e8me \u00e0 l'origine de cette erreur, puis relancez l'op\u00e9ration. + +filetransfer.client.bad.credentials=CWWKX7954E: Le nom d''utilisateur ou le mot de passe indiqu\u00e9 n''est pas autoris\u00e9. Le serveur a r\u00e9pondu avec le code {0} et le message "{1}" pour la connexion {2}. +filetransfer.client.bad.credentials.explanation=Les donn\u00e9es d'identification fournies lors de l'obtention de la connexion sont incorrectes. L'utilisateur n'existe peut-\u00eatre pas, s'il existe, il n'a peut-\u00eatre pas le droit d'acc\u00e9der au serveur, ou le mot de passe indiqu\u00e9 est incorrect. +filetransfer.client.bad.credentials.useraction=Corrigez le nom d'utilisateur ou le mot de passe, puis obtenez une nouvelle connexion. + +filetransfer.response.code.error=CWWKX7955E: Le client de transfert de fichier a re\u00e7u un code de r\u00e9ponse {0} avec le message "{1}" pour la connexion {2}. +filetransfer.response.code.error.explanation=Le client du transfert de fichiers a re\u00e7u un code de r\u00e9ponse inattendu du serveur. +filetransfer.response.code.error.useraction=Utilisez la code de r\u00e9ponse client pour identifier et r\u00e9soudre ce probl\u00e8me, puis relancez l'op\u00e9ration. + +filetransfer.download.file=CWWKX7956I: La demande de t\u00e9l\u00e9chargement du fichier {0} a abouti et son contenu a \u00e9t\u00e9 \u00e9crit dans le fichier {1} \u00e0 l''aide de la connexion {2}. +filetransfer.download.file.explanation=La demande de t\u00e9l\u00e9chargement du fichier sp\u00e9cifi\u00e9 a abouti. +filetransfer.download.file.useraction=Il s'agit d'un message d'information et aucune action n'est requise. + +filetransfer.unsupported.operation=CWWKX7957E: L''op\u00e9ration {0} n''est pas prise en charge par le client de transfert de fichier pour la connexion {1}. +filetransfer.unsupported.operation.explanation=L'op\u00e9ration sp\u00e9cifi\u00e9e n'est pas prise en charge par le client du transfert de fichiers. +filetransfer.unsupported.operation.useraction=Demandez une op\u00e9ration qui est prise en charge par le client du transfert de fichiers. + +filetransfer.upload.file=CWWKX7958I: La demande de t\u00e9l\u00e9chargement du fichier {0} a abouti et son contenu a \u00e9t\u00e9 \u00e9crit dans le fichier {1} \u00e0 l''aide de la connexion {2}. +filetransfer.upload.file.explanation=La demande de t\u00e9l\u00e9chargement du fichier sp\u00e9cifi\u00e9 a abouti. +filetransfer.upload.file.useraction=Il s'agit d'un message d'information et aucune action n'est requise. + +filetransfer.delete.file=CWWKX7959I: La demande de suppression du fichier {0} \u00e0 l''aide de la connexion {1} a abouti. +filetransfer.delete.file.explanation=La demande de suppression du fichier indiqu\u00e9 a abouti. +filetransfer.delete.file.useraction=Il s'agit d'un message d'information et aucune action n'est requise. + +filetransfer.delete.all=CWWKX7960I: La demande de suppression de tous les fichiers et dossiers de la collection {0} a r\u00e9ussi via la connexion {1}. +filetransfer.delete.all.explanation=La demande de suppression de la collection sp\u00e9cifi\u00e9e a r\u00e9ussi. +filetransfer.delete.all.useraction=Il s'agit d'un message d'information et aucune action n'est requise. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_hu.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_hu.nlsprops new file mode 100755 index 000000000000..b5afafc96974 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_hu.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \u00daj f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l csatlakozott {0} kapcsolatazonos\u00edt\u00f3val. +filetransfer.client.init.explanation=\u00daj f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l csatlakozott a megadott kapcsolatazonos\u00edt\u00f3val. +filetransfer.client.init.useraction=Ez inform\u00e1ci\u00f3s \u00fczenet, semmit sem kell tennie. + +filetransfer.client.error=CWWKX7952E: \u00dcgyf\u00e9loldali "{0}" hiba\u00fczenet a(z) {1} kapcsolat eset\u00e9ben. +filetransfer.client.error.explanation=A JMX REST csatol\u00f3 \u00fcgyf\u00e9l oldal\u00e1n hiba t\u00f6rt\u00e9nt, \u00e9s a megadott \u00fczenet j\u00f6tt l\u00e9tre. +filetransfer.client.error.useraction=Az el\u0151\u00e1ll\u00edtott hiba\u00fczenet seg\u00edts\u00e9g\u00e9vel azonos\u00edtsa \u00e9s jav\u00edtsa a hib\u00e1t okoz\u00f3 probl\u00e9m\u00e1t, majd futtassa \u00fajra a m\u0171veletet. + +filetransfer.server.error=CWWKX7953E: Kiszolg\u00e1l\u00f3 oldali "{0}" hiba\u00fczenet a(z) {1} kapcsolat eset\u00e9ben. +filetransfer.server.error.explanation=A JMX REST csatol\u00f3 kiszolg\u00e1l\u00f3 oldal\u00e1n hiba t\u00f6rt\u00e9nt, \u00e9s a megadott \u00fczenetet \u00e1ll\u00edtotta el\u0151. +filetransfer.server.error.useraction=Az el\u0151\u00e1ll\u00edtott hiba\u00fczenet seg\u00edts\u00e9g\u00e9vel azonos\u00edtsa \u00e9s jav\u00edtsa a hib\u00e1t okoz\u00f3 probl\u00e9m\u00e1t, majd futtassa \u00fajra a m\u0171veletet. + +filetransfer.client.bad.credentials=CWWKX7954E: A megadottfelhaszn\u00e1l\u00f3n\u00e9v \u00e9s jelsz\u00f3 nem jogosult. A kiszolg\u00e1l\u00f3 a(z) {0} k\u00f3ddal \u00e9s"{1}" \u00fczenettel v\u00e1laszolt a(z) {2} kapcsolat eset\u00e9ben. +filetransfer.client.bad.credentials.explanation=A kapcsolat l\u00e9trehoz\u00e1sakor megadott hiteles\u00edt\u00e9si adatok helytelenek. Lehet, hogy a felhaszn\u00e1l\u00f3 nem l\u00e9tezik, nincs jogosults\u00e1ga a kiszolg\u00e1l\u00f3 el\u00e9r\u00e9s\u00e9hez, vagy helytelen a jelsz\u00f3. +filetransfer.client.bad.credentials.useraction=Jav\u00edtsa ki a felhaszn\u00e1l\u00f3nevet vagy jelsz\u00f3t, majd hozzon l\u00e9tre \u00faj kapcsolatot. + +filetransfer.response.code.error=CWWKX7955E: A f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l {0} v\u00e1laszk\u00f3dot kapott "{1}" \u00fczenettel a(z) {2} kapcsolat eset\u00e9ben. +filetransfer.response.code.error.explanation=A f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l nem v\u00e1rt v\u00e1laszk\u00f3dot kapott a kiszolg\u00e1l\u00f3t\u00f3l. +filetransfer.response.code.error.useraction=Az \u00fcgyf\u00e9l v\u00e1laszk\u00f3ddal azonos\u00edtsa \u00e9s oldja meg a probl\u00e9ma ok\u00e1t, majd futtassa \u00fajra a m\u0171veletet. + +filetransfer.download.file=CWWKX7956I: A(z) {0} f\u00e1jl let\u00f6lt\u00e9s\u00e9re vonatkoz\u00f3 k\u00e9r\u00e9s sikeres volt, \u00e9s a tartalma a(z) {1} f\u00e1jlba lett \u00edrva a(z) {2} kapcsolat alkalmaz\u00e1s\u00e1val. +filetransfer.download.file.explanation=A megadott f\u00e1jl let\u00f6lt\u00e9si k\u00e9r\u00e9se sikeres volt. +filetransfer.download.file.useraction=Ez inform\u00e1ci\u00f3s \u00fczenet, semmit sem kell tennie. + +filetransfer.unsupported.operation=CWWKX7957E: A(z) {0} m\u0171veletet a f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l nem t\u00e1mogatja a(z) {1} kapcsolat eset\u00e9ben. +filetransfer.unsupported.operation.explanation=A megadott m\u0171veletet nem t\u00e1mogatja a f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l. +filetransfer.unsupported.operation.useraction=K\u00e9rjen olyan m\u0171veletet, amelyet a f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l t\u00e1mogat. + +filetransfer.upload.file=CWWKX7958I: A(z) {0} f\u00e1jl felt\u00f6lt\u00e9s\u00e9re vonatkoz\u00f3 k\u00e9r\u00e9s sikeres volt, \u00e9s a tartalma a(z) {1} f\u00e1jlba lett \u00edrva a(z) {2} kapcsolat alkalmaz\u00e1s\u00e1val. +filetransfer.upload.file.explanation=A megadott f\u00e1jl felt\u00f6lt\u00e9si k\u00e9r\u00e9se sikeres volt. +filetransfer.upload.file.useraction=Ez inform\u00e1ci\u00f3s \u00fczenet, semmit sem kell tennie. + +filetransfer.delete.file=CWWKX7959I: A(z) {0} f\u00e1jl t\u00f6rl\u00e9s\u00e9re vonatkoz\u00f3 k\u00e9r\u00e9s sikeres volt a(z) {1} kapcsolat felhaszn\u00e1l\u00e1s\u00e1val. +filetransfer.delete.file.explanation=A megadott f\u00e1jl t\u00f6rl\u00e9si k\u00e9r\u00e9se sikeres volt. +filetransfer.delete.file.useraction=Ez inform\u00e1ci\u00f3s \u00fczenet, semmit sem kell tennie. + +filetransfer.delete.all=CWWKX7960I: A(z) {0} gy\u0171jtem\u00e9nyben l\u00e9v\u0151 \u00f6sszes f\u00e1jl \u00e9s mappa t\u00f6rl\u00e9s\u00e9re vonatkoz\u00f3 k\u00e9r\u00e9s siker\u00fclt a(z) {1} kapcsolat haszn\u00e1lat\u00e1val. +filetransfer.delete.all.explanation=A megadott gy\u0171jtem\u00e9ny t\u00f6rl\u00e9si k\u00e9r\u00e9se sikeres volt. +filetransfer.delete.all.useraction=Ez inform\u00e1ci\u00f3s \u00fczenet, semmit sem kell tennie. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_it.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_it.nlsprops new file mode 100755 index 000000000000..be4711857d0a --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_it.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Un nuovo client di trasferimento file si \u00e8 connesso con l''identificativo di connessione {0}. +filetransfer.client.init.explanation=Un nuovo client di trasferimento file si \u00e8 connesso con l'identificativo di connessione specificato. +filetransfer.client.init.useraction=Si tratta di un messaggio informativo, non \u00e8 richiesta alcuna azione. + +filetransfer.client.error=CWWKX7952E: Si \u00e8 verificato un messaggio di errore lato client "{0}" per la connessione {1}. +filetransfer.client.error.explanation=Il connettore REST JMX lato client ha rilevato un errore ed \u00e8 stato generato il messaggio specificato. +filetransfer.client.error.useraction=Utilizzare il messaggio di errore generato per identificare e risolvere il problema che ha causato questo errore ed eseguire di nuovo l'operazione. + +filetransfer.server.error=CWWKX7953E: Si \u00e8 verificato un messaggio di errore lato server "{0}" per la connessione {1}. +filetransfer.server.error.explanation=Il connettore REST JMX lato server ha rilevato un errore ed \u00e8 stato generato il messaggio specificato. +filetransfer.server.error.useraction=Utilizzare il messaggio di errore generato per identificare e risolvere il problema che ha causato questo errore ed eseguire di nuovo l'operazione. + +filetransfer.client.bad.credentials=CWWKX7954E: Il nome utente o la password specificati non sono autorizzati. Il server ha risposto con il codice {0} e il messaggio "{1}" per la connessione {2}. +filetransfer.client.bad.credentials.explanation=Le credenziali fornite durante il tentativo di ottenere la connessione non sono corrette. Probabilmente l'utente non esiste, non dispone dell'autorizzazione per accedere al server oppure la password non \u00e8 corretta. +filetransfer.client.bad.credentials.useraction=Correggere il nome utente o la password, quindi ottenere la connessione. + +filetransfer.response.code.error=CWWKX7955E: Il client di trasferimento file ha ricevuto il codice di risposta {0} con il messaggio "{1}" per la connessione {2}. +filetransfer.response.code.error.explanation=Il client di trasferimento file ha ricevuto un codice di risposta imprevisto dal server. +filetransfer.response.code.error.useraction=Utilizzare il codice di risposta del client per identificare e risolvere la causa di questo problema, ed eseguire di nuovo l'operazione. + +filetransfer.download.file=CWWKX7956I: La richiesta di scaricamento del file {0} \u00e8 riuscita e il suo contenuto \u00e8 stato scritto nel file {1} utilizzando la connessione {2}. +filetransfer.download.file.explanation=La richiesta di scaricamento del file specificato \u00e8 riuscita. +filetransfer.download.file.useraction=Si tratta di un messaggio informativo, non \u00e8 richiesta alcuna azione. + +filetransfer.unsupported.operation=CWWKX7957E: L''operazione {0} non \u00e8 supportata dal client di trasferimento file per la connessione {1}. +filetransfer.unsupported.operation.explanation=L'operazione specificata non \u00e8 supportata dal client di trasferimento file. +filetransfer.unsupported.operation.useraction=Richiedere un'operazione supportata dal client di trasferimento file. + +filetransfer.upload.file=CWWKX7958I: La richiesta di caricamento del file {0} \u00e8 riuscita e il suo contenuto \u00e8 stato scritto nel file {1} utilizzando la connessione {2}. +filetransfer.upload.file.explanation=La richiesta di caricamento del file specificato \u00e8 riuscita. +filetransfer.upload.file.useraction=Si tratta di un messaggio informativo, non \u00e8 richiesta alcuna azione. + +filetransfer.delete.file=CWWKX7959I: La richiesta di eliminazione del file {0} \u00e8 riuscita utilizzando la connessione {1}. +filetransfer.delete.file.explanation=La richiesta di eliminazione del file specificato \u00e8 riuscita. +filetransfer.delete.file.useraction=Si tratta di un messaggio informativo, non \u00e8 richiesta alcuna azione. + +filetransfer.delete.all=CWWKX7960I: Richiesta di eliminazione di tutti i file e cartelle dalla raccolta {0} riuscita con la connessione {1}. +filetransfer.delete.all.explanation=La richiesta di eliminazione della raccolta specificata \u00e8 riuscita. +filetransfer.delete.all.useraction=Si tratta di un messaggio informativo, non \u00e8 richiesta alcuna azione. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ja.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ja.nlsprops new file mode 100755 index 000000000000..73608fc00763 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ja.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \u65b0\u898f\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u63a5\u7d9a ID {0} \u3092\u7528\u3044\u3066\u63a5\u7d9a\u3055\u308c\u307e\u3057\u305f\u3002 +filetransfer.client.init.explanation=\u65b0\u898f\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u793a\u3055\u308c\u305f\u63a5\u7d9a ID \u3092\u7528\u3044\u3066\u63a5\u7d9a\u3055\u308c\u307e\u3057\u305f\u3002 +filetransfer.client.init.useraction=\u3053\u308c\u306f\u901a\u77e5\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u3042\u308a\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 + +filetransfer.client.error=CWWKX7952E: \u63a5\u7d9a {1} \u306b\u5bfe\u3057\u3066\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30fb\u30b5\u30a4\u30c9\u306e\u30a8\u30e9\u30fc\u30fb\u30e1\u30c3\u30bb\u30fc\u30b8\u300c{0}\u300d\u304c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002 +filetransfer.client.error.explanation=JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30fb\u30b5\u30a4\u30c9\u304c\u30a8\u30e9\u30fc\u3092\u691c\u51fa\u3057\u3001\u793a\u3055\u308c\u305f\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u751f\u6210\u3055\u308c\u307e\u3057\u305f\u3002 +filetransfer.client.error.useraction=\u751f\u6210\u3055\u308c\u305f\u30a8\u30e9\u30fc\u30fb\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u4f7f\u7528\u3057\u3066\u3053\u306e\u30a8\u30e9\u30fc\u3092\u5f15\u304d\u8d77\u3053\u3057\u305f\u554f\u984c\u3092\u7279\u5b9a\u3057\u3001\u4fee\u6b63\u3057\u3066\u3001\u64cd\u4f5c\u3092\u518d\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +filetransfer.server.error=CWWKX7953E: \u63a5\u7d9a {1} \u306b\u5bfe\u3057\u3066\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30b5\u30a4\u30c9\u306e\u30a8\u30e9\u30fc\u30fb\u30e1\u30c3\u30bb\u30fc\u30b8\u300c{0}\u300d\u304c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002 +filetransfer.server.error.explanation=JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306e\u30b5\u30fc\u30d0\u30fc\u30fb\u30b5\u30a4\u30c9\u304c\u30a8\u30e9\u30fc\u3092\u691c\u51fa\u3057\u3001\u793a\u3055\u308c\u305f\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u751f\u6210\u3057\u307e\u3057\u305f\u3002 +filetransfer.server.error.useraction=\u751f\u6210\u3055\u308c\u305f\u30a8\u30e9\u30fc\u30fb\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u4f7f\u7528\u3057\u3066\u3053\u306e\u30a8\u30e9\u30fc\u3092\u5f15\u304d\u8d77\u3053\u3057\u305f\u554f\u984c\u3092\u7279\u5b9a\u3057\u3001\u4fee\u6b63\u3057\u3066\u3001\u64cd\u4f5c\u3092\u518d\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +filetransfer.client.bad.credentials=CWWKX7954E: \u6307\u5b9a\u3055\u308c\u305f\u30e6\u30fc\u30b6\u30fc\u540d\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u8a31\u53ef\u3055\u308c\u307e\u305b\u3093\u3002\u30b5\u30fc\u30d0\u30fc\u306f\u3001\u63a5\u7d9a {2} \u306b\u3064\u3044\u3066\u30b3\u30fc\u30c9 {0}\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u300c{1}\u300d\u3067\u5fdc\u7b54\u3057\u307e\u3057\u305f\u3002 +filetransfer.client.bad.credentials.explanation=\u63a5\u7d9a\u306e\u53d6\u5f97\u6642\u306b\u6307\u5b9a\u3057\u305f\u8cc7\u683c\u60c5\u5831\u306b\u8aa4\u308a\u304c\u3042\u308a\u307e\u3059\u3002 \u30e6\u30fc\u30b6\u30fc\u304c\u5b58\u5728\u3057\u306a\u3044\u304b\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u304c\u306a\u3044\u304b\u3001\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u306b\u8aa4\u308a\u304c\u3042\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +filetransfer.client.bad.credentials.useraction=\u30e6\u30fc\u30b6\u30fc\u540d\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a02\u6b63\u3057\u3066\u304b\u3089\u65b0\u898f\u63a5\u7d9a\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +filetransfer.response.code.error=CWWKX7955E: \u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u63a5\u7d9a {2} \u306b\u3064\u3044\u3066\u3001\u5fdc\u7b54\u30b3\u30fc\u30c9 {0} \u304a\u3088\u3073\u30e1\u30c3\u30bb\u30fc\u30b8\u300c{1}\u300d\u3092\u53d7\u3051\u53d6\u308a\u307e\u3057\u305f\u3002 +filetransfer.response.code.error.explanation=\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u4e88\u671f\u3057\u306a\u3044\u5fdc\u7b54\u30b3\u30fc\u30c9\u3092\u53d7\u4fe1\u3057\u307e\u3057\u305f\u3002 +filetransfer.response.code.error.useraction=\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u5fdc\u7b54\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3053\u306e\u554f\u984c\u306e\u539f\u56e0\u3092\u7279\u5b9a\u3057\u3001\u89e3\u6c7a\u3057\u3066\u3001\u64cd\u4f5c\u3092\u518d\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +filetransfer.download.file=CWWKX7956I: \u30d5\u30a1\u30a4\u30eb {0} \u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u3001\u63a5\u7d9a {2} \u3092\u4f7f\u7528\u3057\u3066\u305d\u306e\u5185\u5bb9\u304c\u30d5\u30a1\u30a4\u30eb {1} \u306b\u66f8\u304d\u8fbc\u307e\u308c\u307e\u3057\u305f\u3002 +filetransfer.download.file.explanation=\u793a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.download.file.useraction=\u3053\u308c\u306f\u901a\u77e5\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u3042\u308a\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 + +filetransfer.unsupported.operation=CWWKX7957E: \u64cd\u4f5c {0} \u306f\u3001\u63a5\u7d9a {1} \u3067\u306f\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u3088\u3063\u3066\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +filetransfer.unsupported.operation.explanation=\u793a\u3055\u308c\u305f\u64cd\u4f5c\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u3088\u3063\u3066\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +filetransfer.unsupported.operation.useraction=\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u3088\u3063\u3066\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u308b\u64cd\u4f5c\u3092\u8981\u6c42\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +filetransfer.upload.file=CWWKX7958I: \u30d5\u30a1\u30a4\u30eb {0} \u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u3001\u63a5\u7d9a {2} \u3092\u4f7f\u7528\u3057\u3066\u305d\u306e\u5185\u5bb9\u304c\u30d5\u30a1\u30a4\u30eb {1} \u306b\u66f8\u304d\u8fbc\u307e\u308c\u307e\u3057\u305f\u3002 +filetransfer.upload.file.explanation=\u793a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.upload.file.useraction=\u3053\u308c\u306f\u901a\u77e5\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u3042\u308a\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 + +filetransfer.delete.file=CWWKX7959I: \u30d5\u30a1\u30a4\u30eb {0} \u306e\u524a\u9664\u8981\u6c42\u304c\u3001\u63a5\u7d9a {1} \u3092\u4f7f\u7528\u3057\u3066\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.delete.file.explanation=\u793a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u524a\u9664\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.delete.file.useraction=\u3053\u308c\u306f\u901a\u77e5\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u3042\u308a\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 + +filetransfer.delete.all=CWWKX7960I: \u30b3\u30ec\u30af\u30b7\u30e7\u30f3 {0} \u304b\u3089\u306e\u3059\u3079\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30d5\u30a9\u30eb\u30c0\u30fc\u306e\u524a\u9664\u8981\u6c42\u304c\u3001\u63a5\u7d9a {1} \u3092\u4f7f\u7528\u3057\u3066\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.delete.all.explanation=\u793a\u3055\u308c\u305f\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u524a\u9664\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.delete.all.useraction=\u3053\u308c\u306f\u901a\u77e5\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u3042\u308a\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ko.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ko.nlsprops new file mode 100755 index 000000000000..32f9315d6266 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ko.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \uc0c8 \ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc5f0\uacb0 ID {0}\uacfc(\uc640) \uc5f0\uacb0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.client.init.explanation=\uc0c8 \ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc9c0\uc815\ub41c \uc5f0\uacb0 ID\uc640 \uc5f0\uacb0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.client.init.useraction=\uc774\uac83\uc740 \uc815\ubcf4 \uba54\uc2dc\uc9c0\uc774\ubbc0\ub85c \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. + +filetransfer.client.error=CWWKX7952E: \uc5f0\uacb0 {1}\uc5d0 \ub300\ud55c \ud074\ub77c\uc774\uc5b8\ud2b8\uce21 \uc624\ub958 \uba54\uc2dc\uc9c0 "{0}"\uc774(\uac00) \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. +filetransfer.client.error.explanation=JMX REST \ucee4\ub125\ud130\uc758 \ud074\ub77c\uc774\uc5b8\ud2b8\uce21\uc5d0\uc11c \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc73c\uba70 \uc9c0\uc815\ub41c \uba54\uc2dc\uc9c0\uac00 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.client.error.useraction=\uc0dd\uc131\ub41c \uc624\ub958 \uba54\uc2dc\uc9c0\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc774 \uc624\ub958\uc758 \uc6d0\uc778\uc774 \ub418\ub294 \ubb38\uc81c\ub97c \uc2dd\ubcc4\ud558\uace0 \uc815\uc815\ud55c \ud6c4 \uc870\uc791\uc744 \ub2e4\uc2dc \uc2e4\ud589\ud569\ub2c8\ub2e4. + +filetransfer.server.error=CWWKX7953E: \uc5f0\uacb0 {1}\uc5d0 \ub300\ud55c \uc11c\ubc84\uce21 \uc624\ub958 \uba54\uc2dc\uc9c0 "{0}"\uc774(\uac00) \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. +filetransfer.server.error.explanation=JMX REST \ucee4\ub125\ud130\uc758 \uc11c\ubc84\uce21\uc5d0 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc73c\uba70 \uc9c0\uc815\ub41c \uba54\uc2dc\uc9c0\uac00 \ud45c\uc2dc\ub429\ub2c8\ub2e4. +filetransfer.server.error.useraction=\uc0dd\uc131\ub41c \uc624\ub958 \uba54\uc2dc\uc9c0\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc774 \uc624\ub958\uc758 \uc6d0\uc778\uc774 \ub418\ub294 \ubb38\uc81c\ub97c \uc2dd\ubcc4\ud558\uace0 \uc815\uc815\ud55c \ud6c4 \uc870\uc791\uc744 \ub2e4\uc2dc \uc2e4\ud589\ud569\ub2c8\ub2e4. + +filetransfer.client.bad.credentials=CWWKX7954E: \uc9c0\uc815\ub41c \uc0ac\uc6a9\uc790 \uc774\ub984\uc774\ub098 \ube44\ubc00\ubc88\ud638\uac00 \uc778\uc99d\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4. \uc11c\ubc84\uac00 {2} \uc5f0\uacb0\uc5d0 \ub300\ud574 {0} \ucf54\ub4dc \ubc0f "{1}" \uba54\uc2dc\uc9c0\ub85c \uc751\ub2f5\ud569\ub2c8\ub2e4. +filetransfer.client.bad.credentials.explanation=\uc5f0\uacb0\uc744 \uc5bb\uc744 \ub54c \uc81c\uacf5\ub41c \uc2e0\uc784 \uc815\ubcf4\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \uc0ac\uc6a9\uc790\uac00 \uc5c6\uac70\ub098 \uc11c\ubc84\uc5d0 \uc561\uc138\uc2a4\ud560 \uad8c\ud55c\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. \ub610\ub294 \ube44\ubc00\ubc88\ud638\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +filetransfer.client.bad.credentials.useraction=\uc0ac\uc6a9\uc790 \uc774\ub984 \ub610\ub294 \ube44\ubc00\ubc88\ud638\ub97c \uc815\uc815\ud55c \ub2e4\uc74c \uc0c8 \uc5f0\uacb0\uc744 \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +filetransfer.response.code.error=CWWKX7955E: \ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 {2} \uc5f0\uacb0\uc5d0 \ub300\ud574 "{1}" \uba54\uc2dc\uc9c0\uc640 \ud568\uaed8 {0} \uc751\ub2f5 \ucf54\ub4dc\ub97c \uc218\uc2e0\ud588\uc2b5\ub2c8\ub2e4. +filetransfer.response.code.error.explanation=\ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84\uc5d0\uc11c \uc608\uc0c1\uce58 \uc54a\uc740 \uc751\ub2f5 \ucf54\ub4dc\ub97c \uc218\uc2e0\ud588\uc2b5\ub2c8\ub2e4. +filetransfer.response.code.error.useraction=\ud074\ub77c\uc774\uc5b8\ud2b8 \uc751\ub2f5 \ucf54\ub4dc\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc774 \ubb38\uc81c\uc758 \uc6d0\uc778\uc744 \uc2dd\ubcc4\ud558\uace0 \ud574\uacb0\ud55c \ub2e4\uc74c \uc870\uc791\uc744 \ub2e4\uc2dc \uc2e4\ud589\ud569\ub2c8\ub2e4. + +filetransfer.download.file=CWWKX7956I: {0} \ud30c\uc77c \ub2e4\uc6b4\ub85c\ub4dc \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc73c\uba70 {2} \uc5f0\uacb0\uc744 \uc0ac\uc6a9\ud558\uc5ec \ud574\ub2f9 \ucee8\ud150\uce20\uac00 {1} \ud30c\uc77c\uc5d0 \uc791\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.download.file.explanation=\uc9c0\uc815\ub41c \ud30c\uc77c\uc758 \ub2e4\uc6b4\ub85c\ub4dc \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.download.file.useraction=\uc774\uac83\uc740 \uc815\ubcf4 \uba54\uc2dc\uc9c0\uc774\ubbc0\ub85c \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. + +filetransfer.unsupported.operation=CWWKX7957E: {1} \uc5f0\uacb0\uc5d0 \uc0ac\uc6a9\ud558\ub294 \ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0\uc11c ''{0}'' \uc870\uc791\uc774 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +filetransfer.unsupported.operation.explanation=\ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0\uc11c \uc9c0\uc815\ub41c \uc870\uc791\uc774 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +filetransfer.unsupported.operation.useraction=\ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0\uc11c \uc9c0\uc6d0\ub418\ub294 \uc870\uc791\uc744 \uc694\uccad\ud558\uc2ed\uc2dc\uc624. + +filetransfer.upload.file=CWWKX7958I: {0} \ud30c\uc77c \uc5c5\ub85c\ub4dc \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc73c\uba70 {2} \uc5f0\uacb0\uc744 \uc0ac\uc6a9\ud558\uc5ec \ud574\ub2f9 \ucee8\ud150\uce20\uac00 {1} \ud30c\uc77c\uc5d0 \uc791\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.upload.file.explanation=\uc9c0\uc815\ub41c \ud30c\uc77c\uc758 \uc5c5\ub85c\ub4dc \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.upload.file.useraction=\uc774\uac83\uc740 \uc815\ubcf4 \uba54\uc2dc\uc9c0\uc774\ubbc0\ub85c \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. + +filetransfer.delete.file=CWWKX7959I: {0} \ud30c\uc77c \uc0ad\uc81c \uc694\uccad\uc774 {1} \uc5f0\uacb0\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.delete.file.explanation=\uc9c0\uc815\ub41c \ud30c\uc77c\uc758 \uc0ad\uc81c \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.delete.file.useraction=\uc774\uac83\uc740 \uc815\ubcf4 \uba54\uc2dc\uc9c0\uc774\ubbc0\ub85c \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. + +filetransfer.delete.all=CWWKX7960I: {0} \ucf5c\ub809\uc158\uc5d0\uc11c \ubaa8\ub4e0 \ud30c\uc77c\uacfc \ud3f4\ub354\ub97c \uc0ad\uc81c\ud558\ub294 \uc694\uccad\uc774 {1} \uc5f0\uacb0\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc815\uc0c1\uc801\uc73c\ub85c \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.delete.all.explanation=\uc9c0\uc815\ub41c \ucf5c\ub809\uc158\uc5d0 \ub300\ud55c \uc0ad\uc81c \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.delete.all.useraction=\uc774\uac83\uc740 \uc815\ubcf4 \uba54\uc2dc\uc9c0\uc774\ubbc0\ub85c \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pl.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pl.nlsprops new file mode 100755 index 000000000000..77bb0becdc96 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pl.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Nowy klient przesy\u0142ania plik\u00f3w nawi\u0105za\u0142 po\u0142\u0105czenie o identyfikatorze {0}. +filetransfer.client.init.explanation=Nowy klient przesy\u0142ania plik\u00f3w nawi\u0105za\u0142 po\u0142\u0105czenie o okre\u015blonym identyfikatorze. +filetransfer.client.init.useraction=To jest komunikat informacyjny i nie jest wymagana \u017cadna czynno\u015b\u0107. + +filetransfer.client.error=CWWKX7952E: Wyst\u0105pi\u0142 komunikat o b\u0142\u0119dzie po stronie klienta {0} dla po\u0142\u0105czenia {1}. +filetransfer.client.error.explanation=Konektor JMX REST po stronie klienta napotka\u0142 b\u0142\u0105d i zosta\u0142 wygenerowany okre\u015blony komunikat. +filetransfer.client.error.useraction=U\u017cyj wygenerowanego komunikatu o b\u0142\u0119dzie, aby zidenytfikowa\u0107 i rozwi\u0105za\u0107 problem spowodowany b\u0142\u0119dem, a nast\u0119pnie uruchom ponownie operacj\u0119. + +filetransfer.server.error=CWWKX7953E: Wyst\u0105pi\u0142 komunikat o b\u0142\u0119dzie po stronie serwera ({0}) dla po\u0142\u0105czenia {1}. +filetransfer.server.error.explanation=Konektor JMX REST po stronie serwera napotka\u0142 b\u0142\u0105d i wygenerowa\u0142 podany komunikat. +filetransfer.server.error.useraction=U\u017cyj wygenerowanego komunikatu o b\u0142\u0119dzie, aby zidenytfikowa\u0107 i rozwi\u0105za\u0107 problem spowodowany b\u0142\u0119dem, a nast\u0119pnie uruchom ponownie operacj\u0119. + +filetransfer.client.bad.credentials=CWWKX7954E: Podana nazwa u\u017cytkownika lub has\u0142o nie zosta\u0142y autoryzowane. Serwer zwr\u00f3ci\u0142 kod {0} i komunikat \u201e{1}\u201d dla po\u0142\u0105czenia {2}. +filetransfer.client.bad.credentials.explanation=Referencje podane podczas nawi\u0105zywania po\u0142\u0105czenia s\u0105 niepoprawne. Prawdopodobnie u\u017cytkownik nie istnieje, nie ma uprawnie\u0144 niezb\u0119dnych do uzyskania dost\u0119pu do serwera lub has\u0142o jest niepoprawne. +filetransfer.client.bad.credentials.useraction=Popraw nazw\u0119 u\u017cytkownika lub has\u0142o, a nast\u0119pnie nawi\u0105\u017c nowe po\u0142\u0105czenie. + +filetransfer.response.code.error=CWWKX7955E: Klient przesy\u0142ania plik\u00f3w odebra\u0142 kod odpowiedzi {0} z komunikatem \u201e{1}\u201d dla po\u0142\u0105czenia {2}. +filetransfer.response.code.error.explanation=Klient przesy\u0142ania plik\u00f3w odebra\u0142 nieoczekiwany kod odpowiedzi z serwera. +filetransfer.response.code.error.useraction=U\u017cyj kodu odpowiedzi klienta, aby zidentyfikowa\u0107 i usun\u0105\u0107 przyczyn\u0119 problemu, a nast\u0119pnie uruchom ponownie operacj\u0119. + +filetransfer.download.file=CWWKX7956I: \u017b\u0105danie pobrania pliku {0} zosta\u0142o wykonane pomy\u015blnie, a jego zawarto\u015b\u0107 zosta\u0142a zapisana w pliku {1} przy u\u017cyciu po\u0142\u0105czenia {2}. +filetransfer.download.file.explanation=\u017b\u0105danie pobrania podanego pliku zako\u0144czy\u0142o si\u0119 powodzeniem. +filetransfer.download.file.useraction=To jest komunikat informacyjny i nie jest wymagana \u017cadna czynno\u015b\u0107. + +filetransfer.unsupported.operation=CWWKX7957E: Operacja {0} nie jest obs\u0142ugiwana przez klient przesy\u0142ania plik\u00f3w dla po\u0142\u0105czenia {1}. +filetransfer.unsupported.operation.explanation=Okre\u015blona operacja nie jest obs\u0142ugiwana przez klient przesy\u0142ania plik\u00f3w. +filetransfer.unsupported.operation.useraction=Za\u017c\u0105daj operacji, kt\u00f3ra jest obs\u0142ugiwana przez klient przesy\u0142ania plik\u00f3w. + +filetransfer.upload.file=CWWKX7958I: \u017b\u0105danie przes\u0142ania pliku {0} zosta\u0142o wykonane pomy\u015blnie, a jego zawarto\u015b\u0107 zosta\u0142a zapisana w pliku {1} przy u\u017cyciu po\u0142\u0105czenia {2}. +filetransfer.upload.file.explanation=\u017b\u0105danie przes\u0142ania podanego pliku zako\u0144czy\u0142o si\u0119 powodzeniem. +filetransfer.upload.file.useraction=To jest komunikat informacyjny i nie jest wymagana \u017cadna czynno\u015b\u0107. + +filetransfer.delete.file=CWWKX7959I: \u017b\u0105danie usuni\u0119cia pliku {0} zosta\u0142o wykonane pomy\u015blnie przy u\u017cyciu po\u0142\u0105czenia {1}. +filetransfer.delete.file.explanation=\u017b\u0105danie usuni\u0119cia podanego pliku zako\u0144czy\u0142o si\u0119 powodzeniem. +filetransfer.delete.file.useraction=To jest komunikat informacyjny i nie jest wymagana \u017cadna czynno\u015b\u0107. + +filetransfer.delete.all=CWWKX7960I: \u017b\u0105danie usuni\u0119cia wszystkich plik\u00f3w i folder\u00f3w z kolekcji {0} zosta\u0142o wykonane pomy\u015blnie przy u\u017cyciu po\u0142\u0105czenia {1}. +filetransfer.delete.all.explanation=\u017b\u0105danie usuni\u0119cia podanej kolekcji zako\u0144czy\u0142o si\u0119 powodzeniem. +filetransfer.delete.all.useraction=To jest komunikat informacyjny i nie jest wymagana \u017cadna czynno\u015b\u0107. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pt_BR.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pt_BR.nlsprops new file mode 100755 index 000000000000..09725d285613 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pt_BR.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Um novo cliente de transfer\u00eancia de arquivos conectou-se ao identificador de conex\u00e3o {0}. +filetransfer.client.init.explanation=Um novo cliente de transfer\u00eancia de arquivos conectou-se ao identificador de conex\u00e3o especificado. +filetransfer.client.init.useraction=Esta \u00e9 uma mensagem informativa e nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. + +filetransfer.client.error=CWWKX7952E: Ocorreu uma mensagem de erro "{0}" do lado do cliente para a conex\u00e3o {1}. +filetransfer.client.error.explanation=O lado do cliente do conector JMX REST encontrou um erro e a mensagem especificada foi gerada. +filetransfer.client.error.useraction=Use a mensagem de erro gerada para identificar e corrigir o problema que causou esse erro e execute novamente a opera\u00e7\u00e3o. + +filetransfer.server.error=CWWKX7953E: Ocorreu uma mensagem de erro "{0}" do lado do servidor para a conex\u00e3o {1}. +filetransfer.server.error.explanation=O lado do servidor do conector JMX REST encontrou um erro e gerou a mensagem especificada. +filetransfer.server.error.useraction=Use a mensagem de erro gerada para identificar e corrigir o problema que causou esse erro e execute novamente a opera\u00e7\u00e3o. + +filetransfer.client.bad.credentials=CWWKX7954E: O nome de usu\u00e1rio ou a senha especificados n\u00e3o est\u00e3o autorizados. O servidor respondeu com o c\u00f3digo {0} e a mensagem "{1}" para a conex\u00e3o {2}. +filetransfer.client.bad.credentials.explanation=As credenciais fornecidas ao obter a conex\u00e3o s\u00e3o incorretas. O usu\u00e1rio pode n\u00e3o existir, n\u00e3o ter autoridade para acessar o servidor, ou a senha pode ser incorreta. +filetransfer.client.bad.credentials.useraction=Corrija o nome de usu\u00e1rio ou a senha e, em seguida, obtenha uma nova conex\u00e3o. + +filetransfer.response.code.error=CWWKX7955E: O cliente de transfer\u00eancia de arquivos recebeu o c\u00f3digo de resposta {0} com a mensagem "{1}" para a conex\u00e3o {2}. +filetransfer.response.code.error.explanation=O cliente de transfer\u00eancia de arquivos recebeu um c\u00f3digo de resposta inesperado do servidor. +filetransfer.response.code.error.useraction=Use o c\u00f3digo de resposta do cliente para identificar e resolver a causa desse problema e execute novamente a opera\u00e7\u00e3o. + +filetransfer.download.file=CWWKX7956I: A solicita\u00e7\u00e3o para fazer o download do arquivo {0} foi bem-sucedida e seu conte\u00fado foi gravado no arquivo {1} usando a conex\u00e3o {2}. +filetransfer.download.file.explanation=A solicita\u00e7\u00e3o de download do arquivo especificado obteve \u00eaxito. +filetransfer.download.file.useraction=Esta \u00e9 uma mensagem informativa e nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. + +filetransfer.unsupported.operation=CWWKX7957E: A opera\u00e7\u00e3o {0} n\u00e3o \u00e9 suportada pelo cliente de transfer\u00eancia de arquivos para a conex\u00e3o {1}. +filetransfer.unsupported.operation.explanation=A opera\u00e7\u00e3o especificada n\u00e3o \u00e9 suportada pelo cliente de transfer\u00eancia de arquivos. +filetransfer.unsupported.operation.useraction=Solicite uma opera\u00e7\u00e3o que seja suportada pelo cliente de transfer\u00eancia de arquivos. + +filetransfer.upload.file=CWWKX7958I: A solicita\u00e7\u00e3o para fazer o upload do arquivo {0} foi bem-sucedida e seu conte\u00fado foi gravado no arquivo {1} usando a conex\u00e3o {2}. +filetransfer.upload.file.explanation=A solicita\u00e7\u00e3o de upload do arquivo especificado obteve \u00eaxito. +filetransfer.upload.file.useraction=Esta \u00e9 uma mensagem informativa e nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. + +filetransfer.delete.file=CWWKX7959I: A solicita\u00e7\u00e3o para excluir o arquivo {0} foi bem-sucedida usando a conex\u00e3o {1}. +filetransfer.delete.file.explanation=A solicita\u00e7\u00e3o de exclus\u00e3o do arquivo especificado obteve \u00eaxito. +filetransfer.delete.file.useraction=Esta \u00e9 uma mensagem informativa e nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. + +filetransfer.delete.all=CWWKX7960I: A solicita\u00e7\u00e3o para excluir todos os arquivos e pastas da cole\u00e7\u00e3o {0} foi bem-sucedida usando a conex\u00e3o {1}. +filetransfer.delete.all.explanation=A solicita\u00e7\u00e3o de exclus\u00e3o da cole\u00e7\u00e3o especificada foi bem-sucedida. +filetransfer.delete.all.useraction=Esta \u00e9 uma mensagem informativa e nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ro.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ro.nlsprops new file mode 100755 index 000000000000..db396c86498e --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ro.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Un nou client de transfer de fi\u015fiere s-a conectat cu identificatorul de conexiune {0}. +filetransfer.client.init.explanation=Un nou client de transfer de fi\u015fiere s-a conectat cu identificatorul de conexiune specificat. +filetransfer.client.init.useraction=Acesta este un mesaj informa\u0163ional \u015fi nu este necesar\u0103 nici o ac\u0163iune. + +filetransfer.client.error=CWWKX7952E: A ap\u0103rut un mesaj de eroare pe partea de client "{0}" pentru conexiunea {1}. +filetransfer.client.error.explanation=Partea de client a conectorului JMX REST a \u00eent\u00e2lnit o eroare \u015fi s-a generat mesajul specificat. +filetransfer.client.error.useraction=Folosi\u0163i mesajul de eroare generat pentru a identifica \u015fi a corecta problema care a cauzat eroarea, apoi rula\u0163i din nou opera\u0163ia. + +filetransfer.server.error=CWWKX7953E: A ap\u0103rut un mesaj de eroare pe partea de server "{0}" pentru conexiunea {1}. +filetransfer.server.error.explanation=Partea de server a conectorului JMX REST a \u00eent\u00e2lnit o eroare \u015fi s-a generat mesajul specificat. +filetransfer.server.error.useraction=Folosi\u0163i mesajul de eroare generat pentru a identifica \u015fi a corecta problema care a cauzat eroarea, apoi rula\u0163i din nou opera\u0163ia. + +filetransfer.client.bad.credentials=CWWKX7954E: Numele de utilizator sau parola specificat(\u0103) nu este autorizat(\u0103). Serverul a r\u0103spuns cu codul {0} \u015fi mesajul "{1}" pentru conexiunea {2}. +filetransfer.client.bad.credentials.explanation=Acredit\u0103rile furnizate la ob\u0163inerea conexiunii sunt incorecte. Utilizatorul s-ar putea s\u0103 nu existe, s-ar putea s\u0103 nu aib\u0103 autoriza\u0163ia de accesare a serverului sau parola ar putea fi incorect\u0103. +filetransfer.client.bad.credentials.useraction=Corecta\u0163i numele utilizator sau parola, apoi ob\u0163ine\u0163i o nou\u0103 conexiune. + +filetransfer.response.code.error=CWWKX7955E: Clientul de transfer de fi\u015fiere a primi codul de r\u0103spuns {0} cu mesajul "{1}" pentru conexiunea {2}. +filetransfer.response.code.error.explanation=Clientul de transfer de fi\u015fiere a primit un cod de r\u0103spuns nea\u015fteptat de la server. +filetransfer.response.code.error.useraction=Folosi\u0163i codul de r\u0103spuns client pentru a identifica \u015fi a rezolva cauza acestei probleme, apoi rula\u0163i din nou opera\u0163ia. + +filetransfer.download.file=CWWKX7956I: Cererea de desc\u0103rcare a fi\u015fierului {0} a avt succes \u015fi con\u0163inutul s\u0103u a fost scris \u00een fi\u015fierul {1} folosind conexiunea {2}. +filetransfer.download.file.explanation=Cererea de desc\u0103rcare a fi\u015fierului specificat a avut succes. +filetransfer.download.file.useraction=Acesta este un mesaj informa\u0163ional \u015fi nu este necesar\u0103 nici o ac\u0163iune. + +filetransfer.unsupported.operation=CWWKX7957E: Opera\u0163ia {0} nu este suportat\u0103 de clientul de transfer de fi\u015fiere pentru conexiunea {1}. +filetransfer.unsupported.operation.explanation=Opera\u0163ia specificat\u0103 nu este suportat\u0103 de clientul de transfer de fi\u015fiere. +filetransfer.unsupported.operation.useraction=Cere\u0163i o opera\u0163ie care este suportat\u0103 de clientul de transfer de fi\u015fiere. + +filetransfer.upload.file=CWWKX7958I: Cererea de \u00eenc\u0103rcare a fi\u015fierului {0} a avut succes \u015fi con\u0163inutul s\u0103u a fost scris \u00een fi\u015fierul {1} folosind conexiunea {2}. +filetransfer.upload.file.explanation=Cererea de \u00eenc\u0103rcare a fi\u015fierului specificat a avut succes. +filetransfer.upload.file.useraction=Acesta este un mesaj informa\u0163ional \u015fi nu este necesar\u0103 nici o ac\u0163iune. + +filetransfer.delete.file=CWWKX7959I: Cererea de \u015ftergere a fi\u015fierului {0} a avut succes folosind conexiunea {1}. +filetransfer.delete.file.explanation=Cererea de \u015ftergere a fi\u015fierului specificat a avut succes. +filetransfer.delete.file.useraction=Acesta este un mesaj informa\u0163ional \u015fi nu este necesar\u0103 nici o ac\u0163iune. + +filetransfer.delete.all=CWWKX7960I: Cererea de \u015ftergere a tuturor fi\u015fierelor \u015fi folderelor din colec\u0163ia {0} a reu\u015fit prin utilizarea conexiunii {1}. +filetransfer.delete.all.explanation=Cererea de \u015ftergere a colec\u0163iei specificate a avut succes. +filetransfer.delete.all.useraction=Acesta este un mesaj informa\u0163ional \u015fi nu este necesar\u0103 nici o ac\u0163iune. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ru.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ru.nlsprops new file mode 100755 index 000000000000..6ddbb0cf18ec --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ru.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {0}. +filetransfer.client.init.explanation=\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. +filetransfer.client.init.useraction=\u042d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + +filetransfer.client.error=CWWKX7952E: \u041e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c "{0}" \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {1}. +filetransfer.client.error.explanation=\u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST JMX \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0438 \u0432\u044b\u0434\u0430\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. +filetransfer.client.error.useraction=\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0438 \u043f\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u0435 \u0435\u0435 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. + +filetransfer.server.error=CWWKX7953E: \u041e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c "{0}" \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {1}. +filetransfer.server.error.explanation=\u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST JMX \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. +filetransfer.server.error.useraction=\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0438 \u043f\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u0435 \u0435\u0435 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. + +filetransfer.client.bad.credentials=CWWKX7954E: \u0423\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044e \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0421\u0435\u0440\u0432\u0435\u0440 \u0432\u0435\u0440\u043d\u0443\u043b \u043a\u043e\u0434 {0} \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 "{1}" \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {2}. +filetransfer.client.bad.credentials.explanation=\u041f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u044b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0438\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043b \u043f\u0430\u0440\u043e\u043b\u044c. +filetransfer.client.bad.credentials.useraction=\u0418\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. + +filetransfer.response.code.error=CWWKX7955E: \u041a\u043b\u0438\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 {0} \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c "{1}" \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {2}. +filetransfer.response.code.error.explanation=\u041a\u043b\u0438\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0442\u0432\u0435\u0442 \u0441 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. +filetransfer.response.code.error.useraction=\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0438 \u043f\u043e \u043a\u043e\u0434\u0443 \u043e\u0442\u0432\u0435\u0442\u0430, \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u0435 \u0435\u0435 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. + +filetransfer.download.file=CWWKX7956I: \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 {0} \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d, \u0438 \u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0444\u0430\u0439\u043b {1} \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 {2}. +filetransfer.download.file.explanation=\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0431\u044b\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0443\u0441\u043f\u0435\u0448\u043d\u043e. +filetransfer.download.file.useraction=\u042d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + +filetransfer.unsupported.operation=CWWKX7957E: \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f {0} \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {1}. +filetransfer.unsupported.operation.explanation=\u0423\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432. +filetransfer.unsupported.operation.useraction=\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432. + +filetransfer.upload.file=CWWKX7958I: \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 {0} \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d, \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0444\u0430\u0439\u043b {1} \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 {2}. +filetransfer.upload.file.explanation=\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d. +filetransfer.upload.file.useraction=\u042d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + +filetransfer.delete.file=CWWKX7959I: \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 {0} \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 {1}. +filetransfer.delete.file.explanation=\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d. +filetransfer.delete.file.useraction=\u042d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + +filetransfer.delete.all=CWWKX7960I: \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043f\u0430\u043f\u043e\u043a \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 {0} \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {1}. +filetransfer.delete.all.explanation=\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d. +filetransfer.delete.all.useraction=\u042d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh.nlsprops new file mode 100755 index 000000000000..6e14a1606375 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \u5df2\u8fde\u63a5\u5176\u8fde\u63a5\u6807\u8bc6\u4e3a {0} \u7684\u65b0\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u3002 +filetransfer.client.init.explanation=\u5df2\u8fde\u63a5\u5e26\u6709\u6307\u5b9a\u8fde\u63a5\u6807\u8bc6\u7684\u65b0\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u3002 +filetransfer.client.init.useraction=\u8fd9\u662f\u4e00\u6761\u53c2\u8003\u6d88\u606f\uff0c\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 + +filetransfer.client.error=CWWKX7952E: \u8fde\u63a5 {1} \u51fa\u73b0\u4e86\u5ba2\u6237\u7aef\u9519\u8bef\u6d88\u606f\u201c{0}\u201d\u3002 +filetransfer.client.error.explanation=JMX REST \u8fde\u63a5\u5668\u7684\u5ba2\u6237\u7aef\u9047\u5230\u4e86\u9519\u8bef\uff0c\u751f\u6210\u4e86\u6307\u5b9a\u6d88\u606f\u3002 +filetransfer.client.error.useraction=\u8bf7\u4f7f\u7528\u751f\u6210\u7684\u9519\u8bef\u6d88\u606f\u6765\u6807\u8bc6\u6b64\u9519\u8bef\uff0c\u66f4\u6b63\u5bfc\u81f4\u6b64\u9519\u8bef\u7684\u95ee\u9898\u5e76\u91cd\u65b0\u8fd0\u884c\u8be5\u64cd\u4f5c\u3002 + +filetransfer.server.error=CWWKX7953E: \u8fde\u63a5 {1} \u51fa\u73b0\u4e86\u670d\u52a1\u5668\u7aef\u9519\u8bef\u6d88\u606f\u201c{0}\u201d\u3002 +filetransfer.server.error.explanation=JMX REST \u8fde\u63a5\u5668\u7684\u670d\u52a1\u5668\u7aef\u9047\u5230\u4e86\u9519\u8bef\uff0c\u5e76\u751f\u6210\u4e86\u6307\u5b9a\u6d88\u606f\u3002 +filetransfer.server.error.useraction=\u8bf7\u4f7f\u7528\u751f\u6210\u7684\u9519\u8bef\u6d88\u606f\u6765\u6807\u8bc6\u6b64\u9519\u8bef\uff0c\u66f4\u6b63\u5bfc\u81f4\u6b64\u9519\u8bef\u7684\u95ee\u9898\u5e76\u91cd\u65b0\u8fd0\u884c\u8be5\u64cd\u4f5c\u3002 + +filetransfer.client.bad.credentials=CWWKX7954E: \u6307\u5b9a\u7684\u7528\u6237\u540d\u6216\u5bc6\u7801\u672a\u88ab\u6388\u6743\u3002\u5bf9\u4e8e\u8fde\u63a5 {2}\uff0c\u670d\u52a1\u5668\u4ee5\u4ee3\u7801 {0} \u548c\u6d88\u606f\u201c{1}\u201d\u4f5c\u4e3a\u54cd\u5e94\u3002 +filetransfer.client.bad.credentials.explanation=\u83b7\u53d6\u8fde\u63a5\u65f6\u63d0\u4f9b\u7684\u51ed\u8bc1\u4e0d\u6b63\u786e\u3002\u7528\u6237\u53ef\u80fd\u4e0d\u5b58\u5728\u6216\u4e0d\u5177\u6709\u8bbf\u95ee\u670d\u52a1\u5668\u7684\u6743\u9650\uff0c\u6216\u8005\u5bc6\u7801\u53ef\u80fd\u4e0d\u6b63\u786e\u3002 +filetransfer.client.bad.credentials.useraction=\u66f4\u6b63\u7528\u6237\u540d\u6216\u5bc6\u7801\uff0c\u7136\u540e\u83b7\u53d6\u4e00\u4e2a\u65b0\u8fde\u63a5\u3002 + +filetransfer.response.code.error=CWWKX7955E: \u5bf9\u4e8e\u8fde\u63a5 {2}\uff0c\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u63a5\u6536\u5230\u5e26\u6709\u6d88\u606f\u201c{1}\u201d\u7684\u54cd\u5e94\u4ee3\u7801 {0}\u3002 +filetransfer.response.code.error.explanation=\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u4ece\u670d\u52a1\u5668\u63a5\u6536\u5230\u610f\u5916\u54cd\u5e94\u4ee3\u7801\u3002 +filetransfer.response.code.error.useraction=\u8bf7\u4f7f\u7528\u5ba2\u6237\u673a\u54cd\u5e94\u4ee3\u7801\u6765\u6807\u8bc6\u6b64\u95ee\u9898\u5e76\u89e3\u51b3\u5bfc\u81f4\u6b64\u95ee\u9898\u7684\u539f\u56e0\uff0c\u7136\u540e\u91cd\u65b0\u8fd0\u884c\u8be5\u64cd\u4f5c\u3002 + +filetransfer.download.file=CWWKX7956I: \u4e0b\u8f7d\u6587\u4ef6 {0} \u7684\u8bf7\u6c42\u5df2\u6210\u529f\uff0c\u5df2\u4f7f\u7528\u8fde\u63a5 {2} \u5c06\u5176\u5185\u5bb9\u5199\u5165\u6587\u4ef6 {1}\u3002 +filetransfer.download.file.explanation=\u6307\u5b9a\u6587\u4ef6\u7684\u4e0b\u8f7d\u8bf7\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.download.file.useraction=\u8fd9\u662f\u4e00\u6761\u53c2\u8003\u6d88\u606f\uff0c\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 + +filetransfer.unsupported.operation=CWWKX7957E: \u5bf9\u4e8e\u8fde\u63a5 {1}\uff0c\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u4e0d\u652f\u6301\u64cd\u4f5c {0}\u3002 +filetransfer.unsupported.operation.explanation=\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u4e0d\u652f\u6301\u6307\u5b9a\u64cd\u4f5c\u3002 +filetransfer.unsupported.operation.useraction=\u8bf7\u8bf7\u6c42\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u652f\u6301\u7684\u64cd\u4f5c\u3002 + +filetransfer.upload.file=CWWKX7958I: \u4e0a\u8f7d\u6587\u4ef6 {0} \u7684\u8bf7\u6c42\u5df2\u6210\u529f\uff0c\u5df2\u4f7f\u7528\u8fde\u63a5 {2} \u5c06\u5176\u5185\u5bb9\u5199\u5165\u6587\u4ef6 {1}\u3002 +filetransfer.upload.file.explanation=\u6307\u5b9a\u6587\u4ef6\u7684\u4e0a\u8f7d\u8bf7\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.upload.file.useraction=\u8fd9\u662f\u4e00\u6761\u53c2\u8003\u6d88\u606f\uff0c\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 + +filetransfer.delete.file=CWWKX7959I: \u5df2\u6210\u529f\u4f7f\u7528\u8fde\u63a5 {1} \u6267\u884c\u5220\u9664\u6587\u4ef6 {0} \u7684\u8bf7\u6c42\u3002 +filetransfer.delete.file.explanation=\u6307\u5b9a\u6587\u4ef6\u7684\u5220\u9664\u8bf7\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.delete.file.useraction=\u8fd9\u662f\u4e00\u6761\u53c2\u8003\u6d88\u606f\uff0c\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 + +filetransfer.delete.all=CWWKX7960I: \u5df2\u6210\u529f\u4f7f\u7528\u8fde\u63a5 {1} \u6267\u884c\u5220\u9664\u96c6\u5408 {0} \u4e2d\u6240\u6709\u6587\u4ef6\u548c\u6587\u4ef6\u5939\u7684\u8bf7\u6c42\u3002 +filetransfer.delete.all.explanation=\u6307\u5b9a\u96c6\u5408\u7684\u5220\u9664\u8bf7\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.delete.all.useraction=\u8fd9\u662f\u4e00\u6761\u53c2\u8003\u6d88\u606f\uff0c\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh_TW.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh_TW.nlsprops new file mode 100755 index 000000000000..feb4fc13064d --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh_TW.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \u65b0\u7684\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u5df2\u5229\u7528\u9023\u7dda ID {0} \u9032\u884c\u9023\u7dda\u3002 +filetransfer.client.init.explanation=\u65b0\u7684\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u5df2\u5229\u7528\u6307\u5b9a\u7684\u9023\u7dda ID \u9032\u884c\u9023\u7dda\u3002 +filetransfer.client.init.useraction=\u9019\u662f\u4e00\u5247\u53c3\u8003\u8a0a\u606f\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u52d5\u4f5c\u3002 + +filetransfer.client.error=CWWKX7952E: {1} \u9023\u7dda\u51fa\u73fe\u7528\u6236\u7aef\u932f\u8aa4\u8a0a\u606f "{0}"\u3002 +filetransfer.client.error.explanation=JMX REST \u9023\u63a5\u5668\u7684\u7528\u6236\u7aef\u767c\u73fe\u932f\u8aa4\uff0c\u7522\u751f\u6307\u5b9a\u7684\u8a0a\u606f\u3002 +filetransfer.client.error.useraction=\u8acb\u5229\u7528\u7522\u751f\u7684\u932f\u8aa4\u8a0a\u606f\u4f86\u8b58\u5225\u53ca\u66f4\u6b63\u9020\u6210\u9019\u500b\u932f\u8aa4\u7684\u554f\u984c\uff0c\u7136\u5f8c\u91cd\u65b0\u57f7\u884c\u4f5c\u696d\u3002 + +filetransfer.server.error=CWWKX7953E: {1} \u9023\u7dda\u51fa\u73fe\u4f3a\u670d\u5668\u7aef\u932f\u8aa4\u8a0a\u606f "{0}"\u3002 +filetransfer.server.error.explanation=JMX REST \u9023\u63a5\u5668\u7684\u4f3a\u670d\u5668\u7aef\u767c\u73fe\u932f\u8aa4\uff0c\u7522\u751f\u6307\u5b9a\u7684\u8a0a\u606f\u3002 +filetransfer.server.error.useraction=\u8acb\u5229\u7528\u7522\u751f\u7684\u932f\u8aa4\u8a0a\u606f\u4f86\u8b58\u5225\u53ca\u66f4\u6b63\u9020\u6210\u9019\u500b\u932f\u8aa4\u7684\u554f\u984c\uff0c\u7136\u5f8c\u91cd\u65b0\u57f7\u884c\u4f5c\u696d\u3002 + +filetransfer.client.bad.credentials=CWWKX7954E: \u6307\u5b9a\u7684\u4f7f\u7528\u8005\u540d\u7a31\u6216\u5bc6\u78bc\u672a\u7372\u6388\u6b0a\u3002\u4f3a\u670d\u5668\u91dd\u5c0d {2} \u9023\u7dda\u7684\u56de\u61c9\u78bc\u662f {0}\uff0c\u8a0a\u606f\u662f {1}\u3002 +filetransfer.client.bad.credentials.explanation=\u5728\u53d6\u5f97\u9023\u7dda\u6642\u6240\u63d0\u4f9b\u7684\u8a8d\u8b49\u4e0d\u6b63\u78ba\u3002\u53ef\u80fd\u662f\u4f7f\u7528\u8005\u4e0d\u5b58\u5728\u3001\u4e0d\u5177\u5099\u5b58\u53d6\u4f3a\u670d\u5668\u7684\u6b0a\u9650\uff0c\u6216\u8005\u5bc6\u78bc\u4e0d\u6b63\u78ba\u3002 +filetransfer.client.bad.credentials.useraction=\u8acb\u66f4\u6b63\u4f7f\u7528\u8005\u540d\u7a31\u6216\u5bc6\u78bc\uff0c\u7136\u5f8c\u53d6\u5f97\u65b0\u9023\u7dda\u3002 + +filetransfer.response.code.error=CWWKX7955E: \u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u91dd\u5c0d {2} \u9023\u7dda\u6536\u5230\u542b\u6709 {1} \u8a0a\u606f\u7684\u56de\u61c9\u78bc {0}\u3002 +filetransfer.response.code.error.explanation=\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u5f9e\u4f3a\u670d\u5668\u63a5\u6536\u5230\u975e\u9810\u671f\u7684\u56de\u61c9\u78bc\u3002 +filetransfer.response.code.error.useraction=\u8acb\u5229\u7528\u7528\u6236\u7aef\u56de\u61c9\u7a0b\u5f0f\u78bc\u4f86\u8b58\u5225\u53ca\u89e3\u6c7a\u9019\u500b\u554f\u984c\u7684\u539f\u56e0\uff0c\u7136\u5f8c\u91cd\u65b0\u57f7\u884c\u4f5c\u696d\u3002 + +filetransfer.download.file=CWWKX7956I: \u4e0b\u8f09 {0} \u6a94\u7684\u8981\u6c42\u5df2\u9806\u5229\u5b8c\u6210\uff0c\u5df2\u5229\u7528 {2} \u9023\u7dda\u5c07\u5176\u5167\u5bb9\u5beb\u5165 {1} \u6a94\u4e2d\u3002 +filetransfer.download.file.explanation=\u4e0b\u8f09\u6307\u5b9a\u6a94\u6848\u7684\u8981\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.download.file.useraction=\u9019\u662f\u4e00\u5247\u53c3\u8003\u8a0a\u606f\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u52d5\u4f5c\u3002 + +filetransfer.unsupported.operation=CWWKX7957E: {1} \u9023\u7dda\u7684\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u4e0d\u652f\u63f4 {0} \u4f5c\u696d\u3002 +filetransfer.unsupported.operation.explanation=\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u4e0d\u652f\u63f4\u6307\u5b9a\u7684\u4f5c\u696d\u3002 +filetransfer.unsupported.operation.useraction=\u8acb\u8981\u6c42\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u652f\u63f4\u7684\u4f5c\u696d\u3002 + +filetransfer.upload.file=CWWKX7958I: \u4e0a\u50b3 {0} \u6a94\u7684\u8981\u6c42\u5df2\u9806\u5229\u5b8c\u6210\uff0c\u5df2\u5229\u7528 {2} \u9023\u7dda\u5c07\u5176\u5167\u5bb9\u5beb\u5165 {1} \u6a94\u4e2d\u3002 +filetransfer.upload.file.explanation=\u4e0a\u50b3\u6307\u5b9a\u6a94\u6848\u7684\u8981\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.upload.file.useraction=\u9019\u662f\u4e00\u5247\u53c3\u8003\u8a0a\u606f\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u52d5\u4f5c\u3002 + +filetransfer.delete.file=CWWKX7959I: \u5df2\u5229\u7528 {1} \u9023\u7dda\u9806\u5229\u5b8c\u6210\u522a\u9664 {0} \u6a94\u7684\u8981\u6c42\u3002 +filetransfer.delete.file.explanation=\u522a\u9664\u6307\u5b9a\u6a94\u6848\u7684\u8981\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.delete.file.useraction=\u9019\u662f\u4e00\u5247\u53c3\u8003\u8a0a\u606f\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u52d5\u4f5c\u3002 + +filetransfer.delete.all=CWWKX7960I: \u5f9e\u96c6\u5408 {0} \u522a\u9664\u6240\u6709\u6a94\u6848\u548c\u8cc7\u6599\u593e\u7684\u8981\u6c42\u5df2\u4f7f\u7528 {1} \u9023\u7dda\u9806\u5229\u5b8c\u6210\u3002 +filetransfer.delete.all.explanation=\u522a\u9664\u6307\u5b9a\u96c6\u5408\u7684\u8981\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.delete.all.useraction=\u9019\u662f\u4e00\u5247\u53c3\u8003\u8a0a\u606f\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u52d5\u4f5c\u3002 diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops new file mode 100755 index 000000000000..88b290eb885a --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: The WebSphere Java Management Extensions REST client encountered an error while preparing the request to the server for URL {0} on connection {1} +jmx.rest.client.request.error.explanation=The WebSphere Java Management Extensions REST client encountered an error while preparing a request for the server +jmx.rest.client.request.error.useraction=Examine the server logs for further information. + +jmx.rest.client.response.error=CWWKX0202E: The WebSphere Java Management Extensions REST client was unable to process the response from the server for URL {0} on connection {1} +jmx.rest.client.response.error.explanation=The WebSphere Java Management Extensions REST client was unable to process a response from the server +jmx.rest.client.response.error.useraction=Examine the server logs for further information. + +jmx.rest.client.response.code.error=CWWKX0203E: The WebSphere Java Management Extensions REST client received an unexpected response code {0} with message ''{1}'' from the server for URL {2} on connection {3} +jmx.rest.client.response.code.error.explanation=The WebSphere Java Management Extensions REST client received an unexpected response code from the server +jmx.rest.client.response.code.error.useraction=Examine the server logs for further information. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Unable to parse Throwable from server error stream. +jmx.rest.client.server.throwable.exception.explanation=The server raised an exception handling the client request, but the client could not parse a Throwable object from the server error stream. The class of the Throwable object may not be available to the client. +jmx.rest.client.server.throwable.exception.useraction=Examine the server logs for further information. + +jmx.rest.client.not.connected=CWWKX0206E: The client is not connected to the server. +jmx.rest.client.not.connected.explanation=The connection to the server or was closed or has failed. +jmx.rest.client.not.connected.useraction=Check that the REST connector feature is enabled on the server and obtain a new connection to the server. + +jmx.rest.client.url.not.found=CWWKX0207E: The server reported that the URL requested by the client was not found. +jmx.rest.client.url.not.found.explanation=The client may have out-of-date information or the REST connector feature on the server may have been disabled. +jmx.rest.client.url.not.found.useraction=Check that the REST connector feature is enabled on the server and obtain a new connection to the server. + +jmx.rest.client.class.name.null=CWWKX0208E: The class name argument was null. +jmx.rest.client.class.name.null.explanation=The class name argument must not be null. +jmx.rest.client.class.name.null.useraction=Provide a non-null class name when calling the method. + +jmx.rest.client.attribute.name.null=CWWKX0209E: The attribute name argument was null. +jmx.rest.client.attribute.name.null.explanation=The attribute name argument must not be null. +jmx.rest.client.attribute.name.null.useraction=Provide a non-null attribute name when calling the method. + +jmx.rest.client.attribute.names.null=CWWKX0210E: The argument containing an array of attribute names was null. +jmx.rest.client.attribute.names.null.explanation=The argument containing an array of attribute names must not be null. +jmx.rest.client.attribute.names.null.useraction=Provide a non-null array of attribute names when calling the method. + +jmx.rest.client.attribute.null=CWWKX0211E: The Attribute argument was null. +jmx.rest.client.attribute.null.explanation=The Attribute argument must not be null. +jmx.rest.client.attribute.null.useraction=Provide a non-null Attribute when calling the method. + +jmx.rest.client.attribute.list.null=CWWKX0212E: The AttributeList argument was null. +jmx.rest.client.attribute.list.null.explanation=The AttributeList argument must not be null. +jmx.rest.client.attribute.list.null.useraction=Provide a non-null AttributeList when calling the method. + +jmx.rest.client.object.name.null=CWWKX0213E: The ObjectName argument was null. +jmx.rest.client.object.name.null.explanation=The ObjectName argument must not be null. +jmx.rest.client.object.name.null.useraction=Provide a non-null ObjectName when calling the method. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: An unexpected Throwable object was returned from the server. +jmx.rest.client.unexpected.server.throwable.explanation=The exception wraps a Throwable object returned from the server that is not normally expected for this operation. +jmx.rest.client.unexpected.server.throwable.useraction=Examine the server logs for further information. + +jmx.rest.client.bad.credentials=CWWKX0215E: There was a problem with the user name or password provided. The server responded with code {0} and message ''{1}'' +jmx.rest.client.bad.credentials.explanation=The credentials provided when obtaining the connection were incorrect. The user may not exist or may not have authority to access the server, or the password may be incorrect. +jmx.rest.client.bad.credentials.useraction=Correct the user name or password, then obtain a new connection. + +jmx.rest.client.object.name.pattern=CWWKX0216E: The ObjectName argument ''{0}'' is a pattern." +jmx.rest.client.object.name.pattern.explanation=The ObjectName argument is a pattern but the method requires an ObjectName matching exactly one MBean. +jmx.rest.client.object.name.pattern.useraction=Provide an ObjectName argument without wildcards that will match exactly one MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: No MBean is currently registered with the given ObjectName ''{0}'' +jmx.rest.client.instance.not.found.explanation=The operation requires a registered MBean, but no MBean with the given ObjectName was registered. +jmx.rest.client.instance.not.found.useraction=Ensure the MBean is registered before attempting to perform management operations on it. + +jmx.rest.client.attribute.not.found=CWWKX0218E: The MBean ''{0}'' does not have an attribute by the name ''{1}'' +jmx.rest.client.attribute.not.found.explanation=The MBean does not provide an attribute of the given name. +jmx.rest.client.attribute.not.found.useraction=Obtain the MBean information to confirm which attributes the MBean provides. + +jmx.rest.client.operation.not.found=CWWKX0219E: The MBean ''{0}'' does not have an operation by the name ''{1}'' +jmx.rest.client.operation.not.found.explanation=The MBean does not provide an operation of the given name. +jmx.rest.client.operation.not.found.useraction=Obtain the MBean information to confirm which operations the MBean provides. + +jmx.rest.client.listener.not.found=CWWKX0220E: The given NotificationListener is not currently registered to receive notifications from MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=The NotificationListener was not added or has already been removed and is not currently registered to receive notifications from the given MBean. +jmx.rest.client.listener.not.found.useraction=Make sure the calling code tracks which NotificationListeners have been added and removed or catch and handle the exception. + +jmx.rest.client.notification.lost=CWWKX0221I: The notification could not be delivered. +jmx.rest.client.notification.lost.explanation=A notification could not be delivered to one or more NotificationListeners because a registered NotificationListener was not found or there was an exception during delivery of the notification. +jmx.rest.client.notification.lost.useraction=If the notification should have been delivered to a registered NotificationListener, check the logs for exceptions. + +jmx.rest.client.connection.failed=CWWKX0222I: The connection to the server has failed. +jmx.rest.client.connection.failed.explanation=The server became unavailable and did not become available again within the configured maximum time allowable. +jmx.rest.client.connection.failed.useraction=Check the network connection and ensure that the server is running with the REST connector feature enabled. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: The connection to the server has been temporarily lost. +jmx.rest.client.connection.temporarily.lost.explanation=The server has become unavailable, but the client will attempt to restore the connection for the duration of the configured maximum time allowable. +jmx.rest.client.connection.temporarily.lost.useraction=If the server is intentionally restarting, no action is required. Otherwise, check the network connection and ensure that the server is running with the REST connector feature enabled. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: The connection was restored but exceptions were encountered when adding NotificationListeners. +jmx.rest.client.connection.restored.with.exceptions.explanation=The connection to the server was temporarily lost but has been restored successfully. Exceptions were encountered while adding NotificationListeners, so some notifications may not be received. +jmx.rest.client.connection.restored.with.exceptions.useraction=Check the exceptions included with the notification and re-register NotificationListeners after correcting the problems. + +jmx.rest.client.connection.restored=CWWKX0225I: The connection was restored successfully. +jmx.rest.client.connection.restored.explanation=The connection to the server was temporarily lost but has been restored successfully. Any registered NotificationListeners will continue to receive notifications. +jmx.rest.client.connection.restored.useraction=None + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: The parameter of type JMXServiceURL cannot be null. +jmx.rest.client.connection.illegal.argument.explanation=The value for the parameter 'serviceURL' cannot be null. +jmx.rest.client.connection.illegal.argument.useraction=Re-connect to the JMX REST Connector using a non-null JMXServiceURL value. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: The following is not a valid endpoint value: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=The specified endpoint value is not valid. +jmx.rest.client.connection.invalid.endpoint.useraction=Re-connect to the JMX REST Connector using a valid endpoint value that is of type String and has the format "host:port". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Could not find any available endpoints to initialize the connector. +jmx.rest.client.connection.no.endpoints.explanation=None of the specified endpoints were available during the JMX REST Connector's initialization. +jmx.rest.client.connection.no.endpoints.useraction=Re-connect to the JMX REST Connector using at least 1 available endpoint. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: There was a problem with the user credentials provided. The server responded with code {0} and message ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=The credentials provided are incorrect, expired, incomplete, or denied authorization. +jmx.rest.client.bad.user.credentials.useraction=Verify that the user credentials have correct authentication and authorization, then obtain a new connection. + +jmx.rest.client.connection.connect=CWWKX0230I: The collective member opened JMX client to the collective controller: {0} +jmx.rest.client.connection.connect.explanation=The member connected to the controller. +jmx.rest.client.connection.connect.useraction=No action required. + +jmx.rest.client.connection.disconnect=CWWKX0231I: The collective member closed JMX client from the collective controller: {0} +jmx.rest.client.connection.disconnect.explanation=The member disconnected from the controller. +jmx.rest.client.connection.disconnect.useraction=No action required. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_cs.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_cs.nlsprops new file mode 100755 index 000000000000..53a93c9de66d --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_cs.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Klient REST WebSphere Java Management Extensions zjistil chybu p\u0159i p\u0159\u00edprav\u011b po\u017eadavku na server pro adresu URL {0} na p\u0159ipojen\u00ed {1} +jmx.rest.client.request.error.explanation=Klient REST WebSphere Java Management Extensions zjistil chybu p\u0159i p\u0159\u00edprav\u011b po\u017eadavku na server +jmx.rest.client.request.error.useraction=Zkontrolujte protokoly serveru, zda neobsahuj\u00ed dal\u0161\u00ed informace. + +jmx.rest.client.response.error=CWWKX0202E: Klientovi REST WebSphere Java Management Extensions se nezda\u0159ilo zpracovat odezvu ze serveru pro adresu URL {0} na p\u0159ipojen\u00ed {1} +jmx.rest.client.response.error.explanation=Klientovi REST WebSphere Java Management Extensions se nezda\u0159ilo zpracovat odezvu ze serveru +jmx.rest.client.response.error.useraction=Zkontrolujte protokoly serveru, zda neobsahuj\u00ed dal\u0161\u00ed informace. + +jmx.rest.client.response.code.error=CWWKX0203E: Klient REST WebSphere Java Management Extensions p\u0159ijal od serveru pro adresu URL {2} na p\u0159ipojen\u00ed {3} neo\u010dek\u00e1van\u00fd k\u00f3d odezvy {0} se zpr\u00e1vou ''{1}'' +jmx.rest.client.response.code.error.explanation=Klient REST WebSphere Java Management Extensions p\u0159ijal od serveru neo\u010dek\u00e1van\u00fd k\u00f3d odezvy +jmx.rest.client.response.code.error.useraction=Zkontrolujte protokoly serveru, zda neobsahuj\u00ed dal\u0161\u00ed informace. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Nelze analyzovat objekt Throwable z proudu chyb serveru. +jmx.rest.client.server.throwable.exception.explanation=Server vr\u00e1til v\u00fdjimku p\u0159i zpracov\u00e1n\u00ed \u017e\u00e1dosti klienta, ale klient nedok\u00e1zat analyzovat objekt Throwable z proudu chyb serveru. Mo\u017en\u00e1 nen\u00ed t\u0159\u00edda objekt\u016f Throwable pro klienta dostupn\u00e1. +jmx.rest.client.server.throwable.exception.useraction=Zkontrolujte protokoly serveru, zda neobsahuj\u00ed dal\u0161\u00ed informace. + +jmx.rest.client.not.connected=CWWKX0206E: Klient nen\u00ed p\u0159ipojen k serveru. +jmx.rest.client.not.connected.explanation=P\u0159ipojen\u00ed k serveru bylo uzav\u0159eno nebo se nezda\u0159ilo. +jmx.rest.client.not.connected.useraction=Zkontrolujte, zda je na serveru povolena funkce konektoru REST, a z\u00edskejte nov\u00e9 p\u0159ipojen\u00ed k serveru. + +jmx.rest.client.url.not.found=CWWKX0207E: Server ohl\u00e1sil, \u017ee adresa URL, kterou klient po\u017eaduje, nebyla nalezena. +jmx.rest.client.url.not.found.explanation=Mo\u017en\u00e1 m\u00e1 klient zastaral\u00e9 informace nebo m\u016f\u017ee b\u00fdt na serveru zak\u00e1z\u00e1na funkce konektoru REST. +jmx.rest.client.url.not.found.useraction=Zkontrolujte, zda je na serveru povolena funkce konektoru REST, a z\u00edskejte nov\u00e9 p\u0159ipojen\u00ed k serveru. + +jmx.rest.client.class.name.null=CWWKX0208E: Argument n\u00e1zev t\u0159\u00eddy m\u011bl hodnotu null. +jmx.rest.client.class.name.null.explanation=Argument n\u00e1zev t\u0159\u00eddy nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.class.name.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte n\u00e1zev t\u0159\u00eddy s jinou hodnotou ne\u017e null. + +jmx.rest.client.attribute.name.null=CWWKX0209E: Argument n\u00e1zev atributu m\u011bl hodnotu null. +jmx.rest.client.attribute.name.null.explanation=Argument n\u00e1zev atributu nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.attribute.name.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte n\u00e1zev atributu s jinou hodnotou ne\u017e null. + +jmx.rest.client.attribute.names.null=CWWKX0210E: Argument obsahuj\u00edc\u00ed pole s n\u00e1zvy atribut\u016f m\u011bl hodnotu null. +jmx.rest.client.attribute.names.null.explanation=Argument obsahuj\u00edc\u00ed pole s n\u00e1zvy atribut\u016f nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.attribute.names.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte pole s n\u00e1zvy atribut\u016f s jinou hodnotou ne\u017e null. + +jmx.rest.client.attribute.null=CWWKX0211E: Argument Attribute m\u011bl hodnotu null. +jmx.rest.client.attribute.null.explanation=Argument Attribute nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.attribute.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte argument Attribute s jinou hodnotou ne\u017e null. + +jmx.rest.client.attribute.list.null=CWWKX0212E: Argument AttributeList m\u011bl hodnotu null. +jmx.rest.client.attribute.list.null.explanation=Argument AttributeList nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.attribute.list.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte argument AttributeList s jinou hodnotou ne\u017e null. + +jmx.rest.client.object.name.null=CWWKX0213E: Argument ObjectName m\u011bl hodnotu null. +jmx.rest.client.object.name.null.explanation=Argument ObjectName nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.object.name.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte argument ObjectName s jinou hodnotou ne\u017e null. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Ze serveru se vr\u00e1til neo\u010dek\u00e1van\u00fd objekt Throwable. +jmx.rest.client.unexpected.server.throwable.explanation=Ve v\u00fdjimce je zabalen objekt Throwable vr\u00e1cen\u00fd ze serveru, kter\u00fd u t\u00e9to operace obvykle nen\u00ed o\u010dek\u00e1v\u00e1n. +jmx.rest.client.unexpected.server.throwable.useraction=Zkontrolujte protokoly serveru, zda neobsahuj\u00ed dal\u0161\u00ed informace. + +jmx.rest.client.bad.credentials=CWWKX0215E: Do\u0161lo k probl\u00e9mu se zadan\u00fdm jm\u00e9nem u\u017eivatele nebo heslem. Server odpov\u011bd\u011bl k\u00f3dem {0} a zpr\u00e1vou ''{1}''. +jmx.rest.client.bad.credentials.explanation=Pov\u011b\u0159en\u00ed uveden\u00e1 p\u0159i z\u00edsk\u00e1v\u00e1n\u00ed p\u0159ipojen\u00ed byla chybn\u00e1. Mo\u017en\u00e1 u\u017eivatel neexistuje, nem\u00e1 opr\u00e1vn\u011bn\u00ed pro p\u0159\u00edstup k serveru nebo je \u0161patn\u00e9 heslo. +jmx.rest.client.bad.credentials.useraction=Opravte jm\u00e9no u\u017eivatele nebo heslo a pot\u00e9 z\u00edskejte nov\u00e9 p\u0159ipojen\u00ed. + +jmx.rest.client.object.name.pattern=CWWKX0216E: Argument ObjectName ''{0}'' je vzor." +jmx.rest.client.object.name.pattern.explanation=Argument ObjectName je vzor, ale tato metoda vy\u017eaduje ObjectName odpov\u00eddaj\u00edc\u00ed pr\u00e1v\u011b jednomu objektu typu MBean. +jmx.rest.client.object.name.pattern.useraction=Zadejte argument ObjectName bez z\u00e1stupn\u00fdch znak\u016f, kter\u00fd odpov\u00edd\u00e1 pr\u00e1v\u011b jednomu objektu typu MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Aktu\u00e1ln\u011b nen\u00ed registrovan\u00fd \u017e\u00e1dn\u00fd objekt typu MBean s dan\u00fdm atributem ObjectName ''{0}''. +jmx.rest.client.instance.not.found.explanation=Operace vy\u017eaduje registrovan\u00fd objekt typu MBean, ale \u017e\u00e1dn\u00fd objekt typu MBean s uveden\u00fdm atributem ObjectName nebyl zaregistrov\u00e1n. +jmx.rest.client.instance.not.found.useraction=Ne\u017e se pokus\u00edte prov\u00e1d\u011bt na objektu typu MBean operace spr\u00e1vy, zajist\u011bte, aby byl zaregistrovan\u00fd. + +jmx.rest.client.attribute.not.found=CWWKX0218E: Objekt typu MBean ''{0}'' nem\u00e1 atribut s n\u00e1zvem ''{1}''. +jmx.rest.client.attribute.not.found.explanation=Objekt typu MBean nem\u00e1 atribut s dan\u00fdm n\u00e1zvem. +jmx.rest.client.attribute.not.found.useraction=Z\u00edskejte informace o objektu typu MBean a ov\u011b\u0159te, jak\u00e9 atributy tento objekt typu MBean m\u00e1. + +jmx.rest.client.operation.not.found=CWWKX0219E: Objekt typu MBean ''{0}'' nem\u00e1 operaci s n\u00e1zvem ''{1}''. +jmx.rest.client.operation.not.found.explanation=Objekt typu MBean nem\u00e1 operaci s dan\u00fdm n\u00e1zvem. +jmx.rest.client.operation.not.found.useraction=Z\u00edskejte informace o objektu typu MBean a ov\u011b\u0159te, jak\u00e9 operace tento objekt typu MBean m\u00e1. + +jmx.rest.client.listener.not.found=CWWKX0220E: Dan\u00fd modul NotificationListener nen\u00ed v sou\u010dasn\u00e9 dob\u011b registrovan\u00fd pro p\u0159\u00edjem ozn\u00e1men\u00ed z objektu typu MBean ''{0}''. +jmx.rest.client.listener.not.found.explanation=Modul NotificationListener nebyl p\u0159id\u00e1n nebo ji\u017e byl odebr\u00e1n a v sou\u010dasnosti nen\u00ed registrov\u00e1n pro p\u0159\u00edjem ozn\u00e1men\u00ed z dan\u00e9ho objektu typu MBean. +jmx.rest.client.listener.not.found.useraction=Ujist\u011bte se, \u017ee k\u00f3d vol\u00e1n\u00ed sleduje, kter\u00e9 moduly NotificationListener byly p\u0159id\u00e1ny a odebr\u00e1ny, nebo tuto v\u00fdjimku zachy\u0165te a o\u0161et\u0159ete. + +jmx.rest.client.notification.lost=CWWKX0221I: Ozn\u00e1men\u00ed nebylo mo\u017en\u00e9 doru\u010dit. +jmx.rest.client.notification.lost.explanation=Nebylo mo\u017en\u00e9 doru\u010dit ozn\u00e1men\u00ed nejm\u00e9n\u011b jednomu modulu NotificationListener, proto\u017ee nebyl nalezen registrovan\u00fd modul NotificationListener nebo p\u0159i doru\u010dov\u00e1n\u00ed ozn\u00e1men\u00ed do\u0161lo k v\u00fdjimce. +jmx.rest.client.notification.lost.useraction=Pokud m\u011blo b\u00fdt ozn\u00e1men\u00ed doru\u010deno registrovan\u00e9mu modulu NotificationListener, zkontrolujte, zda protokoly neobsahuj\u00ed v\u00fdjimky. + +jmx.rest.client.connection.failed=CWWKX0222I: P\u0159ipojen\u00ed k serveru se nezda\u0159ilo. +jmx.rest.client.connection.failed.explanation=Server se stal nedostupn\u00fdm a v nakonfigurovan\u00e9m maxim\u00e1ln\u00edm povolen\u00e9m \u010dase nebyl znovu dostupn\u00fd. +jmx.rest.client.connection.failed.useraction=Zkontrolujte s\u00ed\u0165ov\u00e9 p\u0159ipojen\u00ed a ujist\u011bte se, \u017ee je server spu\u0161t\u011bn a je povolena funkce konektoru REST. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: P\u0159ipojen\u00ed k serveru bylo do\u010dasn\u011b ztraceno. +jmx.rest.client.connection.temporarily.lost.explanation=Server se stal nedostupn\u00fdm, ale klient se bude pokou\u0161et obnovit p\u0159ipojen\u00ed po dobu nakonfigurovan\u00e9ho maxim\u00e1ln\u00edho povolen\u00e9ho \u010dasu. +jmx.rest.client.connection.temporarily.lost.useraction=Pokud je server \u00famysln\u011b restartov\u00e1n, nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. Jinak zkontrolujte s\u00ed\u0165ov\u00e9 p\u0159ipojen\u00ed a ujist\u011bte se, \u017ee je server spu\u0161t\u011bn a je povolena funkce konektoru REST. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: P\u0159ipojen\u00ed bylo obnoveno, ale p\u0159i p\u0159id\u00e1v\u00e1n\u00ed modul\u016f NotificationListener se vyskytly v\u00fdjimky. +jmx.rest.client.connection.restored.with.exceptions.explanation=P\u0159ipojen\u00ed k serveru bylo do\u010dasn\u011b ztraceno, ale bylo \u00fasp\u011b\u0161n\u011b obnoveno. P\u0159i p\u0159id\u00e1v\u00e1n\u00ed modul\u016f NotificationListener se vyskytly v\u00fdjimky, tak\u017ee mo\u017en\u00e1 nebudou p\u0159ijata n\u011bkter\u00e1 ozn\u00e1men\u00ed. +jmx.rest.client.connection.restored.with.exceptions.useraction=Zkontrolujte v\u00fdjimky uveden\u00e9 u ozn\u00e1men\u00ed a po opraven\u00ed probl\u00e9m\u016f znovu zaregistrujte moduly NotificationListener. + +jmx.rest.client.connection.restored=CWWKX0225I: P\u0159ipojen\u00ed bylo \u00fasp\u011b\u0161n\u011b obnoveno. +jmx.rest.client.connection.restored.explanation=P\u0159ipojen\u00ed k serveru bylo do\u010dasn\u011b ztraceno, ale bylo \u00fasp\u011b\u0161n\u011b obnoveno. V\u0161echny zaregistrovan\u00e9 moduly NotificationListener budou i nad\u00e1le p\u0159ij\u00edmat ozn\u00e1men\u00ed. +jmx.rest.client.connection.restored.useraction=Nen\u00ed + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Parametr typu JMXServiceURL nem\u016f\u017ee b\u00fdt null. +jmx.rest.client.connection.illegal.argument.explanation=Hodnota parametru 'serviceURL' nem\u016f\u017ee b\u00fdt null. +jmx.rest.client.connection.illegal.argument.useraction=Znovu se p\u0159ipojte ke konektoru JMX REST Connector pomoc\u00ed nenulov\u00e9 hodnoty JMXServiceURL. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: D\u00e1le uveden\u00e9 nen\u00ed platnou hodnotou koncov\u00e9ho bodu: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=Ur\u010den\u00e1 hodnota koncov\u00e9ho bodu nen\u00ed platn\u00e1. +jmx.rest.client.connection.invalid.endpoint.useraction=Znovu se p\u0159ipojte ke konektoru JMX REST Connector pomoc\u00ed platn\u00e9 hodnoty koncov\u00e9ho bodu, kter\u00e1 je typem String a je ve form\u00e1tu "host:port". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Nelze naj\u00edt \u017e\u00e1dn\u00e9 dostupn\u00e9 koncov\u00e9 body pro inicializaci konektoru. +jmx.rest.client.connection.no.endpoints.explanation=\u017d\u00e1dn\u00fd z uveden\u00fdch koncov\u00fdch bod\u016f nebyl k dispozici b\u011bhem inicializace konektoru JMX REST Connector. +jmx.rest.client.connection.no.endpoints.useraction=Znovu se p\u0159ipojte ke konektoru JMX REST Connector pomoc\u00ed alespo\u0148 1 dostupn\u00e9ho koncov\u00e9ho bodu. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Do\u0161lo k probl\u00e9mu se zadan\u00fdmi u\u017eivatelsk\u00fdmi pov\u011b\u0159en\u00edmi. Server odpov\u011bd\u011bl k\u00f3dem {0} a zpr\u00e1vou ''{1}''. +jmx.rest.client.bad.user.credentials.explanation=Zadan\u00e1 pov\u011b\u0159en\u00ed jsou chybn\u00e1, vypr\u0161ela platnost, ne\u00fapln\u00e1 nebo byl odep\u0159ena autorizace. +jmx.rest.client.bad.user.credentials.useraction=Ov\u011b\u0159te, \u017ee u\u017eivatelsk\u00e1 pov\u011b\u0159en\u00ed maj\u00ed spr\u00e1vn\u00e9 ov\u011b\u0159en\u00ed a autorizaci, potom z\u00edskejte nov\u00e9 p\u0159ipojen\u00ed. + +jmx.rest.client.connection.connect=CWWKX0230I: \u010clen kolektivu otev\u0159el klienta JMX ke kolektivn\u00edmu \u0159adi\u010di: {0} +jmx.rest.client.connection.connect.explanation=\u010clen p\u0159ipojen\u00fd k \u0159adi\u010di. +jmx.rest.client.connection.connect.useraction=Nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + +jmx.rest.client.connection.disconnect=CWWKX0231I: \u010clen kolektivu zav\u0159el klienta JMX z kolektivn\u00edho \u0159adi\u010de: {0} +jmx.rest.client.connection.disconnect.explanation=\u010clen odpojen\u00fd od \u0159adi\u010de. +jmx.rest.client.connection.disconnect.useraction=Nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_de.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_de.nlsprops new file mode 100755 index 000000000000..39cfc72695dc --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_de.nlsprops @@ -0,0 +1,145 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Im REST-Client von WebSphere Java Management Extensions ist beim Vorbereiten der Anforderung an den Server f\u00fcr den URL {0} in der Verbindung {1} ein Fehler aufgetreten. +jmx.rest.client.request.error.explanation=Im REST-Client von WebSphere Java Management Extensions ist beim Vorbereiten einer Anforderung f\u00fcr den Server ein Fehler aufgetreten. +jmx.rest.client.request.error.useraction=Suchen Sie in den Serverprotokollen nach weiteren Informationen. + +jmx.rest.client.response.error=CWWKX0202E: Der REST-Client von WebSphere Java Management Extensions konnte die Antwort des Servers f\u00fcr den URL {0} in der Verbindung {1} nicht verarbeiten. +jmx.rest.client.response.error.explanation=Der REST-Client von WebSphere Java Management Extensions konnte eine Antwort des Servers nicht verarbeiten. +jmx.rest.client.response.error.useraction=Suchen Sie in den Serverprotokollen nach weiteren Informationen. + +jmx.rest.client.response.code.error=CWWKX0203E: Der REST-Client von WebSphere Java Management Extensions hat den unerwarteten Antwortcode {0} mit der Nachricht ''{1}'' vom Server f\u00fcr den URL {2} in der Verbindung {3} empfangen. +jmx.rest.client.response.code.error.explanation=Der REST-Client von WebSphere Java Management Extensions hat einen unerwarteten Antwortcode vom Server empfangen. +jmx.rest.client.response.code.error.useraction=Suchen Sie in den Serverprotokollen nach weiteren Informationen. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Throwable aus Fehlerdatenstrom des Servers kann nicht geparst werden. +jmx.rest.client.server.throwable.exception.explanation=Der Server hat bei der Verarbeitung der Clientanforderung eine Ausnahme ausgel\u00f6st, aber der Client konnte ein Throwable-Objekt aus dem Fehlerdatenstrom des Servers nicht parsen. Die Klasse des Throwable-Objekts steht dem Client m\u00f6glicherweise nicht zur Verf\u00fcgung. +jmx.rest.client.server.throwable.exception.useraction=Suchen Sie in den Serverprotokollen nach weiteren Informationen. + +jmx.rest.client.not.connected=CWWKX0206E: Der Client ist nicht mit dem Server verbunden. +jmx.rest.client.not.connected.explanation=Die Verbindung zum Server wurde geschlossen oder ist fehlgeschlagen. +jmx.rest.client.not.connected.useraction=Vergewissern Sie sich, dass das REST-Connector-Feature im Server aktiviert ist, und fordern Sie eine neue Verbindung zum Server an. + +jmx.rest.client.url.not.found=CWWKX0207E: Der Server hat gemeldet, dass der vom Client angeforderte URL nicht gefunden wurde. +jmx.rest.client.url.not.found.explanation=Der Client hat m\u00f6glicherweise Informationen, die nicht auf dem neuesten Stand sind, oder das REST-Connector-Feature im Server wurde aktiviert. +jmx.rest.client.url.not.found.useraction=Vergewissern Sie sich, dass das REST-Connector-Feature im Server aktiviert ist, und fordern Sie eine neue Verbindung zum Server an. +jmx.rest.client.class.name.null=CWWKX0208E: Das Argument f\u00fcr den Klassennamen ist null. +jmx.rest.client.class.name.null.explanation=Das Argument f\u00fcr den Klassennamen darf nicht null sein. +jmx.rest.client.class.name.null.useraction=Geben Sie einen Klassennamen ungleich null beim Aufruf der Methode an. + +jmx.rest.client.attribute.name.null=CWWKX0209E: Das Argument f\u00fcr den Attributnamen ist null. +jmx.rest.client.attribute.name.null.explanation=Das Argument f\u00fcr den Attributnamen darf nicht null sein. +jmx.rest.client.attribute.name.null.useraction=Geben Sie einen Attributnamen ungleich null beim Aufruf der Methode an. + +jmx.rest.client.attribute.names.null=CWWKX0210E: Das Argument, das ein Array von Attributnamen enth\u00e4lt, ist null. +jmx.rest.client.attribute.names.null.explanation=Das Argument, das ein Array von Attributnamen enth\u00e4lt, darf nicht null sein. +jmx.rest.client.attribute.names.null.useraction=Geben Sie ein Array mit Attributnamen ungleich null beim Aufruf der Methode an. + +jmx.rest.client.attribute.null=CWWKX0211E: Das Argument Attribute ist null. +jmx.rest.client.attribute.null.explanation=Das Argument Attribute darf nicht null sein. +jmx.rest.client.attribute.null.useraction=Geben Sie ein Argument Attribute ungleich null beim Aufruf der Methode an. + +jmx.rest.client.attribute.list.null=CWWKX0212E: Das Argument AttributeList ist null. +jmx.rest.client.attribute.list.null.explanation=Das Argument AttributeList darf nicht null sein. +jmx.rest.client.attribute.list.null.useraction=Geben Sie ein Argument AttributeList ungleich null beim Aufruf der Methode an. + +jmx.rest.client.object.name.null=CWWKX0213E: Das Argument ObjectName ist null. +jmx.rest.client.object.name.null.explanation=Das Argument ObjectName darf nicht null sein. +jmx.rest.client.object.name.null.useraction=Geben Sie ein Argument ObjectName ungleich null beim Aufruf der Methode an. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Es wurde ein nicht erwartetes Throwable-Objekt vom Server zur\u00fcckgegeben. +jmx.rest.client.unexpected.server.throwable.explanation=Die Ausnahme schlie\u00dft ein vom Server zur\u00fcckgegebenes Throwable-Objekt ein, das f\u00fcr diese Operation normalerweise nicht erwartet wird. +jmx.rest.client.unexpected.server.throwable.useraction=Suchen Sie in den Serverprotokollen nach weiteren Informationen. + +jmx.rest.client.bad.credentials=CWWKX0215E: Es liegt ein Problem mit dem angegebenen Benutzernamen oder Kennwort vor. Der Server hat mit dem Code {0} und der Nachricht ''{1}'' geantwortet. +jmx.rest.client.bad.credentials.explanation=Die beim Anfordern der Verbindung angegebenen Berechtigungsnachweise sind nicht g\u00fcltig. M\u00f6glicherweise ist der Benutzer nicht vorhanden, oder er hat keine Berechtigung f\u00fcr den Zugriff auf den Server, oder das Kennwort ist ung\u00fcltig. +jmx.rest.client.bad.credentials.useraction=Korrigieren Sie den Benutzernamen bzw. das Kennwort, und fordern Sie dann eine neue Verbindung an. + +jmx.rest.client.object.name.pattern=CWWKX0216E: Das ObjectName-Argument ''{0}'' ist ein Muster. +jmx.rest.client.object.name.pattern.explanation=Das ObjectName-Argument ist ein Muster, aber die Methode erfordert ein ObjectName-Argument, das einer einzigen MBean entspricht. +jmx.rest.client.object.name.pattern.useraction=Geben Sie ein ObjectName-Argument ohne Platzhalterzeichen ein, das einer einzigen MBean entspricht. + +jmx.rest.client.instance.not.found=CWWKX0217E: Es ist momentan keine MBean mit dem angegebenen ObjectName ''{0}'' registriert. +jmx.rest.client.instance.not.found.explanation=Die Operation erfordert eine registrierte MBean, aber es wurde keine MBean mit dem angegebenen ObjectName registriert. +jmx.rest.client.instance.not.found.useraction=Stellen Sie sicher, dass die MBean registriert ist, bevor Sie versuchen, Verwaltungsoperationen f\u00fcr die MBean auszuf\u00fchren. + +jmx.rest.client.attribute.not.found=CWWKX0218E: Die MBean ''{0}'' hat kein Attribut mit dem Namen ''{1}''. +jmx.rest.client.attribute.not.found.explanation=Die MBean hat kein Attribut mit dem angegebenen Namen. +jmx.rest.client.attribute.not.found.useraction=Fordern Sie die MBean-Informationen an, um festzustellen, welche Attribute die MBean enth\u00e4lt. + +jmx.rest.client.operation.not.found=CWWKX0219E: Die MBean ''{0}'' hat keine Operation mit dem Namen ''{1}''. +jmx.rest.client.operation.not.found.explanation=Die MBean hat keine Operation mit dem angegebenen Namen. +jmx.rest.client.operation.not.found.useraction=Fordern Sie die MBean-Informationen an, um festzustellen, welche Operationen die MBean enth\u00e4lt. + +jmx.rest.client.listener.not.found=CWWKX0220E: Der angegebene NotificationListener ist momentan nicht f\u00fcr den Empfang von Benachrichtigungen von der MBean ''{0}'' registriert. +jmx.rest.client.listener.not.found.explanation=Der NotificationListener wurde nicht hinzugef\u00fcgt oder bereits entfernt und ist momentan nicht f\u00fcr den Empfang von Benachrichtigungen von der angegebenen MBean registriert. +jmx.rest.client.listener.not.found.useraction=Stellen Sie sicher, dass der aufrufende Code \u00fcberwacht, welche NotificationListener hinzugef\u00fcgt und entfernt werden, bzw. die Ausnahme abf\u00e4ngt und behandelt. + +jmx.rest.client.notification.lost=CWWKX0221I: Die Benachrichtigung konnte nicht zugestellt werden. +jmx.rest.client.notification.lost.explanation=Eine Benachrichtigung konnte mindestens einem NotificationListener nicht zugestellt werden, weil der registrierte NotificationListener nicht gefunden wurde oder weil w\u00e4hrend der Zustellung der Benachrichtigung eine Ausnahme eingetreten ist. +jmx.rest.client.notification.lost.useraction=Wenn die Benachrichtigung einem registrierten NotificationListener h\u00e4tte zugestellt werden m\u00fcssen, suchen Sie in den Protokollen nach Ausnahmen. + +jmx.rest.client.connection.failed=CWWKX0222I: Die Verbindung zum Server ist fehlgeschlagen. +jmx.rest.client.connection.failed.explanation=Der Server war nicht verf\u00fcgbar und wurde auch nicht innerhalb des konfigurierten maximal zul\u00e4ssigen Zeitraums wiederhergestellt. +jmx.rest.client.connection.failed.useraction=\u00dcberpr\u00fcfen Sie die Netzverbindung, und stellen Sie sicher, dass der Server mit aktiviertem REST-Connector-Feature aktiv ist. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: Die Verbindung zum Server ist vor\u00fcbergehend nicht mehr vorhanden. +jmx.rest.client.connection.temporarily.lost.explanation=Der Server ist nicht verf\u00fcgbar, aber der Client versucht, die Verbindung innerhalb der konfigurierten maximal zul\u00e4ssigen Zeit wiederherzustellen. +jmx.rest.client.connection.temporarily.lost.useraction=Wenn der Server absichtlich erneut gestartet wird, ist keine Aktion erforderlich. War der Neustart nicht beabsichtigt, \u00fcberpr\u00fcfen Sie die Netzverbindung, und stellen Sie sicher, dass der Server mit aktiviertem REST-Connector-Feature aktiv ist. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: Die Verbindung wurde wiederhergestellt, aber beim Hinzuf\u00fcgen der NotificationListener sind Ausnahmen eingetreten. +jmx.rest.client.connection.restored.with.exceptions.explanation=Die Verbindung zum Server war vor\u00fcbergehend nicht mehr vorhanden, wurde aber erfolgreich wiederhergestellt. Beim Hinzuf\u00fcgen der NotificationListeners sind Ausnahmen eingetreten, und deshalb wurden m\u00f6glicherweise einige Benachrichtigungen nicht empfangen. +jmx.rest.client.connection.restored.with.exceptions.useraction=\u00dcberpr\u00fcfen Sie die Ausnahmen, die in der Benachrichtigung enthalten sind, und registrieren Sie die NotificationListener erneut, nachdem Sie die Probleme behoben haben. + +jmx.rest.client.connection.restored=CWWKX0225I: Die Verbindung wurde erfolgreich wiederhergestellt. +jmx.rest.client.connection.restored.explanation=Die Verbindung zum Server war vor\u00fcbergehend nicht mehr vorhanden, wurde aber erfolgreich wiederhergestellt. Alle registrierten NotificationListener empfangen wieder Benachrichtigungen. +jmx.rest.client.connection.restored.useraction=Keine. + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Der Parameter des Typs JMXServiceURL darf nicht null sein. +jmx.rest.client.connection.illegal.argument.explanation=Der Wert f\u00fcr den Parameter 'serviceURL' darf nicht null sein. +jmx.rest.client.connection.illegal.argument.useraction=Wiederholen Sie die Herstellung der Verbindung zum JMX-REST-Connector mit einem JMXServiceURL-Wert ungleich null. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: Der folgende Endpunktwert ist nicht g\u00fcltig: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=Der angegebene Endpunktwert ist nicht g\u00fcltig. +jmx.rest.client.connection.invalid.endpoint.useraction=Wiederholen Sie die Herstellung der Verbindung zum JMX-REST-Connector mit einem g\u00fcltigen Endpunktwert, der den Datentyp String und das Format "Host:Port" hat. + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Es wurden keine verf\u00fcgbaren Endpunkte f\u00fcr die Initalisierung des Connectors gefunden. +jmx.rest.client.connection.no.endpoints.explanation=Keiner der angegebenen Endpunkte war w\u00e4hrend der Initialisierung des JMX-REST-Connectors verf\u00fcgbar. +jmx.rest.client.connection.no.endpoints.useraction=Wiederholen Sie die Herstellung der Verbindung zum JMX-REST-Connector mit mindestens einem verf\u00fcgbaren Endpunkt. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Es liegt ein Problem mit den angegebenen Benutzerberechtigungsnachweisen vor. Der Server hat mit dem Code {0} und der Nachricht ''{1}'' geantwortet. +jmx.rest.client.bad.user.credentials.explanation=Die angegebenen Berechtigungsnachweise sind falsch, abgelaufen, unvollst\u00e4ndig oder die Berechtigung wurde verweigert. +jmx.rest.client.bad.user.credentials.useraction=Vergewissern Sie sich, dass die Benutzerberechtigungsnachweise die ordnungsgem\u00e4\u00dfe Authentifizierung und Berechtigung haben, und stellen Sie anschlie\u00dfend eine neue Verbindung her. + +jmx.rest.client.connection.connect=CWWKX0230I: Das Verbundmember hat den JMX-Client zum Verbundcontroller ge\u00f6ffnet: {0} +jmx.rest.client.connection.connect.explanation=Das Member hat eine Verbindung zum Controller hergestellt. +jmx.rest.client.connection.connect.useraction=Es ist keine Aktion erforderlich. + +jmx.rest.client.connection.disconnect=CWWKX0231I: Das Verbundmember hat den JMX-Client zum Verbundcontroller geschlossen: {0} +jmx.rest.client.connection.disconnect.explanation=Das Member hat die Verbindung zum Controller getrennt. +jmx.rest.client.connection.disconnect.useraction=Es ist keine Aktion erforderlich. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_es.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_es.nlsprops new file mode 100755 index 000000000000..721b1580b0d6 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_es.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: El cliente REST de WebSphere Java Management Extensions ha encontrado un error mientras preparaba la solicitud en el servidor para el URL {0} en la conexi\u00f3n {1} +jmx.rest.client.request.error.explanation=El cliente REST de WebSphere Java Management Extensions ha encontrado un error mientras preparaba una solicitud para el servidor +jmx.rest.client.request.error.useraction=Examine los registros del servidor para obtener m\u00e1s informaci\u00f3n. + +jmx.rest.client.response.error=CWWKX0202E: El cliente REST de WebSphere Java Management Extensions no ha podido procesar la respuesta del servidor para el URL {0} en la conexi\u00f3n {1} +jmx.rest.client.response.error.explanation=El cliente REST de WebSphere Java Management Extensions no ha podido procesar una respuesta del servidor +jmx.rest.client.response.error.useraction=Examine los registros del servidor para obtener m\u00e1s informaci\u00f3n. + +jmx.rest.client.response.code.error=CWWKX0203E: El cliente REST de WebSphere Java Management Extensions ha recibido un c\u00f3digo de respuesta inesperado {0} con el mensaje ''{1}'' del servidor para el URL {2} en la conexi\u00f3n {3} +jmx.rest.client.response.code.error.explanation=El cliente REST de WebSphere Java Management Extensions ha recibido un c\u00f3digo de respuesta inesperado del servidor +jmx.rest.client.response.code.error.useraction=Examine los registros del servidor para obtener m\u00e1s informaci\u00f3n. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: No se puede analizar Throwable de la corriente de error del servidor. +jmx.rest.client.server.throwable.exception.explanation=El servidor ha generado una excepci\u00f3n al manejar la solicitud del cliente, pero el cliente no ha podido analizar un objeto Throwable de la corriente de error del servidor. Es posible que la clase del objeto Throwable no est\u00e9 disponible para el cliente. +jmx.rest.client.server.throwable.exception.useraction=Examine los registros del servidor para obtener m\u00e1s informaci\u00f3n. + +jmx.rest.client.not.connected=CWWKX0206E: El cliente no est\u00e1 conectado al servidor. +jmx.rest.client.not.connected.explanation=La conexi\u00f3n con el servidor se ha cerrado o ha fallado. +jmx.rest.client.not.connected.useraction=Compruebe que la caracter\u00edstica del conector REST est\u00e9 habilitada en el servidor y obtenga una nueva conexi\u00f3n con el servidor. + +jmx.rest.client.url.not.found=CWWKX0207E: El servidor inform\u00f3 que no ha encontrado el URL solicitado por el cliente. +jmx.rest.client.url.not.found.explanation=Es posible que el cliente tenga informaci\u00f3n no actualizada o que la caracter\u00edstica del conector REST del servidor no est\u00e9 habilitada. +jmx.rest.client.url.not.found.useraction=Compruebe que la caracter\u00edstica del conector REST est\u00e9 habilitada en el servidor y obtenga una nueva conexi\u00f3n con el servidor. + +jmx.rest.client.class.name.null=CWWKX0208E: El argumento de nombre de clase era nulo. +jmx.rest.client.class.name.null.explanation=El argumento de nombre de clase no debe ser nulo. +jmx.rest.client.class.name.null.useraction=Proporcione un nombre de clase no nulo cuando llame al m\u00e9todo. + +jmx.rest.client.attribute.name.null=CWWKX0209E: El argumento de nombre de atributo era nulo. +jmx.rest.client.attribute.name.null.explanation=El argumento de nombre de atributo no debe ser nulo. +jmx.rest.client.attribute.name.null.useraction=Proporcione un nombre de atributo no nulo cuando llame al m\u00e9todo. + +jmx.rest.client.attribute.names.null=CWWKX0210E: El argumento que contiene una matriz de nombres de atributo era nulo. +jmx.rest.client.attribute.names.null.explanation=El argumento que contiene una matriz de nombres de atributo no debe ser nulo. +jmx.rest.client.attribute.names.null.useraction=Proporcione una matriz no nula de nombres de atributo cuando llame al m\u00e9todo. + +jmx.rest.client.attribute.null=CWWKX0211E: El argumento Attribute era nulo. +jmx.rest.client.attribute.null.explanation=El argumento Attribute no debe ser nulo. +jmx.rest.client.attribute.null.useraction=Proporcione un Attribute no nulo cuando llame al m\u00e9todo. + +jmx.rest.client.attribute.list.null=CWWKX0212E: El argumento AttributeList era nulo. +jmx.rest.client.attribute.list.null.explanation=El argumento AttributeList no debe ser nulo. +jmx.rest.client.attribute.list.null.useraction=Proporcione un AttributeList no nulo cuando llame al m\u00e9todo. + +jmx.rest.client.object.name.null=CWWKX0213E: El argumento ObjectName era nulo. +jmx.rest.client.object.name.null.explanation=El argumento ObjectName no debe ser nulo. +jmx.rest.client.object.name.null.useraction=Proporcione un ObjectName no nulo cuando llame al m\u00e9todo. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: El servidor ha devuelto un objeto Throwable inesperado. +jmx.rest.client.unexpected.server.throwable.explanation=La excepci\u00f3n incluye un objeto Throwable devuelto desde el servidor que no se espera normalmente para esta operaci\u00f3n. +jmx.rest.client.unexpected.server.throwable.useraction=Examine los registros del servidor para obtener m\u00e1s informaci\u00f3n. + +jmx.rest.client.bad.credentials=CWWKX0215E: Ha habido un problema con el nombre de usuario o contrase\u00f1a especificados. El servidor respondi\u00f3 con el c\u00f3digo {0} y el mensaje ''{1}'' +jmx.rest.client.bad.credentials.explanation=Las credenciales proporcionadas al obtener la conexi\u00f3n eran incorrectas. Es posible que el usuario no exista o que no tenga autoridad para acceder al servidor, o que la contrase\u00f1a sea incorrecta. +jmx.rest.client.bad.credentials.useraction=Corrija el nombre de usuario o la contrase\u00f1a y despu\u00e9s obtenga una nueva conexi\u00f3n. + +jmx.rest.client.object.name.pattern=CWWKX0216E: El argumento ObjectName ''{0}'' es un patr\u00f3n. " +jmx.rest.client.object.name.pattern.explanation=El argumento ObjectName es un patr\u00f3n pero el m\u00e9todo requiere un ObjectName que coincida exactamente con un MBean. +jmx.rest.client.object.name.pattern.useraction=Proporcione un argumento ObjectName sin comodines y que coincida exactamente con un MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Actualmente no hay registrado ning\u00fan MBean con el ObjectName ''{0}'' indicado +jmx.rest.client.instance.not.found.explanation=La operaci\u00f3n requiere un MBean registrado, pero no se ha registrado ning\u00fan MBean con el ObjectName indicado. +jmx.rest.client.instance.not.found.useraction=Aseg\u00farese de que el MBean est\u00e9 registrado antes de intentar realizar operaciones de gesti\u00f3n en \u00e9l. + +jmx.rest.client.attribute.not.found=CWWKX0218E: El MBean ''{0}'' no tiene ning\u00fan atributo con el nombre ''{1}'' +jmx.rest.client.attribute.not.found.explanation=El MBean no proporciona ning\u00fan atributo del nombre indicado. +jmx.rest.client.attribute.not.found.useraction=Obtenga la informaci\u00f3n del MBean para confirmar qu\u00e9 atributos proporciona el MBean. + +jmx.rest.client.operation.not.found=CWWKX0219E: El MBean ''{0}'' no tiene ninguna operaci\u00f3n con el nombre ''{1}'' +jmx.rest.client.operation.not.found.explanation=El MBean no proporciona ninguna operaci\u00f3n del nombre indicado. +jmx.rest.client.operation.not.found.useraction=Obtenga la informaci\u00f3n del MBean para confirmar qu\u00e9 operaciones proporciona el MBean. + +jmx.rest.client.listener.not.found=CWWKX0220E: El NotificationListener indicado no est\u00e1 actualmente registrado para recibir notificaciones del MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=No se ha a\u00f1adido el NotificationListener o se ha eliminado y no est\u00e1 registrado actualmente para recibir notificaciones del MBean indicado. +jmx.rest.client.listener.not.found.useraction=Aseg\u00farese de que el c\u00f3digo de llamada hace un seguimiento de qu\u00e9 NotificationListeners se ha a\u00f1adido y eliminado o que capture y gestione la excepci\u00f3n. + +jmx.rest.client.notification.lost=CWWKX0221I: No se ha podido entregar la notificaci\u00f3n. +jmx.rest.client.notification.lost.explanation=No se ha podido entregar la notificaci\u00f3n a uno o m\u00e1s NotificationListeners porque no se ha encontrado un NotificationListener registrado o se ha producido una excepci\u00f3n durante la entrega de la notificaci\u00f3n. +jmx.rest.client.notification.lost.useraction=Si la notificaci\u00f3n deber\u00eda haberse entregado a un NotificationListener registrado busque excepciones en los registros. + +jmx.rest.client.connection.failed=CWWKX0222I: Ha fallado la conexi\u00f3n con el servidor. +jmx.rest.client.connection.failed.explanation=El servidor ha dejado de estar disponible y no ha vuelto a estar disponible dentro del tiempo m\u00e1ximo configurado permitido. +jmx.rest.client.connection.failed.useraction=Compruebe la conexi\u00f3n de red y aseg\u00farese de que el servidor est\u00e9 en ejecuci\u00f3n con la caracter\u00edstica del conector REST habilitada. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: Se ha perdido temporalmente la conexi\u00f3n con el servidor. +jmx.rest.client.connection.temporarily.lost.explanation=El servidor ha dejado de estar disponible, pero el cliente intentar\u00e1 restablecer la conexi\u00f3n durante el tiempo m\u00e1ximo configurado permitido. +jmx.rest.client.connection.temporarily.lost.useraction=Si el servidor se est\u00e1 reiniciando de manera intencionada, no hay que realizar ninguna acci\u00f3n. En caso contrario, compruebe la conexi\u00f3n de red y aseg\u00farese de que el servidor est\u00e9 en ejecuci\u00f3n con la caracter\u00edstica del conector REST habilitada. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: Se ha restablecido la conexi\u00f3n pero se han encontrado excepciones al a\u00f1adir los NotificationListeners. +jmx.rest.client.connection.restored.with.exceptions.explanation=Se hab\u00eda perdido temporalmente la conexi\u00f3n con el servidor pero se restableci\u00f3 satisfactoriamente. Se encontraron excepciones al a\u00f1adir los NotificationListeners, por lo que es posible que algunas notificaciones no se hayan recibido. +jmx.rest.client.connection.restored.with.exceptions.useraction=Compruebe las excepciones incluidas con la notificaci\u00f3n y vuelva a registrar los NotificationListeners despu\u00e9s de corregir los problemas. + +jmx.rest.client.connection.restored=CWWKX0225I: La conexi\u00f3n se ha restablecido satisfactoriamente. +jmx.rest.client.connection.restored.explanation=Se hab\u00eda perdido temporalmente la conexi\u00f3n con el servidor pero se restableci\u00f3 satisfactoriamente. Los NotificationListeners registrados seguir\u00e1n recibiendo notificaciones. +jmx.rest.client.connection.restored.useraction=Ninguna. + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: El par\u00e1metro de tipo JMXServiceURL no puede ser nulo. +jmx.rest.client.connection.illegal.argument.explanation=El valor del par\u00e1metro 'serviceURL' no puede ser nulo. +jmx.rest.client.connection.illegal.argument.useraction=Vuelva a conectar con JMX REST Connector utilizando un valor JMXServiceURL no nulo. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: El siguiente valor no es un valor de punto final v\u00e1lido: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=El valor de punto final especificado no es v\u00e1lido. +jmx.rest.client.connection.invalid.endpoint.useraction=Vuelva a conectar con JMX REST Connector utilizando un valor de punto final v\u00e1lido que sea de tipo String y tenga el formato "host:puerto". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: No se ha podido encontrar ning\u00fan punto final disponible para inicializar el conector. +jmx.rest.client.connection.no.endpoints.explanation=Ninguno de los puntos finales especificados estaba disponible durante la inicializaci\u00f3n de JMX REST Connector. +jmx.rest.client.connection.no.endpoints.useraction=Vuelva a conectar con JMX REST Connector utilizando al menos un punto final disponible. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Ha habido un problema con las credenciales de usuario proporcionadas. El servidor respondi\u00f3 con el c\u00f3digo {0} y el mensaje ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=Las credenciales proporcionadas son incorrectas, caducadas, incompletas o se ha rechazado la autorizaci\u00f3n. +jmx.rest.client.bad.user.credentials.useraction=Verifique que las credenciales de usuario tengan la autenticaci\u00f3n y la autorizaci\u00f3n correctas y, a continuaci\u00f3n obtenga una nueva conexi\u00f3n. + +jmx.rest.client.connection.connect=CWWKX0230I: El miembro de colectivo ha abierto el cliente JMX al controlador colectivo: {0} +jmx.rest.client.connection.connect.explanation=El miembro se ha conectado al controlador. +jmx.rest.client.connection.connect.useraction=No se requiere ninguna acci\u00f3n. + +jmx.rest.client.connection.disconnect=CWWKX0231I: El miembro de colectivo ha cerrado el cliente JMX del controlador colectivo: {0} +jmx.rest.client.connection.disconnect.explanation=El miembro se ha desconectado del controlador. +jmx.rest.client.connection.disconnect.useraction=No se requiere ninguna acci\u00f3n. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_fr.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_fr.nlsprops new file mode 100755 index 000000000000..a2726a64fab2 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_fr.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Le client REST WebSphere Java Management Extensions a d\u00e9tect\u00e9 une erreur lors de la pr\u00e9paration de la demande au serveur de l''URL {0} sur la connexion {1} +jmx.rest.client.request.error.explanation=Le client REST WebSphere Java Management Extensions a d\u00e9tect\u00e9 une erreur lors de la pr\u00e9paration d'une demande pour le serveur +jmx.rest.client.request.error.useraction=Examinez les journaux du serveur pour plus d'informations. + +jmx.rest.client.response.error=CWWKX0202E: Le client REST WebSphere Java Management Extensions n''a pas pu traiter la r\u00e9ponse du serveur pour l''URL {0} sur la connexion {1} +jmx.rest.client.response.error.explanation=Le client REST WebSphere Java Management Extensions n'a pas pu traiter une r\u00e9ponse du serveur +jmx.rest.client.response.error.useraction=Examinez les journaux du serveur pour plus d'informations. + +jmx.rest.client.response.code.error=CWWKX0203E: Le client REST WebSphere Java Management Extensions a re\u00e7u un code de r\u00e9ponse inattendu {0} avec le message ''{1}'' du serveur pour l''URL {2} sur la connexion {3} +jmx.rest.client.response.code.error.explanation=Le client REST WebSphere Java Management Extensions a re\u00e7u un code de r\u00e9ponse inattendu du serveur +jmx.rest.client.response.code.error.useraction=Examinez les journaux du serveur pour plus d'informations. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Impossible d'interpr\u00e9ter un objet Throwable dans le flux d'erreurs du serveur. +jmx.rest.client.server.throwable.exception.explanation=Le serveur a lev\u00e9 une exception en traitant la demande du client, mais le client n'a pas pu interpr\u00e9ter un objet Throwable \u00e0 partir du flux d'erreurs du serveur. Il est possible que le client ne dispose pas de la classe de l'objet Throwable. +jmx.rest.client.server.throwable.exception.useraction=Examinez les journaux du serveur pour plus d'informations. + +jmx.rest.client.not.connected=CWWKX0206E: Le client n'est pas connect\u00e9 au serveur. +jmx.rest.client.not.connected.explanation=La connexion au serveur a \u00e9t\u00e9 ferm\u00e9e ou a \u00e9chou\u00e9. +jmx.rest.client.not.connected.useraction=V\u00e9rifiez que la fonction connecteur REST est activ\u00e9e sur le serveur, puis obtenez une nouvelle connexion au serveur. + +jmx.rest.client.url.not.found=CWWKX0207E: Le serveur signale que l'URL demand\u00e9e par le client est introuvable. +jmx.rest.client.url.not.found.explanation=Les informations dont dispose le client sont peut-\u00eatre obsol\u00e8tes, ou bien la fonction connecteur REST sur le serveur a peut-\u00eatre \u00e9t\u00e9 d\u00e9sactiv\u00e9e. +jmx.rest.client.url.not.found.useraction=V\u00e9rifiez que la fonction connecteur REST est activ\u00e9e sur le serveur, puis obtenez une nouvelle connexion au serveur. + +jmx.rest.client.class.name.null=CWWKX0208E: L'argument de nom de classe \u00e9tait Null. +jmx.rest.client.class.name.null.explanation=L'argument de nom de classe ne doit pas \u00eatre Null. +jmx.rest.client.class.name.null.useraction=Fournissez un nom de classe non Null lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.attribute.name.null=CWWKX0209E: L'argument de nom d'attribut \u00e9tait Null. +jmx.rest.client.attribute.name.null.explanation=L'argument de nom d'attribut ne doit pas \u00eatre Null. +jmx.rest.client.attribute.name.null.useraction=Fournissez un nom d'attribut non Null lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.attribute.names.null=CWWKX0210E: L'argument suppos\u00e9 contenir un tableau de noms d'attribut \u00e9tait Null. +jmx.rest.client.attribute.names.null.explanation=L'argument suppos\u00e9 contenir un tableau de noms d'attribut ne doit pas \u00eatre Null. +jmx.rest.client.attribute.names.null.useraction=Fournissez un tableau non Null de noms d'attribut lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.attribute.null=CWWKX0211E: L'argument Attribute \u00e9tait Null. +jmx.rest.client.attribute.null.explanation=L'argument Attribute ne doit pas \u00eatre Null. +jmx.rest.client.attribute.null.useraction=Fournissez un argument Attribute non Null lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.attribute.list.null=CWWKX0212E: L'argument AttributeList \u00e9tait Null. +jmx.rest.client.attribute.list.null.explanation=L'argument AttributeList ne doit pas \u00eatre Null. +jmx.rest.client.attribute.list.null.useraction=Fournissez un argument AttributeList non Null lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.object.name.null=CWWKX0213E: L'argument ObjectName \u00e9tait Null. +jmx.rest.client.object.name.null.explanation=L'argument ObjectName ne doit pas \u00eatre Null. +jmx.rest.client.object.name.null.useraction=Fournissez un argument ObjectName non Null lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Un objet Throwable inattendu a \u00e9t\u00e9 renvoy\u00e9 par le serveur. +jmx.rest.client.unexpected.server.throwable.explanation=L'exception encapsule un objet Throwable renvoy\u00e9 par le serveur qui n'est normalement pas pr\u00e9vu pour cette op\u00e9ration. +jmx.rest.client.unexpected.server.throwable.useraction=Examinez les journaux du serveur pour plus d'informations. + +jmx.rest.client.bad.credentials=CWWKX0215E: Un probl\u00e8me est survenu avec le nom d''utilisateur ou le mot de passe fourni. Le serveur a r\u00e9pondu avec le code {0} et le message ''{1}'' +jmx.rest.client.bad.credentials.explanation=Les donn\u00e9es d'identification fournies lors de l'obtention de la connexion \u00e9taient incorrectes. L'utilisateur n'existe peut-\u00eatre pas ; ou alors, s'il existe, il n'a peut-\u00eatre pas le droit d'acc\u00e9der au serveur ou le mot de passe indiqu\u00e9 est incorrect. +jmx.rest.client.bad.credentials.useraction=Corrigez le nom d'utilisateur ou le mot de passe, puis obtenez une nouvelle connexion. + +jmx.rest.client.object.name.pattern=CWWKX0216E: L''argument ObjectName ''{0}'' est un masque g\u00e9n\u00e9rique. +jmx.rest.client.object.name.pattern.explanation=L'argument ObjectName est un masque g\u00e9n\u00e9rique alors que la m\u00e9thode requiert un ObjectName correspondant pr\u00e9cis\u00e9ment \u00e0 un unique bean g\u00e9r\u00e9 (MBean). +jmx.rest.client.object.name.pattern.useraction=Fournissez un argument ObjectName sans partie g\u00e9n\u00e9rique afin de d\u00e9signer pr\u00e9cis\u00e9ment un unique MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Aucun MBean n''est actuellement enregistr\u00e9 avec l''ObjectName indiqu\u00e9, ''{0}'' +jmx.rest.client.instance.not.found.explanation=L'op\u00e9ration n\u00e9cessite un MBean enregistr\u00e9, mais aucun ne l'a \u00e9t\u00e9 avec l'ObjectName indiqu\u00e9. +jmx.rest.client.instance.not.found.useraction=Assurez-vous que le MBean est bien enregistr\u00e9 avant de tenter toute op\u00e9ration de gestion dessus. + +jmx.rest.client.attribute.not.found=CWWKX0218E: Le MBean ''{0}'' n''a pas d''attribut nomm\u00e9 ''{1}'' +jmx.rest.client.attribute.not.found.explanation=Le MBean ne fournit pas d'attribut portant le nom indiqu\u00e9. +jmx.rest.client.attribute.not.found.useraction=Obtenez les informations du MBean afin de d\u00e9terminer quels attributs il fournit. + +jmx.rest.client.operation.not.found=CWWKX0219E: Le MBean ''{0}'' n''a pas d''op\u00e9ration nomm\u00e9e ''{1}'' +jmx.rest.client.operation.not.found.explanation=Le MBean ne fournit pas d'op\u00e9ration portant le nom indiqu\u00e9. +jmx.rest.client.operation.not.found.useraction=Obtenez les informations du MBean afin de d\u00e9terminer quelles op\u00e9rations il fournit. + +jmx.rest.client.listener.not.found=CWWKX0220E: Le NotificationListener fourni n''est pas actuellement enregistr\u00e9 pour recevoir des notifications du MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=Le NotificationListener n'a pas \u00e9t\u00e9 ajout\u00e9, ou bien s'il l'a \u00e9t\u00e9, il est d\u00e9j\u00e0 retir\u00e9 et n'est donc pas actuellement enregistr\u00e9 pour recevoir des notifications du MBean indiqu\u00e9. +jmx.rest.client.listener.not.found.useraction=Assurez-vous que le code appelant tient \u00e0 jour la liste des NotificationListeners ayant \u00e9t\u00e9 ajout\u00e9s et retir\u00e9s ou que l'exception est intercept\u00e9e (catch) et trait\u00e9e. + +jmx.rest.client.notification.lost=CWWKX0221I: La notification n'a pas pu \u00eatre livr\u00e9e. +jmx.rest.client.notification.lost.explanation=Une notification n'a pas pu \u00eatre livr\u00e9e \u00e0 un ou plusieurs NotificationListeners car aucun NotificationListener enregistr\u00e9 n'a \u00e9t\u00e9 trouv\u00e9 ou bien une exception s'est produite lors de la livraison de la notification. +jmx.rest.client.notification.lost.useraction=Si la notification aurait due \u00eatre envoy\u00e9e \u00e0 un programme d'\u00e9coute NotificationListener enregistr\u00e9, recherchez des exceptions dans les journaux. + +jmx.rest.client.connection.failed=CWWKX0222I: La connexion au serveur a \u00e9chou\u00e9. +jmx.rest.client.connection.failed.explanation=Le serveur est devenu indisponible et sa disponibilit\u00e9 n'a pas \u00e9t\u00e9 r\u00e9tablie dans le d\u00e9lai imparti configur\u00e9. +jmx.rest.client.connection.failed.useraction=V\u00e9rifiez la connexion r\u00e9seau et assurez-vous que le serveur est ex\u00e9cut\u00e9 avec la fonction connecteur REST activ\u00e9e. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: La connexion au serveur a \u00e9t\u00e9 temporairement perdue. +jmx.rest.client.connection.temporarily.lost.explanation=Le serveur est devenu indisponible, mais le client va tenter de restaurer la connexion dans le d\u00e9lai imparti configur\u00e9. +jmx.rest.client.connection.temporarily.lost.useraction=Si le serveur red\u00e9marre intentionnellement, aucune action n'est requise. Sinon, v\u00e9rifiez la connexion r\u00e9seau et assurez-vous que le serveur est ex\u00e9cut\u00e9 avec la fonction connecteur REST activ\u00e9e. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: La connexion a \u00e9t\u00e9 restaur\u00e9e, mais des exceptions ont \u00e9t\u00e9 rencontr\u00e9es lors de l'ajout des NotificationListeners. +jmx.rest.client.connection.restored.with.exceptions.explanation=La connexion au serveur a \u00e9t\u00e9 perdue temporairement, mais elle a ensuite \u00e9t\u00e9 correctement r\u00e9tablie. Des exceptions ont toutefois \u00e9t\u00e9 rencontr\u00e9es lors de l'ajout des NotificationListeners, de sorte que certaines notifications risquent de ne pas \u00eatre re\u00e7ues. +jmx.rest.client.connection.restored.with.exceptions.useraction=V\u00e9rifiez les exceptions incluses avec la notification et, une fois les probl\u00e8mes corrig\u00e9s, r\u00e9enregistrez les NotificationListeners. + +jmx.rest.client.connection.restored=CWWKX0225I: La connexion a \u00e9t\u00e9 restaur\u00e9e correctement. +jmx.rest.client.connection.restored.explanation=La connexion au serveur a \u00e9t\u00e9 perdue temporairement, mais elle a ensuite \u00e9t\u00e9 correctement r\u00e9tablie. Tous les NotificationListeners enregistr\u00e9s continueront \u00e0 recevoir les notifications. +jmx.rest.client.connection.restored.useraction=Aucun + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Le param\u00e8tre de type JMXServiceURL ne peut pas avoir la valeur NULL. +jmx.rest.client.connection.illegal.argument.explanation=La valeur du param\u00e8tre 'serviceURL' ne peut pas \u00eatre NULL. +jmx.rest.client.connection.illegal.argument.useraction=Connectez-vous \u00e0 nouveau au connecteur JMX REST \u00e0 l'aide d'une valeur JMXServiceURL non NULL. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: La valeur de noeud final suivante n''est pas valide : {0} +jmx.rest.client.connection.invalid.endpoint.explanation=La valeur de noeud final indiqu\u00e9e n'est pas valide. +jmx.rest.client.connection.invalid.endpoint.useraction=Connectez-vous \u00e0 nouveau au connecteur JMX REST \u00e0 l'aide d'une valeur de noeud final valide de type cha\u00eene et au format "h\u00f4te:port". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Aucun noeud final disponible ne peut \u00eatre localis\u00e9 pour initialiser le connecteur. +jmx.rest.client.connection.no.endpoints.explanation=Aucun des noeuds finaux indiqu\u00e9s n'\u00e9tait disponible pendant l'initialisation du connecteur JMX REST. +jmx.rest.client.connection.no.endpoints.useraction=Connectez-vous \u00e0 nouveau au connecteur JMX REST \u00e0 l'aide d'au moins un noeud final disponible. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Un probl\u00e8me est survenu avec les donn\u00e9es d''identification de l''utilisateur fournies. Le serveur a r\u00e9pondu avec le code {0} et le message ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=Les donn\u00e9es d'identification fournies sont incorrectes, expir\u00e9es, incompl\u00e8tes ou non autoris\u00e9es. +jmx.rest.client.bad.user.credentials.useraction=V\u00e9rifiez que les donn\u00e9es d'identification de l'utilisateur disposent d'une authentification et d'une autorisation correctes, puis obtenez une nouvelle connexion. + +jmx.rest.client.connection.connect=CWWKX0230I: Le membre de collectivit\u00e9 a ouvert le client JMX dans le contr\u00f4leur de collectivit\u00e9 : {0} +jmx.rest.client.connection.connect.explanation=Le membre est connect\u00e9 au contr\u00f4leur. +jmx.rest.client.connection.connect.useraction=Aucune action n'est requise. + +jmx.rest.client.connection.disconnect=CWWKX0231I: Le membre de collectivit\u00e9 a ferm\u00e9 le client JMX dans le contr\u00f4leur de collectivit\u00e9 : {0} +jmx.rest.client.connection.disconnect.explanation=Le membre est d\u00e9connect\u00e9 du contr\u00f4leur. +jmx.rest.client.connection.disconnect.useraction=Aucune action n'est requise. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_hu.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_hu.nlsprops new file mode 100755 index 000000000000..b0e0c628dc22 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_hu.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l hib\u00e1ba \u00fctk\u00f6z\u00f6tt, mik\u00f6zben el\u0151k\u00e9sz\u00edtette a kiszolg\u00e1l\u00f3hoz k\u00fcldend\u0151 k\u00e9r\u00e9st a(z) {1} kapcsolaton tal\u00e1lhat\u00f3 {0} URL eset\u00e9ben +jmx.rest.client.request.error.explanation=A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l hib\u00e1ba \u00fctk\u00f6z\u00f6tt, mik\u00f6zben el\u0151k\u00e9sz\u00edtette a kiszolg\u00e1l\u00f3hoz k\u00fcldend\u0151 k\u00e9r\u00e9st +jmx.rest.client.request.error.useraction=Tov\u00e1bbi inform\u00e1ci\u00f3k\u00e9rt vizsg\u00e1lja meg a kiszolg\u00e1l\u00f3napl\u00f3kat. + +jmx.rest.client.response.error=CWWKX0202E: A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l nem tudta feldolgozni a kiszolg\u00e1l\u00f3t\u00f3l \u00e9rkezett v\u00e1laszt a(z) {1} kapcsolaton tal\u00e1lhat\u00f3 {0} URL eset\u00e9ben +jmx.rest.client.response.error.explanation=A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l nem tudott feldolgozni egy kiszolg\u00e1l\u00f3t\u00f3l \u00e9rkezett v\u00e1laszt +jmx.rest.client.response.error.useraction=Tov\u00e1bbi inform\u00e1ci\u00f3k\u00e9rt vizsg\u00e1lja meg a kiszolg\u00e1l\u00f3napl\u00f3kat. + +jmx.rest.client.response.code.error=CWWKX0203E: A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l a(z) {0} v\u00e1ratlan v\u00e1laszk\u00f3dot kapta a(z) "{1}" \u00fczenettel a kiszolg\u00e1l\u00f3t\u00f3l a(z) {3} kapcsolaton tal\u00e1lhat\u00f3 {2} URL eset\u00e9ben +jmx.rest.client.response.code.error.explanation=A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l egy v\u00e1ratlan v\u00e1laszk\u00f3dot kapta a kiszolg\u00e1l\u00f3t\u00f3l +jmx.rest.client.response.code.error.useraction=Tov\u00e1bbi inform\u00e1ci\u00f3k\u00e9rt vizsg\u00e1lja meg a kiszolg\u00e1l\u00f3napl\u00f3kat. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Nem lehet \u00e9rtelmezni egy Throwable objektumot a kiszolg\u00e1l\u00f3 hibafolyam\u00e1b\u00f3l. +jmx.rest.client.server.throwable.exception.explanation=A kiszolg\u00e1l\u00f3 kiv\u00e9telt adott az \u00fcgyf\u00e9lk\u00e9r\u00e9s kezel\u00e9sekor, de az \u00fcgyf\u00e9l nem tudott \u00e9rtelmezni egy Throwable objektumot a kiszolg\u00e1l\u00f3 hibafolyam\u00e1b\u00f3l. Lehet, hogy a Throwable objektum oszt\u00e1lya nem el\u00e9rhet\u0151 az \u00fcgyf\u00e9l sz\u00e1m\u00e1ra. +jmx.rest.client.server.throwable.exception.useraction=Tov\u00e1bbi inform\u00e1ci\u00f3k\u00e9rt vizsg\u00e1lja meg a kiszolg\u00e1l\u00f3napl\u00f3kat. + +jmx.rest.client.not.connected=CWWKX0206E: Az \u00fcgyf\u00e9l nem kapcsol\u00f3dik a kiszolg\u00e1l\u00f3hoz. +jmx.rest.client.not.connected.explanation=A kapcsolat a kiszolg\u00e1l\u00f3val megszakadt vagy sikertelen. +jmx.rest.client.not.connected.useraction=Ellen\u0151rizze, hogy enged\u00e9lyezve van-e a REST csatol\u00f3 szolg\u00e1ltat\u00e1s a kiszolg\u00e1l\u00f3n, \u00e9s hozzon l\u00e9tre \u00faj kapcsolatot a kiszolg\u00e1l\u00f3val. + +jmx.rest.client.url.not.found=CWWKX0207E: A kiszolg\u00e1l\u00f3 jelezte, hogy az \u00fcgyf\u00e9l \u00e1ltal k\u00e9rt URL nem tal\u00e1lhat\u00f3. +jmx.rest.client.url.not.found.explanation=Lehet, hogy az \u00fcgyf\u00e9l elavult inform\u00e1ci\u00f3kkal rendelkezik vagy a REST csatol\u00f3 funkci\u00f3 a kiszolg\u00e1l\u00f3n le van tiltva. +jmx.rest.client.url.not.found.useraction=Ellen\u0151rizze, hogy enged\u00e9lyezve van-e a REST csatol\u00f3 szolg\u00e1ltat\u00e1s a kiszolg\u00e1l\u00f3n, \u00e9s hozzon l\u00e9tre \u00faj kapcsolatot a kiszolg\u00e1l\u00f3val. + +jmx.rest.client.class.name.null=CWWKX0208E: Az oszt\u00e1lyn\u00e9v argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.class.name.null.explanation=Az oszt\u00e1lyn\u00e9v argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.class.name.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 oszt\u00e1lynevet a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.attribute.name.null=CWWKX0209E: Az attrib\u00fatumn\u00e9v argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.attribute.name.null.explanation=Az attrib\u00fatumn\u00e9v argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.attribute.name.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 attrib\u00fatumnevet a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.attribute.names.null=CWWKX0210E: Az attrib\u00fatumneveket tartalmaz\u00f3 argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.attribute.names.null.explanation=Az attrib\u00fatumneveket tartalmaz\u00f3 argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.attribute.names.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 attrib\u00fatumn\u00e9v t\u00f6mb\u00f6t a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.attribute.null=CWWKX0211E: Az Attribute argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.attribute.null.explanation=Az Attribute argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.attribute.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 Attribute argumentumot a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.attribute.list.null=CWWKX0212E: Az AttributeList argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.attribute.list.null.explanation=Az AttributeList argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.attribute.list.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 AttributeList argumentumot a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.object.name.null=CWWKX0213E: Az ObjectName argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.object.name.null.explanation=Az ObjectName argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.object.name.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 ObjectName argumentumot a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Nem v\u00e1rt Throwable objektumot adott vissza a program. +jmx.rest.client.unexpected.server.throwable.explanation=A kiv\u00e9tel a m\u0171velethez a kiszolg\u00e1l\u00f3r\u00f3l visszaadott nem v\u00e1rt Throwable objektumot tartalmaz. +jmx.rest.client.unexpected.server.throwable.useraction=Tov\u00e1bbi inform\u00e1ci\u00f3k\u00e9rt vizsg\u00e1lja meg a kiszolg\u00e1l\u00f3napl\u00f3kat. + +jmx.rest.client.bad.credentials=CWWKX0215E: Probl\u00e9ma volt a megadott felhaszn\u00e1l\u00f3n\u00e9vvel vagy jelsz\u00f3val. A kiszolg\u00e1l\u00f3 {0} k\u00f3ddal \u00e9s ''{1}'' \u00fczenettel v\u00e1laszolt. +jmx.rest.client.bad.credentials.explanation=A kapcsolat l\u00e9trehoz\u00e1sakor megadott hiteles\u00edt\u00e9si adatok helytelenek voltak. Lehet, hogy a felhaszn\u00e1l\u00f3 nem l\u00e9tezik vagy nincs jogosults\u00e1ga a kiszolg\u00e1l\u00f3 el\u00e9r\u00e9s\u00e9hez, vagy helytelen a jelsz\u00f3. +jmx.rest.client.bad.credentials.useraction=Jav\u00edtsa ki a felhaszn\u00e1l\u00f3nevet vagy jelsz\u00f3t, majd hozzon l\u00e9tre \u00faj kapcsolatot. + +jmx.rest.client.object.name.pattern=CWWKX0216E: A(z) ''{0}'' ObjectName argumentum egy minta." +jmx.rest.client.object.name.pattern.explanation=Az ObjectName argumentum egy minta, de a met\u00f3dus sz\u00e1m\u00e1ra pontosan egy MBean elemmel egyez\u0151 ObjectName sz\u00fcks\u00e9ges. +jmx.rest.client.object.name.pattern.useraction=Adjon meg helyettes\u00edt\u0151 karakterek n\u00e9lk\u00fcl egy ObjectName argumentumot, ami pontosan egy MBean elemmel egyezik. + +jmx.rest.client.instance.not.found=CWWKX0217E: Jelenleg nincs MBean regisztr\u00e1lva a megadott ''{0}'' ObjectName argumentummal. +jmx.rest.client.instance.not.found.explanation=A m\u0171velethez regisztr\u00e1lt MBean sz\u00fcks\u00e9ges, de a megadott ObjectName argumentummal nem volt MBean regisztr\u00e1lva. +jmx.rest.client.instance.not.found.useraction=Gondoskodjon arr\u00f3l, hogy az MBean regisztr\u00e1lva legyen, miel\u0151tt kezel\u00e9si m\u0171veleteket pr\u00f3b\u00e1l meg v\u00e9grehajtani rajta. + +jmx.rest.client.attribute.not.found=CWWKX0218E: A(z) ''{0}'' MBean nem rendelkezik ''{1}'' nev\u0171 attrib\u00fatummal. +jmx.rest.client.attribute.not.found.explanation=Az MBean nem biztos\u00edtja a megadott nev\u0171 attrib\u00fatumot. +jmx.rest.client.attribute.not.found.useraction=Az MBean inform\u00e1ci\u00f3i megszerz\u00e9s\u00e9vel gy\u0151z\u0151dj\u00f6n meg arr\u00f3l, hogy milyen attrib\u00fatumokat biztos\u00edt az MBean. + +jmx.rest.client.operation.not.found=CWWKX0219E: A(z) ''{0}'' MBean nem rendelkezik ''{1}'' nev\u0171 m\u0171velettel. +jmx.rest.client.operation.not.found.explanation=Az MBean nem biztos\u00edtja a megadott nev\u0171 m\u0171veletet. +jmx.rest.client.operation.not.found.useraction=Az MBean inform\u00e1ci\u00f3i megszerz\u00e9s\u00e9vel gy\u0151z\u0151dj\u00f6n meg arr\u00f3l, hogy milyen m\u0171veleteket biztos\u00edt az MBean. + +jmx.rest.client.listener.not.found=CWWKX0220E: A megadott NotificationListener jelenleg nincs regisztr\u00e1lva, hogy \u00e9rtes\u00edt\u00e9seket fogadjon ''{0}'' MBean \u00f6sszetev\u0151t\u0151l. +jmx.rest.client.listener.not.found.explanation=A NotificationListener nem lett hozz\u00e1adva vagy m\u00e1r el lett t\u00e1vol\u00edtva, \u00e9s jelenleg nincs regisztr\u00e1lva \u00e9rtes\u00edt\u00e9sek fogad\u00e1s\u00e1ra a megadott MBean \u00f6sszetev\u0151t\u0151l. +jmx.rest.client.listener.not.found.useraction=Gondoskodjon arr\u00f3l, hogy a h\u00edv\u00f3 k\u00f3d nyomon k\u00f6vesse, hogy melyik NotificationListener \u00f6sszetev\u0151k lettek hozz\u00e1adva \u00e9s elt\u00e1vol\u00edtva, vagy fogja el \u00e9s kezelje a kiv\u00e9telt. + +jmx.rest.client.notification.lost=CWWKX0221I: Az \u00e9rtes\u00edt\u00e9st nem lehetett k\u00e9zbes\u00edteni. +jmx.rest.client.notification.lost.explanation=Egy \u00e9rtes\u00edt\u00e9st nem lehetett k\u00e9zbes\u00edteni n\u00e9h\u00e1ny NotificationListener sz\u00e1m\u00e1ra, mert egy regisztr\u00e1lt NotificationListener nem volt megtal\u00e1lhat\u00f3 vagy kiv\u00e9tel t\u00f6rt\u00e9nt az \u00e9rtes\u00edt\u00e9s k\u00e9zbes\u00edt\u00e9se sor\u00e1n. +jmx.rest.client.notification.lost.useraction=Ha az \u00e9rtes\u00edt\u00e9st k\u00e9zbes\u00edteni kellett volna egy regisztr\u00e1lt NotificationListener sz\u00e1m\u00e1ra, akkor ellen\u0151rizze a napl\u00f3kban a kiv\u00e9teleket. + +jmx.rest.client.connection.failed=CWWKX0222I: A kapcsolat a kiszolg\u00e1l\u00f3val sikertelen. +jmx.rest.client.connection.failed.explanation=A kiszolg\u00e1l\u00f3 el\u00e9rhetetlenn\u00e9 v\u00e1lt, \u00e9s nem lett \u00fajb\u00f3l el\u00e9rhet\u0151 a be\u00e1ll\u00edtott rendelkez\u00e9sre \u00e1ll\u00f3 maxim\u00e1lis id\u0151n bel\u00fcl. +jmx.rest.client.connection.failed.useraction=Ellen\u0151rizze a h\u00e1l\u00f3zati kapcsolatot, \u00e9s gondoskodjon arr\u00f3l, hogy a kiszolg\u00e1l\u00f3 enged\u00e9lyezett REST csatol\u00f3 funkci\u00f3val fusson. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: A kapcsolat a kiszolg\u00e1l\u00f3val ideiglenesen elveszett. +jmx.rest.client.connection.temporarily.lost.explanation=A kiszolg\u00e1l\u00f3 el\u00e9rhetetlenn\u00e9 v\u00e1lt, de az \u00fcgyf\u00e9l megpr\u00f3b\u00e1lja vissza\u00e1ll\u00edtani a kapcsolatot a be\u00e1ll\u00edtott rendelkez\u00e9sre \u00e1ll\u00f3 maxim\u00e1lis id\u0151n bel\u00fcl. +jmx.rest.client.connection.temporarily.lost.useraction=Ha a kiszolg\u00e1l\u00f3 sz\u00e1nd\u00e9kosan indul \u00fajra, akkor nincs teend\u0151. Ellenkez\u0151 esetben ellen\u0151rizze a h\u00e1l\u00f3zati kapcsolatot, \u00e9s gondoskodjon arr\u00f3l, hogy a kiszolg\u00e1l\u00f3 enged\u00e9lyezett REST csatol\u00f3 funkci\u00f3val fusson. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: A kapcsolat vissza\u00e1llt, de kiv\u00e9telek fordultak el\u0151 a NotificationListener elemek hozz\u00e1ad\u00e1sakor. +jmx.rest.client.connection.restored.with.exceptions.explanation=A kapcsolat a kiszolg\u00e1l\u00f3val ideiglenesen elveszett, de sikeresen helyre\u00e1llt. Kiv\u00e9telek fordultak el\u0151 a NotificationListener elemek hozz\u00e1ad\u00e1sakor, ez\u00e9rt lehet, hogy n\u00e9h\u00e1ny \u00e9rtes\u00edt\u00e9st nem lehetett fogadni. +jmx.rest.client.connection.restored.with.exceptions.useraction=Ellen\u0151rizze az \u00e9rtes\u00edt\u00e9s tartalmazott kiv\u00e9teleit, \u00e9s regisztr\u00e1lja \u00fajra a NotificationListener elemeket a probl\u00e9m\u00e1k kijav\u00edt\u00e1sa ut\u00e1n. + +jmx.rest.client.connection.restored=CWWKX0225I: A kapcsolat helyre\u00e1ll\u00edt\u00e1sa siker\u00fclt. +jmx.rest.client.connection.restored.explanation=A kapcsolat a kiszolg\u00e1l\u00f3val ideiglenesen elveszett, de sikeresen helyre\u00e1llt. A regisztr\u00e1lt NotificationListener elemek tov\u00e1bbra is kapnak \u00e9rtes\u00edt\u00e9seket. +jmx.rest.client.connection.restored.useraction=Nincs + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: A JMXServiceURL t\u00edpus\u00fa param\u00e9ter nem lehet null\u00e9rt\u00e9k. +jmx.rest.client.connection.illegal.argument.explanation=A 'serviceURL' param\u00e9ter \u00e9rt\u00e9ke nem lehet null\u00e9rt\u00e9k. +jmx.rest.client.connection.illegal.argument.useraction=Csatlakozzon \u00fajra a JMX REST csatol\u00f3hoz nem null\u00e9rt\u00e9k\u0171 JMXServiceURL \u00e9rt\u00e9kkel. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: A k\u00f6vetkez\u0151 nem \u00e9rv\u00e9nyes v\u00e9gpont\u00e9rt\u00e9k: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=A megadott v\u00e9gpont\u00e9rt\u00e9k \u00e9rv\u00e9nytelen. +jmx.rest.client.connection.invalid.endpoint.useraction=Csatlakozzon \u00fajra a JMX REST csatol\u00f3hoz karaktersorozat t\u00edpus\u00fa, "hoszt:port" form\u00e1tum\u00fa \u00e9rv\u00e9nyes v\u00e9gpont\u00e9rt\u00e9kkel. + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: A csatol\u00f3 inicializ\u00e1l\u00e1s\u00e1hoz nem tal\u00e1lhat\u00f3 el\u00e9rhet\u0151 v\u00e9gpont. +jmx.rest.client.connection.no.endpoints.explanation=A JMX REST csatol\u00f3 inicializ\u00e1l\u00e1sa sor\u00e1n egyik megadott v\u00e9gpont sem \u00e9rhet\u0151 el. +jmx.rest.client.connection.no.endpoints.useraction=Csatlakozzon \u00fajra a JMX REST csatol\u00f3hoz legal\u00e1bb 1 el\u00e9rhet\u0151 v\u00e9gpont haszn\u00e1lat\u00e1val. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Probl\u00e9ma volt a megadott felhaszn\u00e1l\u00f3 hiteles\u00edt\u00e9si adatokkal. A kiszolg\u00e1l\u00f3 {0} k\u00f3ddal \u00e9s ''{1}'' \u00fczenettel v\u00e1laszolt. +jmx.rest.client.bad.user.credentials.explanation=A megadott hiteles\u00edt\u00e9si adatok helytelenek, lej\u00e1rtak vagy jogosults\u00e1guk megtagad\u00e1sra ker\u00fclt. +jmx.rest.client.bad.user.credentials.useraction=Gy\u0151z\u0151dj\u00f6n meg r\u00f3la, hogy a felhaszn\u00e1l\u00f3 hiteles\u00edt\u00e9si adatok hiteles\u00edt\u00e9se \u00e9s jogosults\u00e1ga helyes, majd alak\u00edtson ki \u00faj kapcsolatot. + +jmx.rest.client.connection.connect=CWWKX0230I: Az egy\u00fcttes tag megnyitotta az JMX \u00fcgyfelet az egy\u00fcttes vez\u00e9rl\u0151h\u00f6z: {0} +jmx.rest.client.connection.connect.explanation=A tag csatlakoztat\u00e1sra ker\u00fclt a vez\u00e9rl\u0151h\u00f6z. +jmx.rest.client.connection.connect.useraction=Semmit sem kell tennie. + +jmx.rest.client.connection.disconnect=CWWKX0231I: Az egy\u00fcttes tag lez\u00e1rta az JMX \u00fcgyfelet az egy\u00fcttes vez\u00e9rl\u0151vel: {0} +jmx.rest.client.connection.disconnect.explanation=A tag vez\u00e9rl\u0151h\u00f6z val\u00f3 csatlakoz\u00e1sa megsz\u0171nt. +jmx.rest.client.connection.disconnect.useraction=Semmit sem kell tennie. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_it.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_it.nlsprops new file mode 100755 index 000000000000..f127d779fc38 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_it.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Il client REST WebSphere Java Management Extensions ha rilevato un errore durante la preparazione della richiesta al server per l''URL {0} sulla connessione {1} +jmx.rest.client.request.error.explanation=Il client REST WebSphere Java Management Extensions ha rilevato un errore durante la preparazione di una richiesta per il server. +jmx.rest.client.request.error.useraction=Per ulteriori informazioni, esaminare i log del server. + +jmx.rest.client.response.error=CWWKX0202E: Il client REST WebSphere Java Management Extensions non \u00e8 riuscito ad elaborare la risposta dal server per l''URL {0} sulla connessione {1} +jmx.rest.client.response.error.explanation=Il client REST WebSphere Java Management Extensions non \u00e8 riuscito ad elaborare una risposta dal server +jmx.rest.client.response.error.useraction=Per ulteriori informazioni, esaminare i log del server. + +jmx.rest.client.response.code.error=CWWKX0203E: Il client REST WebSphere Java Management Extensions ha ricevuto un codice di risposta imprevisto {0} con il messaggio ''{1}'' dal server per l''URL {2} sulla connessione {3} +jmx.rest.client.response.code.error.explanation=Il client REST WebSphere Java Management Extensions ha ricevuto un codice di risposta imprevisto dal server +jmx.rest.client.response.code.error.useraction=Per ulteriori informazioni, esaminare i log del server. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Impossibile analizzare l'oggetto Throwable dal flusso di errori del server. +jmx.rest.client.server.throwable.exception.explanation=Il server ha generato un'eccezione durante la gestione della richiesta del client, ma il client non \u00e8 stato in grado di analizzare l'oggetto Throwable proveniente dal flusso di errori del server. La classe dell'oggetto Throwable potrebbe non essere disponibile per il client. +jmx.rest.client.server.throwable.exception.useraction=Per ulteriori informazioni, esaminare i log del server. + +jmx.rest.client.not.connected=CWWKX0206E: Il client non \u00e8 connesso al server. +jmx.rest.client.not.connected.explanation=La connessione al server \u00e8 stata chiusa o ha avuto esito negativo. +jmx.rest.client.not.connected.useraction=Controllare che la funzione connettore REST sia abilitata sul server e ottenere una nuova connessione al server. + +jmx.rest.client.url.not.found=CWWKX0207E: Il server ha notificato che l'URL richiesto dal client non \u00e8 stato trovato. +jmx.rest.client.url.not.found.explanation=\u00c8 possibile che il client abbia informazioni non aggiornate o che la funzione connettore REST sul server sia stata disabilitata. +jmx.rest.client.url.not.found.useraction=Controllare che la funzione connettore REST sia abilitata sul server e ottenere una nuova connessione al server. + +jmx.rest.client.class.name.null=CWWKX0208E: L'argomento nome classe \u00e8 null. +jmx.rest.client.class.name.null.explanation=L'argomento nome classe non deve essere null. +jmx.rest.client.class.name.null.useraction=Fornire un nome classe che non sia null durante la chiamata del metodo. + +jmx.rest.client.attribute.name.null=CWWKX0209E: L'argomento nome attributo \u00e8 null. +jmx.rest.client.attribute.name.null.explanation=L'argomento nome attributo non deve essere null. +jmx.rest.client.attribute.name.null.useraction=Fornire un nome attributo che non sia null durante la chiamata del metodo. + +jmx.rest.client.attribute.names.null=CWWKX0210E: L'argomento contenente un array di nomi attributo \u00e8 null. +jmx.rest.client.attribute.names.null.explanation=L'argomento contenente un array di nomi attributo non deve essere null. +jmx.rest.client.attribute.names.null.useraction=Fornire un array non null di nomi attributo durante la chiamata del metodo. + +jmx.rest.client.attribute.null=CWWKX0211E: L'argomento Attribute \u00e8 null. +jmx.rest.client.attribute.null.explanation=L'argomento Attribute non deve essere null. +jmx.rest.client.attribute.null.useraction=Fornire un argomento Attribute che non sia null durante la chiamata del metodo. + +jmx.rest.client.attribute.list.null=CWWKX0212E: L'argomento AttributeList \u00e8 null. +jmx.rest.client.attribute.list.null.explanation=L'argomento AttributeList non deve essere null. +jmx.rest.client.attribute.list.null.useraction=Fornire un argomento AttributeList che non sia null durante la chiamata del metodo. + +jmx.rest.client.object.name.null=CWWKX0213E: L'argomento ObjectName \u00e8 null. +jmx.rest.client.object.name.null.explanation=L'argomento ObjectName non deve essere null. +jmx.rest.client.object.name.null.useraction=Fornire un argomento ObjectName che non sia null durante la chiamata del metodo. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Un oggetto Throwable imprevisto \u00e8 stato restituito dal server. +jmx.rest.client.unexpected.server.throwable.explanation=L'eccezione include un oggetto Throwable restituito dal server che normalmente non \u00e8 previsto per questa operazione. +jmx.rest.client.unexpected.server.throwable.useraction=Per ulteriori informazioni, esaminare i log del server. + +jmx.rest.client.bad.credentials=CWWKX0215E: Si \u00e8 verificato un problema con il nome utente o la password forniti. Il server ha risposto con il codice {0} e il messaggio ''{1}'' +jmx.rest.client.bad.credentials.explanation=Le credenziali fornite durante il tentativo di ottenere una connessione non erano corrette. L'utente non esiste o non dispone dell'autorizzazione per accedere al server, oppure la password non \u00e8 corretta. +jmx.rest.client.bad.credentials.useraction=Correggere il nome utente o la password, quindi ottenere la connessione. + +jmx.rest.client.object.name.pattern=CWWKX0216E: L''argomento ObjectName ''{0}'' \u00e8 un pattern." +jmx.rest.client.object.name.pattern.explanation=L'argomento ObjectName \u00e8 un pattern, ma il metodo richiede un ObjectName che corrisponda esattamente a un MBean. +jmx.rest.client.object.name.pattern.useraction=Fornire un argomento ObjectName, senza caratteri jolly, che corrisponda esattamente a un MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Nessun MBean correntemente registrato con l''ObjectName fornito ''{0}'' +jmx.rest.client.instance.not.found.explanation=L'operazione richiede un MBean registrato, ma non \u00e8 stato registrato alcun MBean con l'ObjectName fornito. +jmx.rest.client.instance.not.found.useraction=Verificare che l'MBean sia registrato prima di tentare di eseguire operazioni di gestione su esso. + +jmx.rest.client.attribute.not.found=CWWKX0218E: L''MBean ''{0}'' non dispone di un attributo con il nome ''{1}'' +jmx.rest.client.attribute.not.found.explanation=L'MBean non fornisce un attributo con il nome indicato. +jmx.rest.client.attribute.not.found.useraction=Richiamare le informazioni dell'MBean per verificare quali attributi fornisce. + +jmx.rest.client.operation.not.found=CWWKX0219E: L''MBean ''{0}'' non dispone di un''operazione con il nome ''{1}'' +jmx.rest.client.operation.not.found.explanation=L'MBean non fornisce un'operazione con il nome indicato. +jmx.rest.client.operation.not.found.useraction=Richiamare le informazioni dell'MBean per verificare quali operazioni fornisce. + +jmx.rest.client.listener.not.found=CWWKX0220E: Il NotificationListener fornito non \u00e8 correntemente registrato per ricevere notifiche dall''MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=Il NotificationListener non \u00e8 stato aggiunto o \u00e8 gi\u00e0 stato rimosso e non \u00e8 correntemente registrato per ricevere notifiche dall'MBean indicato. +jmx.rest.client.listener.not.found.useraction=Assicurarsi che il codice chiamante tenga traccia di quali NotificationListener sono stati aggiunti e rimossi o catturi e gestisca l'eccezione. + +jmx.rest.client.notification.lost=CWWKX0221I: Impossibile consegnare la notifica. +jmx.rest.client.notification.lost.explanation=Non \u00e8 stato possibile consegnare una notifica a uno o pi\u00f9 NotificationListener perch\u00e9 non \u00e8 stato trovato un NotificationListener registrato o si \u00e8 verificata un'eccezione durante la consegna della notifica. +jmx.rest.client.notification.lost.useraction=Se la notifica doveva essere consegnata a un NotificationListener registrato, cercare eventuali eccezioni nei log. + +jmx.rest.client.connection.failed=CWWKX0222I: La connessione al server ha avuto esito negativo. +jmx.rest.client.connection.failed.explanation=Il server \u00e8 diventato indisponibile e non \u00e8 tornato disponibile entro il tempo massimo consentito configurato. +jmx.rest.client.connection.failed.useraction=Controllare la connessione di rete e assicurarsi che il server sia in esecuzione con la funzione connettore REST abilitata. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: La connessione al server \u00e8 stata temporaneamente persa. +jmx.rest.client.connection.temporarily.lost.explanation=Il server \u00e8 diventato indisponibile, ma il client tenter\u00e0 di ripristinare la connessione per la durata del tempo massimo consentito configurato. +jmx.rest.client.connection.temporarily.lost.useraction=Se il riavvio del server \u00e8 intenzionale, non sono richieste azioni. In caso contrario, controllare la connessione di rete e assicurarsi che il server sia in esecuzione con la funzione connettore REST abilitata. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: La connessione \u00e8 stata ripristinata, ma si sono verificate eccezioni durante l'aggiunta dei NotificationListener. +jmx.rest.client.connection.restored.with.exceptions.explanation=La connessione al server \u00e8 stata temporaneamente persa, ma \u00e8 stata correttamente ripristinata. Si sono verificate eccezioni durante l'aggiunta dei NotificationListener, quindi \u00e8 possibile che non si ricevano alcune notifiche. +jmx.rest.client.connection.restored.with.exceptions.useraction=Controllare le eccezioni incluse con la notifica e registrare nuovamente i NotificationListener dopo aver risolto i problemi. + +jmx.rest.client.connection.restored=CWWKX0225I: La connessione \u00e8 stata ripristinata correttamente. +jmx.rest.client.connection.restored.explanation=La connessione al server \u00e8 stata temporaneamente persa, ma \u00e8 stata correttamente ripristinata. Tutti i NotificationListener registrati continueranno a ricevere le notifiche. +jmx.rest.client.connection.restored.useraction=Nessuno + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Il parametro di tipo JMXServiceURL non pu\u00f2 essere null. +jmx.rest.client.connection.illegal.argument.explanation=Il valore per il parametro 'serviceURL' non pu\u00f2 essere null. +jmx.rest.client.connection.illegal.argument.useraction=Ripetere la connessione al connettore REST JMX utilizzando un valore JMXServiceURL che non sia null. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: Il seguente valore endpoint non \u00e8 valido: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=Il valore endpoint specificato non \u00e8 valido. +jmx.rest.client.connection.invalid.endpoint.useraction=Ripetere la connessione al connettore REST JMX utilizzando un valore endpoint valido di tipo stringa e nel formato "host:porta". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Impossibile trovare endpoint disponibili per inizializzare il connettore. +jmx.rest.client.connection.no.endpoints.explanation=Nessuno degli endpoint specificati era disponibile durante l'inizializzazione del connettore REST JMX. +jmx.rest.client.connection.no.endpoints.useraction=Ripetere la connessione al connettore REST JMX utilizzando almeno un endpoint disponibile. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Si \u00e8 verificato un problema con le credenziali utente fornite. Il server ha risposto con il codice {0} e il messaggio ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=Le credenziali utente fornite non sono corrette, sono scadute, incomplete oppure non dispongono dell'autorizzazione. +jmx.rest.client.bad.user.credentials.useraction=Verificare che le credenziali utente dispongano dell'autenticazione e dell'autorizzazione corrette, quindi ottenere una nuova connessione. + +jmx.rest.client.connection.connect=CWWKX0230I: Il membro collective ha aperto il client JMX sul collective controller: {0} +jmx.rest.client.connection.connect.explanation=Il membro \u00e8 connesso al controllore. +jmx.rest.client.connection.connect.useraction=Nessuna azione richiesta. + +jmx.rest.client.connection.disconnect=CWWKX0231I: Il membro collective ha chiuso il client JMX dal collective controller: {0} +jmx.rest.client.connection.disconnect.explanation=Il membro \u00e8 disconnesso dal controllore. +jmx.rest.client.connection.disconnect.useraction=Nessuna azione richiesta. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ja.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ja.nlsprops new file mode 100755 index 000000000000..fd285d2741da --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ja.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u63a5\u7d9a {1} \u4e0a\u306e URL {0} \u306b\u95a2\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u8981\u6c42\u306e\u6e96\u5099\u4e2d\u306b\u30a8\u30e9\u30fc\u3092\u691c\u51fa\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.request.error.explanation=WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u8981\u6c42\u306e\u6e96\u5099\u4e2d\u306b\u30a8\u30e9\u30fc\u3092\u691c\u51fa\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.request.error.useraction=\u3055\u3089\u306a\u308b\u60c5\u5831\u304c\u306a\u3044\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.response.error=CWWKX0202E: WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u63a5\u7d9a {1} \u4e0a\u306e URL {0} \u306b\u95a2\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u306e\u5fdc\u7b54\u3092\u51e6\u7406\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.response.error.explanation=WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u306e\u5fdc\u7b54\u3092\u51e6\u7406\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.response.error.useraction=\u3055\u3089\u306a\u308b\u60c5\u5831\u304c\u306a\u3044\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.response.code.error=CWWKX0203E: WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u63a5\u7d9a {3} \u4e0a\u306e URL {2} \u306b\u95a2\u3059\u308b\u30e1\u30c3\u30bb\u30fc\u30b8 ''{1}'' \u4ed8\u304d\u306e\u4e88\u671f\u3057\u306a\u3044\u5fdc\u7b54\u30b3\u30fc\u30c9 {0} \u3092\u53d7\u4fe1\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.response.code.error.explanation=WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u4e88\u671f\u3057\u306a\u3044\u5fdc\u7b54\u30b3\u30fc\u30c9\u3092\u53d7\u4fe1\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.response.code.error.useraction=\u3055\u3089\u306a\u308b\u60c5\u5831\u304c\u306a\u3044\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.server.throwable.exception=CWWKX0204E: \u30b5\u30fc\u30d0\u30fc\u30fb\u30a8\u30e9\u30fc\u30fb\u30b9\u30c8\u30ea\u30fc\u30e0\u304b\u3089 Throwable \u3092\u89e3\u6790\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.server.throwable.exception.explanation=\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u8981\u6c42\u306e\u51e6\u7406\u4e2d\u306b\u30b5\u30fc\u30d0\u30fc\u3067\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u304c\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306f\u30b5\u30fc\u30d0\u30fc\u30fb\u30a8\u30e9\u30fc\u30fb\u30b9\u30c8\u30ea\u30fc\u30e0\u304b\u3089 Throwable \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u89e3\u6790\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 Throwable \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30af\u30e9\u30b9\u304c\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3067\u4f7f\u7528\u3067\u304d\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +jmx.rest.client.server.throwable.exception.useraction=\u3055\u3089\u306a\u308b\u60c5\u5831\u304c\u306a\u3044\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.not.connected=CWWKX0206E: \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306f\u30b5\u30fc\u30d0\u30fc\u306b\u63a5\u7d9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +jmx.rest.client.not.connected.explanation=\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u304c\u30af\u30ed\u30fc\u30ba\u3057\u305f\u304b\u3001\u307e\u305f\u306f\u5931\u6557\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.not.connected.useraction=REST \u30b3\u30cd\u30af\u30bf\u30fc\u30fb\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u304c\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067\u4f7f\u7528\u53ef\u80fd\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3001\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u65b0\u898f\u63a5\u7d9a\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.url.not.found=CWWKX0207E: \u30b5\u30fc\u30d0\u30fc\u3067\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u3088\u3063\u3066\u8981\u6c42\u3055\u308c\u305f URL \u304c\u898b\u3064\u304b\u3089\u306a\u3044\u3053\u3068\u304c\u5831\u544a\u3055\u308c\u307e\u3057\u305f\u3002 +jmx.rest.client.url.not.found.explanation=\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u53e4\u3044\u60c5\u5831\u304c\u4fdd\u6301\u3055\u308c\u3066\u3044\u308b\u304b\u3001\u307e\u305f\u306f\u30b5\u30fc\u30d0\u30fc\u4e0a\u306e REST \u30b3\u30cd\u30af\u30bf\u30fc\u30fb\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u304c\u4f7f\u7528\u4e0d\u53ef\u306b\u306a\u3063\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +jmx.rest.client.url.not.found.useraction=REST \u30b3\u30cd\u30af\u30bf\u30fc\u30fb\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u304c\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067\u4f7f\u7528\u53ef\u80fd\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3001\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u65b0\u898f\u63a5\u7d9a\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.class.name.null=CWWKX0208E: \u30af\u30e9\u30b9\u540d\u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.class.name.null.explanation=\u30af\u30e9\u30b9\u540d\u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.class.name.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e\u30af\u30e9\u30b9\u540d\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.attribute.name.null=CWWKX0209E: \u5c5e\u6027\u540d\u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.attribute.name.null.explanation=\u5c5e\u6027\u540d\u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.attribute.name.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e\u5c5e\u6027\u540d\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.attribute.names.null=CWWKX0210E: \u5c5e\u6027\u540d\u306e\u914d\u5217\u3092\u542b\u3080\u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.attribute.names.null.explanation=\u5c5e\u6027\u540d\u306e\u914d\u5217\u3092\u542b\u3080\u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.attribute.names.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e\u5c5e\u6027\u540d\u306e\u914d\u5217\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.attribute.null=CWWKX0211E: Attribute \u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.attribute.null.explanation=Attribute \u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.attribute.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e Attribute \u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.attribute.list.null=CWWKX0212E: AttributeList \u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.attribute.list.null.explanation=AttributeList \u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.attribute.list.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e AttributeList \u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.object.name.null=CWWKX0213E: ObjectName \u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.object.name.null.explanation=ObjectName \u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.object.name.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e ObjectName \u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: \u30b5\u30fc\u30d0\u30fc\u304b\u3089\u4e88\u671f\u3057\u306a\u3044 Throwable \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u8fd4\u3055\u308c\u307e\u3057\u305f\u3002 +jmx.rest.client.unexpected.server.throwable.explanation=\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u8fd4\u3055\u308c\u305f\u3001\u3053\u306e\u64cd\u4f5c\u306b\u5bfe\u3057\u3066\u901a\u5e38\u306f\u4e88\u671f\u3055\u308c\u306a\u3044 Throwable \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4f8b\u5916\u306b\u3088\u308a\u30e9\u30c3\u30d7\u3055\u308c\u3066\u3044\u307e\u3059\u3002 +jmx.rest.client.unexpected.server.throwable.useraction=\u3055\u3089\u306a\u308b\u60c5\u5831\u304c\u306a\u3044\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.bad.credentials=CWWKX0215E: \u6307\u5b9a\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u540d\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u306b\u554f\u984c\u304c\u3042\u308a\u307e\u3059\u3002 \u30b5\u30fc\u30d0\u30fc\u306f\u3001\u30b3\u30fc\u30c9 {0}\u3001\u30e1\u30c3\u30bb\u30fc\u30b8 ''{1}'' \u3067\u5fdc\u7b54\u3057\u307e\u3057\u305f +jmx.rest.client.bad.credentials.explanation=\u63a5\u7d9a\u306e\u53d6\u5f97\u6642\u306b\u6307\u5b9a\u3057\u305f\u8cc7\u683c\u60c5\u5831\u306b\u8aa4\u308a\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u30e6\u30fc\u30b6\u30fc\u304c\u5b58\u5728\u3057\u306a\u3044\u304b\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u304c\u306a\u3044\u304b\u3001\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u306b\u8aa4\u308a\u304c\u3042\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +jmx.rest.client.bad.credentials.useraction=\u30e6\u30fc\u30b6\u30fc\u540d\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a02\u6b63\u3057\u3066\u304b\u3089\u65b0\u898f\u63a5\u7d9a\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.object.name.pattern=CWWKX0216E: ObjectName \u5f15\u6570 ''{0}'' \u306f\u30d1\u30bf\u30fc\u30f3\u3067\u3059\u3002 +jmx.rest.client.object.name.pattern.explanation=ObjectName \u5f15\u6570\u304c\u30d1\u30bf\u30fc\u30f3\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u30e1\u30bd\u30c3\u30c9\u306b\u306f\u30011 \u3064\u306e MBean \u3068\u5b8c\u5168\u306b\u4e00\u81f4\u3059\u308b ObjectName \u304c\u5fc5\u8981\u3067\u3059\u3002 +jmx.rest.client.object.name.pattern.useraction=1 \u3064\u306e MBean \u3068\u5b8c\u5168\u306b\u4e00\u81f4\u3059\u308b\u3001\u30ef\u30a4\u30eb\u30c9\u30ab\u30fc\u30c9\u306a\u3057\u306e ObjectName \u5f15\u6570\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.instance.not.found=CWWKX0217E: \u6307\u5b9a\u3055\u308c\u305f ObjectName ''{0}'' \u306b\u73fe\u5728\u767b\u9332\u6e08\u307f\u306e MBean \u306f\u3042\u308a\u307e\u305b\u3093 +jmx.rest.client.instance.not.found.explanation=\u3053\u306e\u64cd\u4f5c\u306b\u306f\u767b\u9332\u6e08\u307f\u306e MBean \u304c\u5fc5\u8981\u3067\u3059\u304c\u3001\u6307\u5b9a\u3055\u308c\u305f ObjectName \u306e MBean \u306f\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.instance.not.found.useraction=MBean \u304c\u767b\u9332\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u3001\u3053\u308c\u306b\u5bfe\u3059\u308b\u7ba1\u7406\u64cd\u4f5c\u3092\u5b9f\u884c\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.attribute.not.found=CWWKX0218E: MBean ''{0}'' \u306b ''{1}'' \u3068\u3044\u3046\u540d\u524d\u306e\u5c5e\u6027\u306f\u3042\u308a\u307e\u305b\u3093 +jmx.rest.client.attribute.not.found.explanation=\u6307\u5b9a\u3055\u308c\u305f\u540d\u524d\u306e\u5c5e\u6027\u306f MBean \u3067\u306f\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +jmx.rest.client.attribute.not.found.useraction=MBean \u60c5\u5831\u3092\u53d6\u5f97\u3057\u3066\u3001MBean \u304c\u63d0\u4f9b\u3059\u308b\u5c5e\u6027\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.operation.not.found=CWWKX0219E: MBean ''{0}'' \u306b ''{1}'' \u3068\u3044\u3046\u540d\u524d\u306e\u64cd\u4f5c\u306f\u3042\u308a\u307e\u305b\u3093 +jmx.rest.client.operation.not.found.explanation=\u6307\u5b9a\u3055\u308c\u305f\u540d\u524d\u306e\u64cd\u4f5c\u306f MBean \u3067\u306f\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +jmx.rest.client.operation.not.found.useraction=MBean \u60c5\u5831\u3092\u53d6\u5f97\u3057\u3066\u3001MBean \u304c\u63d0\u4f9b\u3059\u308b\u64cd\u4f5c\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.listener.not.found=CWWKX0220E: \u6307\u5b9a\u3055\u308c\u305f NotificationListener \u306f\u73fe\u5728\u3001MBean ''{0}'' \u304b\u3089\u306e\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b\u3088\u3046\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u305b\u3093 +jmx.rest.client.listener.not.found.explanation=NotificationListener \u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u306a\u3044\u304b\u3001\u307e\u305f\u306f\u65e2\u306b\u524a\u9664\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u73fe\u5728\u3001\u6307\u5b9a\u3055\u308c\u305f MBean \u304b\u3089\u306e\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b\u3088\u3046\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +jmx.rest.client.listener.not.found.useraction=\u547c\u3073\u51fa\u3057\u30b3\u30fc\u30c9\u3067\u3001\u3069\u306e NotificationListener \u304c\u8ffd\u52a0\u304a\u3088\u3073\u524a\u9664\u3055\u308c\u305f\u304b\u3092\u8ffd\u8de1\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u304b\u3001\u307e\u305f\u306f\u4f8b\u5916\u3092\u30ad\u30e3\u30c3\u30c1\u3057\u3066\u51e6\u7406\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.notification.lost=CWWKX0221I: \u901a\u77e5\u3092\u9001\u4fe1\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.notification.lost.explanation=\u767b\u9332\u6e08\u307f\u306e NotificationListener \u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u304b\u3001\u901a\u77e5\u306e\u9001\u4fe1\u4e2d\u306b\u4f8b\u5916\u304c\u767a\u751f\u3057\u305f\u305f\u3081\u30011 \u3064\u4ee5\u4e0a\u306e NotificationListener \u306b\u3053\u306e\u901a\u77e5\u3092\u9001\u4fe1\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.notification.lost.useraction=\u767b\u9332\u6e08\u307f\u306e NotificationListener \u306b\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u3066\u3044\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u4f8b\u5916\u304c\u306a\u3044\u304b\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.failed=CWWKX0222I: \u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u304c\u5931\u6557\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.failed.explanation=\u30b5\u30fc\u30d0\u30fc\u304c\u4f7f\u7528\u4e0d\u53ef\u306b\u306a\u308a\u3001\u3055\u3089\u306b\u3001\u69cb\u6210\u6e08\u307f\u306e\u6700\u5927\u8a31\u5bb9\u6642\u9593\u5185\u306b\u518d\u5ea6\u4f7f\u7528\u53ef\u80fd\u306b\u306a\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.connection.failed.useraction=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u63a5\u7d9a\u3092\u78ba\u8a8d\u3057\u3001REST \u30b3\u30cd\u30af\u30bf\u30fc\u30fb\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u304c\u4f7f\u7528\u53ef\u80fd\u306a\u72b6\u614b\u3067\u30b5\u30fc\u30d0\u30fc\u304c\u7a3c\u50cd\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: \u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u304c\u4e00\u6642\u7684\u306b\u5931\u308f\u308c\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.temporarily.lost.explanation=\u30b5\u30fc\u30d0\u30fc\u306f\u4f7f\u7528\u4e0d\u53ef\u306b\u306a\u308a\u307e\u3057\u305f\u304c\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306f\u69cb\u6210\u6e08\u307f\u306e\u6700\u5927\u8a31\u5bb9\u6642\u9593\u4e2d\u306b\u63a5\u7d9a\u306e\u5fa9\u5143\u3092\u8a66\u884c\u3057\u307e\u3059\u3002 +jmx.rest.client.connection.temporarily.lost.useraction=\u30b5\u30fc\u30d0\u30fc\u304c\u610f\u56f3\u7684\u306b\u518d\u59cb\u52d5\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 \u305d\u308c\u4ee5\u5916\u306e\u5834\u5408\u306b\u306f\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u63a5\u7d9a\u3092\u78ba\u8a8d\u3057\u3001REST \u30b3\u30cd\u30af\u30bf\u30fc\u30fb\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u304c\u4f7f\u7528\u53ef\u80fd\u306a\u72b6\u614b\u3067\u30b5\u30fc\u30d0\u30fc\u304c\u7a3c\u50cd\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: \u63a5\u7d9a\u306f\u5fa9\u5143\u3055\u308c\u307e\u3057\u305f\u304c\u3001NotificationListener \u306e\u8ffd\u52a0\u6642\u306b\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.restored.with.exceptions.explanation=\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u306f\u4e00\u6642\u7684\u306b\u5931\u308f\u308c\u307e\u3057\u305f\u304c\u3001\u6b63\u5e38\u306b\u5fa9\u5143\u3055\u308c\u307e\u3057\u305f\u3002 NotificationListener \u306e\u8ffd\u52a0\u6642\u306b\u4f8b\u5916\u304c\u767a\u751f\u3057\u305f\u305f\u3081\u3001\u4e00\u90e8\u306e\u901a\u77e5\u304c\u53d7\u3051\u53d6\u3089\u308c\u3066\u3044\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +jmx.rest.client.connection.restored.with.exceptions.useraction=\u901a\u77e5\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u4f8b\u5916\u3092\u78ba\u8a8d\u3057\u3001\u554f\u984c\u306e\u8a02\u6b63\u5f8c\u306b NotificationListener \u3092\u518d\u767b\u9332\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.restored=CWWKX0225I: \u63a5\u7d9a\u304c\u6b63\u5e38\u306b\u5fa9\u5143\u3055\u308c\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.restored.explanation=\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u306f\u4e00\u6642\u7684\u306b\u5931\u308f\u308c\u307e\u3057\u305f\u304c\u3001\u6b63\u5e38\u306b\u5fa9\u5143\u3055\u308c\u307e\u3057\u305f\u3002 \u767b\u9332\u6e08\u307f\u306e NotificationListener \u306f\u5f15\u304d\u7d9a\u304d\u901a\u77e5\u306e\u53d7\u3051\u53d6\u308a\u3092\u884c\u3044\u307e\u3059\u3002 +jmx.rest.client.connection.restored.useraction=\u306a\u3057 + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: \u30bf\u30a4\u30d7 JMXServiceURL \u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306f\u30cc\u30eb\u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.connection.illegal.argument.explanation=\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u300cserviceURL\u300d\u306e\u5024\u3092\u30cc\u30eb\u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.connection.illegal.argument.useraction=\u30cc\u30eb\u4ee5\u5916\u306e JMXServiceURL \u306e\u5024\u3092\u4f7f\u7528\u3057\u3066 JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306b\u518d\u63a5\u7d9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: \u6b21\u306e\u5024\u306f\u6709\u52b9\u306a\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u5024\u3067\u306f\u3042\u308a\u307e\u305b\u3093: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=\u6307\u5b9a\u3055\u308c\u305f\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u5024\u304c\u7121\u52b9\u3067\u3059\u3002 +jmx.rest.client.connection.invalid.endpoint.useraction=\u30bf\u30a4\u30d7\u304c\u30b9\u30c8\u30ea\u30f3\u30b0\u3067\u3001\u300chost:port\u300d\u306e\u5f62\u5f0f\u306e\u6709\u52b9\u306a\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u5024\u3092\u4f7f\u7528\u3057\u3066 JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306b\u518d\u63a5\u7d9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: \u30b3\u30cd\u30af\u30bf\u30fc\u3092\u521d\u671f\u8a2d\u5b9a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u53ef\u80fd\u306a\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u898b\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.connection.no.endpoints.explanation=\u6307\u5b9a\u3055\u308c\u305f\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306f\u3001JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306e\u521d\u671f\u8a2d\u5b9a\u6642\u306b\u3044\u305a\u308c\u3082\u4f7f\u7528\u53ef\u80fd\u3067\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.connection.no.endpoints.useraction=\u4f7f\u7528\u53ef\u80fd\u306a\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u5c11\u306a\u304f\u3068\u3082 1 \u3064\u4f7f\u7528\u3057\u3066 JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306b\u518d\u63a5\u7d9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.bad.user.credentials=CWWKX0229E: \u6307\u5b9a\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u8cc7\u683c\u60c5\u5831\u306b\u554f\u984c\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u30b5\u30fc\u30d0\u30fc\u306f\u3001\u30b3\u30fc\u30c9 {0}\u3001\u30e1\u30c3\u30bb\u30fc\u30b8 ''{1}'' \u3067\u5fdc\u7b54\u3057\u307e\u3057\u305f +jmx.rest.client.bad.user.credentials.explanation=\u6307\u5b9a\u3055\u308c\u305f\u8cc7\u683c\u60c5\u5831\u306f\u3001\u8aa4\u3063\u3066\u3044\u308b\u304b\u3001\u6709\u52b9\u671f\u9650\u304c\u5207\u308c\u3066\u3044\u308b\u304b\u3001\u4e0d\u5b8c\u5168\u3067\u3042\u308b\u304b\u3001\u307e\u305f\u306f\u8a31\u53ef\u304c\u62d2\u5426\u3055\u308c\u3066\u3044\u307e\u3059\u3002 +jmx.rest.client.bad.user.credentials.useraction=\u30e6\u30fc\u30b6\u30fc\u8cc7\u683c\u60c5\u5831\u304c\u3001\u6b63\u3057\u304f\u8a8d\u8a3c\u304a\u3088\u3073\u8a31\u53ef\u3055\u308c\u308b\u3082\u306e\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u3001\u65b0\u898f\u63a5\u7d9a\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.connect=CWWKX0230I: \u96c6\u5408\u30e1\u30f3\u30d0\u30fc\u306f\u3001\u96c6\u5408\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u5bfe\u3057\u3066 JMX \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u958b\u304d\u307e\u3057\u305f: {0} +jmx.rest.client.connection.connect.explanation=\u30e1\u30f3\u30d0\u30fc\u304c\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u63a5\u7d9a\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.connect.useraction=\u30a2\u30af\u30b7\u30e7\u30f3\u306f\u4e0d\u8981\u3067\u3059\u3002 + +jmx.rest.client.connection.disconnect=CWWKX0231I: \u96c6\u5408\u30e1\u30f3\u30d0\u30fc\u306f\u3001\u96c6\u5408\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304b\u3089\u306e JMX \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u9589\u3058\u307e\u3057\u305f: {0} +jmx.rest.client.connection.disconnect.explanation=\u30e1\u30f3\u30d0\u30fc\u304c\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3068\u306e\u63a5\u7d9a\u3092\u5207\u65ad\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.disconnect.useraction=\u30a2\u30af\u30b7\u30e7\u30f3\u306f\u4e0d\u8981\u3067\u3059\u3002 + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ko.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ko.nlsprops new file mode 100755 index 000000000000..5b0b222d7fbf --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ko.nlsprops @@ -0,0 +1,144 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc5f0\uacb0 {1}\uc5d0\uc11c URL {0}\uc758 \uc11c\ubc84\ub85c \uc694\uccad\uc744 \uc900\ube44\ud558\ub294 \ub3d9\uc548 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.request.error.explanation=WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84\uc758 \uc694\uccad\uc744 \uc900\ube44\ud558\ub294 \ub3d9\uc548 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.request.error.useraction=\uc790\uc138\ud55c \uc815\ubcf4\ub294 \uc11c\ubc84 \ub85c\uadf8\ub97c \uc0b4\ud3b4\ubcf4\uc2ed\uc2dc\uc624. + +jmx.rest.client.response.error=CWWKX0202E: WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc5f0\uacb0 {1}\uc5d0\uc11c URL {0}\uc758 \uc11c\ubc84\uc5d0\uc11c \uc751\ub2f5\uc744 \ucc98\ub9ac\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.response.error.explanation=WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84\uc5d0\uc11c \uc751\ub2f5\uc744 \ucc98\ub9ac\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.response.error.useraction=\uc790\uc138\ud55c \uc815\ubcf4\ub294 \uc11c\ubc84 \ub85c\uadf8\ub97c \uc0b4\ud3b4\ubcf4\uc2ed\uc2dc\uc624. + +jmx.rest.client.response.code.error=CWWKX0203E: WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc5f0\uacb0 {3}\uc5d0\uc11c URL {2}\uc758 \uc11c\ubc84\uc5d0\uc11c \uba54\uc2dc\uc9c0 ''{1}''\uc774(\uac00) \ud45c\uc2dc\ub418\ub294 \uc608\uc0c1\uce58 \uc54a\uc740 \uc751\ub2f5 \ucf54\ub4dc{0}\uc744(\ub97c) \uc218\uc2e0\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.response.code.error.explanation=WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84\uc5d0\uc11c \uc608\uc0c1\uce58 \uc54a\uc740 \uc751\ub2f5 \ucf54\ub4dc\ub97c \uc218\uc2e0\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.response.code.error.useraction=\uc790\uc138\ud55c \uc815\ubcf4\ub294 \uc11c\ubc84 \ub85c\uadf8\ub97c \uc0b4\ud3b4\ubcf4\uc2ed\uc2dc\uc624. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: \uc11c\ubc84 \uc624\ub958 \uc2a4\ud2b8\ub9bc\uc5d0\uc11c Throwable\uc744 \uad6c\ubb38 \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.server.throwable.exception.explanation=\uc11c\ubc84\uc5d0\uc11c \ud074\ub77c\uc774\uc5b8\ud2b8 \uc694\uccad\uc744 \ucc98\ub9ac\ud558\ub294 \uc911\uc5d0 \uc608\uc678\uac00 \ubc1c\uc0dd\ud588\uc9c0\ub9cc \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84 \uc624\ub958 \uc2a4\ud2b8\ub9bc\uc5d0\uc11c Throwable \uc624\ube0c\uc81d\ud2b8\ub97c \uad6c\ubb38 \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0\uc11c Throwable \uc624\ube0c\uc81d\ud2b8\uc758 \ud074\ub798\uc2a4\uac00 \uc0ac\uc6a9 \uac00\ub2a5\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.server.throwable.exception.useraction=\uc790\uc138\ud55c \uc815\ubcf4\ub294 \uc11c\ubc84 \ub85c\uadf8\ub97c \uc0b4\ud3b4\ubcf4\uc2ed\uc2dc\uc624. + +jmx.rest.client.not.connected=CWWKX0206E: \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84\uc5d0 \uc5f0\uacb0\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4. +jmx.rest.client.not.connected.explanation=\uc11c\ubc84\uc5d0 \ub300\ud55c \uc5f0\uacb0\uc774 \ub2eb\ud614\uac70\ub098 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.not.connected.useraction=\uc11c\ubc84\uc5d0\uc11c REST \ucee4\ub125\ud130 \uae30\ub2a5\uc774 \uc0ac\uc6a9 \uac00\ub2a5\ud55c\uc9c0 \ud655\uc778\ud558\uace0 \uc11c\ubc84\uc5d0 \ub300\ud55c \uc0c8 \uc5f0\uacb0\uc744 \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +jmx.rest.client.url.not.found=CWWKX0207E: \uc11c\ubc84\ub294 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc694\uccad\ud55c URL\uc744 \ucc3e\uc744 \uc218 \uc5c6\ub2e4\uace0 \ubcf4\uace0\ud569\ub2c8\ub2e4. +jmx.rest.client.url.not.found.explanation=\ud074\ub77c\uc774\uc5b8\ud2b8\uc758 \uc815\ubcf4\uac00 \uc720\ud6a8 \uae30\uac04\uc774 \uc9c0\ub0ac\uac70\ub098 \uc11c\ubc84\uc758 REST \ucee4\ub125\ud130 \uae30\ub2a5\uc744 \uc0ac\uc6a9 \uc548\ud569\ub2c8\ub2e4. +jmx.rest.client.url.not.found.useraction=\uc11c\ubc84\uc5d0\uc11c REST \ucee4\ub125\ud130 \uae30\ub2a5\uc774 \uc0ac\uc6a9 \uac00\ub2a5\ud55c\uc9c0 \ud655\uc778\ud558\uace0 \uc11c\ubc84\uc5d0 \ub300\ud55c \uc0c8 \uc5f0\uacb0\uc744 \uc5bb\uc73c\uc2ed\uc2dc\uc624. +jmx.rest.client.class.name.null=CWWKX0208E: \ud074\ub798\uc2a4 \uc774\ub984 \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.class.name.null.explanation=\ud074\ub798\uc2a4 \uc774\ub984 \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.class.name.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc \ud074\ub798\uc2a4 \uc774\ub984\uc744 \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.attribute.name.null=CWWKX0209E: \uc18d\uc131 \uc774\ub984 \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.attribute.name.null.explanation=\uc18d\uc131 \uc774\ub984 \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.attribute.name.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc \uc18d\uc131 \uc774\ub984\uc744 \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.attribute.names.null=CWWKX0210E: \uc18d\uc131 \uc774\ub984 \ubc30\uc5f4\uc744 \ud3ec\ud568\ud558\ub294 \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.attribute.names.null.explanation=\uc18d\uc131 \uc774\ub984 \ubc30\uc5f4\uc744 \ud3ec\ud568\ud558\ub294 \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.attribute.names.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc \uc18d\uc131 \uc774\ub984 \ubc30\uc5f4\uc744 \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.attribute.null=CWWKX0211E: \uc18d\uc131 \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.attribute.null.explanation=\uc18d\uc131 \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.attribute.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc \uc18d\uc131\uc744 \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.attribute.list.null=CWWKX0212E: AttributeList \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.attribute.list.null.explanation=AttributeList \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.attribute.list.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc AttributeList\ub97c \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.object.name.null=CWWKX0213E: ObjectName \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.object.name.null.explanation=ObjectName \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.object.name.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc ObjectName\uc744 \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: \uc11c\ubc84\uc5d0\uc11c \uc608\uae30\uce58 \ubabb\ud55c Throwable \uc624\ube0c\uc81d\ud2b8\uac00 \ub9ac\ud134\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.unexpected.server.throwable.explanation=\uc608\uc678\uac00 \uc11c\ubc84\uc5d0\uc11c \ub9ac\ud134\ub41c Throwable \uc624\ube0c\uc81d\ud2b8(\uc77c\ubc18\uc801\uc73c\ub85c \uc774 \uc870\uc791\uc5d0\ub294 \ubc1c\uc0dd\ud558\uc9c0 \uc54a\uc74c)\ub97c \ub7a9\ud551\ud569\ub2c8\ub2e4. +jmx.rest.client.unexpected.server.throwable.useraction=\uc790\uc138\ud55c \uc815\ubcf4\ub294 \uc11c\ubc84 \ub85c\uadf8\ub97c \uc0b4\ud3b4\ubcf4\uc2ed\uc2dc\uc624. + +jmx.rest.client.bad.credentials=CWWKX0215E: \uc81c\uacf5\ub41c \uc0ac\uc6a9\uc790 \uc774\ub984 \ub610\ub294 \ube44\ubc00\ubc88\ud638\uc5d0 \ubb38\uc81c\uc810\uc774 \uc788\uc2b5\ub2c8\ub2e4. \uc11c\ubc84\uac00 \ucf54\ub4dc {0} \ubc0f ''{1}'' \uba54\uc2dc\uc9c0\ub85c \uc751\ub2f5\ud569\ub2c8\ub2e4. +jmx.rest.client.bad.credentials.explanation=\uc5f0\uacb0\uc744 \uc5bb\uc744 \ub54c \uc81c\uacf5\ub41c \uc2e0\uc784 \uc815\ubcf4\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \uc0ac\uc6a9\uc790\uac00 \uc5c6\uac70\ub098 \uc11c\ubc84\uc5d0 \uc561\uc138\uc2a4\ud560 \uad8c\ud55c\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. \ub610\ub294 \ube44\ubc00\ubc88\ud638\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.bad.credentials.useraction=\uc0ac\uc6a9\uc790 \uc774\ub984 \ub610\ub294 \ube44\ubc00\ubc88\ud638\ub97c \uc815\uc815\ud55c \ub2e4\uc74c \uc0c8 \uc5f0\uacb0\uc744 \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +jmx.rest.client.object.name.pattern=CWWKX0216E: ObjectName \uc778\uc218 ''{0}''\uc774(\uac00) \ud328\ud134\uc785\ub2c8\ub2e4." +jmx.rest.client.object.name.pattern.explanation=ObjectName \uc778\uc218\uac00 \ud328\ud134\uc785\ub2c8\ub2e4. \uadf8\ub7ec\ub098 \uba54\uc18c\ub4dc\uc5d0\ub294 \ub2e8 \ud558\ub098\uc758 MBean\uacfc \uc77c\uce58\ud558\ub294 ObjectName\uc774 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.object.name.pattern.useraction=\ub2e8 \ud558\ub098\uc758 MBean\uacfc \uc77c\uce58\ud558\ub3c4\ub85d \uc640\uc77c\ub4dc\uce74\ub4dc\uac00 \uc5c6\ub294 ObjectName \uc778\uc218\ub97c \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.instance.not.found=CWWKX0217E: \ud604\uc7ac \uc9c0\uc815\ub41c ObjectName ''{0}''(\uc73c)\ub85c \ub4f1\ub85d\ub41c MBean\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.instance.not.found.explanation=\uc870\uc791\uc744 \uc218\ud589\ud558\ub824\uba74 \ub4f1\ub85d\ub41c MBean\uc774 \ud544\uc694\ud558\uc9c0\ub9cc \uc9c0\uc815\ub41c ObjectName\uc73c\ub85c \ub4f1\ub85d\ub41c MBean\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.instance.not.found.useraction=\uad00\ub9ac \uc870\uc791\uc744 \uc218\ud589\ud558\uae30 \uc804\uc5d0 MBean\uc774 \ub4f1\ub85d\ub418\uc5c8\ub294\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.attribute.not.found=CWWKX0218E: MBean ''{0}''\uc5d0 ''{1}''(\uc774)\ub77c\ub294 \uc18d\uc131\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.attribute.not.found.explanation=MBean\uc774 \uc9c0\uc815\ub41c \uc774\ub984\uc758 \uc18d\uc131\uc744 \uc81c\uacf5\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.attribute.not.found.useraction=MBean\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 \uc18d\uc131\uc744 \ud655\uc778\ud558\ub824\uba74 MBean \uc815\ubcf4\ub97c \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +jmx.rest.client.operation.not.found=CWWKX0219E: MBean ''{0}''\uc5d0 ''{1}''(\uc774)\ub77c\ub294 \uc870\uc791\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.operation.not.found.explanation=MBean\uc774 \uc9c0\uc815\ub41c \uc774\ub984\uc758 \uc870\uc791\uc744 \uc81c\uacf5\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.operation.not.found.useraction=MBean\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 \uc870\uc791\uc744 \ud655\uc778\ud558\ub824\uba74 MBean \uc815\ubcf4\ub97c \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +jmx.rest.client.listener.not.found=CWWKX0220E: \ud604\uc7ac \uc9c0\uc815\ub41c NotificationListener\uac00 MBean ''{0}''\uc5d0\uc11c \uc54c\ub9bc\uc744 \uc218\uc2e0\ud558\ub3c4\ub85d \ub4f1\ub85d\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4. +jmx.rest.client.listener.not.found.explanation=NotificationListener\uac00 \ucd94\uac00\ub418\uc9c0 \uc54a\uc558\uac70\ub098 \uc774\ubbf8 \uc81c\uac70\ub418\uc5c8\uc73c\uba70 \ud604\uc7ac \uc9c0\uc815\ub41c MBean\uc5d0\uc11c \uc54c\ub9bc\uc744 \uc218\uc2e0\ud558\ub3c4\ub85d \ub4f1\ub85d\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4. +jmx.rest.client.listener.not.found.useraction=\ud638\ucd9c \ucf54\ub4dc\uac00 \ucd94\uac00 \ubc0f \uc81c\uac70\ub41c NotificationListener\ub97c \ucd94\uc801\ud558\uac70\ub098 \uc608\uc678\ub97c \ubc1c\uacac\ud558\uace0 \ucc98\ub9ac\ud558\ub3c4\ub85d \ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.notification.lost=CWWKX0221I: \uc54c\ub9bc\uc744 \uc804\ub2ec\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.notification.lost.explanation=\ub4f1\ub85d\ub41c NotificationListener\ub97c \ucc3e\uc744 \uc218 \uc5c6\uac70\ub098 \uc54c\ub9bc\uc744 \uc804\ub2ec\ud558\ub294 \uc911\uc5d0 \uc608\uc678\uac00 \ubc1c\uc0dd\ud588\uc73c\ubbc0\ub85c \uc54c\ub9bc\uc744 \ud558\ub098 \uc774\uc0c1\uc758 NotificationListener\uc5d0 \uc804\ub2ec\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.notification.lost.useraction=\ub4f1\ub85d\ub41c NotificationListener\uc5d0 \uc54c\ub9bc\uc744 \uc804\ub2ec\ud588\uc5b4\uc57c \ud558\ub294 \uacbd\uc6b0 \uc608\uc678\uc5d0 \ub300\ud55c \ub85c\uadf8\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.failed=CWWKX0222I: \uc11c\ubc84\uc5d0 \uc5f0\uacb0\ud558\ub294 \ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.failed.explanation=\uc11c\ubc84\uac00 \uc0ac\uc6a9 \ubd88\uac00\ub2a5\ud558\uac8c \ub418\uc5c8\uac70\ub098 \ud5c8\uc6a9 \uac00\ub2a5\ud558\ub3c4\ub85d \uad6c\uc131\ub41c \ucd5c\ub300 \uc2dc\uac04 \uc548\uc5d0 \ub2e4\uc2dc \uc0ac\uc6a9 \uac00\ub2a5\ud558\uac8c \ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.failed.useraction=\ub124\ud2b8\uc6cc\ud06c \uc5f0\uacb0\uc744 \ud655\uc778\ud558\uace0 \uc11c\ubc84\uac00 REST \ucee4\ub125\ud130 \uae30\ub2a5\uc774 \uc0ac\uc6a9\ub418\uc5b4 \uc2e4\ud589 \uc911\uc778\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: \uc11c\ubc84\uc5d0 \ub300\ud55c \uc5f0\uacb0\uc774 \uc784\uc2dc\ub85c \uc720\uc2e4\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.temporarily.lost.explanation=\uc11c\ubc84\uac00 \uc0ac\uc6a9 \ubd88\uac00\ub2a5\ud558\uc9c0\ub9cc \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \ud5c8\uc6a9 \uac00\ub2a5\ud558\ub3c4\ub85d \uad6c\uc131\ub41c \ucd5c\ub300 \uc2dc\uac04 \ub3d9\uc548 \uc5f0\uacb0\uc744 \ubcf5\uc6d0\ud558\ub824\uace0 \uc2dc\ub3c4\ud569\ub2c8\ub2e4. +jmx.rest.client.connection.temporarily.lost.useraction=\uc11c\ubc84\ub97c \uc758\ub3c4\uc801\uc73c\ub85c \ub2e4\uc2dc \uc2dc\uc791\ud558\ub294 \uacbd\uc6b0 \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \uadf8\ub807\uc9c0 \uc54a\uc73c\uba74 \ub124\ud2b8\uc6cc\ud06c \uc5f0\uacb0\uc744 \ud655\uc778\ud558\uace0 \uc11c\ubc84\uac00 REST \ucee4\ub125\ud130 \uae30\ub2a5\uc774 \uc0ac\uc6a9\ub418\uc5b4 \uc2e4\ud589 \uc911\uc778\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: \uc5f0\uacb0\uc774 \ubcf5\uc6d0\ub418\uc5c8\uc9c0\ub9cc NotificationListener\ub97c \ucd94\uac00\ud560 \ub54c \uc608\uc678\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.restored.with.exceptions.explanation=\uc11c\ubc84\uc5d0 \ub300\ud55c \uc5f0\uacb0\uc774 \uc784\uc2dc\ub85c \uc720\uc2e4\ub418\uc5c8\uc9c0\ub9cc \uc131\uacf5\uc801\uc73c\ub85c \ubcf5\uc6d0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. NotificationListener\ub97c \ucd94\uac00\ud558\ub294 \uc911\uc5d0 \uc608\uc678\uac00 \ubc1c\uc0dd\ud588\uc73c\ubbc0\ub85c \uc77c\ubd80 \uc54c\ub9bc\uc740 \uc218\uc2e0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.restored.with.exceptions.useraction=\uc54c\ub9bc\uc5d0 \ud3ec\ud568\ub41c \uc608\uc678\ub97c \ud655\uc778\ud558\uace0 \ubb38\uc81c\uc810\uc744 \uc815\uc815\ud55c \ub2e4\uc74c NotificationListener\ub97c \ub2e4\uc2dc \ub4f1\ub85d\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.restored=CWWKX0225I: \uc5f0\uacb0\uc774 \ubcf5\uc6d0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.restored.explanation=\uc11c\ubc84\uc5d0 \ub300\ud55c \uc5f0\uacb0\uc774 \uc784\uc2dc\ub85c \uc720\uc2e4\ub418\uc5c8\uc9c0\ub9cc \uc131\uacf5\uc801\uc73c\ub85c \ubcf5\uc6d0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \ub4f1\ub85d\ub41c \ubaa8\ub4e0 NotificationListener\uac00 \uacc4\uc18d \uc54c\ub9bc\uc744 \uc218\uc2e0\ud569\ub2c8\ub2e4. +jmx.rest.client.connection.restored.useraction=\uc5c6\uc74c + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: JMXServiceURL \uc720\ud615\uc758 \ub9e4\uac1c\ubcc0\uc218\ub294 \ub110\uc77c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.illegal.argument.explanation='serviceURL' \ub9e4\uac1c\ubcc0\uc218 \uac12\uc740 \ub110\uc77c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.illegal.argument.useraction=\ub110\uc774 \uc544\ub2cc JMXServiceURL \uac12\uc744 \uc0ac\uc6a9\ud558\uc5ec JMX REST Connector\uc5d0 \ub2e4\uc2dc \uc5f0\uacb0\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: \ub2e4\uc74c\uc740 \uc720\ud6a8\ud55c \uc5d4\ub4dc\ud3ec\uc778\ud2b8 \uac12\uc774 \uc544\ub2d9\ub2c8\ub2e4. {0} +jmx.rest.client.connection.invalid.endpoint.explanation=\uc9c0\uc815\ub41c \uc5d4\ub4dc\ud3ec\uc778\ud2b8 \uac12\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.invalid.endpoint.useraction=\ubb38\uc790\uc5f4 \uc720\ud615\uc774\uace0 "host:port" \ud615\uc2dd\uc744 \uac00\uc9c0\ub294 \uc720\ud6a8\ud55c \uc5d4\ub4dc\ud3ec\uc778\ud2b8 \uac12\uc744 \uc0ac\uc6a9\ud558\uc5ec JMX REST Connector\uc5d0 \ub2e4\uc2dc \uc5f0\uacb0\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: \ucee4\ub125\ud130\ub97c \ucd08\uae30\ud654\ud560 \uc0ac\uc6a9 \uac00\ub2a5\ud55c \uc5d4\ub4dc\ud3ec\uc778\ud2b8\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.no.endpoints.explanation=JMX REST Connector\uc758 \ucd08\uae30\ud654 \uc911\uc5d0, \uc9c0\uc815\ub41c \uc5d4\ud2b8\ud3ec\uc778\ud2b8\uac00 \uc0ac\uc6a9 \uac00\ub2a5\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.no.endpoints.useraction=\ud558\ub098 \uc774\uc0c1\uc758 \uc0ac\uc6a9 \uac00\ub2a5\ud55c \uc5d4\ub4dc\ud3ec\uc778\ud2b8\ub97c \uc0ac\uc6a9\ud558\uc5ec JMX REST Connector\uc5d0 \ub2e4\uc2dc \uc5f0\uacb0\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: \uc81c\uacf5\ub41c \uc0ac\uc6a9\uc790 \uc2e0\uc784 \uc815\ubcf4\uc5d0 \ubb38\uc81c\uc810\uc774 \uc788\uc2b5\ub2c8\ub2e4. \uc11c\ubc84\uac00 \ucf54\ub4dc {0} \ubc0f ''{1}'' \uba54\uc2dc\uc9c0\ub85c \uc751\ub2f5\ud569\ub2c8\ub2e4. +jmx.rest.client.bad.user.credentials.explanation=\uc81c\uacf5\ub41c \uc2e0\uc784 \uc815\ubcf4\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uace0 \ub9cc\uae30\ub418\uc5c8\uac70\ub098 \ubd88\uc644\uc804\ud558\uba70 \ub610\ub294 \uad8c\ud55c\uc774 \uac70\ubd80\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.bad.user.credentials.useraction=\uc0ac\uc6a9\uc790 \uc2e0\uc784 \uc815\ubcf4\uc5d0 \uc62c\ubc14\ub978 \uc778\uc99d \ubc0f \uad8c\ud55c\uc774 \uc788\ub294\uc9c0 \ud655\uc778\ud55c \ub2e4\uc74c \uc0c8 \uc5f0\uacb0\uc744 \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.connect=CWWKX0230I: Collective \uba64\ubc84\uac00 Collective \uc81c\uc5b4\uae30\uc5d0 JMX \ud074\ub77c\uc774\uc5b8\ud2b8\ub97c \uc5f4\uc5c8\uc2b5\ub2c8\ub2e4. {0} +jmx.rest.client.connection.connect.explanation=\uba64\ubc84\uac00 \uc81c\uc5b4\uae30\uc5d0 \uc5f0\uacb0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.connect.useraction=\uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.disconnect=CWWKX0231I: Collective \uba64\ubc84\uac00 Collective \uc81c\uc5b4\uae30\uc5d0\uc11c JMX \ud074\ub77c\uc774\uc5b8\ud2b8\ub97c \ub2eb\uc558\uc2b5\ub2c8\ub2e4. {0} +jmx.rest.client.connection.disconnect.explanation=\uba64\ubc84\uac00 \uc81c\uc5b4\uae30\uc5d0\uc11c \uc5f0\uacb0 \ud574\uc81c\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.disconnect.useraction=\uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pl.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pl.nlsprops new file mode 100755 index 000000000000..8babd6083d84 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pl.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Klient REST produktu WebSphere Java Management Extensions napotka\u0142 b\u0142\u0105d podczas przygotowywania \u017c\u0105dania dla serwera zwi\u0105zanego z adresem URL {0} w po\u0142\u0105czeniu {1} +jmx.rest.client.request.error.explanation=Klient REST produktu WebSphere Java Management Extensions napotka\u0142 b\u0142\u0105d podczas przygotowywania \u017c\u0105dania dla serwera +jmx.rest.client.request.error.useraction=Dodatkowe informacje s\u0105 zawarte w plikach dziennik\u00f3w serwera. + +jmx.rest.client.response.error=CWWKX0202E: Klient REST produktu WebSphere Java Management Extensions nie m\u00f3g\u0142 przetworzy\u0107 \u017c\u0105dania z serwera zwi\u0105zanego z adresem URL {0} w po\u0142\u0105czeniu {1} +jmx.rest.client.response.error.explanation=Klient REST produktu WebSphere Java Management Extensions nie m\u00f3g\u0142 przetworzy\u0107 \u017c\u0105dania z serwera +jmx.rest.client.response.error.useraction=Dodatkowe informacje s\u0105 zawarte w plikach dziennik\u00f3w serwera. + +jmx.rest.client.response.code.error=CWWKX0203E: Klient REST produktu WebSphere Java Management Extensions odebra\u0142 nieoczekiwany kod odpowiedzi {0} z komunikatem {1} od serwera zwi\u0105zanego z adresem URL {2} w po\u0142\u0105czeniu {3} +jmx.rest.client.response.code.error.explanation=Klient REST produktu WebSphere Java Management Extensions odebra\u0142 nieoczekiwany kod odpowiedzi od serwera +jmx.rest.client.response.code.error.useraction=Dodatkowe informacje s\u0105 zawarte w plikach dziennik\u00f3w serwera. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Nie mo\u017cna przeanalizowa\u0107 wyj\u0105tku Throwable ze strumienia b\u0142\u0119d\u00f3w serwera. +jmx.rest.client.server.throwable.exception.explanation=Serwer zg\u0142osi\u0142 wyj\u0105tek podczas obs\u0142ugiwania \u017c\u0105dania klienta, ale klient nie mo\u017ce przeanalizowa\u0107 obiektu Throwable ze strumienia b\u0142\u0119d\u00f3w serwera. Klasa obiektu Throwable mo\u017ce by\u0107 niedost\u0119pna dla klienta. +jmx.rest.client.server.throwable.exception.useraction=Dodatkowe informacje s\u0105 zawarte w plikach dziennik\u00f3w serwera. + +jmx.rest.client.not.connected=CWWKX0206E: Klient nie jest po\u0142\u0105czony z serwerem. +jmx.rest.client.not.connected.explanation=Po\u0142\u0105czenie z serwerem zosta\u0142o zamkni\u0119te lub utracone. +jmx.rest.client.not.connected.useraction=Sprawd\u017a, czy na serwerze w\u0142\u0105czono funkcj\u0119 konektora REST i nawi\u0105\u017c nowe po\u0142\u0105czenie z serwerem. + +jmx.rest.client.url.not.found=CWWKX0207E: Serwer zg\u0142osi\u0142 brak mo\u017cliwo\u015bci znalezienia adresu URL za\u017c\u0105danego przez klient. +jmx.rest.client.url.not.found.explanation=Klient ma nieaktualne informacje lub funkcja konektora REST na serwerze zosta\u0142a wy\u0142\u0105czona. +jmx.rest.client.url.not.found.useraction=Sprawd\u017a, czy na serwerze w\u0142\u0105czono funkcj\u0119 konektora REST i nawi\u0105\u017c nowe po\u0142\u0105czenie z serwerem. + +jmx.rest.client.class.name.null=CWWKX0208E: Argument nazwy klasy ma warto\u015b\u0107 NULL. +jmx.rest.client.class.name.null.explanation=Argument nazwy klasy nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.class.name.null.useraction=Podczas wywo\u0142ywania metody podaj nazw\u0119 klasy inn\u0105 ni\u017c NULL. + +jmx.rest.client.attribute.name.null=CWWKX0209E: Argument nazwy atrybutu ma warto\u015b\u0107 NULL. +jmx.rest.client.attribute.name.null.explanation=Argument nazwy atrybutu nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.attribute.name.null.useraction=Podczas wywo\u0142ywania metody podaj nazw\u0119 atrybutu inn\u0105 ni\u017c NULL. + +jmx.rest.client.attribute.names.null=CWWKX0210E: Argument zawieraj\u0105cy tablic\u0119 nazw atrybut\u00f3w ma warto\u015b\u0107 NULL. +jmx.rest.client.attribute.names.null.explanation=Argument zawieraj\u0105cy tablic\u0119 nazw atrybut\u00f3w nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.attribute.names.null.useraction=Podczas wywo\u0142ywania metody podaj tablic\u0119 nazw atrybut\u00f3w o warto\u015bci innej ni\u017c NULL. + +jmx.rest.client.attribute.null=CWWKX0211E: Argument Attribute ma warto\u015b\u0107 NULL. +jmx.rest.client.attribute.null.explanation=Argument Attribute nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.attribute.null.useraction=Podczas wywo\u0142ywania metody podaj argument Attribute o warto\u015bci innej ni\u017c NULL. + +jmx.rest.client.attribute.list.null=CWWKX0212E: Argument AttributeList ma warto\u015b\u0107 NULL. +jmx.rest.client.attribute.list.null.explanation=Argument AttributeList nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.attribute.list.null.useraction=Podczas wywo\u0142ywania metody podaj argument AttributeList o warto\u015bci innej ni\u017c NULL. + +jmx.rest.client.object.name.null=CWWKX0213E: Argument ObjectName ma warto\u015b\u0107 NULL. +jmx.rest.client.object.name.null.explanation=Argument ObjectName nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.object.name.null.useraction=Podczas wywo\u0142ywania metody podaj argument ObjectName o warto\u015bci innej ni\u017c NULL. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Serwer zwr\u00f3ci\u0142 nieoczekiwany obiekt Throwable. +jmx.rest.client.unexpected.server.throwable.explanation=Wyj\u0105tek opakowuje obiekt Throwable zwr\u00f3cony przez serwer, kt\u00f3ry nie jest normalnie oczekiwany dla tej operacji. +jmx.rest.client.unexpected.server.throwable.useraction=Dodatkowe informacje s\u0105 zawarte w plikach dziennik\u00f3w serwera. + +jmx.rest.client.bad.credentials=CWWKX0215E: Wyst\u0105pi\u0142 problem dotycz\u0105cy podanej nazwy u\u017cytkownika lub has\u0142a. Odpowied\u017a serwera to kod {0} i komunikat {1}. +jmx.rest.client.bad.credentials.explanation=Referencje podane podczas nawi\u0105zywania po\u0142\u0105czenia by\u0142y niepoprawne. U\u017cytkownik nie istnieje lub nie ma uprawnie\u0144 niezb\u0119dnych do uzyskania dost\u0119pu do serwera albo has\u0142o jest niepoprawne. +jmx.rest.client.bad.credentials.useraction=Popraw nazw\u0119 u\u017cytkownika lub has\u0142o, a nast\u0119pnie nawi\u0105\u017c nowe po\u0142\u0105czenie. + +jmx.rest.client.object.name.pattern=CWWKX0216E: Argument ObjectName {0} to wzorzec. +jmx.rest.client.object.name.pattern.explanation=Argument ObjectName to wzorzec, a metoda wymaga argumentu ObjectName zgodnego z dok\u0142adnie jednym komponentem MBean. +jmx.rest.client.object.name.pattern.useraction=Podaj argument ObjectName bez znak\u00f3w wieloznacznych, kt\u00f3ry b\u0119dzie zgodny z dok\u0142adnie jednym komponentem MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: \u017baden komponent MBean nie zosta\u0142 zarejestrowany przy u\u017cyciu nazwy obiektu {0} +jmx.rest.client.instance.not.found.explanation=Operacja wymaga zarejestrowanego komponentu MBean, ale nie zarejestrowano \u017cadnego komponentu MBean o podanej nazwie obiektu. +jmx.rest.client.instance.not.found.useraction=Upewnij si\u0119, \u017ce komponent MBean jest zarejestrowany przed podj\u0119ciem pr\u00f3by wykonania wzgl\u0119dem niego operacji zarz\u0105dzania. + +jmx.rest.client.attribute.not.found=CWWKX0218E: Komponent MBean {0} nie zawiera atrybutu o nazwie {1} +jmx.rest.client.attribute.not.found.explanation=Komponent MBean nie udost\u0119pnia atrybutu o podanej nazwie. +jmx.rest.client.attribute.not.found.useraction=Uzyskaj informacje o komponencie MBean, aby okre\u015bli\u0107 atrybuty, kt\u00f3re udost\u0119pnia. + +jmx.rest.client.operation.not.found=CWWKX0219E: Komponent MBean {0} nie zawiera operacji o nazwie {1} +jmx.rest.client.operation.not.found.explanation=Komponent MBean nie udost\u0119pnia operacji o podanej nazwie. +jmx.rest.client.operation.not.found.useraction=Uzyskaj informacje o komponencie MBean, aby okre\u015bli\u0107 operacje, kt\u00f3re udost\u0119pnia. + +jmx.rest.client.listener.not.found=CWWKX0220E: Obiekt NotificationListener nie jest obecnie zarejestrowany do otrzymywania powiadomie\u0144 od komponentu MBean {0} +jmx.rest.client.listener.not.found.explanation=Obiekt NotificationListener nie zosta\u0142 dodany lub zosta\u0142 ju\u017c usuni\u0119ty i nie jest obecnie zarejestrowany do otrzymywania powiadomie\u0144 od danego komponentu MBean. +jmx.rest.client.listener.not.found.useraction=Upewnij si\u0119, \u017ce kod wywo\u0142uj\u0105cy \u015bledzi, kt\u00f3re obiekty NotificationListener s\u0105 dodawane i usuwane, lub przechwy\u0107 i obs\u0142u\u017c wyj\u0105tek. + +jmx.rest.client.notification.lost=CWWKX0221I: Nie mo\u017cna dostarczy\u0107 powiadomienia. +jmx.rest.client.notification.lost.explanation=Powiadomienie nie mo\u017ce zosta\u0107 dostarczone do co najmniej jednego obiektu NotificationListener, poniewa\u017c nie znaleziono zarejestrowanego obiektu NotificationListener lub wyst\u0105pi\u0142 wyj\u0105tek podczas dostarczania powiadomienia. +jmx.rest.client.notification.lost.useraction=Je\u015bli powiadomienie powinno zosta\u0107 dostarczone do zarejestrowanego obiektu NotificationListener, sprawd\u017a, czy w dzienniku zosta\u0142y zarejestrowane wyj\u0105tki. + +jmx.rest.client.connection.failed=CWWKX0222I: Po\u0142\u0105czenie z serwerem zosta\u0142o utracone. +jmx.rest.client.connection.failed.explanation=Serwer sta\u0142 si\u0119 niedost\u0119pny i w skonfigurowanym maksymalnym dozwolonym czasie jego dost\u0119pno\u015b\u0107 nie zosta\u0142a przywr\u00f3cona. +jmx.rest.client.connection.failed.useraction=Sprawd\u017a po\u0142\u0105czenie sieciowe i upewnij si\u0119, \u017ce serwer dzia\u0142a oraz \u017ce w\u0142\u0105czono na nim funkcj\u0119 konektora REST. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: Po\u0142\u0105czenie z serwerem zosta\u0142o tymczasowo utracone. +jmx.rest.client.connection.temporarily.lost.explanation=Serwer sta\u0142 si\u0119 niedost\u0119pny, ale klient b\u0119dzie podejmowa\u0142 pr\u00f3by przywr\u00f3cenia po\u0142\u0105czenia przez skonfigurowany maksymalny dozwolony czas. +jmx.rest.client.connection.temporarily.lost.useraction=Je\u015bli serwer jest planowo restartowany, nie jest wymagana \u017cadna czynno\u015b\u0107. W przeciwnym razie sprawd\u017a po\u0142\u0105czenie sieciowe i upewnij si\u0119, \u017ce serwer dzia\u0142a oraz \u017ce w\u0142\u0105czono na nim funkcj\u0119 konektora REST. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: Po\u0142\u0105czenie zosta\u0142o przywr\u00f3cone, ale napotkano wyj\u0105tki podczas dodawania obiekt\u00f3w NotificationListener. +jmx.rest.client.connection.restored.with.exceptions.explanation=Po\u0142\u0105czenie z serwerem zosta\u0142o tymczasowo utracone, a nast\u0119pnie pomy\u015blnie przywr\u00f3cone. Podczas dodawania obiekt\u00f3w NotificationListener napotkano wyj\u0105tki, wi\u0119c niekt\u00f3re powiadomienia mog\u0105 nie zosta\u0107 odebrane. +jmx.rest.client.connection.restored.with.exceptions.useraction=Sprawd\u017a wyj\u0105tki do\u0142\u0105czone do powiadomienia i ponownie zarejestruj obiekty NotificationListener po usuni\u0119ciu problem\u00f3w. + +jmx.rest.client.connection.restored=CWWKX0225I: Po\u0142\u0105czenie zosta\u0142o pomy\u015blnie przywr\u00f3cone. +jmx.rest.client.connection.restored.explanation=Po\u0142\u0105czenie z serwerem zosta\u0142o tymczasowo utracone, a nast\u0119pnie pomy\u015blnie przywr\u00f3cone. Wszystkie zarejestrowane obiekty NotificationListener b\u0119d\u0105 nadal odbiera\u0107 powiadomienia. +jmx.rest.client.connection.restored.useraction=Brak. + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Parametr typu JMXServiceURL nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.connection.illegal.argument.explanation=Warto\u015bci\u0105 parametru serviceURL nie mo\u017ce by\u0107 warto\u015b\u0107 NULL. +jmx.rest.client.connection.illegal.argument.useraction=Nawi\u0105\u017c ponownie po\u0142\u0105czenie z konektorem us\u0142ug REST JMX przy u\u017cyciu warto\u015bci JMXServiceURL innej ni\u017c NULL. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: Nast\u0119puj\u0105ca warto\u015b\u0107 nie jest poprawn\u0105 warto\u015bci\u0105 punktu ko\u0144cowego: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=Okre\u015blona warto\u015b\u0107 punktu ko\u0144cowego jest niepoprawna. +jmx.rest.client.connection.invalid.endpoint.useraction=Nawi\u0105\u017c ponownie po\u0142\u0105czenie z konektorem us\u0142ug REST JMX przy u\u017cyciu poprawnej warto\u015bci punktu ko\u0144cowego, kt\u00f3ra ma typ String i format host:port. + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Nie mo\u017cna znale\u017a\u0107 \u017cadnych dost\u0119pnych punkt\u00f3w ko\u0144cowych na potrzeby inicjowania konektora. +jmx.rest.client.connection.no.endpoints.explanation=\u017baden z okre\u015blonych punkt\u00f3w ko\u0144cowych nie by\u0142 dost\u0119pny podczas inicjowania konektora us\u0142ug REST JMX. +jmx.rest.client.connection.no.endpoints.useraction=Nawi\u0105\u017c ponownie po\u0142\u0105czenie z konektorem us\u0142ug REST JMX przy u\u017cyciu co najmniej jednego dost\u0119pnego punktu ko\u0144cowego. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Wyst\u0105pi\u0142 problem dotycz\u0105cy podanych referencji u\u017cytkownika. Odpowied\u017a serwera to kod {0} i komunikat {1}. +jmx.rest.client.bad.user.credentials.explanation=Podane referencje s\u0105 niepoprawne, niekompletne, utraci\u0142y wa\u017cno\u015b\u0107 lub odm\u00f3wiono ich autoryzacji. +jmx.rest.client.bad.user.credentials.useraction=Sprawd\u017a, czy referencje u\u017cytkownika maj\u0105 odpowiednie uwierzytelnienie i autoryzacj\u0119, a nast\u0119pnie nawi\u0105\u017c nowe po\u0142\u0105czenie. + +jmx.rest.client.connection.connect=CWWKX0230I: W elemencie kolektywu zosta\u0142 otwarty klient JMX dla kontrolera kolektywu: {0} +jmx.rest.client.connection.connect.explanation=Element zosta\u0142 po\u0142\u0105czony z kontrolerem. +jmx.rest.client.connection.connect.useraction=Nie jest wymagana \u017cadna czynno\u015b\u0107. + +jmx.rest.client.connection.disconnect=CWWKX0231I: W elemencie zosta\u0142 zamkni\u0119ty klient JMX z kontrolera kolektywu: {0} +jmx.rest.client.connection.disconnect.explanation=Element zosta\u0142 roz\u0142\u0105czony z kontrolerem. +jmx.rest.client.connection.disconnect.useraction=Nie jest wymagana \u017cadna czynno\u015b\u0107. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pt_BR.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pt_BR.nlsprops new file mode 100755 index 000000000000..c9fe250acfb9 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pt_BR.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: O cliente REST do Java Management Extensions do WebSphere encontrou um erro ao preparar a solicita\u00e7\u00e3o para o servidor para a URL {0} na conex\u00e3o {1} +jmx.rest.client.request.error.explanation=O cliente REST do Java Management Extensions do WebSphere encontrou um erro ao preparar uma solicita\u00e7\u00e3o para o servidor +jmx.rest.client.request.error.useraction=Examine os logs do servidor para obter informa\u00e7\u00f5es adicionais. + +jmx.rest.client.response.error=CWWKX0202E: O cliente REST do Java Management Extensions do WebSphere n\u00e3o conseguiu processar a resposta do servidor para a URL {0} na conex\u00e3o {1} +jmx.rest.client.response.error.explanation=O cliente REST do Java Management Extensions do WebSphere n\u00e3o conseguiu processar uma resposta do servidor +jmx.rest.client.response.error.useraction=Examine os logs do servidor para obter informa\u00e7\u00f5es adicionais. + +jmx.rest.client.response.code.error=CWWKX0203E: O cliente REST do Java Management Extensions do WebSphere recebeu um c\u00f3digo de resposta {0} inesperado com a mensagem ''{1}'' a partir do servidor para a URL {2} na conex\u00e3o {3} +jmx.rest.client.response.code.error.explanation=O cliente REST do Java Management Extensions do WebSphere recebeu um c\u00f3digo de resposta inesperado do servidor +jmx.rest.client.response.code.error.useraction=Examine os logs do servidor para obter informa\u00e7\u00f5es adicionais. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: N\u00e3o \u00e9 poss\u00edvel analisar Lan\u00e7\u00e1vel a partir do fluxo de erros do servidor. +jmx.rest.client.server.throwable.exception.explanation=O servidor emitiu uma exce\u00e7\u00e3o ao manipular a solicita\u00e7\u00e3o do cliente, mas o cliente n\u00e3o p\u00f4de analisar um objeto Lan\u00e7\u00e1vel a partir do fluxo de erros do servidor. A classe do objeto Lan\u00e7\u00e1vel pode n\u00e3o estar dispon\u00edvel ao cliente. +jmx.rest.client.server.throwable.exception.useraction=Examine os logs do servidor para obter informa\u00e7\u00f5es adicionais. + +jmx.rest.client.not.connected=CWWKX0206E: O cliente n\u00e3o est\u00e1 conectado ao servidor. +jmx.rest.client.not.connected.explanation=A conex\u00e3o com o servidor foi fechada ou falhou. +jmx.rest.client.not.connected.useraction=Verifique se o recurso do conector REST est\u00e1 ativado no servidor e obtenha uma nova conex\u00e3o com o servidor. + +jmx.rest.client.url.not.found=CWWKX0207E: O servidor relatou que a URL solicitada pelo cliente n\u00e3o foi localizada. +jmx.rest.client.url.not.found.explanation=O cliente pode ter informa\u00e7\u00f5es desatualizadas ou o recurso do conector REST no servidor pode ter sido desativado. +jmx.rest.client.url.not.found.useraction=Verifique se o recurso do conector REST est\u00e1 ativado no servidor e obtenha uma nova conex\u00e3o com o servidor. + +jmx.rest.client.class.name.null=CWWKX0208E: O argumento de nome de classe era nulo. +jmx.rest.client.class.name.null.explanation=O argumento de nome de classe n\u00e3o deve ser nulo. +jmx.rest.client.class.name.null.useraction=Forne\u00e7a um nome de classe n\u00e3o nulo ao chamar o m\u00e9todo. + +jmx.rest.client.attribute.name.null=CWWKX0209E: O argumento de nome do atributo era nulo. +jmx.rest.client.attribute.name.null.explanation=O argumento de nome do atributo n\u00e3o deve ser nulo. +jmx.rest.client.attribute.name.null.useraction=Forne\u00e7a um nome de atributo n\u00e3o nulo ao chamar o m\u00e9todo. + +jmx.rest.client.attribute.names.null=CWWKX0210E: O argumento que cont\u00e9m uma matriz de nomes de atributo era nulo. +jmx.rest.client.attribute.names.null.explanation=O argumento que cont\u00e9m uma matriz de nomes de atributo n\u00e3o deve ser nulo. +jmx.rest.client.attribute.names.null.useraction=Forne\u00e7a uma matriz n\u00e3o nula de nomes de atributo ao chamar o m\u00e9todo. + +jmx.rest.client.attribute.null=CWWKX0211E: O argumento Atributo era nulo. +jmx.rest.client.attribute.null.explanation=O argumento Atributo n\u00e3o deve ser nulo. +jmx.rest.client.attribute.null.useraction=Forne\u00e7a um Atributo n\u00e3o nulo ao chamar o m\u00e9todo. + +jmx.rest.client.attribute.list.null=CWWKX0212E: O argumento AttributeList era nulo. +jmx.rest.client.attribute.list.null.explanation=O argumento AttributeList n\u00e3o deve ser nulo. +jmx.rest.client.attribute.list.null.useraction=Forne\u00e7a um AttributeList n\u00e3o nulo ao chamar o m\u00e9todo. + +jmx.rest.client.object.name.null=CWWKX0213E: O argumento ObjectName era nulo. +jmx.rest.client.object.name.null.explanation=O argumento ObjectName n\u00e3o deve ser nulo. +jmx.rest.client.object.name.null.useraction=Forne\u00e7a um ObjectName n\u00e3o nulo ao chamar o m\u00e9todo. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Um objeto Lan\u00e7\u00e1vel inesperado foi retornado do servidor. +jmx.rest.client.unexpected.server.throwable.explanation=A exce\u00e7\u00e3o agrupa um objeto Lan\u00e7\u00e1vel retornado do servidor que n\u00e3o \u00e9 esperado normalmente para esta opera\u00e7\u00e3o. +jmx.rest.client.unexpected.server.throwable.useraction=Examine os logs do servidor para obter informa\u00e7\u00f5es adicionais. + +jmx.rest.client.bad.credentials=CWWKX0215E: Houve um problema com o nome de usu\u00e1rio ou senha fornecida. O servidor respondeu com o c\u00f3digo {0} e a mensagem ''{1}'' +jmx.rest.client.bad.credentials.explanation=As credenciais fornecidas ao obter a conex\u00e3o estavam incorretas. O usu\u00e1rio pode n\u00e3o existir ou pode n\u00e3o ter autoridade para acessar o servidor, ou a senha pode estar incorreta. +jmx.rest.client.bad.credentials.useraction=Corrija o nome de usu\u00e1rio ou a senha e, em seguida, obtenha uma nova conex\u00e3o. + +jmx.rest.client.object.name.pattern=CWWKX0216E: O argumento ObjectName ''{0}'' \u00e9 um padr\u00e3o". +jmx.rest.client.object.name.pattern.explanation=O argumento ObjectName \u00e9 um padr\u00e3o, mas o m\u00e9todo requer um ObjectName que corresponda exatamente a um MBean. +jmx.rest.client.object.name.pattern.useraction=Forne\u00e7a um argumento ObjectName sem curingas que corresponda exatamente a um MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Nenhum MBean est\u00e1 registrado atualmente com o ObjectName ''{0}'' determinado +jmx.rest.client.instance.not.found.explanation=A opera\u00e7\u00e3o requer um MBean registrado, mas nenhum MBean com o ObjectName determinado foi registrado. +jmx.rest.client.instance.not.found.useraction=Assegure-se de que o MBean esteja registrado antes de tentar executar opera\u00e7\u00f5es de gerenciamento nele. + +jmx.rest.client.attribute.not.found=CWWKX0218E: O MBean ''{0}'' n\u00e3o possui um atributo com o nome ''{1}'' +jmx.rest.client.attribute.not.found.explanation=O MBean n\u00e3o fornece um atributo com o nome determinado. +jmx.rest.client.attribute.not.found.useraction=Obtenha as informa\u00e7\u00f5es do MBean para confirmar quais atributos ele fornece. + +jmx.rest.client.operation.not.found=CWWKX0219E: O MBean ''{0}'' n\u00e3o possui uma opera\u00e7\u00e3o com o nome ''{1}'' +jmx.rest.client.operation.not.found.explanation=O MBean n\u00e3o fornece uma opera\u00e7\u00e3o com o nome determinado. +jmx.rest.client.operation.not.found.useraction=Obtenha as informa\u00e7\u00f5es do MBean para confirmar quais opera\u00e7\u00f5es ele fornece. + +jmx.rest.client.listener.not.found=CWWKX0220E: O NotificationListener determinado n\u00e3o est\u00e1 registrado atualmente para receber notifica\u00e7\u00f5es do MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=O NotificationListener n\u00e3o foi inclu\u00eddo ou j\u00e1 foi removido e n\u00e3o est\u00e1 registrado atualmente para receber notifica\u00e7\u00f5es do MBean determinado. +jmx.rest.client.listener.not.found.useraction=Certifique-se de que o c\u00f3digo de chamada controle quais NotificationListeners foram inclu\u00eddos e removidos ou capture e manipule a exce\u00e7\u00e3o. + +jmx.rest.client.notification.lost=CWWKX0221I: N\u00e3o foi poss\u00edvel entregar a notifica\u00e7\u00e3o. +jmx.rest.client.notification.lost.explanation=Uma notifica\u00e7\u00e3o n\u00e3o p\u00f4de ser entregue a um ou mais NotificationListeners porque um NotificationListener registrado n\u00e3o foi localizado ou houve uma exce\u00e7\u00e3o durante a entrega da notifica\u00e7\u00e3o. +jmx.rest.client.notification.lost.useraction=Se a notifica\u00e7\u00e3o deveria ter sido entregue para um NotificationListener registrado, verifique os logs para exce\u00e7\u00f5es. + +jmx.rest.client.connection.failed=CWWKX0222I: A conex\u00e3o com o servidor falhou. +jmx.rest.client.connection.failed.explanation=O servidor ficou indispon\u00edvel e n\u00e3o foi disponibilizado novamente no tempo m\u00e1ximo configurado permitido. +jmx.rest.client.connection.failed.useraction=Verifique a conex\u00e3o de rede e assegure-se de que o servidor esteja em execu\u00e7\u00e3o com o recurso de conector REST ativado. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: A conex\u00e3o com o servidor foi perdida temporariamente. +jmx.rest.client.connection.temporarily.lost.explanation=O servidor ficou indispon\u00edvel, mas o cliente tentar\u00e1 restaurar a conex\u00e3o durante o tempo m\u00e1ximo configurado permitido. +jmx.rest.client.connection.temporarily.lost.useraction=Se o servidor estiver sendo reiniciado intencionalmente, nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. Caso contr\u00e1rio, verifique a conex\u00e3o de rede e assegure-se de que o servidor esteja em execu\u00e7\u00e3o com o recurso de conector REST ativado. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: A conex\u00e3o foi restaurada, mas foram encontradas exce\u00e7\u00f5es ao incluir NotificationListeners. +jmx.rest.client.connection.restored.with.exceptions.explanation=A conex\u00e3o com o servidor foi perdida temporariamente, mas foi restaurada com sucesso. Foram encontradas exce\u00e7\u00f5es ao incluir NotificationListeners, portanto, algumas notifica\u00e7\u00f5es podem n\u00e3o ter sido recebidas. +jmx.rest.client.connection.restored.with.exceptions.useraction=Verifique as exce\u00e7\u00f5es inclu\u00eddas com a notifica\u00e7\u00e3o e registre NotificationListeners novamente depois de corrigir os problemas. + +jmx.rest.client.connection.restored=CWWKX0225I: A conex\u00e3o foi restaurada com sucesso. +jmx.rest.client.connection.restored.explanation=A conex\u00e3o com o servidor foi perdida temporariamente, mas foi restaurada com sucesso. Todos os NotificationListeners registrados continuar\u00e3o a receber notifica\u00e7\u00f5es. +jmx.rest.client.connection.restored.useraction=Nenhuma + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: O par\u00e2metro do tipo JMXServiceURL n\u00e3o pode ser nulo. +jmx.rest.client.connection.illegal.argument.explanation=O valor para o par\u00e2metro 'serviceURL' n\u00e3o pode ser nulo. +jmx.rest.client.connection.illegal.argument.useraction=Reconecte-se ao Conector JMX REST usando um valor JMXServiceURL n\u00e3o nulo. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: O seguinte n\u00e3o \u00e9 um valor de terminal v\u00e1lido: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=O valor de terminal especificado n\u00e3o \u00e9 v\u00e1lido. +jmx.rest.client.connection.invalid.endpoint.useraction=Reconecte-se ao Conector JMX REST usando um valor de terminal v\u00e1lido que seja do tipo Sequ\u00eancia e tenha o formato "host:porta". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: N\u00e3o foi poss\u00edvel localizar nenhum terminal dispon\u00edvel para inicializar o conector. +jmx.rest.client.connection.no.endpoints.explanation=Nenhum dos terminais especificados estava dispon\u00edvel durante a inicializa\u00e7\u00e3o do Conector JMX REST. +jmx.rest.client.connection.no.endpoints.useraction=Reconecte-se ao Conector JMX REST usando pelo menos 1 terminal dispon\u00edvel. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Houve um problema com as credenciais dos usu\u00e1rios fornecidas. O servidor respondeu com o c\u00f3digo {0} e a mensagem ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=As credenciais fornecidas s\u00e3o autoriza\u00e7\u00f5es incorretas, expiradas, incompletas ou negadas. +jmx.rest.client.bad.user.credentials.useraction=Verifique se as credenciais do usu\u00e1rio possuem autentica\u00e7\u00e3o e autoriza\u00e7\u00e3o corretas, em seguida obtenha uma nova conex\u00e3o. + +jmx.rest.client.connection.connect=CWWKX0230I: O membro coletivo abriu o cliente JMX para o controlador coletivo: {0} +jmx.rest.client.connection.connect.explanation=O membro conectado ao controlador. +jmx.rest.client.connection.connect.useraction=Nenhuma a\u00e7\u00e3o \u00e9 necess\u00e1ria. + +jmx.rest.client.connection.disconnect=CWWKX0231I: O membro coletivo fechou o cliente JMX do controlador coletivo: {0} +jmx.rest.client.connection.disconnect.explanation=O membro desconectado do controlador. +jmx.rest.client.connection.disconnect.useraction=Nenhuma a\u00e7\u00e3o \u00e9 necess\u00e1ria. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ro.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ro.nlsprops new file mode 100755 index 000000000000..65f278d7703d --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ro.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Clientul WebSphere Java Management Extensions REST a \u00eent\u00e2lnit o eroare \u00een timpul preg\u0103tirii cererii la serverul pentru URL-ul {0} pe conexiunea {1} +jmx.rest.client.request.error.explanation=Clientul WebSphere Java Management Extensions REST a \u00eent\u00e2lnit o eroare \u00een timpul preg\u0103tirii cererii la serverul +jmx.rest.client.request.error.useraction=Pentru informa\u0163ii suplimentare examina\u0163i istoricele de server. + +jmx.rest.client.response.error=CWWKX0202E: Clientul WebSphere Java Management Extensions REST nu a putut procesa r\u0103spunsul de la serverul pentru URL-ul {0} pe conexiunea {1} +jmx.rest.client.response.error.explanation=Clientul WebSphere Java Management Extensions REST nu a putut procesa un r\u0103spuns de la server +jmx.rest.client.response.error.useraction=Pentru informa\u0163ii suplimentare examina\u0163i istoricele de server. + +jmx.rest.client.response.code.error=CWWKX0203E: Clientul WebSphere Java Management Extensions REST a primit un cod r\u0103spuns nea\u015fteptat {0} cu mesajul ''{1}'' de la server pentru URL-ul {2} pe conexiunea {3} +jmx.rest.client.response.code.error.explanation=Clientul WebSphere Java Management Extensions REST a primit un cod r\u0103spuns nea\u015fteptat de la server +jmx.rest.client.response.code.error.useraction=Pentru informa\u0163ii suplimentare examina\u0163i istoricele de server. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Nu se poate analiza Throwable din fluxul de erori de server. +jmx.rest.client.server.throwable.exception.explanation=Serverul a ridicat o excep\u0163ie la instrumentarea cererii de client, dar clientul nu a putut analiza un obiect Throwable din fluxul de erori de server. Clasa obiectului Throwable poate s\u0103 nu fie disponibil\u0103 pentru client. +jmx.rest.client.server.throwable.exception.useraction=Pentru informa\u0163ii suplimentare examina\u0163i istoricele de server. + +jmx.rest.client.not.connected=CWWKX0206E: Clientul nu este conectat la server. +jmx.rest.client.not.connected.explanation=Conexiunea la server fie a fost \u00eenchis\u0103, fie a e\u015fuat. +jmx.rest.client.not.connected.useraction=Verifica\u0163i c\u0103 este activat\u0103 caracteristica de conector REST pe server \u015fi ob\u0163ine\u0163i o nou\u0103 conexiune la server. + +jmx.rest.client.url.not.found=CWWKX0207E: Serverul a raportat c\u0103 URL-ul cerut de client nu a fost g\u0103sit. +jmx.rest.client.url.not.found.explanation=Clientul poate avea informa\u0163ii dep\u0103\u015fite sau caracteristica REST de conector pe server poate fi dezactivat\u0103. +jmx.rest.client.url.not.found.useraction=Verifica\u0163i c\u0103 este activat\u0103 caracerostica de conector REST pe server \u015fi ob\u0163ine\u0163i o nou\u0103 conexiune la server. + +jmx.rest.client.class.name.null=CWWKX0208E: Argumentul de nume de clas\u0103 a fost nul. +jmx.rest.client.class.name.null.explanation=Argumentul de nume de clas\u0103 nu trebuie s\u0103 fie nul. +jmx.rest.client.class.name.null.useraction=Furniza\u0163i un nume de clas\u0103 nenul c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.attribute.name.null=CWWKX0209E: Argumentul de nume de atribut a fost nul. +jmx.rest.client.attribute.name.null.explanation=Argumentul de nume de atribut nu trebuie s\u0103 fie nul. +jmx.rest.client.attribute.name.null.useraction=Furniza\u0163i un nume de atribut nenul c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.attribute.names.null=CWWKX0210E: Argumentul care con\u0163ine o matrice de nume de atribute a fost nul. +jmx.rest.client.attribute.names.null.explanation=Argumentul care con\u0163ine o matrice de nume de atribute nu trebuie s\u0103 fie nul. +jmx.rest.client.attribute.names.null.useraction=Furniza\u0163i o matrice nenul\u0103 de nume de atribute c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.attribute.null=CWWKX0211E: Argumentul Atribut a fost nul. +jmx.rest.client.attribute.null.explanation=Argumentul Atribut nu trebuie s\u0103 fie nul. +jmx.rest.client.attribute.null.useraction=Furniza\u0163i un Atribut nenul c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.attribute.list.null=CWWKX0212E: Argumentul AttributeList a fost nul. +jmx.rest.client.attribute.list.null.explanation=Argumentul AttributeList nu trebuie s\u0103 fie nul. +jmx.rest.client.attribute.list.null.useraction=Furniza\u0163i un AttributeList nenul c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.object.name.null=CWWKX0213E: Argumentul ObjectName a fost nul. +jmx.rest.client.object.name.null.explanation=Argumentul ObjectName nu trebuie s\u0103 fie nul. +jmx.rest.client.object.name.null.useraction=Furniza\u0163i un ObjectName nenul c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: A fost returnat un obiect Throwable nea\u015fteptat de la server. +jmx.rest.client.unexpected.server.throwable.explanation=Excep\u0163ia \u00eenf\u0103\u015foar\u0103 un obiect Throwable returnat de la server care nu este \u00een mod normal a\u015fteptat\u0103 pentru aceast\u0103 opera\u0163ie. +jmx.rest.client.unexpected.server.throwable.useraction=Pentru informa\u0163ii suplimentare examina\u0163i istoricele de server. + +jmx.rest.client.bad.credentials=CWWKX0215E: A existat o problem\u0103 cu numele utilizator sau parola furnizate. Serverul a r\u0103spuns cu cod {0} \u015fi mesaj ''{1}'' +jmx.rest.client.bad.credentials.explanation=Acredit\u0103rile furnizate la ob\u0163inerea conexiunii au fost incorecte. Utilizatorul poate s\u0103 nu existe sau s\u0103 nu aib\u0103 autoritatea de a accesa serverul, sau parola poate fi incorect\u0103. +jmx.rest.client.bad.credentials.useraction=Corecta\u0163i numele utilizator sau parola, apoi ob\u0163ine\u0163i o nou\u0103 conexiune. + +jmx.rest.client.object.name.pattern=CWWKX0216E: Argumentul ObjectName ''{0}'' este un model." +jmx.rest.client.object.name.pattern.explanation=Argumentul ObjectName este un model dar metoda cere un ObjectName care s\u0103 se potriveasc\u0103 exact cu un MBean. +jmx.rest.client.object.name.pattern.useraction=Furniza\u0163i un argument ObjectName f\u0103r\u0103 metacaractere care se va potrivi exact cu un MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Nu este \u00eenregistrat niciun MBean cu ObjectName ''{0}'' dat. +jmx.rest.client.instance.not.found.explanation=Opera\u0163ia cere un MBean \u00eenregistrat, dar nu a fost \u00eenregistrat niciun MBean cu ObjectName dat. +jmx.rest.client.instance.not.found.useraction=Asigura\u0163i-v\u0103 c\u0103 MBean-ul este \u00eenregistrat \u00eenainte de a \u00eencerca s\u0103 face\u0163i opera\u0163ii de gestiune pa el. + +jmx.rest.client.attribute.not.found=CWWKX0218E: MBean-ul ''{0}'' nu are un atribut cu numele ''{1}'' +jmx.rest.client.attribute.not.found.explanation=MBean-ul nu furnizeaz\u0103 un atribut cu numele dat. +jmx.rest.client.attribute.not.found.useraction=Ob\u0163ine\u0163i informa\u0163ii de MBean pentru a confirma ce atribute furnizeaz\u0103 MBean-ul. + +jmx.rest.client.operation.not.found=CWWKX0219E: MBean-ul ''{0}'' nu are o opera\u0163ie cu numele ''{1}'' +jmx.rest.client.operation.not.found.explanation=MBean-ul nu furnizeaz\u0103 o opera\u0163ie cu numele dat. +jmx.rest.client.operation.not.found.useraction=Ob\u0163ine\u0163i informa\u0163ii de MBean pentru a confirma ce opera\u0163ii furnizeaz\u0103 MBean-ul. + +jmx.rest.client.listener.not.found=CWWKX0220E: NotificationListener-ul dat nu este \u00eenregistrat curent pentru a primi notific\u0103ri de la MBean-ul ''{0}'' +jmx.rest.client.listener.not.found.explanation=NotificationListener-ul nu a fost ad\u0103ugat sau a fost deja \u00eenl\u0103turat \u015fi nu este \u00eenregistrat curent pentru a primi notific\u0103ri de la MBean-ul dat. +jmx.rest.client.listener.not.found.useraction=Asigura\u0163i-v\u0103 c\u0103 codul de apelare urm\u0103re\u015fte ce NotificationListener-e au fost ad\u0103ugate \u015fi \u00eenl\u0103turate sau capta\u0163i \u015fi instrumenta\u0163i excep\u0163ia. + +jmx.rest.client.notification.lost=CWWKX0221I: Notificarea nu a putut fi livrat\u0103. +jmx.rest.client.notification.lost.explanation=O notificare nu a putut fi livrat\u0103 unuia sau mai multor ascult\u0103toare de notific\u0103ri, deoarece NotificationListener \u00eenregistrat nu a fost g\u0103sit sau exista o excep\u0163ie \u00een timpul livr\u0103rii notific\u0103rii. +jmx.rest.client.notification.lost.useraction=Dac\u0103 notificarea trebuia livrat\u0103 la un NotificationListener (ascult\u0103tor de notific\u0103ri) existent, verifica\u0163i istoricele pentru excep\u0163ii. + +jmx.rest.client.connection.failed=CWWKX0222I: A e\u015fuat conexiunea la server. +jmx.rest.client.connection.failed.explanation=Serverul a devenit indisponibil \u015fi nu a devenit disponibil din nou \u00een intervalul maxim permisibil configurat. +jmx.rest.client.connection.failed.useraction=Verifica\u0163i conexiunea de re\u0163ea \u015fi asigura\u0163i-v\u0103 c\u0103 serverul ruleaz\u0103 cu caracteristica de conector REST activat\u0103. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: S-a pierdut temporar conexiunea la server. +jmx.rest.client.connection.temporarily.lost.explanation=Serverul a devenit indisponibil, dar clientul va \u00eencerca s\u0103 restaureze conexiunea pe durata intervalului de timp maxim permisibil configurat. +jmx.rest.client.connection.temporarily.lost.useraction=Dac\u0103 serverul este repornit inten\u0163ionat, nu este necesar\u0103 nici o ac\u0163iune. Altfel, verifica\u0163i conexiunea de re\u0163ea \u015fi asigura\u0163i-v\u0103 c\u0103 serverul ruleaz\u0103 cu caracteristica de conector REST activat\u0103. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: Conexiunea a fost restaurat\u0103 dar excep\u0163iile au ap\u0103rut la ad\u0103ugarea NotificationListener-ilor. +jmx.rest.client.connection.restored.with.exceptions.explanation=Conexiunea la server s-a pierdut temporar dar a fost restaurat\u0103 cu succes. Excep\u0163iile au ap\u0103rut la ad\u0103ugarea NotificationListener-ilor, deci unele notific\u0103ri pot lipsi. +jmx.rest.client.connection.restored.with.exceptions.useraction=Verifica\u0163i c\u0103 excep\u0163iile au inclus notificarea \u015fi re-\u00eenregistra\u0163i NotificationListener-ii dup\u0103 corectarea problemelor. + +jmx.rest.client.connection.restored=CWWKX0225I: Conexiunea a fost restaurat\u0103 cu succes. +jmx.rest.client.connection.restored.explanation=Conexiunea la server s-a pierdut temporar dar a fost restaurat\u0103 cu succes. To\u0163i NotificationListener-ii \u00eenregistra\u0163i vor continua s\u0103 primeasc\u0103 notific\u0103ri. +jmx.rest.client.connection.restored.useraction=F\u0103r\u0103 + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Parametrul de tipul JMXServiceURL nu poate fi null. +jmx.rest.client.connection.illegal.argument.explanation=Valoarea parametrului 'serviceURL' nu poate fi null. +jmx.rest.client.connection.illegal.argument.useraction=Reconecta\u0163i-v\u0103 la JMX REST Connector folosind o valoare JMXServiceURL non-null. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: Urm\u0103toarea nu este o valoare de punct final valid\u0103: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=Valoarea de punct final specificat\u0103 nu este valid\u0103. +jmx.rest.client.connection.invalid.endpoint.useraction=Reconecta\u0163i-v\u0103 la JMX REST Connector folosind o valoare de punct final valid\u0103 care este de tipul String \u015fi are formatul "host:port". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Nu s-au g\u0103sit puncte finale disponibile pentru ini\u0163ializarea conectorului. +jmx.rest.client.connection.no.endpoints.explanation=Niciunul din punctele finale specificate nu este disponibil \u00een timpul ini\u0163ializ\u0103rii pentru JMX REST Connector. +jmx.rest.client.connection.no.endpoints.useraction=Reconecta\u0163i-v\u0103 la JMX REST Connector folosind cel pu\u0163in un punct final disponibil. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: A existat o problem\u0103 cu acredit\u0103rile de utilizator furnizate. Serverul a r\u0103spuns cu codul {0} \u015fi mesajul ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=Acredit\u0103rile furnizate sunt incorecte, expirate, incomplete sau cu autorizare refuzat\u0103. +jmx.rest.client.bad.user.credentials.useraction=Verifica\u0163i c\u0103 acredit\u0103rile de utilizator au autentificare \u015fi autoriza\u0163ie corecte, apoi ob\u0163ine\u0163i o nou\u0103 conexiune. + +jmx.rest.client.connection.connect=CWWKX0230I: Membrul colectiv a deschis clientul JMX pentru controlerul colectiv: {0} +jmx.rest.client.connection.connect.explanation=Membrul conectat la controler. +jmx.rest.client.connection.connect.useraction=Nu este necesar\u0103 nicio ac\u0163iune. + +jmx.rest.client.connection.disconnect=CWWKX0231I: Membrul colectiv a \u00eenchis clientul JMX pentru controlerul colectiv: {0} +jmx.rest.client.connection.disconnect.explanation=Membrul s-a deconectat de la controler. +jmx.rest.client.connection.disconnect.useraction=Nu este necesar\u0103 nicio ac\u0163iune. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ru.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ru.nlsprops new file mode 100755 index 000000000000..a169f12238f8 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ru.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: \u0412 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 REST WebSphere Java Management Extensions \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0441 URL {0} \u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 {1} +jmx.rest.client.request.error.explanation=\u0412 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 REST WebSphere Java Management Extensions \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 +jmx.rest.client.request.error.useraction=\u0421\u043c. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. + +jmx.rest.client.response.error=CWWKX0202E: \u041a\u043b\u0438\u0435\u043d\u0442\u0443 REST WebSphere Java Management Extensions \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 URL {0} \u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 {1} +jmx.rest.client.response.error.explanation=\u041a\u043b\u0438\u0435\u043d\u0442\u0443 REST WebSphere Java Management Extensions \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 +jmx.rest.client.response.error.useraction=\u0421\u043c. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. + +jmx.rest.client.response.code.error=CWWKX0203E: \u041a\u043b\u0438\u0435\u043d\u0442 REST WebSphere Java Management Extensions \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0442\u0432\u0435\u0442 \u0441 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c {0} \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c ''{1}'' \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 URL {2} \u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 {3} +jmx.rest.client.response.code.error.explanation=\u041a\u043b\u0438\u0435\u043d\u0442 REST WebSphere Java Management Extensions \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0442\u0432\u0435\u0442 \u0441 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 +jmx.rest.client.response.code.error.useraction=\u0421\u043c. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c Throwable \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430. +jmx.rest.client.server.throwable.exception.explanation=\u0421\u0435\u0440\u0432\u0435\u0440 \u0441\u043e\u043e\u0431\u0449\u0438\u043b \u043e\u0431 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043d\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 Throwable \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u043b\u0430\u0441\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Throwable \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430. +jmx.rest.client.server.throwable.exception.useraction=\u0421\u043c. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. + +jmx.rest.client.not.connected=CWWKX0206E: \u041a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443. +jmx.rest.client.not.connected.explanation=\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u043e \u0438\u043b\u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e. +jmx.rest.client.not.connected.useraction=\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043d\u043e\u0432\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. + +jmx.rest.client.url.not.found=CWWKX0207E: \u0421\u0435\u0440\u0432\u0435\u0440 \u0441\u043e\u043e\u0431\u0449\u0438\u043b, \u0447\u0442\u043e \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 URL, \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c. +jmx.rest.client.url.not.found.explanation=\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u0438\u043b\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST. +jmx.rest.client.url.not.found.useraction=\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043d\u043e\u0432\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. + +jmx.rest.client.class.name.null=CWWKX0208E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u043d\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u0443\u0441\u0442. +jmx.rest.client.class.name.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u043d\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.class.name.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0435 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430. + +jmx.rest.client.attribute.name.null=CWWKX0209E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u043d\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u043f\u0443\u0441\u0442. +jmx.rest.client.attribute.name.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u043d\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.attribute.name.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0435 \u0438\u043c\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430. + +jmx.rest.client.attribute.names.null=CWWKX0210E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043c\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043f\u0443\u0441\u0442. +jmx.rest.client.attribute.names.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043c\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.attribute.names.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043c\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. + +jmx.rest.client.attribute.null=CWWKX0211E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 Attribute \u043f\u0443\u0441\u0442. +jmx.rest.client.attribute.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 Attribute \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.attribute.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0439 Attribute. + +jmx.rest.client.attribute.list.null=CWWKX0212E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 AttributeList \u043f\u0443\u0441\u0442. +jmx.rest.client.attribute.list.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 AttributeList \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.attribute.list.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0439 AttributeList. + +jmx.rest.client.object.name.null=CWWKX0213E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 ObjectName \u043f\u0443\u0441\u0442. +jmx.rest.client.object.name.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 ObjectName \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.object.name.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0439 ObjectName. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: \u0421\u0435\u0440\u0432\u0435\u0440 \u0432\u0435\u0440\u043d\u0443\u043b \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 Throwable. +jmx.rest.client.unexpected.server.throwable.explanation=\u041f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043b \u043e\u0431\u044a\u0435\u043a\u0442 Throwable, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c: \u043f\u0440\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e. +jmx.rest.client.unexpected.server.throwable.useraction=\u0421\u043c. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. + +jmx.rest.client.bad.credentials=CWWKX0215E: \u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0430 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u0435\u043c. \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0431\u044b\u043b \u0443\u043a\u0430\u0437\u0430\u043d \u043a\u043e\u0434 {0} \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 ''{1}'' +jmx.rest.client.bad.credentials.explanation=\u041f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u044b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0438\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043b \u043f\u0430\u0440\u043e\u043b\u044c. +jmx.rest.client.bad.credentials.useraction=\u0418\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. + +jmx.rest.client.object.name.pattern=CWWKX0216E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 ObjectName ''{0}'' \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c." +jmx.rest.client.object.name.pattern.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 ObjectName \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c, \u043d\u043e \u043c\u0435\u0442\u043e\u0434 \u0442\u0440\u0435\u0431\u0443\u0435\u0442, \u0447\u0442\u043e\u0431\u044b ObjectName \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u043e\u043c\u0443 MBean. +jmx.rest.client.object.name.pattern.useraction=\u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 ObjectName \u0431\u0435\u0437 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0431\u044b \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u043e\u043c\u0443 MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: \u0414\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e ObjectName ''{0}'' \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0438 \u043e\u0434\u0438\u043d MBean +jmx.rest.client.instance.not.found.explanation=\u0414\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 MBean, \u043d\u043e \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c ObjectName \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0438 \u043e\u0434\u0438\u043d MBean. +jmx.rest.client.instance.not.found.useraction=\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u044b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 MBean. + +jmx.rest.client.attribute.not.found=CWWKX0218E: \u0412 MBean ''{0}'' \u043d\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ''{1}'' +jmx.rest.client.attribute.not.found.explanation=\u0412 MBean \u043d\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c. +jmx.rest.client.attribute.not.found.useraction=\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e MBean \u0438 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u0435, \u043a\u0430\u043a\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0432 \u043d\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b. + +jmx.rest.client.operation.not.found=CWWKX0219E: \u0412 MBean ''{0}'' \u043d\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ''{1}'' +jmx.rest.client.operation.not.found.explanation=\u0412 MBean \u043d\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c. +jmx.rest.client.operation.not.found.useraction=\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e MBean \u0438 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u0435, \u043a\u0430\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u043d\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b. + +jmx.rest.client.listener.not.found=CWWKX0220E: \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 NotificationListener \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043e\u0442 MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=\u041e\u0431\u044a\u0435\u043a\u0442 NotificationListener \u043d\u0435 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0438\u043b\u0438 \u0443\u0436\u0435 \u0431\u044b\u043b \u0443\u0434\u0430\u043b\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043d \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043e\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e MBean. +jmx.rest.client.listener.not.found.useraction=\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432 \u043a\u043e\u0434\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 NotificationListener, \u0438\u043b\u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0439\u0442\u0435\u0441\u044c \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0443 \u043f\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. + +jmx.rest.client.notification.lost=CWWKX0221I: \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435. +jmx.rest.client.notification.lost.explanation=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c NotificationListener, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 NotificationListener \u0438\u043b\u0438 \u0432 \u0445\u043e\u0434\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f. +jmx.rest.client.notification.lost.useraction=\u0415\u0441\u043b\u0438 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 NotificationListener, \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u0445. + +jmx.rest.client.connection.failed=CWWKX0222I: \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. +jmx.rest.client.connection.failed.explanation=\u0421\u0435\u0440\u0432\u0435\u0440 \u0441\u0442\u0430\u043b \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0438\u0441\u0442\u0435\u0447\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. +jmx.rest.client.connection.failed.useraction=\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0442\u044c\u044e \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043e. +jmx.rest.client.connection.temporarily.lost.explanation=\u0421\u0435\u0440\u0432\u0435\u0440 \u0441\u0442\u0430\u043b \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c, \u043d\u043e \u043a\u043b\u0438\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0438\u0441\u0442\u0435\u0447\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. +jmx.rest.client.connection.temporarily.lost.useraction=\u0415\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043b\u0430\u043d\u043e\u0432\u043e\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0442\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e, \u043d\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 NotificationListener \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. +jmx.rest.client.connection.restored.with.exceptions.explanation=\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0431\u044b\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043e, \u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e. \u0422\u0430\u043a \u043a\u0430\u043a \u0432 \u0445\u043e\u0434\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 NotificationListener \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043c\u043e\u0433\u043b\u0438 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u043d\u0435 \u0432\u0441\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f. +jmx.rest.client.connection.restored.with.exceptions.useraction=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f, \u0438 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043e\u043a \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b NotificationListener. + +jmx.rest.client.connection.restored=CWWKX0225I: \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e. +jmx.rest.client.connection.restored.explanation=\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0431\u044b\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043e, \u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e. \u0412\u0441\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b NotificationListener \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f. +jmx.rest.client.connection.restored.useraction=\u041d\u0435\u0442 + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0441 \u0442\u0438\u043f\u043e\u043c JMXServiceURL \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u043c. +jmx.rest.client.connection.illegal.argument.explanation=\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 'serviceURL' \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u043c. +jmx.rest.client.connection.illegal.argument.useraction=\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u0441\u044c \u043a \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0443 JMX REST \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e, \u0443\u043a\u0430\u0437\u0430\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 JMXServiceURL, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u0435\u0432\u044b\u043c. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: \u0414\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=\u0423\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c. +jmx.rest.client.connection.invalid.endpoint.useraction=\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u0441\u044c \u043a \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0443 JMX REST \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e, \u0443\u043a\u0430\u0437\u0430\u0432 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441 \u0442\u0438\u043f\u043e\u043c String \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 "\u0445\u043e\u0441\u0442:\u043f\u043e\u0440\u0442". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430. +jmx.rest.client.connection.no.endpoints.explanation=\u041d\u0438 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u043d\u0435 \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 JMX REST. +jmx.rest.client.connection.no.endpoints.useraction=\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u0441\u044c \u043a \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0443 JMX REST \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e, \u0443\u043a\u0430\u0437\u0430\u0432 \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 1 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: \u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0431\u044b\u043b \u0443\u043a\u0430\u0437\u0430\u043d \u043a\u043e\u0434 {0} \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0443\u0441\u0442\u0430\u0440\u0435\u043b\u0438, \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u044b \u0438\u043b\u0438 \u043a \u043d\u0438\u043c \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f. +jmx.rest.client.bad.user.credentials.useraction=\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u044c\u0442\u0435 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. + +jmx.rest.client.connection.connect=CWWKX0230I: \u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0433\u0440\u0443\u043f\u043f\u044b \u043e\u0442\u043a\u0440\u044b\u043b \u043a\u043b\u0438\u0435\u043d\u0442 JMX \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430: {0} +jmx.rest.client.connection.connect.explanation=\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443. +jmx.rest.client.connection.connect.useraction=\u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + +jmx.rest.client.connection.disconnect=CWWKX0231I: \u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0433\u0440\u0443\u043f\u043f\u044b \u0437\u0430\u043a\u0440\u044b\u043b \u043a\u043b\u0438\u0435\u043d\u0442 JMX \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430: {0} +jmx.rest.client.connection.disconnect.explanation=\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. +jmx.rest.client.connection.disconnect.useraction=\u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh.nlsprops new file mode 100755 index 000000000000..94beef546881 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh.nlsprops @@ -0,0 +1,144 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: \u51c6\u5907\u5728\u8fde\u63a5 {1} \u4e0a\u4e3a URL {0} \u8bf7\u6c42\u670d\u52a1\u5668\u65f6\uff0cWebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u9047\u5230\u9519\u8bef\u3002 +jmx.rest.client.request.error.explanation=\u51c6\u5907\u8bf7\u6c42\u670d\u52a1\u5668\u65f6\uff0cWebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u9047\u5230\u9519\u8bef\u3002 +jmx.rest.client.request.error.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 + +jmx.rest.client.response.error=CWWKX0202E: WebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u65e0\u6cd5\u5728\u8fde\u63a5 {1} \u4e0a\u4e3a URL {0} \u5904\u7406\u6765\u81ea\u670d\u52a1\u5668\u7684\u54cd\u5e94\u3002 +jmx.rest.client.response.error.explanation=WebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u65e0\u6cd5\u5904\u7406\u6765\u81ea\u670d\u52a1\u5668\u7684\u54cd\u5e94\u3002 +jmx.rest.client.response.error.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 + +jmx.rest.client.response.code.error=CWWKX0203E: WebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u5728\u8fde\u63a5 {3} \u4e0a\u4e3a URL {2} \u4ece\u670d\u52a1\u5668\u63a5\u6536\u5230\u5e26\u6709\u6d88\u606f\u201c{1}\u201d\u7684\u610f\u5916\u54cd\u5e94\u4ee3\u7801 {0}\u3002 +jmx.rest.client.response.code.error.explanation=WebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u4ece\u670d\u52a1\u5668\u63a5\u6536\u5230\u610f\u5916\u54cd\u5e94\u4ee3\u7801\u3002 +jmx.rest.client.response.code.error.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 + +jmx.rest.client.server.throwable.exception=CWWKX0204E: \u65e0\u6cd5\u89e3\u6790\u670d\u52a1\u5668\u9519\u8bef\u6d41\u4e2d\u7684 Throwable\u3002 +jmx.rest.client.server.throwable.exception.explanation=\u670d\u52a1\u5668\u5728\u5904\u7406\u5ba2\u6237\u673a\u8bf7\u6c42\u65f6\u629b\u51fa\u4e86\u5f02\u5e38\uff0c\u4f46\u662f\u5ba2\u6237\u673a\u65e0\u6cd5\u89e3\u6790\u670d\u52a1\u5668\u9519\u8bef\u6d41\u4e2d\u7684 Throwable \u5bf9\u8c61\u3002Throwable \u5bf9\u8c61\u7684\u7c7b\u53ef\u80fd\u5bf9\u5ba2\u6237\u673a\u4e0d\u53ef\u7528\u3002 +jmx.rest.client.server.throwable.exception.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 + +jmx.rest.client.not.connected=CWWKX0206E: \u5ba2\u6237\u673a\u672a\u8fde\u63a5\u5230\u670d\u52a1\u5668\u3002 +jmx.rest.client.not.connected.explanation=\u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u5df2\u5173\u95ed\u6216\u5df2\u5931\u8d25\u3002 +jmx.rest.client.not.connected.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u4e0a\u662f\u5426\u5df2\u542f\u7528 REST \u8fde\u63a5\u5668\u529f\u80fd\u90e8\u4ef6\u5e76\u83b7\u53d6\u4e0e\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002 + +jmx.rest.client.url.not.found=CWWKX0207E: \u670d\u52a1\u5668\u62a5\u544a\u672a\u627e\u5230\u5ba2\u6237\u673a\u6240\u8bf7\u6c42\u7684 URL\u3002 +jmx.rest.client.url.not.found.explanation=\u5ba2\u6237\u673a\u5177\u6709\u7684\u4fe1\u606f\u53ef\u80fd\u5df2\u8fc7\u65f6\uff0c\u6216\u8005\u53ef\u80fd\u5728\u670d\u52a1\u5668\u4e0a\u5df2\u7981\u7528 REST \u8fde\u63a5\u5668\u529f\u80fd\u90e8\u4ef6\u3002 +jmx.rest.client.url.not.found.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u4e0a\u662f\u5426\u5df2\u542f\u7528 REST \u8fde\u63a5\u5668\u529f\u80fd\u90e8\u4ef6\u5e76\u83b7\u53d6\u4e0e\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002 +jmx.rest.client.class.name.null=CWWKX0208E: \u7c7b\u540d\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.class.name.null.explanation=\u7c7b\u540d\u81ea\u53d8\u91cf\u4e0d\u5f97\u4e3a null\u3002 +jmx.rest.client.class.name.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u975e null \u7c7b\u540d\u3002 + +jmx.rest.client.attribute.name.null=CWWKX0209E: \u5c5e\u6027\u540d\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.attribute.name.null.explanation=\u5c5e\u6027\u540d\u81ea\u53d8\u91cf\u4e0d\u5f97\u4e3a null\u3002 +jmx.rest.client.attribute.name.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u975e null \u5c5e\u6027\u540d\u3002 + +jmx.rest.client.attribute.names.null=CWWKX0210E: \u5305\u542b\u4e00\u7cfb\u5217\u5c5e\u6027\u540d\u7684\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.attribute.names.null.explanation=\u5305\u542b\u4e00\u7cfb\u5217\u5c5e\u6027\u540d\u7684\u81ea\u53d8\u91cf\u4e0d\u5f97\u4e3a null\u3002 +jmx.rest.client.attribute.names.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u4e00\u7ec4\u975e null \u5c5e\u6027\u540d\u3002 + +jmx.rest.client.attribute.null=CWWKX0211E: \u5c5e\u6027\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.attribute.null.explanation=\u5c5e\u6027\u81ea\u53d8\u91cf\u4e0d\u5f97\u4e3a null\u3002 +jmx.rest.client.attribute.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u975e null \u5c5e\u6027\u3002 + +jmx.rest.client.attribute.list.null=CWWKX0212E: \u5c5e\u6027\u5217\u8868\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.attribute.list.null.explanation=\u5c5e\u6027\u5217\u8868\u81ea\u53d8\u91cf\u4e0d\u80fd\u4e3a null\u3002 +jmx.rest.client.attribute.list.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u975e null \u5c5e\u6027\u5217\u8868\u3002 + +jmx.rest.client.object.name.null=CWWKX0213E: \u5bf9\u8c61\u540d\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.object.name.null.explanation=\u5bf9\u8c61\u540d\u81ea\u53d8\u91cf\u4e0d\u80fd\u4e3a null\u3002 +jmx.rest.client.object.name.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u975e null \u5bf9\u8c61\u540d\u3002 + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: \u4ece\u670d\u52a1\u5668\u8fd4\u56de\u4e86\u610f\u5916\u7684 Throwable \u5bf9\u8c61\u3002 +jmx.rest.client.unexpected.server.throwable.explanation=\u6b64\u5f02\u5e38\u5305\u542b\u4ece\u670d\u52a1\u5668\u8fd4\u56de\u7684 Throwable \u5bf9\u8c61\uff0c\u6b64\u5bf9\u8c61\u901a\u67e5\u4e0d\u662f\u6b64\u64cd\u4f5c\u6240\u671f\u671b\u7684\u3002 +jmx.rest.client.unexpected.server.throwable.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 + +jmx.rest.client.bad.credentials=CWWKX0215E: \u63d0\u4f9b\u7684\u7528\u6237\u540d\u6216\u5bc6\u7801\u5b58\u5728\u95ee\u9898\u3002\u670d\u52a1\u5668\u4ee5\u4ee3\u7801 {0} \u548c\u6d88\u606f\u201c{1}\u201d\u4f5c\u4e3a\u54cd\u5e94 +jmx.rest.client.bad.credentials.explanation=\u83b7\u53d6\u8fde\u63a5\u65f6\u63d0\u4f9b\u7684\u51ed\u8bc1\u4e0d\u6b63\u786e\u3002\u7528\u6237\u53ef\u80fd\u4e0d\u5b58\u5728\u6216\u4e0d\u5177\u6709\u8bbf\u95ee\u670d\u52a1\u5668\u7684\u6743\u9650\uff0c\u6216\u8005\u5bc6\u7801\u53ef\u80fd\u4e0d\u6b63\u786e\u3002 +jmx.rest.client.bad.credentials.useraction=\u66f4\u6b63\u7528\u6237\u540d\u6216\u5bc6\u7801\uff0c\u7136\u540e\u83b7\u53d6\u4e00\u4e2a\u65b0\u8fde\u63a5\u3002 + +jmx.rest.client.object.name.pattern=CWWKX0216E: \u5bf9\u8c61\u540d\u81ea\u53d8\u91cf\u201c{0}\u201d\u662f\u4e00\u4e2a\u6a21\u5f0f\u3002" +jmx.rest.client.object.name.pattern.explanation=\u5bf9\u8c61\u540d\u81ea\u53d8\u91cf\u662f\u4e00\u4e2a\u6a21\u5f0f\uff0c\u4f46\u65b9\u6cd5\u9700\u8981\u7684\u662f\u4e0e\u4e00\u4e2a MBean \u5b8c\u5168\u5339\u914d\u7684\u5bf9\u8c61\u540d\u3002 +jmx.rest.client.object.name.pattern.useraction=\u8bf7\u63d0\u4f9b\u4e00\u4e2a\u4e0d\u5305\u542b\u901a\u914d\u7b26\u4e14\u4e0e\u4e00\u4e2a MBean \u5b8c\u5168\u5339\u914d\u7684\u5bf9\u8c61\u540d\u81ea\u53d8\u91cf\u3002 + +jmx.rest.client.instance.not.found=CWWKX0217E: \u5f53\u524d\u672a\u6ce8\u518c\u5177\u6709\u7ed9\u5b9a\u7684\u5bf9\u8c61\u540d\u201c {0}\u201d\u7684 MBean\u3002 +jmx.rest.client.instance.not.found.explanation=\u64cd\u4f5c\u9700\u8981\u6ce8\u518c\u7684 MBean\uff0c\u4f46\u662f\u672a\u6ce8\u518c\u5177\u6709\u7ed9\u5b9a\u7684\u5bf9\u8c61\u540d\u7684 MBean\u3002 +jmx.rest.client.instance.not.found.useraction=\u8bf7\u786e\u4fdd\u5728\u5c1d\u8bd5\u5bf9 MBean \u6267\u884c\u7ba1\u7406\u64cd\u4f5c\u524d\uff0c\u5df2\u5bf9\u5176\u8fdb\u884c\u6ce8\u518c\u3002 + +jmx.rest.client.attribute.not.found=CWWKX0218E: MBean\u201c{0}\u201d\u4e0d\u5177\u6709\u540d\u79f0\u4e3a\u201c{1}\u201d\u7684\u5c5e\u6027 +jmx.rest.client.attribute.not.found.explanation=MBean \u672a\u63d0\u4f9b\u5177\u6709\u7ed9\u5b9a\u540d\u79f0\u7684\u5c5e\u6027\u3002 +jmx.rest.client.attribute.not.found.useraction=\u83b7\u53d6 MBean \u4fe1\u606f\u4ee5\u786e\u8ba4 MBean \u6240\u63d0\u4f9b\u7684\u5c5e\u6027\u3002 + +jmx.rest.client.operation.not.found=CWWKX0219E: MBean\u201c{0}\u201d\u4e0d\u5177\u6709\u540d\u79f0\u4e3a\u201c{1}\u201d\u7684\u64cd\u4f5c +jmx.rest.client.operation.not.found.explanation=MBean \u672a\u63d0\u4f9b\u5177\u6709\u7ed9\u5b9a\u540d\u79f0\u7684\u64cd\u4f5c\u3002 +jmx.rest.client.operation.not.found.useraction=\u83b7\u53d6 MBean \u4fe1\u606f\u4ee5\u786e\u8ba4 MBean \u6240\u63d0\u4f9b\u7684\u64cd\u4f5c\u3002 + +jmx.rest.client.listener.not.found=CWWKX0220E: \u7ed9\u5b9a\u7684\u901a\u77e5\u4fa6\u542c\u5668\u5f53\u524d\u672a\u6ce8\u518c\u4e3a\u63a5\u6536\u6765\u81ea MBean\u201c{0}\u201d\u7684\u901a\u77e5 +jmx.rest.client.listener.not.found.explanation=\u672a\u6dfb\u52a0\u901a\u77e5\u4fa6\u542c\u5668\u6216\u8005\u5df2\u5c06\u5176\u9664\u53bb\uff0c\u5e76\u4e14\u901a\u77e5\u4fa6\u542c\u5668\u5f53\u524d\u672a\u6ce8\u518c\u4e3a\u63a5\u6536\u6765\u81ea\u7ed9\u5b9a\u7684 MBean \u7684\u901a\u77e5\u3002 +jmx.rest.client.listener.not.found.useraction=\u8bf7\u786e\u4fdd\u8c03\u7528\u4ee3\u7801\u8ddf\u8e2a\u6dfb\u52a0\u548c\u9664\u53bb\u7684\u901a\u77e5\u4fa6\u542c\u5668\u6216\u83b7\u53d6\u548c\u5904\u7406\u5f02\u5e38\u3002 + +jmx.rest.client.notification.lost=CWWKX0221I: \u65e0\u6cd5\u4f20\u9012\u901a\u77e5. +jmx.rest.client.notification.lost.explanation=\u65e0\u6cd5\u5c06\u901a\u77e5\u4f20\u9012\u7ed9\u4e00\u4e2a\u6216\u591a\u4e2a\u901a\u77e5\u4fa6\u542c\u5668\uff0c\u56e0\u4e3a\u672a\u627e\u5230\u5df2\u6ce8\u518c\u901a\u77e5\u4fa6\u542c\u5668\u6216\u5728\u4f20\u9012\u901a\u77e5\u65f6\u53d1\u751f\u4e86\u5f02\u5e38\u3002 +jmx.rest.client.notification.lost.useraction=\u5982\u679c\u901a\u77e5\u5e94\u4f20\u9012\u7ed9\u5df2\u6ce8\u518c\u901a\u77e5\u4fa6\u542c\u5668\uff0c\u8bf7\u68c0\u67e5\u65e5\u5fd7\u4ee5\u67e5\u627e\u5f02\u5e38\u3002 + +jmx.rest.client.connection.failed=CWWKX0222I: \u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u5df2\u5931\u8d25\u3002 +jmx.rest.client.connection.failed.explanation=\u670d\u52a1\u5668\u53d8\u5f97\u4e0d\u53ef\u7528\uff0c\u5e76\u4e14\u5728\u914d\u7f6e\u7684\u6700\u5927\u5141\u8bb8\u65f6\u95f4\u5185\u4e0d\u4f1a\u518d\u6b21\u53d8\u5f97\u53ef\u7528\u3002 +jmx.rest.client.connection.failed.useraction=\u8bf7\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\u5e76\u786e\u4fdd\u670d\u52a1\u5668\u6b63\u5728\u8fd0\u884c\uff08\u5df2\u542f\u7528 REST \u8fde\u63a5\u5668\u529f\u80fd\u90e8\u4ef6\uff09\u3002 + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: \u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u6682\u65f6\u5df2\u65ad\u5f00\u3002 +jmx.rest.client.connection.temporarily.lost.explanation=\u670d\u52a1\u5668\u5df2\u53d8\u5f97\u4e0d\u53ef\u7528\uff0c\u4f46\u662f\u5ba2\u6237\u673a\u5c06\u5728\u914d\u7f6e\u7684\u6700\u5927\u5141\u8bb8\u65f6\u95f4\u5185\u5c1d\u8bd5\u590d\u539f\u94fe\u63a5\u3002 +jmx.rest.client.connection.temporarily.lost.useraction=\u5982\u679c\u6b63\u5728\u6709\u610f\u5730\u91cd\u65b0\u542f\u52a8\u670d\u52a1\u5668\uff0c\u90a3\u4e48\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002\u5426\u5219\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\u5e76\u786e\u4fdd\u670d\u52a1\u5668\u6b63\u5728\u8fd0\u884c\uff08\u5df2\u542f\u7528 REST \u8fde\u63a5\u5668\u529f\u80fd\u90e8\u4ef6\uff09\u3002 + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: \u8fde\u63a5\u5df2\u590d\u539f\uff0c\u4f46\u5728\u6dfb\u52a0\u901a\u77e5\u4fa6\u542c\u5668\u65f6\u53d1\u751f\u4e86\u5f02\u5e38\u3002 +jmx.rest.client.connection.restored.with.exceptions.explanation=\u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u4e34\u65f6\u65ad\u5f00\uff0c\u4f46\u5df2\u6210\u529f\u590d\u539f\u3002\u6dfb\u52a0\u901a\u77e5\u4fa6\u542c\u5668\u65f6\u53d1\u751f\u4e86\u5f02\u5e38\uff0c\u56e0\u6b64\u53ef\u80fd\u4e0d\u4f1a\u63a5\u6536\u5230\u67d0\u4e9b\u901a\u77e5\u3002 +jmx.rest.client.connection.restored.with.exceptions.useraction=\u8bf7\u68c0\u67e5\u901a\u77e5\u4e2d\u5305\u542b\u7684\u5f02\u5e38\u5e76\u5728\u66f4\u6b63\u95ee\u9898\u540e\u91cd\u65b0\u6ce8\u518c\u901a\u77e5\u4fa6\u542c\u5668\u3002 + +jmx.rest.client.connection.restored=CWWKX0225I: \u8fde\u63a5\u5df2\u6210\u529f\u590d\u539f\u3002 +jmx.rest.client.connection.restored.explanation=\u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u4e34\u65f6\u65ad\u5f00\uff0c\u4f46\u5df2\u6210\u529f\u590d\u539f\u3002\u4efb\u4f55\u5df2\u6ce8\u518c\u901a\u77e5\u76d1\u89c6\u5668\u5c06\u7ee7\u7eed\u6536\u5230\u901a\u77e5\u3002 +jmx.rest.client.connection.restored.useraction=\u65e0 + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: \u7c7b\u578b\u4e3a JMXServiceURL \u7684\u53c2\u6570\u4e0d\u80fd\u4e3a null\u3002 +jmx.rest.client.connection.illegal.argument.explanation=\u53c2\u6570\u201cserviceURL\u201d\u7684\u503c\u4e0d\u80fd\u4e3a null\u3002 +jmx.rest.client.connection.illegal.argument.useraction=\u8bf7\u4f7f\u7528\u975e\u7a7a JMXServiceURL \u503c\u91cd\u65b0\u8fde\u63a5\u81f3 JMX REST \u8fde\u63a5\u5668\u3002 + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: \u4ee5\u4e0b\u7aef\u70b9\u503c\u65e0\u6548\uff1a{0} +jmx.rest.client.connection.invalid.endpoint.explanation=\u6307\u5b9a\u7684\u7aef\u70b9\u503c\u65e0\u6548\u3002 +jmx.rest.client.connection.invalid.endpoint.useraction=\u8bf7\u4f7f\u7528\u7c7b\u578b\u4e3a\u201c\u5b57\u7b26\u4e32\u201d\u4e14\u683c\u5f0f\u4e3a\u201chost:port\u201d\u7684\u6709\u6548\u7aef\u70b9\u503c\u91cd\u65b0\u8fde\u63a5\u81f3 JMX REST \u8fde\u63a5\u5668\u3002 + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: \u627e\u4e0d\u5230\u4efb\u4f55\u53ef\u7528\u4e8e\u521d\u59cb\u5316\u8fde\u63a5\u5668\u7684\u7aef\u70b9\u3002 +jmx.rest.client.connection.no.endpoints.explanation=JMX REST \u8fde\u63a5\u5668\u521d\u59cb\u5316\u521d\u59cb\u5316\u671f\u95f4\u6ca1\u6709\u4efb\u4f55\u4e00\u4e2a\u6307\u5b9a\u7aef\u70b9\u53ef\u7528\u3002 +jmx.rest.client.connection.no.endpoints.useraction=\u8bf7\u81f3\u5c11\u4f7f\u7528 1 \u4e2a\u53ef\u7528\u7aef\u70b9\u91cd\u65b0\u8fde\u63a5\u81f3 JMX REST \u8fde\u63a5\u5668\u3002 + +jmx.rest.client.bad.user.credentials=CWWKX0229E: \u63d0\u4f9b\u7684\u7528\u6237\u51ed\u8bc1\u5b58\u5728\u95ee\u9898\u3002\u670d\u52a1\u5668\u4ee5\u4ee3\u7801 {0} \u548c\u6d88\u606f\u201c{1}\u201d\u4f5c\u4e3a\u54cd\u5e94 +jmx.rest.client.bad.user.credentials.explanation=\u63d0\u4f9b\u7684\u51ed\u8bc1\u4e0d\u6b63\u786e\u3001\u5df2\u5230\u671f\u3001\u4e0d\u5b8c\u6574\u6216\u4e3a\u62d2\u7edd\u7684\u6388\u6743\u3002 +jmx.rest.client.bad.user.credentials.useraction=\u9a8c\u8bc1\u7528\u6237\u51ed\u8bc1\u662f\u5426\u5177\u6709\u6b63\u786e\u8ba4\u8bc1\u548c\u6388\u6743\uff0c\u7136\u540e\u83b7\u53d6\u65b0\u8fde\u63a5\u3002 + +jmx.rest.client.connection.connect=CWWKX0230I: \u96c6\u5408\u4f53\u6210\u5458\u6253\u5f00\u4e86 JMX \u5ba2\u6237\u673a\u5230\u96c6\u5408\u4f53\u63a7\u5236\u5668\uff1a{0} +jmx.rest.client.connection.connect.explanation=\u6210\u5458\u5df2\u8fde\u63a5\u81f3\u63a7\u5236\u5668\u3002 +jmx.rest.client.connection.connect.useraction=\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 +jmx.rest.client.connection.disconnect=CWWKX0231I: \u96c6\u5408\u4f53\u6210\u5458\u4ece\u96c6\u5408\u4f53\u63a7\u5236\u5668\u5173\u95ed\u4e86 JMX \u5ba2\u6237\u673a\uff1a{0} +jmx.rest.client.connection.disconnect.explanation=\u6210\u5458\u5df2\u4e0e\u63a7\u5236\u5668\u65ad\u5f00\u8fde\u63a5\u3002 +jmx.rest.client.connection.disconnect.useraction=\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh_TW.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh_TW.nlsprops new file mode 100755 index 000000000000..d2f4d3951ead --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh_TW.nlsprops @@ -0,0 +1,143 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u5728\u6e96\u5099\u5c0d\u9023\u7dda {1} \u4e0a URL {0} \u7684\u4f3a\u670d\u5668\u63d0\u51fa\u8981\u6c42\u6642\uff0c\u767c\u73fe\u932f\u8aa4 +jmx.rest.client.request.error.explanation=WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u5728\u6e96\u5099\u4f3a\u670d\u5668\u7684\u8981\u6c42\u6642\uff0c\u767c\u73fe\u932f\u8aa4 +jmx.rest.client.request.error.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u65e5\u8a8c\uff0c\u4ee5\u53d6\u5f97\u9032\u4e00\u6b65\u8cc7\u8a0a\u3002 + +jmx.rest.client.response.error=CWWKX0202E: WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u7121\u6cd5\u8655\u7406\u4f86\u81ea\u4f3a\u670d\u5668\u91dd\u5c0d\u9023\u7dda {1} \u4e0a\u7684 URL {0} \u7684\u56de\u61c9 +jmx.rest.client.response.error.explanation=WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u7121\u6cd5\u8655\u7406\u4f86\u81ea\u4f3a\u670d\u5668\u7684\u56de\u61c9 +jmx.rest.client.response.error.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u65e5\u8a8c\uff0c\u4ee5\u53d6\u5f97\u9032\u4e00\u6b65\u8cc7\u8a0a\u3002 + +jmx.rest.client.response.code.error=CWWKX0203E: WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u63a5\u6536\u5230\u4f86\u81ea\u4f3a\u670d\u5668\u91dd\u5c0d\u9023\u7dda {3} \u4e0a\u7684 URL {2} \u7684\u975e\u9810\u671f\u56de\u61c9\u78bc {0}\uff0c\u5e36\u6709\u8a0a\u606f ''{1}'' +jmx.rest.client.response.code.error.explanation=WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u63a5\u6536\u5230\u4f86\u81ea\u4f3a\u670d\u5668\u7684\u975e\u9810\u671f\u56de\u61c9\u78bc +jmx.rest.client.response.code.error.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u65e5\u8a8c\uff0c\u4ee5\u53d6\u5f97\u9032\u4e00\u6b65\u8cc7\u8a0a\u3002 + +jmx.rest.client.server.throwable.exception=CWWKX0204E: \u7121\u6cd5\u5f9e\u4f3a\u670d\u5668\u932f\u8aa4\u4e32\u6d41\u4f86\u5256\u6790 Throwable\u3002 +jmx.rest.client.server.throwable.exception.explanation=\u4f3a\u670d\u5668\u5728\u8655\u7406\u7528\u6236\u7aef\u8981\u6c42\u6642\uff0c\u5f15\u767c\u7570\u5e38\u72c0\u6cc1\uff0c\u4f46\u662f\u7528\u6236\u7aef\u7121\u6cd5\u5f9e\u4f3a\u670d\u5668\u932f\u8aa4\u4e32\u6d41\u4f86\u5256\u6790 Throwable \u7269\u4ef6\u3002\u7528\u6236\u7aef\u53ef\u80fd\u7121\u6cd5\u4f7f\u7528 Throwable \u7269\u4ef6\u7684\u985e\u5225\u3002 +jmx.rest.client.server.throwable.exception.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u65e5\u8a8c\uff0c\u4ee5\u53d6\u5f97\u9032\u4e00\u6b65\u8cc7\u8a0a\u3002 + +jmx.rest.client.not.connected=CWWKX0206E: \u7528\u6236\u7aef\u6c92\u6709\u9023\u63a5\u4f3a\u670d\u5668\u3002 +jmx.rest.client.not.connected.explanation=\u4f3a\u670d\u5668\u9023\u7dda\u5df2\u95dc\u9589\u6216\u5931\u6557\u3002 +jmx.rest.client.not.connected.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u4e0a\u662f\u5426\u5df2\u555f\u7528 REST \u9023\u63a5\u5668\u7279\u6027\uff0c\u4e26\u53d6\u5f97\u65b0\u7684\u4f3a\u670d\u5668\u9023\u7dda\u3002 + +jmx.rest.client.url.not.found=CWWKX0207E: \u4f3a\u670d\u5668\u5831\u544a\u627e\u4e0d\u5230\u7528\u6236\u7aef\u6240\u8981\u6c42\u7684 URL\u3002 +jmx.rest.client.url.not.found.explanation=\u7528\u6236\u7aef\u7684\u8cc7\u8a0a\u5df2\u904e\u671f\uff0c\u6216\u8005\u4f3a\u670d\u5668\u4e0a\u7684 REST \u9023\u63a5\u5668\u7279\u6027\u53ef\u80fd\u5df2\u505c\u7528\u3002 +jmx.rest.client.url.not.found.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u4e0a\u662f\u5426\u5df2\u555f\u7528 REST \u9023\u63a5\u5668\u7279\u6027\uff0c\u4e26\u53d6\u5f97\u65b0\u7684\u4f3a\u670d\u5668\u9023\u7dda\u3002 +jmx.rest.client.class.name.null=CWWKX0208E: \u985e\u5225\u540d\u7a31\u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.class.name.null.explanation=\u985e\u5225\u540d\u7a31\u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.class.name.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684\u985e\u5225\u540d\u7a31\u3002 + +jmx.rest.client.attribute.name.null=CWWKX0209E: \u5c6c\u6027\u540d\u7a31\u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.name.null.explanation=\u5c6c\u6027\u540d\u7a31\u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.name.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684\u5c6c\u6027\u540d\u7a31\u3002 + +jmx.rest.client.attribute.names.null=CWWKX0210E: \u5305\u542b\u5c6c\u6027\u540d\u7a31\u9663\u5217\u7684\u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.names.null.explanation=\u5305\u542b\u5c6c\u6027\u540d\u7a31\u9663\u5217\u7684\u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.names.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684\u5c6c\u6027\u540d\u7a31\u9663\u5217\u3002 + +jmx.rest.client.attribute.null=CWWKX0211E: Attribute \u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.null.explanation=Attribute \u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684 Attribute\u3002 + +jmx.rest.client.attribute.list.null=CWWKX0212E: AttributeList \u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.list.null.explanation=AttributeList \u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.list.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684 AttributeList\u3002 + +jmx.rest.client.object.name.null=CWWKX0213E: ObjectName \u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.object.name.null.explanation=ObjectName \u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.object.name.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684 ObjectName\u3002 + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: \u4f3a\u670d\u5668\u50b3\u56de\u975e\u9810\u671f\u7684 Throwable \u7269\u4ef6\u3002 +jmx.rest.client.unexpected.server.throwable.explanation=\u7570\u5e38\u72c0\u6cc1\u542b\u62ec\u4e00\u500b\u4f3a\u670d\u5668\u6240\u50b3\u56de\u7684 Throwable \u7269\u4ef6\uff0c\u5c0d\u9019\u9805\u4f5c\u696d\u4f86\u8aaa\uff0c\u9019\u901a\u5e38\u4e0d\u662f\u6240\u9810\u671f\u7684\u3002 +jmx.rest.client.unexpected.server.throwable.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u65e5\u8a8c\uff0c\u4ee5\u53d6\u5f97\u9032\u4e00\u6b65\u8cc7\u8a0a\u3002 + +jmx.rest.client.bad.credentials=CWWKX0215E: \u6240\u63d0\u4f9b\u7684\u4f7f\u7528\u8005\u540d\u7a31\u6216\u5bc6\u78bc\u6709\u554f\u984c\u3002\u4f3a\u670d\u5668\u7684\u56de\u61c9\u78bc\u662f {0}\uff0c\u8a0a\u606f\u662f ''{1}'' +jmx.rest.client.bad.credentials.explanation=\u5728\u53d6\u5f97\u9023\u7dda\u6642\u6240\u63d0\u4f9b\u7684\u8a8d\u8b49\u4e0d\u6b63\u78ba\u3002\u53ef\u80fd\u662f\u4f7f\u7528\u8005\u4e0d\u5b58\u5728\u3001\u4e0d\u5177\u5099\u4f3a\u670d\u5668\u7684\u5b58\u53d6\u6b0a\uff0c\u6216\u8005\u5bc6\u78bc\u4e0d\u6b63\u78ba\u3002 +jmx.rest.client.bad.credentials.useraction=\u8acb\u66f4\u6b63\u4f7f\u7528\u8005\u540d\u7a31\u6216\u5bc6\u78bc\uff0c\u7136\u5f8c\u53d6\u5f97\u65b0\u9023\u7dda\u3002 + +jmx.rest.client.object.name.pattern=CWWKX0216E: ObjectName \u5f15\u6578 ''{0}'' \u662f\u4e00\u500b\u578b\u6a23\u3002 +jmx.rest.client.object.name.pattern.explanation=ObjectName \u5f15\u6578\u662f\u578b\u6a23\uff0c\u4f46\u662f\u65b9\u6cd5\u6240\u9700\u8981\u7684 ObjectName \u5fc5\u9808\u53ea\u7b26\u5408\u4e00\u500b MBean\u3002 +jmx.rest.client.object.name.pattern.useraction=\u8acb\u63d0\u4f9b\u6c92\u6709\u842c\u7528\u5b57\u5143\u4e14\u53ea\u7b26\u5408\u4e00\u500b MBean \u7684 ObjectName \u5f15\u6578\u3002 + +jmx.rest.client.instance.not.found=CWWKX0217E: \u76ee\u524d\u672a\u767b\u9304\u4efb\u4f55\u4e00\u500b\u4f7f\u7528\u7d66\u5b9a ObjectName ''{0}'' \u7684 MBean +jmx.rest.client.instance.not.found.explanation=\u4f5c\u696d\u9700\u8981\u5df2\u767b\u9304\u7684 MBean\uff0c\u4f46\u537b\u672a\u767b\u9304\u4efb\u4f55\u4f7f\u7528\u7d66\u5b9a ObjectName \u7684 MBean\u3002 +jmx.rest.client.instance.not.found.useraction=\u8acb\u5148\u78ba\u5b9a\u5df2\u767b\u9304 MBean\uff0c\u518d\u5617\u8a66\u5c0d\u5b83\u57f7\u884c\u7ba1\u7406\u4f5c\u696d\u3002 + +jmx.rest.client.attribute.not.found=CWWKX0218E: MBean ''{0}'' \u6c92\u6709\u4e00\u500b\u540d\u7a31\u70ba ''{1}'' \u7684\u5c6c\u6027 +jmx.rest.client.attribute.not.found.explanation=MBean \u6c92\u6709\u63d0\u4f9b\u7d66\u5b9a\u540d\u7a31\u7684\u5c6c\u6027\u3002 +jmx.rest.client.attribute.not.found.useraction=\u8acb\u53d6\u5f97 MBean \u8cc7\u8a0a\uff0c\u4ee5\u78ba\u8a8d MBean \u6240\u63d0\u4f9b\u7684\u5c6c\u6027\u3002 + +jmx.rest.client.operation.not.found=CWWKX0219E: MBean ''{0}'' \u6c92\u6709\u4e00\u500b\u540d\u7a31\u70ba ''{1}'' \u7684\u4f5c\u696d +jmx.rest.client.operation.not.found.explanation=MBean \u6c92\u6709\u63d0\u4f9b\u7d66\u5b9a\u540d\u7a31\u7684\u4f5c\u696d\u3002 +jmx.rest.client.operation.not.found.useraction=\u8acb\u53d6\u5f97 MBean \u8cc7\u8a0a\uff0c\u4ee5\u78ba\u8a8d MBean \u6240\u63d0\u4f9b\u7684\u4f5c\u696d\u3002 + +jmx.rest.client.listener.not.found=CWWKX0220E: \u76ee\u524d\u672a\u767b\u9304\u7d66\u5b9a NotificationListener\uff0c\u4ee5\u4fbf\u63a5\u6536\u4f86\u81ea MBean ''{0}'' \u7684\u901a\u77e5 +jmx.rest.client.listener.not.found.explanation=NotificationListener \u672a\u65b0\u589e\u6216\u8005\u5df2\u79fb\u9664\uff0c\u4e14\u76ee\u524d\u672a\u767b\u9304\u4f86\u63a5\u53d7\u4f86\u81ea\u7d66\u5b9a MBean \u7684\u901a\u77e5\u3002 +jmx.rest.client.listener.not.found.useraction=\u8acb\u78ba\u5b9a\u547c\u53eb\u7a0b\u5f0f\u78bc\u6703\u8ffd\u8e64\u5df2\u65b0\u589e\u8207\u79fb\u9664\u4e86\u54ea\u4e9b NotificationListener\uff0c\u6216\u662f\u6355\u6349\u6216\u8655\u7406\u7570\u5e38\u72c0\u6cc1\u3002 + +jmx.rest.client.notification.lost=CWWKX0221I: \u7121\u6cd5\u905e\u9001\u901a\u77e5\u3002 +jmx.rest.client.notification.lost.explanation=\u7121\u6cd5\u5c07\u901a\u77e5\u905e\u9001\u7d66\u4e00\u6216\u591a\u500b NotificationListener\uff0c\u56e0\u70ba\u627e\u4e0d\u5230\u5df2\u767b\u9304\u7684 NotificationListener\uff0c\u6216\u8005\u5728\u905e\u9001\u901a\u77e5\u671f\u9593\uff0c\u767c\u751f\u7570\u5e38\u72c0\u6cc1\u3002 +jmx.rest.client.notification.lost.useraction=\u5982\u679c\u901a\u77e5\u61c9\u5df2\u905e\u9001\u7d66\u5df2\u767b\u9304\u7684 NotificationListener\uff0c\u8acb\u6aa2\u67e5\u65e5\u8a8c\u4e2d\u662f\u5426\u6709\u7570\u5e38\u72c0\u6cc1\u3002 + +jmx.rest.client.connection.failed=CWWKX0222I: \u9023\u63a5\u4f3a\u670d\u5668\u5931\u6557\u3002 +jmx.rest.client.connection.failed.explanation=\u4f3a\u670d\u5668\u8b8a\u6210\u7121\u6cd5\u4f7f\u7528\uff0c\u4e14\u5728\u6240\u914d\u7f6e\u7684\u5bb9\u8a31\u6642\u9593\u4e0a\u9650\u4e4b\u5167\uff0c\u7121\u6cd5\u91cd\u65b0\u8b8a\u6210\u53ef\u7528\u7684\u3002 +jmx.rest.client.connection.failed.useraction=\u8acb\u6aa2\u67e5\u7db2\u8def\u9023\u7dda\uff0c\u4e26\u78ba\u5b9a\u4f3a\u670d\u5668\u6b63\u5728\u57f7\u884c\uff0c\u4e14\u5df2\u555f\u7528\u4e86 REST \u9023\u63a5\u5668\u7279\u6027\u3002 + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: \u4f3a\u670d\u5668\u9023\u7dda\u66ab\u6642\u907a\u5931\u3002 +jmx.rest.client.connection.temporarily.lost.explanation=\u4f3a\u670d\u5668\u8b8a\u6210\u7121\u6cd5\u4f7f\u7528\uff0c\u4f46\u662f\u7528\u6236\u7aef\u5617\u8a66\u5728\u6240\u914d\u7f6e\u7684\u5bb9\u8a31\u6642\u9593\u4e0a\u9650\u671f\u9593\u9084\u539f\u9023\u7dda\u3002 +jmx.rest.client.connection.temporarily.lost.useraction=\u5982\u679c\u4f3a\u670d\u5668\u6b63\u5728\u81ea\u767c\u5730\u91cd\u65b0\u555f\u52d5\uff0c\u5247\u4e0d\u9700\u57f7\u884c\u4efb\u4f55\u52d5\u4f5c\u3002\u5426\u5247\uff0c\u8acb\u6aa2\u67e5\u7db2\u8def\u9023\u7dda\uff0c\u4e26\u78ba\u5b9a\u4f3a\u670d\u5668\u6b63\u5728\u57f7\u884c\uff0c\u4e14\u5df2\u555f\u7528\u4e86 REST \u9023\u63a5\u5668\u7279\u6027\u3002 +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: \u9023\u7dda\u5df2\u9084\u539f\uff0c\u4f46\u662f\u5728\u65b0\u589e NotificationListener \u6642\uff0c\u767c\u73fe\u7570\u5e38\u72c0\u6cc1\u3002 +jmx.rest.client.connection.restored.with.exceptions.explanation=\u4f3a\u670d\u5668\u9023\u7dda\u66ab\u6642\u907a\u5931\uff0c\u4f46\u662f\u5df2\u9806\u5229\u9084\u539f\u3002\u5728\u65b0\u589e NotificationListener \u671f\u9593\uff0c\u767c\u73fe\u7570\u5e38\u72c0\u6cc1\uff0c\u56e0\u6b64\u53ef\u80fd\u6c92\u6709\u6536\u5230\u67d0\u4e9b\u901a\u77e5\u3002 +jmx.rest.client.connection.restored.with.exceptions.useraction=\u8acb\u6aa2\u67e5\u901a\u77e5\u96a8\u9644\u7684\u7570\u5e38\u72c0\u6cc1\uff0c\u4e26\u5728\u66f4\u6b63\u554f\u984c\u4e4b\u5f8c\uff0c\u91cd\u65b0\u767b\u9304 NotificationListener\u3002 + +jmx.rest.client.connection.restored=CWWKX0225I: \u5df2\u9806\u5229\u9084\u539f\u9023\u7dda\u3002 +jmx.rest.client.connection.restored.explanation=\u4f3a\u670d\u5668\u9023\u7dda\u66ab\u6642\u907a\u5931\uff0c\u4f46\u662f\u5df2\u9806\u5229\u9084\u539f\u3002\u4efb\u4f55\u5df2\u767b\u9304\u7684 NotificationListener \u90fd\u5c07\u7e7c\u7e8c\u63a5\u6536\u901a\u77e5\u3002 +jmx.rest.client.connection.restored.useraction=\u7121 + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: \u985e\u578b JMXServiceURL \u7684\u53c3\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.connection.illegal.argument.explanation=\u53c3\u6578 'serviceURL' \u7684\u503c\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.connection.illegal.argument.useraction=\u4f7f\u7528\u975e\u7a7a\u503c\u7684 JMXServiceURL \u503c\u4f86\u91cd\u65b0\u9023\u63a5\u5230\u300cJMX REST \u9023\u63a5\u5668\u300d\u3002 + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: \u4ee5\u4e0b\u4e0d\u662f\u6709\u6548\u7684\u7aef\u9ede\u503c\uff1a{0} +jmx.rest.client.connection.invalid.endpoint.explanation=\u6307\u5b9a\u7684\u7aef\u9ede\u503c\u7121\u6548\u3002 +jmx.rest.client.connection.invalid.endpoint.useraction=\u4f7f\u7528\u5c6c\u65bc\u985e\u578b\u300c\u5b57\u4e32\u300d\u4e14\u683c\u5f0f\u70ba "host:port" \u7684\u6709\u6548\u7aef\u9ede\u503c\u4f86\u91cd\u65b0\u9023\u63a5\u5230\u300cJMX REST \u9023\u63a5\u5668\u300d\u3002 + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: \u627e\u4e0d\u5230\u4efb\u4f55\u53ef\u7528\u7684\u7aef\u9ede\u4f86\u8d77\u59cb\u8a2d\u5b9a\u9023\u63a5\u5668\u3002 +jmx.rest.client.connection.no.endpoints.explanation=\u5728\u8d77\u59cb\u8a2d\u5b9a\u300cJMX REST \u9023\u63a5\u5668\u300d\u671f\u9593\uff0c\u6c92\u6709\u4efb\u4f55\u6307\u5b9a\u7684\u7aef\u9ede\u53ef\u7528\u3002 +jmx.rest.client.connection.no.endpoints.useraction=\u4f7f\u7528\u81f3\u5c11\u4e00\u500b\u53ef\u7528\u7684\u7aef\u9ede\u4f86\u91cd\u65b0\u9023\u63a5\u5230\u300cJMX REST \u9023\u63a5\u5668\u300d\u3002 + +jmx.rest.client.bad.user.credentials=CWWKX0229E: \u6240\u63d0\u4f9b\u7684\u4f7f\u7528\u8005\u8a8d\u8b49\u6709\u554f\u984c\u3002\u4f3a\u670d\u5668\u7684\u56de\u61c9\u78bc\u662f {0}\uff0c\u8a0a\u606f\u662f ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=\u63d0\u4f9b\u7684\u8a8d\u8b49\u4e0d\u6b63\u78ba\u3001\u5df2\u904e\u671f\u3001\u4e0d\u5b8c\u6574\u6216\u6388\u6b0a\u88ab\u62d2\u3002 +jmx.rest.client.bad.user.credentials.useraction=\u8acb\u78ba\u8a8d\u4f7f\u7528\u8005\u8a8d\u8b49\u6709\u6b63\u78ba\u7684\u9451\u5225\u8207\u6388\u6b0a\uff0c\u7136\u5f8c\u53d6\u5f97\u65b0\u9023\u7dda\u3002 + +jmx.rest.client.connection.connect=CWWKX0230I: \u7fa4\u9ad4\u6210\u54e1\u5df2\u958b\u555f JMX \u7528\u6236\u7aef\uff0c\u4e26\u6307\u5411\u7fa4\u9ad4\u63a7\u5236\u5668\uff1a{0} +jmx.rest.client.connection.connect.explanation=\u6210\u54e1\u5df2\u9023\u63a5\u81f3\u63a7\u5236\u5668\u3002 +jmx.rest.client.connection.connect.useraction=\u4e0d\u9700\u63a1\u53d6\u4efb\u4f55\u52d5\u4f5c\u3002 +jmx.rest.client.connection.disconnect=CWWKX0231I: \u7fa4\u9ad4\u6210\u54e1\u5df2\u5f9e\u7fa4\u9ad4\u63a7\u5236\u5668 {0} \u95dc\u9589 JMX \u7528\u6236\u7aef +jmx.rest.client.connection.disconnect.explanation=\u6210\u54e1\u5df2\u5207\u65b7\u63a7\u5236\u5668\u9023\u7dda\u3002 +jmx.rest.client.connection.disconnect.useraction=\u4e0d\u9700\u63a1\u53d6\u4efb\u4f55\u52d5\u4f5c\u3002 + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/restConnector-headers.bnd b/dev/com.ibm.ws.jmx.connector.client.rest/restConnector-headers.bnd new file mode 100755 index 000000000000..e5f924c8d017 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/restConnector-headers.bnd @@ -0,0 +1,9 @@ +Private-Package: \ + com.ibm.json.*, \ + com.ibm.websphere.jmx.connector.rest, \ + com.ibm.ws.jmx.connector.client.rest.*, \ + com.ibm.ws.jmx.connector.converter, \ + com.ibm.ws.jmx.connector.datatypes + +Include-Resource: \ + META-INF=resources/META-INF diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/restConnector.bnd b/dev/com.ibm.ws.jmx.connector.client.rest/restConnector.bnd new file mode 100755 index 000000000000..fc4f5c2087c9 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/restConnector.bnd @@ -0,0 +1,8 @@ +-include = \ + ~../cnf/resources/bnd/jar.props, \ + restConnector-headers.bnd + +bVersion=1.0 + +Client-Name: REST Connector Client JAR +Client-Description: REST Connector Client JAR; version=${bVersion} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/ConnectorSettings.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/ConnectorSettings.java new file mode 100755 index 000000000000..ffd1f24d2930 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/ConnectorSettings.java @@ -0,0 +1,283 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012,2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.jmx.connector.rest; + +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; + +/** + * Provides constants for connection settings of the Liberty profile JMX REST connector client. + * The settings can be adjusted in 2 ways: + *

+ *

    + *
  1. Globally, by setting a system property with the desired value. For example, to set READ_TIMEOUT to 2 minutes (120000 milliseconds), use the Java option: + *

    + * + *

    + * -Dcom.ibm.ws.jmx.connector.client.rest.readTimeout=120000
    + * 
    + * + *
  2. + *
  3. On a per connection basis, by adding an entry to the environment Map parameter of the + * {@link JMXConnectorFactory#newJMXConnector(javax.management.remote.JMXServiceURL, java.util.Map)} or {@link JMXConnector#connect(java.util.Map)} method. + *

    + * + *

    + * 
    + * HashMap environment = new HashMap();
    + * environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client");
    + * environment.put(JMXConnector.CREDENTIALS, new String[] { "bob", "bobpassword" });
    + * environment.put(ConnectorSettings.MAX_SERVER_WAIT_TIME, 120000);
    + *
    + * JMXServiceURL url = new JMXServiceURL("service:jmx:rest://<host>:<port>/IBMJMXConnectorREST");
    + * JMXConnector connector = JMXConnectorFactory.newJMXConnector(url, environment);
    + * connector.connect(environment);
    + * 
    + * 
    + * + *
  4. + *
+ * + * @ibm-api + */ +public interface ConnectorSettings { + + /** + * Boolean setting that when enabled disables hostname verification on the client connections. This can be useful for environments where the hostname used does not match the + * one specified in the server certificate. + */ + public static final String DISABLE_HOSTNAME_VERIFICATION = ClientProvider.CLIENT_DOMAIN + ".disableURLHostnameVerification"; + + /** + * Integer setting for the maximum amount of time in milliseconds that the server waits for new notifications before responding to a request for notifications from the client. + * A larger value results in better notification delivery times because less time is spent establishing new connections. Normally it is not necessary to adjust this value. + */ + public static final String NOTIFICATION_DELIVERY_INTERVAL = ClientProvider.REST_CLIENT_DOMAIN + ".notificationDeliveryInterval"; + + /** + * Integer setting for the amount of time in milliseconds that the server waits before discarding notification registrations if the client has not checked for new + * notifications. Normally it is not necessary to adjust this value. + */ + public static final String NOTIFICATION_INBOX_EXPIRY = ClientProvider.REST_CLIENT_DOMAIN + ".notificationInboxExpiry"; + + /** + * Integer setting for the amount of time in milliseconds that the client waits before making a new request to fetch notifications. + */ + public static final String NOTIFICATION_FETCH_INTERVAL = ClientProvider.REST_CLIENT_DOMAIN + ".notificationFetchInterval"; + + /** + * Integer setting for the read timeout in milliseconds for all client communications with the server, except notification fetching. Adjust this value if the client throws read + * timeout exceptions because of a slow connection or client or server process. + */ + public static final String READ_TIMEOUT = ClientProvider.REST_CLIENT_DOMAIN + ".readTimeout"; + + /** + * Integer setting for the read timeout in milliseconds for notification fetching. Because the server might wait up to NOTIFICATION_DELIVERY_INTERVAL before responding, this + * value must be somewhat larger, though normally it is not necessary to adjust this value. + */ + public static final String NOTIFICATION_READ_TIMEOUT = ClientProvider.REST_CLIENT_DOMAIN + ".notificationReadTimeout"; + + /** + * Integer setting for the amount of time in milliseconds that the client waits between checks that the server is still available. To disable this behaviour, set the value to + * a negative integer. + * + * This value is overridden by {@link ConnectorSettings.NOTIFICATION_FETCH_INTERVAL} whenever there are notification listeners registered with this client. + */ + public static final String SERVER_FAILOVER_INTERVAL = ClientProvider.REST_CLIENT_DOMAIN + ".failoverInterval"; + + /** + * Integer setting for the amount of time in milliseconds that the client waits for the server to become available before the JMX connection fails and a new connection must be + * created. If the connection is restored, any previous notification listeners are registered again. To disable this behavior, set the value to zero. + */ + public static final String MAX_SERVER_WAIT_TIME = ClientProvider.REST_CLIENT_DOMAIN + ".maxServerWaitTime"; + + /** + * Integer setting for the amount of time in milliseconds that the client waits between checks that the server is available again when MAX_SERVER_WAIT_TIME is non-zero. + * Normally it is not necessary to adjust this value. + */ + public static final String SERVER_STATUS_POLLING_INTERVAL = ClientProvider.REST_CLIENT_DOMAIN + ".serverStatusPollingInterval"; + + /** + * Indicates that the {@link JMXConnector.CREDENTIALS} will be handled by SSL certificate based authentication. + */ + public static final String CERTIFICATE_AUTHENTICATION = ClientProvider.CLIENT_DOMAIN + ".CLIENT_CERT_AUTH"; + + /** + * Indicates that all JMX connections will use the specified SSLSocketFactory + */ + public static final String CUSTOM_SSLSOCKETFACTORY = ClientProvider.CLIENT_DOMAIN + ".CUSTOM_SSLSOCKETFACTORY"; + + /** + *

Work Load Management Endpoints

+ * List of Strings setting to indicate which endpoints, in addition + * to the host and port in the {@link JMXServiceURL}, are valid for + * establishing a connection. An endpoint is defined as "host:port". + *

+ * When the work load management endpoint list is set, the initial + * connection is made using one of the endpoints in the complete set of + * available endpoints. The complete set of endpoints is the host and port + * specified to the {@link JMXServiceURL} as well as the contents of the + * work load management endpoint list. + *

+ * This property is only supported in the programmatic JMX environment. + * + *

+     * 
+     * List<String> endpoints = new ArrayList<String>
+     * endpoints.add("<host2>:<port>");
+     *
+     * HashMap environment = new HashMap();
+     * environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client");
+     * environment.put(JMXConnector.CREDENTIALS, new String[] { "bob", "bobpassword" });
+     * environment.put(ConnectorSettings.WLM_ENDPOINTS, endpoints);
+     *
+     * JMXServiceURL url = new JMXServiceURL("service:jmx:rest://<host>:<port>/IBMJMXConnectorREST");
+     * JMXConnector connector = JMXConnectorFactory.newJMXConnector(url, environment);
+     * connector.connect(environment);
+     * 
+     * 
+ * + * The preceding code would establish the available endpoint set as host:port + * and host2:port. + *

+ * No ordering guarantees are made regarding which endpoint is ultimately + * used for the connection, but all endpoints will be tried in order to + * establish a connection. Only when all endpoints in the complete set are + * inaccessible is a connection considered to be unobtainable. + *

+ * Fail-over retry will occur if the invoked operation could not be + * started. If the connection is lost during an operation, no retry will + * be done so as to not issue the same command twice. In other words, if + * we loose the connection before the operation can report success, an + * IOException will be thrown and the operation will not be re-tried. + */ + public static final String WLM_ENDPOINTS = ClientProvider.CLIENT_DOMAIN + ".wlm.endpoints"; + + /** + * This parameter represents the host name to be used in a routing context. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint and the Routing MBean, exposed by the server-side of the JMX REST connector. + */ + public static final String ROUTING_KEY_HOST_NAME = "com.ibm.websphere.jmx.connector.rest.routing.hostName"; + + /** + * This parameter represents the server name to be used in a routing context. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint and the Routing MBean, exposed by the server-side of the JMX REST connector. + */ + public static final String ROUTING_KEY_SERVER_NAME = "com.ibm.websphere.jmx.connector.rest.routing.serverName"; + + /** + * This parameter represents the server user directory to be used in a routing context. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint and the Routing MBean, exposed by the server-side of the JMX REST connector. + */ + public static final String ROUTING_KEY_SERVER_USER_DIR = "com.ibm.websphere.jmx.connector.rest.routing.serverUserDir"; + + /** + * This parameter represents a comma-separated list of host names within the collective. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String COLLECTIVE_HOST_NAMES = "com.ibm.websphere.collective.hostNames"; + + /** + * This parameter represents a request for an asynchronous execution within the collective. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String ASYNC_EXECUTION = "com.ibm.websphere.jmx.connector.rest.asyncExecution"; + + /** + * This parameter represents the set of credentials to be used for the transfer action. + * The payload of the header is a JSON object with attributes from the CollectiveRegistrationMBean. + * Only credentials (user name, password, keys) are defined. The host and port attributes are not supported. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String TRANSFER_CREDENTIALS = "com.ibm.websphere.jmx.connector.rest.transferCredentials"; + + /** + * This parameter represents the request for a pre transfer action within the collective. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String PRE_TRANSFER_ACTION = "com.ibm.websphere.jmx.connector.rest.preTransferAction"; + + /** + * This parameter represents the request for a post transfer action within the collective. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String POST_TRANSFER_ACTION = "com.ibm.websphere.jmx.connector.rest.postTransferAction"; + + /** + * This parameter represents the default value for the collective pre-transfer-action. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String PRE_TRANSFER_ACTION_DEFAULT = "com.ibm.websphere.jmx.connector.rest.preTransferAction.remove"; + + /** + * This parameter represents the default value for the collective post-transfer-action. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String POST_TRANSFER_ACTION_DEFAULT = "com.ibm.websphere.jmx.connector.rest.postTransferAction.join"; + + /** + * This parameter represents the action of extarcting a severName from a Liberty zip package for the collective post-transfer-action. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String POST_TRANSFER_ACTION_FIND_SERVER_NAME = "com.ibm.websphere.jmx.connector.rest.postTransferAction.findServerName"; + + /** + * This parameter represents the options pertaining to the collective pre-transfer-action. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String PRE_TRANSFER_ACTION_OPTIONS = "com.ibm.websphere.jmx.connector.rest.preTransferAction.options"; + + /** + * This parameter represents the options pertaining to the collective post-transfer-action. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String POST_TRANSFER_ACTION_OPTIONS = "com.ibm.websphere.jmx.connector.rest.postTransferAction.options"; + + /** + * This parameter represents a set of environment variables and their corresponding values. + * The payload of the header is a JSON object that has envKey : envValue pairs. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String TRANSFER_ENV_VARS = "com.ibm.websphere.jmx.connector.rest.transferEnvVars"; + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/package-info.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/package-info.java new file mode 100755 index 000000000000..8f227398e475 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/package-info.java @@ -0,0 +1,16 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +/** + * @version 1.4 + */ +@org.osgi.annotation.versioning.Version("1.4") +package com.ibm.websphere.jmx.connector.rest; diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/ClientProvider.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/ClientProvider.java new file mode 100755 index 000000000000..b2eec76c36ea --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/ClientProvider.java @@ -0,0 +1,58 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.Map; + +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorProvider; +import javax.management.remote.JMXServiceURL; + +import com.ibm.websphere.jmx.connector.rest.ConnectorSettings; +import com.ibm.ws.jmx.connector.client.rest.internal.Connector; + +public class ClientProvider implements JMXConnectorProvider, ConnectorSettings { + + public static final String REST_PROTOCOL = "rest"; + + public static final String CLIENT_DOMAIN = "com.ibm.ws.jmx.connector.client"; + public static final String REST_CLIENT_DOMAIN = "com.ibm.ws.jmx.connector.client.rest"; + + public static final String CONNECTION_TEMPORARILY_LOST = REST_CLIENT_DOMAIN + ".connectionTemporarilyLost"; + public static final String CONNECTION_RESTORED = REST_CLIENT_DOMAIN + ".connectionRestored"; + public static final String CONNECTION_RESTORED_WITH_EXCEPTIONS = REST_CLIENT_DOMAIN + ".connectionRestoredWithExceptions"; + + public static final String CONNECTION_ROUTING_DOMAIN = "WebSphere"; + public static final String CONNECTION_ROUTING_NAME = "RoutingContext"; + public static final String CONNECTION_ROUTING_OPERATION_ASSIGN_SERVER = "assignServerContext"; + public static final String CONNECTION_ROUTING_OPERATION_ASSIGN_HOST = "assignHostContext"; + + public static final String FILE_TRANSFER_DOMAIN = "WebSphere"; + public static final String FILE_TRANSFER_NAME = "FileTransfer"; + + /* + * (non-Javadoc) + * + * @see javax.management.remote.JMXConnectorProvider#newJMXConnector(javax.management.remote.JMXServiceURL, java.util.Map) + */ + @Override + public JMXConnector newJMXConnector(JMXServiceURL serviceURL, Map environment) throws IOException { + if (serviceURL == null || environment == null) + throw new NullPointerException(); + if (!ClientProvider.REST_PROTOCOL.equals(serviceURL.getProtocol())) + throw new MalformedURLException(); + return new Connector(serviceURL, environment); + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Activator.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Activator.java new file mode 100755 index 000000000000..06fab68c4d99 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Activator.java @@ -0,0 +1,59 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* WLP Copyright IBM Corp. 2016 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ConfigurationPolicy; +import org.osgi.service.component.annotations.Deactivate; + +@Component(configurationPolicy = ConfigurationPolicy.IGNORE) +public class Activator { + + private final static String PKGS_KEY = "jmx.remote.protocol.provider.pkgs"; + private final static String PKGS = "com.ibm.ws.jmx.connector.client"; + private final static Pattern P = Pattern.compile("(?:\\A|,)" + PKGS + "(?:\\z|,)"); + + @Activate + protected void activate() { + + String jmx = System.getProperty(PKGS_KEY); + System.setProperty(PKGS_KEY, add(jmx)); + } + + @Deactivate + protected void deactivate() { + String jmx = System.getProperty(PKGS_KEY); + if (PKGS.equals(jmx)) { + System.clearProperty(PKGS_KEY); + } else { + System.setProperty(PKGS_KEY, remove(jmx)); + } + } + + static String add(String jmx) { + if (jmx == null) { + return PKGS; + } else { + return jmx + "," + PKGS; + } + } + + static String remove(String jmx) { + Matcher m = P.matcher(jmx); + return m.replaceAll(""); + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ClientConstants.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ClientConstants.java new file mode 100755 index 000000000000..b3c038bc61ec --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ClientConstants.java @@ -0,0 +1,43 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package com.ibm.ws.jmx.connector.client.rest.internal; + +class ClientConstants { + + enum HttpMethod { + GET, POST, PUT, DELETE, + HEAD, OPTIONS, TRACE + }; + + static final String JSON_MIME_TYPE = "application/json"; + + static final boolean DISABLE_HOSTNAME_VERIFICATION_DEFAULT = false; + + static final int NOTIFICATION_DELIVERY_INTERVAL_DEFAULT = 0; + + static final int NOTIFICATION_FETCH_INTERVAL_DEFAULT = 1000; + + static final int NOTIFICATION_INBOX_EXPIRY_DEFAULT = 5 * 60 * 1000; + + static final int SERVER_FAILOVER_INTERVAL_DEFAULT = 30 * 1000; + + static final int READ_TIMEOUT_DEFAULT = 60 * 1000; + + static final int MAX_SERVER_WAIT_TIME_DEFAULT = 120 * 1000; + + static final int SERVER_STATUS_POLLING_INTERVAL_DEFAULT = 4 * 1000; + + static final String CONNECTOR_URI = "IBMJMXConnectorREST"; + + static final String ROUTER_URI = CONNECTOR_URI + "/router"; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Connector.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Connector.java new file mode 100755 index 000000000000..ef422240d5d8 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Connector.java @@ -0,0 +1,619 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.io.IOException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.ListenerNotFoundException; +import javax.management.MBeanServerConnection; +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; +import javax.management.remote.JMXConnectionNotification; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.SSLSocketFactory; +import javax.security.auth.Subject; + +import com.ibm.websphere.jmx.connector.rest.ConnectorSettings; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.ws.jmx.connector.client.rest.internal.resources.RESTClientMessagesUtil; +import com.ibm.ws.jmx.connector.converter.JSONConverter; +import com.ibm.ws.jmx.connector.datatypes.ConversionException; + +public class Connector implements JMXConnector { + + private static final Logger logger = Logger.getLogger(Connector.class.getName()); + + private final JMXServiceURL serviceURL; + private Map environment; + private long connectionId; + + private List wlmList; + + private String currentEndpoint; + + private boolean hostnameVerificationDisabled; + private int notificationDeliveryInterval, notificationFetchInterval, notificationInboxExpiry, readTimeout, notificationReadTimeout, serverFailoverInterval, maxServerWaitTime, + serverStatusPollingInterval; + private String user; + private String basicAuthHeader = null; + + private RESTMBeanServerConnection connection = null; + private boolean closed = false; + + private List connectionListeners = null; + + private static long nextConnectionNumber = 1; + + private SSLSocketFactory customSSLSocketFactory = null; + + private boolean isCollectiveUtilConnection = false; + private boolean logFailovers = false; + + /** + * @return the customSSLSocketFactory + */ + public SSLSocketFactory getCustomSSLSocketFactory() { + return customSSLSocketFactory; + } + + /** + * @param customSSLSocketFactory the customSSLSocketFactory to set + */ + public void setCustomSSLSocketFactory(SSLSocketFactory customSSLSocketFactory) { + this.customSSLSocketFactory = customSSLSocketFactory; + } + + private synchronized static long getConnectionNumber() { + return nextConnectionNumber++; + } + + private static long nextNotificationNumber = 1; + + private static long getNotificationNumber() { + synchronized (Connector.class) { + return nextNotificationNumber++; + } + } + + public Connector(JMXServiceURL serviceURL, Map environment) { + this.serviceURL = serviceURL; + this.environment = environment; + this.isCollectiveUtilConnection = getBooleanSetting("isCollectiveUtil", false); + this.logFailovers = getBooleanSetting("logFailovers", false); + + if (serviceURL == null) { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.NULL_SERVICE_URL)); + } + + //We initialize our WLM list to have the connecting URL. In non-WLM cases, this is our only URL. + this.wlmList = new ArrayList(); + this.wlmList.add(serviceURL.getHost() + ":" + serviceURL.getPort()); + } + + /** {@inheritDoc} */ + @Override + public void connect() throws IOException { + connect(null); + } + + private Object getCredentials() { + Object credentials = environment.get(JMXConnector.CREDENTIALS); + if (credentials != null) { + //We found a non-null key in our map, so that's the credentials we'll use + return credentials; + } + + //Our map was empty, but before we fail, check if we can fetch a String from the system properties + credentials = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty(JMXConnector.CREDENTIALS); + } + }); + + return credentials; + } + + private boolean getBooleanSetting(final String key, boolean defaultValue) { + // Check environment first for per-connection setting + if (environment != null) { + Object setting = environment.get(key); + if (setting != null && setting instanceof Boolean) + return (Boolean) setting; + } + + // Next, check system property for global setting + String setting = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty(key); + } + }); + if (setting != null) { + return Boolean.parseBoolean(setting); + } + + // Otherwise, return default value + return defaultValue; + } + + private int getIntegerSetting(final String key, int defaultValue) { + // Check environment first for per-connection setting + if (environment != null) { + Object setting = environment.get(key); + if (setting != null && setting instanceof Integer) + return (Integer) setting; + } + + // Next, check system property for global setting + String setting = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty(key); + } + }); + if (setting != null) { + try { + return Integer.parseInt(setting); + } catch (NumberFormatException nfe) { + // ignore value + } + } + + // Otherwise, return default value + return defaultValue; + } + + /** + * Validate the possible endpoint String. + * + * @param possibleEndpoint + * @throws IllegalArgumentException if the String is not a valid endpoint + */ + private void validatePossibleEndpoint(String possibleEndpoint) throws IllegalArgumentException { + if (!possibleEndpoint.contains(":")) { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint)); + } + String[] components = possibleEndpoint.split(":"); + if (components.length != 2) { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint)); + } + try { + Integer.valueOf(components[1]); + } catch (NumberFormatException e) { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint)); + } + } + + /** + * Validates the list contains nothing but Strings, and that those Strings + * are in the endpoint format. If the List contains non-String elements, + * or a String that does not follow the endpoint host:port format, + * an IllegalArgumentException will be thrown. + * + * @param list A generic List of Objects to be validated + * @throws IllegalArgumentException if the List contains a non-String + * element or if the String is not in endpoint format + */ + private void validateEndpointList(List list) throws IllegalArgumentException { + if (list.isEmpty()) { + return; + } + + for (Object element : list) { + if (element == null) { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, "null")); + } else if (element instanceof String) { + String elemStr = (String) element; + validatePossibleEndpoint((String) element); + //Add endpoint to our list. Filter duplicates. + if (!wlmList.contains(elemStr)) { + wlmList.add(elemStr); + } + } else { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, element.toString())); + } + } + + //Randomize the list if we have more than 1 element. This is our basic load balancer. + if (wlmList.size() > 1) { + Collections.shuffle(wlmList, new Random(System.currentTimeMillis())); + } + + //We don't want anybody changing our list of endpoints from this point forward + this.wlmList = Collections.unmodifiableList(this.wlmList); + + } + + /** + * Return the configured List of endpoints + */ + List getEndpointList() { + return this.wlmList; + } + + /** {@inheritDoc} */ + @Override + public synchronized void connect(Map env) throws IOException { + // Connector can only be used once + if (closed) + throw new IOException(); + + // connect has no effect if already connected + if (connection != null) + return; + + if (env != null) + environment = env; + + // User credentials will either be available as a String[] for basic auth, OR + //as a String (equals to ConnectorSettings.CERTIFICATE_AUTHENTICATION), which could also come from a system property + Object credentials = getCredentials(); + if (!areRequiedCredentialsSet(credentials)) { + throw new IOException(JMXConnector.CREDENTIALS + " not provided. Set to a String[2] {user,password}."); + } + // If the credentials are not certificate, extract and set the basicAuthHeader + if (!ConnectorSettings.CERTIFICATE_AUTHENTICATION.equals(credentials)) { + String[] userPass = (String[]) credentials; + user = userPass[0]; + JSONConverter converter = JSONConverter.getConverter(); + try { + basicAuthHeader = "Basic " + converter.encodeStringAsBase64(user + ":" + userPass[1]); + } catch (ConversionException ce) { + throw new IOException("Failure encoding credentials", ce); + } finally { + JSONConverter.returnConverter(converter); + } + } + + hostnameVerificationDisabled = getBooleanSetting(ConnectorSettings.DISABLE_HOSTNAME_VERIFICATION, ClientConstants.DISABLE_HOSTNAME_VERIFICATION_DEFAULT); + notificationDeliveryInterval = getIntegerSetting(ConnectorSettings.NOTIFICATION_DELIVERY_INTERVAL, ClientConstants.NOTIFICATION_DELIVERY_INTERVAL_DEFAULT); + notificationFetchInterval = getIntegerSetting(ConnectorSettings.NOTIFICATION_FETCH_INTERVAL, ClientConstants.NOTIFICATION_FETCH_INTERVAL_DEFAULT); + notificationInboxExpiry = getIntegerSetting(ConnectorSettings.NOTIFICATION_INBOX_EXPIRY, ClientConstants.NOTIFICATION_INBOX_EXPIRY_DEFAULT); + readTimeout = getIntegerSetting(ConnectorSettings.READ_TIMEOUT, ClientConstants.READ_TIMEOUT_DEFAULT); + notificationReadTimeout = getIntegerSetting(ConnectorSettings.NOTIFICATION_READ_TIMEOUT, + notificationDeliveryInterval > 0 ? 2 * notificationDeliveryInterval : ClientConstants.READ_TIMEOUT_DEFAULT); + serverFailoverInterval = getIntegerSetting(ConnectorSettings.SERVER_FAILOVER_INTERVAL, ClientConstants.SERVER_FAILOVER_INTERVAL_DEFAULT); + maxServerWaitTime = getIntegerSetting(ConnectorSettings.MAX_SERVER_WAIT_TIME, ClientConstants.MAX_SERVER_WAIT_TIME_DEFAULT); + serverStatusPollingInterval = getIntegerSetting(ConnectorSettings.SERVER_STATUS_POLLING_INTERVAL, ClientConstants.SERVER_STATUS_POLLING_INTERVAL_DEFAULT); + + //Validate endpoints if applicable + Object list = environment.get(ConnectorSettings.WLM_ENDPOINTS); + if (list != null && list instanceof List) { + validateEndpointList((List) list); + } + + // -- Logging + if (logger.isLoggable(Level.FINER)) { + StringBuilder sb = new StringBuilder(); + sb.append("Endpoints:"); + for (String endpoint : wlmList) { + sb.append(endpoint); + sb.append(" "); + } + logger.logp(Level.FINER, logger.getName(), "connect", sb.toString()); + + if (logger.isLoggable(Level.FINEST)) { + sb = new StringBuilder(); + sb.append("notificationDeliveryInterval"); + sb.append("="); + sb.append(notificationDeliveryInterval); + sb.append("\n"); + + sb.append("notificationFetchInterval"); + sb.append("="); + sb.append(notificationFetchInterval); + sb.append("\n"); + + sb.append("notificationInboxExpiry"); + sb.append("="); + sb.append(notificationInboxExpiry); + sb.append("\n"); + + sb.append("readTimeout"); + sb.append("="); + sb.append(readTimeout); + sb.append("\n"); + + sb.append("notificationReadTimeout"); + sb.append("="); + sb.append(notificationReadTimeout); + sb.append("\n"); + + sb.append("serverFailoverInterval"); + sb.append("="); + sb.append(serverFailoverInterval); + sb.append("\n"); + + sb.append("maxServerWaitTime"); + sb.append("="); + sb.append(maxServerWaitTime); + sb.append("\n"); + + sb.append("serverStatusPollingInterval"); + sb.append("="); + sb.append(serverStatusPollingInterval); + sb.append("\n"); + + logger.logp(Level.FINEST, logger.getName(), "connect", sb.toString()); + } + } + + connectionId = getConnectionNumber(); + + Object o = environment.get(ConnectorSettings.CUSTOM_SSLSOCKETFACTORY); + if (o != null && o instanceof SSLSocketFactory) { + SSLSocketFactory sslf = (SSLSocketFactory) o; + this.setCustomSSLSocketFactory(sslf); + } + + // No longer need environment + environment = null; + + connection = new RESTMBeanServerConnection(this); + + connectionOpened(); + } + + /** + * @param credentials + * @return + */ + private boolean areRequiedCredentialsSet(Object credentials) { + if (credentials == null) { + return false; + } + if (ConnectorSettings.CERTIFICATE_AUTHENTICATION.equals(credentials)) { + return true; + } + if ((credentials instanceof String[]) && (((String[]) credentials).length == 2)) { + return true; + } + return false; + } + + /** {@inheritDoc} */ + @Override + public synchronized MBeanServerConnection getMBeanServerConnection() throws IOException { + // if not yet connected, throw IOException + if (connection == null) + throw new IOException(); + + return connection; + } + + /** {@inheritDoc} */ + @Override + public MBeanServerConnection getMBeanServerConnection(Subject delegationSubject) throws IOException { + // this use-case not supported + throw new IOException(); + } + + /** {@inheritDoc} */ + @Override + public synchronized void close() throws IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "close", "Closing connector"); + } + + if (!closed) { + // It is possible for close to be called prior to connecting. + // If so, we behave as a no-op. + if (connection != null) { + connection.close(); + } + connection = null; + closed = true; + if (connectionListeners != null) { + JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.CLOSED, this, getConnectionId(), getNotificationNumber(), null, null); + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + } + + synchronized void connectionOpened() { + if (connectionListeners != null) { + JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.OPENED, this, getConnectionId(), getNotificationNumber(), null, null); + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + + synchronized void connectionFailed(Throwable t) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "connectionFailed", "Failed connection: " + t); + } + closed = true; + if (connectionListeners != null) { + JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.FAILED, this, getConnectionId(), getNotificationNumber(), RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.CONNECTION_FAILED), t); + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + + synchronized void notificationLost(Notification n) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "notificationLost", "Lost notification: " + n); + } + + if (connectionListeners != null) { + JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.NOTIFS_LOST, this, getConnectionId(), getNotificationNumber(), RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.NOTIFICATION_LOST), n); + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + + synchronized void connectionTemporarilyLost(Throwable t) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "connectionTemporarilyLost", "Lost connection:" + t.getMessage()); + } + + if (connectionListeners != null) { + JMXConnectionNotification notification = new JMXConnectionNotification(ClientProvider.CONNECTION_TEMPORARILY_LOST, this, getConnectionId(), getNotificationNumber(), RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.CONNECTION_TEMPORARILY_LOST), t); + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + + synchronized void connectionRestored(Exception[] exceptions) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "connectionRestored", "Connection restored"); + } + + if (connectionListeners != null) { + JMXConnectionNotification notification; + if (exceptions != null) { + notification = new JMXConnectionNotification(ClientProvider.CONNECTION_RESTORED_WITH_EXCEPTIONS, this, getConnectionId(), getNotificationNumber(), RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.CONNECTION_RESTORED_WITH_EXCEPTIONS), exceptions); + } else { + notification = new JMXConnectionNotification(ClientProvider.CONNECTION_RESTORED, this, getConnectionId(), getNotificationNumber(), RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.CONNECTION_RESTORED), null); + } + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + + /** {@inheritDoc} */ + @Override + public synchronized void addConnectionNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "addConnectionNotificationListener", "listener: " + listener + " | filter: " + filter + " | handback: " + handback); + } + + if (connectionListeners == null) + connectionListeners = new ArrayList(); + + connectionListeners.add(new NotificationListenerEntry(listener, filter, handback)); + } + + /** {@inheritDoc} */ + @Override + public synchronized void removeConnectionNotificationListener(NotificationListener listener) throws ListenerNotFoundException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeConnectionNotificationListener", "listener: " + listener); + } + + boolean listenerFound = false; + if (connectionListeners != null) { + Iterator entryIterator = connectionListeners.iterator(); + while (entryIterator.hasNext()) { + if (entryIterator.next().listener == listener) { + listenerFound = true; + entryIterator.remove(); + } + } + } + + if (!listenerFound) + throw new ListenerNotFoundException(); + } + + /** {@inheritDoc} */ + @Override + public synchronized void removeConnectionNotificationListener(NotificationListener l, NotificationFilter f, Object handback) throws ListenerNotFoundException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeConnectionNotificationListener", "listener: " + l + " | filter: " + f + " | handback: " + handback); + } + boolean listenerFound = false; + if (connectionListeners != null) { + listenerFound = connectionListeners.remove(new NotificationListenerEntry(l, f, handback)); + } + + if (!listenerFound) + throw new ListenerNotFoundException(); + } + + /** {@inheritDoc} */ + @Override + public synchronized String getConnectionId() { + return serviceURL.getProtocol() + ":" + getCurrentEndpoint() + " " + user + " " + connectionId; + } + + JMXServiceURL getServiceURL() { + return serviceURL; + } + + boolean isHostnameVerificationDisabled() { + return hostnameVerificationDisabled; + } + + int getNotificationDeliveryInterval() { + return notificationDeliveryInterval; + } + + int getNotificationFetchInterval() { + return notificationFetchInterval; + } + + int getNotificationInboxExpiry() { + return notificationInboxExpiry; + } + + int getReadTimeout() { + return readTimeout; + } + + int getNotificationReadTimeout() { + return notificationReadTimeout; + } + + int getMaxServerWaitTime() { + return maxServerWaitTime; + } + + int getServerFailoverInterval() { + return serverFailoverInterval; + } + + int getServerStatusPollingInterval() { + return serverStatusPollingInterval; + } + + String getBasicAuthHeader() { + return basicAuthHeader; + } + + String getCurrentEndpoint() { + return currentEndpoint; + } + + boolean isCollectiveUtilConnection() { + return isCollectiveUtilConnection; + } + + void setCurrentEndpoint(String currentEndpoint) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "setCurrentEndpoint", "Changing endpoint from " + this.currentEndpoint + " to " + currentEndpoint); + } + this.currentEndpoint = currentEndpoint; + } + + /** + * @return the logFailovers + */ + public boolean logFailovers() { + return logFailovers; + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/DynamicURL.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/DynamicURL.java new file mode 100755 index 000000000000..857b69e6fecc --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/DynamicURL.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Level; +import java.util.logging.Logger; + +class DynamicURL { + + private static final Logger logger = Logger.getLogger(DynamicURL.class.getName()); + + private final String name; + private final Connector connector; + + DynamicURL(Connector connector, String name) { + this.name = name; + this.connector = connector; + } + + URL getURL() throws MalformedURLException { + String[] endpoint = RESTMBeanServerConnection.splitEndpoint(connector.getCurrentEndpoint()); + URL retURL = new URL("https", endpoint[0], Integer.valueOf(endpoint[1]), getName()); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "getURL", "URL: " + retURL.toString()); + } + + return retURL; + } + + String getName() { + return name; + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/FileTransferClient.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/FileTransferClient.java new file mode 100755 index 000000000000..7cff1cfd7c54 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/FileTransferClient.java @@ -0,0 +1,619 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.RandomAccessFile; +import java.net.ConnectException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +import javax.net.ssl.HttpsURLConnection; + +import com.ibm.json.java.JSONArray; +import com.ibm.json.java.JSONObject; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.ws.jmx.connector.client.rest.internal.ClientConstants.HttpMethod; +import com.ibm.ws.jmx.connector.client.rest.internal.resources.FileTransferClientMessagesUtil; +import com.ibm.ws.jmx.connector.converter.JSONConverter; + +/** + * This class provides the client-side file transfer support. It uses artifacts from the jmx rest connector client, such as the root URL and + * security credentials. New URLs are appended to the file transfer REST calls, so that it maps to a different jax-rs resource on the server-side. + */ +class FileTransferClient { + + private static final Logger logger = Logger.getLogger(FileTransferClient.class.getName()); + + private static final String OPERATION_DOWNLOAD = "downloadFile"; + private static final String OPERATION_UPLOAD = "uploadFile"; + private static final String OPERATION_DELETE = "deleteFile"; + private static final String OPERATION_DELETE_ALL = "deleteAll"; + private static final String QUERY_PARAM_UPLOAD_EXPAND = "expandOnCompletion"; + private static final String QUERY_PARAM_START_OFFSET = "startOffset"; + private static final String QUERY_PARAM_END_OFFSET = "endOffset"; + + private static final String FILE_TRANSFER_URL_V2 = "/fileTransfer"; + private static final String FILE_TRANSFER_ROUTER_URL_V2 = FILE_TRANSFER_URL_V2 + "/router"; + + private static final String COLLECTION_URL = "/collection"; + private static final String COLLECTION_OPERATION_DELETE = "delete"; + + private static final String FILE_TRANSFER_CONTENT_TYPE = "application/gzip"; + private static final String FILE_TRANSFER_ZIP_MIME = "application/zip"; + private static final String FILE_TRANSFER_PAX_MIME = "application/pax"; + private static final String FILE_TRANSFER_JSON_MIME = "application/json"; + private static final int FILE_TRANSFER_DEFAULT_BUFFER_SIZE = 8 * 1024; + private static final String RANDOM_FILE_ACCESS_READ_MODE = "r"; + private static final String RANDOM_FILE_ACCESS_READ_WRITE_MODE = "rw"; + + private final RESTMBeanServerConnection restConnection; + + public FileTransferClient(RESTMBeanServerConnection restConnection) throws IOException { + this.restConnection = restConnection; + + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), "constructor", + FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.CLIENT_INIT, restConnection.connector.getConnectionId())); + } + } + + /** + * Handle MBean invocation requests + */ + public Object handleOperation(String operation, Object[] params) throws IOException { + if (OPERATION_DOWNLOAD.equals(operation)) { + if (params.length == 2) { + downloadFile((String) params[0], (String) params[1]); + } else { + //partial download + return downloadFile((String) params[0], (String) params[1], (Long) params[2], (Long) params[3]); + } + } else if (OPERATION_UPLOAD.equals(operation)) { + uploadFile((String) params[0], (String) params[1], (Boolean) params[2]); + } else if (OPERATION_DELETE.equals(operation)) { + deleteFile((String) params[0]); + } else if (OPERATION_DELETE_ALL.equals(operation)) { + deleteAll((List) params[0]); + } else { + throw logUnsupportedOperationError("handleOperation", operation); + } + + //currently all operations are void, so return null. + return null; + } + + HttpsURLConnection getFileTransferConnection(URL url, HttpMethod method) throws IOException { + return getFileTransferConnection(url, method, true); + } + + HttpsURLConnection getFileTransferConnection(URL url, HttpMethod method, boolean setEncoding) throws IOException { + HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + connection.setDoInput(true); + if (method == HttpMethod.POST) { + if (restConnection.serverVersion == 2) { + //In V2 we were setting the Content-Type to application/gzip. In V3+ we corrected that + //by not specifying a Content-Type and instead specifying that the Content-Encoding is gzip. + connection.setRequestProperty("Content-Type", FILE_TRANSFER_CONTENT_TYPE); + } + connection.setDoOutput(true); + } else { + connection.setDoOutput(false); + } + connection.setUseCaches(false); + connection.setRequestMethod(method.toString()); + connection.setReadTimeout(restConnection.connector.getReadTimeout()); + + // fix 'Invalid CRLF found in header name' error + if (restConnection.connector.getBasicAuthHeader() != null) { + connection.setRequestProperty("Authorization", restConnection.connector.getBasicAuthHeader()); + } + if (restConnection.connector.isHostnameVerificationDisabled()) { + connection.setHostnameVerifier(restConnection.hostnameVerificationDisabler); + } + + connection.setRequestProperty("User-Agent", RESTMBeanServerConnection.CLIENT_VERSION); + + //Set routing headers if applicable + if (restConnection.isHostLevelRouting()) { + connection.addRequestProperty(ClientProvider.ROUTING_KEY_HOST_NAME, (String) restConnection.mapRouting.get(ClientProvider.ROUTING_KEY_HOST_NAME)); + } else if (restConnection.isServerLevelRouting()) { + connection.addRequestProperty(ClientProvider.ROUTING_KEY_HOST_NAME, (String) restConnection.mapRouting.get(ClientProvider.ROUTING_KEY_HOST_NAME)); + connection.addRequestProperty(ClientProvider.ROUTING_KEY_SERVER_USER_DIR, (String) restConnection.mapRouting.get(ClientProvider.ROUTING_KEY_SERVER_USER_DIR)); + connection.addRequestProperty(ClientProvider.ROUTING_KEY_SERVER_NAME, (String) restConnection.mapRouting.get(ClientProvider.ROUTING_KEY_SERVER_NAME)); + } + + if (restConnection.getConnector().getCustomSSLSocketFactory() != null) { + connection.setSSLSocketFactory(restConnection.getConnector().getCustomSSLSocketFactory()); + } + + if (restConnection.serverVersion > 2 && setEncoding) { + if (method == HttpMethod.POST) { + connection.addRequestProperty("Content-Encoding", "gzip"); + } else { + connection.addRequestProperty("Accept-Encoding", "gzip"); + } + } + + return connection; + } + + private String getEncodedFilePath(String path) throws IOException { + return "/" + URLEncoder.encode(path, "UTF-8"); + } + + private String getFileTransferURL() throws IOException { + if (restConnection.serverVersion == 2) { + return restConnection.getRootURL() + FILE_TRANSFER_URL_V2; + } else { + return restConnection.getFileTransferURL().toString(); + } + } + + private String getFileTransferRoutingURL() throws IOException { + if (restConnection.serverVersion == 2) { + return restConnection.getRootURL() + FILE_TRANSFER_ROUTER_URL_V2; + } else { + return restConnection.getFileTransferURL().toString(); + } + } + + private URL getURL(Map queryParameters, String additionalURL) throws IOException { + + String coreURLStr; + + if (restConnection.isServerLevelRouting() || restConnection.isHostLevelRouting()) { + coreURLStr = getFileTransferRoutingURL() + additionalURL; + } else { + coreURLStr = getFileTransferURL() + additionalURL; + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "getURL", "coreURLStr: " + coreURLStr); + } + + try { + if (queryParameters != null && !queryParameters.isEmpty()) { + //Iterate through the query parameters and build a query string + StringBuilder sb = new StringBuilder(); + Set> params = queryParameters.entrySet(); + + for (Entry param : params) { + //Add preceding characters + if (sb.length() == 0) { + //first entry + sb.append('?'); + } else { + //not the first entry + sb.append('&'); + } + + //Add parameter + sb.append(param.getKey()); + sb.append('='); + sb.append(URLEncoder.encode(param.getValue(), "UTF-8")); + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "getURL", "queryURL: " + sb.toString()); + } + + return new URL(coreURLStr + sb.toString()); + } + + return new URL(coreURLStr); + + } catch (Exception e) { + throw logClientException("getURL", e); + } + + } + + public void downloadFile(String remoteSourceFile, String localTargetFile) throws IOException { + downloadFile(remoteSourceFile, localTargetFile, 0, -1); //regular download (non-partial download) + } + + public long downloadFile(String remoteSourceFile, String localTargetFile, long startOffset, long endOffset) throws IOException { + final String methodName = "downloadFile(String remoteSourceFile, String localTargetFile, long startOffset, long endOffset)"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Entering downloadFile with remoteSourceFile: " + remoteSourceFile + " ; localTargetFile: " + localTargetFile + + " ; startOffset: " + startOffset + " and endOffset: " + endOffset); + } + + Map queryParams = new HashMap(); + + if (startOffset > 0) { + queryParams.put(QUERY_PARAM_START_OFFSET, String.valueOf(startOffset)); + } + + if (endOffset > -1) { + queryParams.put(QUERY_PARAM_END_OFFSET, String.valueOf(endOffset)); + } + + URL url = getURL(queryParams, getEncodedFilePath(remoteSourceFile)); + HttpsURLConnection connection = getFileTransferConnection(url, HttpMethod.GET); + + // Check response code from server + final int responseCode = connection.getResponseCode(); + InputStream is = null; + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + + //Get the resulting stream + is = connection.getInputStream(); + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), methodName, "Received stream: " + FileTransferClientMessagesUtil.getObjID(is)); + } + //Data is always compressed with this java client, so use GZIP stream reader + is = new GZIPInputStream(is, FILE_TRANSFER_DEFAULT_BUFFER_SIZE); + break; + + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + throw logServerException(methodName, connection); + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw logCredentialsException(methodName, responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = logResponseCodeException(methodName, responseCode, connection); + restConnection.recoverConnection(ioe); + throw ioe; + default: + throw logResponseCodeException(methodName, responseCode, connection); + } + + //Create our target output stream + RandomAccessFile destFile = new RandomAccessFile(localTargetFile, RANDOM_FILE_ACCESS_READ_WRITE_MODE); + long totalBytesRead = 0; + + try { + //Transfer bytes to output file + byte[] buf = new byte[FILE_TRANSFER_DEFAULT_BUFFER_SIZE]; + int bytesRead; + + while ((bytesRead = is.read(buf)) > 0) { + destFile.write(buf, 0, bytesRead); + totalBytesRead += bytesRead; + } + destFile.setLength(totalBytesRead); + } finally { + tryToClose(is); + tryToClose(destFile); + } + + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), methodName, + FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.DOWNLOAD_TO_FILE, remoteSourceFile, localTargetFile, + restConnection.connector.getConnectionId())); + } + + if (startOffset < 0) { + startOffset = 0; + } + + long nextStartOffset = startOffset + totalBytesRead; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Exiting downloadFile with nextStartOffset=" + nextStartOffset); + } + + return nextStartOffset; + } + + public void uploadFile(String localSourceFile, String remoteTargetFile, boolean expandOnCompletion) throws IOException { + final String methodName = "uploadFile(String localSourceFile, String remoteTargetFile, boolean expandOnCompletion)"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Entering uploadFile with localSourceFile: " + localSourceFile + " and remoteTargetFile: " + remoteTargetFile); + } + + Map queryParams = new HashMap(); + queryParams.put(QUERY_PARAM_UPLOAD_EXPAND, String.valueOf(expandOnCompletion)); + URL url = getURL(queryParams, getEncodedFilePath(remoteTargetFile)); + HttpsURLConnection connection = getFileTransferConnection(url, HttpMethod.POST); + + if (expandOnCompletion && restConnection.serverVersion >= 5) { + //Starting with server V5 users aren't required to put an extension on the target file, + //so for archives that will be expanded we place a proper Content-Type + if (localSourceFile.endsWith(".pax")) { + connection.setRequestProperty("Content-Type", FILE_TRANSFER_PAX_MIME); + } else { + //default is zip, since it's handled the same was WAR/EAR/JAR + connection.setRequestProperty("Content-Type", FILE_TRANSFER_ZIP_MIME); + } + } + + //Grab file to be uploaded + RandomAccessFile uploadFile = new RandomAccessFile(localSourceFile, RANDOM_FILE_ACCESS_READ_MODE); + + //Grab the outgoing stream + OutputStream outStream = null; + try { + outStream = connection.getOutputStream(); + } catch (ConnectException ce) { + restConnection.recoverConnection(ce); + tryToClose(outStream); + tryToClose(uploadFile); + throw ce; + } + + //We're always compressing the transfers from this java client, so use GZIP + outStream = new GZIPOutputStream(outStream, FILE_TRANSFER_DEFAULT_BUFFER_SIZE); + + try { + //Transfer bytes to output file + byte[] buf = new byte[FILE_TRANSFER_DEFAULT_BUFFER_SIZE]; + int bytesRead; + while ((bytesRead = uploadFile.read(buf)) > 0) { + outStream.write(buf, 0, bytesRead); + } + outStream.flush(); + + } finally { + tryToClose(outStream); + tryToClose(uploadFile); + } + + // Check response code from server + final int responseCode = connection.getResponseCode(); + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), methodName, + FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.UPLOAD_FROM_FILE, localSourceFile, remoteTargetFile, + restConnection.connector.getConnectionId())); + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Exiting uploadFile"); + } + + return; + + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + throw logServerException(methodName, connection); + + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw logCredentialsException(methodName, responseCode, connection); + + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = logResponseCodeException(methodName, responseCode, connection); + restConnection.recoverConnection(ioe); + throw ioe; + + default: + throw logResponseCodeException(methodName, responseCode, connection); + } + + } + + public void deleteFile(String remoteSourceFile) throws IOException { + final String methodName = "deleteFile(String remoteSourceFile)"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Entering deleteFile with remoteSourceFile: " + remoteSourceFile); + } + + URL url = getURL(null, getEncodedFilePath(remoteSourceFile)); + HttpsURLConnection connection = getFileTransferConnection(url, HttpMethod.DELETE); + + // Check response code from server + final int responseCode = connection.getResponseCode(); + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), methodName, + FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.DELETE_FILE, remoteSourceFile, + restConnection.connector.getConnectionId())); + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Exiting deleteFile"); + } + + return; + + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + throw logServerException(methodName, connection); + + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw logCredentialsException(methodName, responseCode, connection); + + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = logResponseCodeException(methodName, responseCode, connection); + restConnection.recoverConnection(ioe); + throw ioe; + + default: + throw logResponseCodeException(methodName, responseCode, connection); + } + } + + public void deleteAll(List remoteArtifacts) throws IOException { + final String methodName = "deleteAll(List remoteArtifacts)"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Entering deleteAll with remoteArtifacts: " + remoteArtifacts); + } + + URL url = getURL(null, COLLECTION_URL); + HttpsURLConnection connection = getFileTransferConnection(url, HttpMethod.POST, false); + connection.setRequestProperty("Content-Type", FILE_TRANSFER_JSON_MIME); + + //Grab the outgoing stream + OutputStream outStream = null; + try { + outStream = connection.getOutputStream(); + } catch (ConnectException ce) { + restConnection.recoverConnection(ce); + tryToClose(outStream); + throw ce; + } + + try { + // Generate JSON with following structure: { "delete": ["C:/temp/output.log", "C:/wlp", "C:/workarea"] } + JSONArray artifactsArray = new JSONArray(); + for (String artifact : remoteArtifacts) { + artifactsArray.add(artifact); + } + + JSONObject contentObject = new JSONObject(); + contentObject.put(COLLECTION_OPERATION_DELETE, artifactsArray); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Generated JSON: " + contentObject.toString()); + } + outStream.write(contentObject.toString().getBytes("UTF-8")); + outStream.flush(); + } finally { + tryToClose(outStream); + } + + // Check response code from server + final int responseCode = connection.getResponseCode(); + + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), methodName, + FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.DELETE_ALL, remoteArtifacts, + restConnection.connector.getConnectionId())); + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Exiting deleteAll"); + } + + return; + + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + throw logServerException(methodName, connection); + + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw logCredentialsException(methodName, responseCode, connection); + + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = logResponseCodeException(methodName, responseCode, connection); + restConnection.recoverConnection(ioe); + throw ioe; + + default: + throw logResponseCodeException(methodName, responseCode, connection); + } + } + + public static boolean tryToClose(Closeable closeable) { + if (closeable != null) { + try { + closeable.close(); + return true; + } catch (IOException e) { + // ignore + } + } + return false; + } + + private IOException logClientException(String methodName, Exception e) { + String errorMsg = FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.CLIENT_ERROR, e.getLocalizedMessage(), + restConnection.connector.getConnectionId()); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg, e); + return new IOException(errorMsg, e); + } + + private IOException logServerException(String methodName, HttpURLConnection connection) { + Throwable t = null; + JSONConverter converter = JSONConverter.getConverter(); + try { + t = converter.readThrowable(connection.getErrorStream()); + logger.logp(Level.SEVERE, logger.getName(), methodName, t.getMessage()); + + } catch (Exception e) { + //Fallback into standard server message + String responseMessage = "error"; + try { + responseMessage = connection.getResponseMessage(); + } catch (IOException io) { + // Use "error" for message..but shouldn't really happen + } + String errorMsg = FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.SERVER_ERROR, responseMessage, + restConnection.connector.getConnectionId()); + t = new IOException(errorMsg); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg); + } finally { + JSONConverter.returnConverter(converter); + } + + return (t instanceof IOException) ? (IOException) t : new IOException(t); + } + + private IOException logCredentialsException(String methodName, int responseCode, HttpURLConnection connection) { + String responseMessage = null; + try { + responseMessage = connection.getResponseMessage(); + } catch (IOException io) { + // Use null for message + } + String errorMsg = FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.BAD_CREDENTIALS, responseCode, responseMessage, + restConnection.connector.getConnectionId()); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg); + return new IOException(errorMsg); + } + + private IOException logResponseCodeException(String methodName, int responseCode, HttpURLConnection connection) { + String responseMessage = null; + try { + responseMessage = connection.getResponseMessage(); + } catch (IOException io) { + // Use null for message + } + String errorMsg = FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.RESPONSE_CODE_ERROR, responseCode, responseMessage, + restConnection.connector.getConnectionId()); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg); + return new IOException(errorMsg); + } + + private IOException logUnsupportedOperationError(String methodName, String operation) { + String errorMsg = FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.UNSUPPORTED_OPERATION, operation, restConnection.connector.getConnectionId()); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg); + return new IOException(errorMsg); + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationListenerEntry.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationListenerEntry.java new file mode 100755 index 000000000000..49738d7371c2 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationListenerEntry.java @@ -0,0 +1,71 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; + +import com.ibm.ws.jmx.connector.client.rest.internal.resources.RESTClientMessagesUtil; + +class NotificationListenerEntry { + public final NotificationListener listener; + public final NotificationFilter filter; + public final Object handback; + + private static final Logger logger = Logger.getLogger(NotificationListenerEntry.class.getName()); + + /** + * @param listener + * @param filter + * @param handback + */ + NotificationListenerEntry(NotificationListener listener, NotificationFilter filter, Object handback) { + this.listener = listener; + this.filter = filter; + this.handback = handback; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "NotificationListenerEntry", "[" + RESTClientMessagesUtil.getObjID(this) + "] | listener: " + listener + " | filter: " + + filter + " | handback: " + handback); + } + } + + void handleNotification(Notification notification) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "handleNotification", "[" + RESTClientMessagesUtil.getObjID(this) + "] | Notification: " + notification); + } + + if (filter == null || filter.isNotificationEnabled(notification)) { + listener.handleNotification(notification, handback); + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NotificationListenerEntry)) + return false; + NotificationListenerEntry other = (NotificationListenerEntry) o; + return listener.equals(other.listener) && filter == other.filter && handback == other.handback; + } + + @Override + public int hashCode() { + return listener.hashCode() + + (filter != null ? filter.hashCode() : 0) + + (handback != null ? handback.hashCode() : 0); + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationRegistry.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationRegistry.java new file mode 100755 index 000000000000..15a730bcad1d --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationRegistry.java @@ -0,0 +1,907 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.ConnectException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.InstanceNotFoundException; +import javax.management.ListenerNotFoundException; +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; +import javax.management.ObjectName; +import javax.management.OperationsException; +import javax.management.RuntimeOperationsException; +import javax.net.ssl.HttpsURLConnection; + +import com.ibm.ws.jmx.connector.client.rest.internal.ClientConstants.HttpMethod; +import com.ibm.ws.jmx.connector.client.rest.internal.RESTMBeanServerConnection.PollingMode; +import com.ibm.ws.jmx.connector.client.rest.internal.resources.RESTClientMessagesUtil; +import com.ibm.ws.jmx.connector.converter.JSONConverter; +import com.ibm.ws.jmx.connector.converter.NotificationTargetInformation; +import com.ibm.ws.jmx.connector.datatypes.NotificationArea; +import com.ibm.ws.jmx.connector.datatypes.NotificationRegistration; +import com.ibm.ws.jmx.connector.datatypes.NotificationSettings; +import com.ibm.ws.jmx.connector.datatypes.ServerNotificationRegistration; +import com.ibm.ws.jmx.connector.datatypes.ServerNotificationRegistration.Operation; + +class NotificationRegistry { + + private static final Logger logger = Logger.getLogger(NotificationRegistry.class.getName()); + + private final RESTMBeanServerConnection serverConnection; + private DynamicURL inboxURL, registrationsURL, serverRegistrationsURL, notificationClientURL; + private final Map registrationMap = Collections.synchronizedMap(new HashMap()); + private final List serverRegistrationList = Collections.synchronizedList(new ArrayList()); + private ObjectIdentityCache identityCache; + private final JSONConverter converter = JSONConverter.getConverter(); + + NotificationRegistry(RESTMBeanServerConnection serverConnection) throws IOException { + this.serverConnection = serverConnection; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "init", "Initializing registry " + RESTClientMessagesUtil.getObjID(this) + " within connection: " + + serverConnection.getConnector().getConnectionId()); + } + + try { + setupNotificationArea(); + } catch (IOException io) { + //ignore IOException at this point, because we will do a connection recovery later on inside the notification thread's run method. + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + } + + //NOTE: we don't call recoverConnection from this method, because this method is already called from recoverConnection so + //we want to avoid cycles. + protected void setupNotificationArea() throws Throwable { + final String sourceMethod = "setupNotificationArea"; + + URL notificationsURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for creating a notification area + notificationsURL = serverConnection.getNotificationsURL(); + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "[" + RESTClientMessagesUtil.getObjID(this) + "] About to call notificationURL: " + notificationsURL); + } + + // Get connection to server + connection = serverConnection.getConnection(notificationsURL, HttpMethod.POST, true); + + // Create NotificationSettings object + NotificationSettings ns = new NotificationSettings(); + ns.deliveryInterval = serverConnection.getConnector().getNotificationDeliveryInterval(); + ns.inboxExpiry = serverConnection.getConnector().getNotificationInboxExpiry(); + + // Write CreateMBean JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeNotificationSettings(output, ns); + output.flush(); + } catch (ConnectException ce) { + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw serverConnection.getRequestErrorException(sourceMethod, io, notificationsURL); + } + + // Check response code from server + final int responseCode = connection.getResponseCode(); + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Received responseCode: " + responseCode); + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a NotificationArea + NotificationArea area = converter.readNotificationArea(connection.getInputStream()); + + inboxURL = new DynamicURL(serverConnection.connector, area.inboxURL); + registrationsURL = new DynamicURL(serverConnection.connector, area.registrationsURL); + serverRegistrationsURL = new DynamicURL(serverConnection.connector, area.serverRegistrationsURL); + notificationClientURL = new DynamicURL(serverConnection.connector, area.clientURL); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "setupNotificationArea", "Successfully setup inboxURL: " + inboxURL.getURL()); + } + break; + } catch (Exception e) { + throw serverConnection.getResponseErrorException(sourceMethod, e, notificationsURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_NOT_FOUND: + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.URL_NOT_FOUND)); + case HttpURLConnection.HTTP_UNAVAILABLE: + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + throw serverConnection.getServerThrowable(sourceMethod, connection); + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw serverConnection.getBadCredentialsException(responseCode, connection); + default: + throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + synchronized void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "addNotificationListener", "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + name + " | listener: " + + listener + " | filter: " + filter + " | handback: " + + handback); + } + // Check if the MBean is registered and throw InstanceNotFoundException if not + // (it is possible the registration will not need updating, so we do this check first) + if (!serverConnection.isRegistered(name)) { + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + } + + // Build identifier for accessing the registration map. + // If a routing context has been set up, include the routing info (host name, server name, server user dir) as part of the key. + final NotificationTargetInformation nti; + if (serverConnection.isServerLevelRouting()) { + nti = new NotificationTargetInformation(name, serverConnection.mapRouting); + } else { + nti = new NotificationTargetInformation(name); + } + + NotificationListenerEntry set = new NotificationListenerEntry(listener, filter, handback); + ClientNotificationRegistration localRegistration = registrationMap.get(nti); + if (localRegistration == null) { + localRegistration = new ClientNotificationRegistration(nti); + registrationMap.put(nti, localRegistration); + } + + localRegistration.addNotificationListenerEntry(set); + + //ensure we're polling for notifications (will be no-op if we're already polling for notifications) + serverConnection.setPollingMode(PollingMode.NOTIFICATION); + } + + synchronized void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "addNotificationListener", "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + name + " | listener: " + + listener + " | filter: " + filter + " | handback: " + handback); + } + + // Build identifier for accessing the server registration list. + // If a routing context has been set up, include the routing info (host name, server name, server user dir) as part of the key. + final NotificationTargetInformation nti; + if (serverConnection.isServerLevelRouting()) { + nti = new NotificationTargetInformation(name, serverConnection.mapRouting); + } else { + nti = new NotificationTargetInformation(name); + } + + try { + updateServerNotificationRegistration(nti, listener, filter, handback, Operation.Add); + serverRegistrationList.add(new ServerNotificationListenerEntry(nti, listener, filter, handback)); + } catch (ListenerNotFoundException lnf) { + throw new IOException(lnf); // Should never happen + } + + //ensure we're polling for notifications (will be no-op if we're already polling for notifications) + serverConnection.setPollingMode(PollingMode.NOTIFICATION); + } + + synchronized void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeNotificationListener", "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + name + " | listener: " + + listener); + } + + // Build identifier for accessing the server registration list. + // If a routing context has been set up, include the routing info (host name, server name, server user dir) as part of the key. + final NotificationTargetInformation nti; + if (serverConnection.isServerLevelRouting()) { + nti = new NotificationTargetInformation(name, serverConnection.mapRouting); + } else { + nti = new NotificationTargetInformation(name); + } + + updateServerNotificationRegistration(nti, listener, null, null, Operation.RemoveAll); + Iterator iterator = serverRegistrationList.iterator(); + while (iterator.hasNext()) { + ServerNotificationListenerEntry entry = iterator.next(); + // Remove all registrations for the listener on the given MBean (ObjectName + routing info). + if (entry.nti.equals(nti) && entry.listener.equals(listener)) { + iterator.remove(); + } + } + + cleanupIfEmpty(); + } + + synchronized void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeNotificationListener", "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + name + " | listener: " + + listener + " | filter: " + filter + " | handback: " + + handback); + } + + // Build identifier for accessing the server registration list. + // If a routing context has been set up, include the routing info (host name, server name, server user dir) as part of the key. + final NotificationTargetInformation nti; + if (serverConnection.isServerLevelRouting()) { + nti = new NotificationTargetInformation(name, serverConnection.mapRouting); + } else { + nti = new NotificationTargetInformation(name); + } + + updateServerNotificationRegistration(nti, listener, filter, handback, Operation.RemoveSpecific); + serverRegistrationList.remove(new ServerNotificationListenerEntry(nti, listener, filter, handback)); + + cleanupIfEmpty(); + } + + synchronized void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + removeNotificationListener(name, listener, null, null, true); + } + + synchronized void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + removeNotificationListener(name, listener, filter, handback, false); + } + + void close() { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "close", "Closing registry " + RESTClientMessagesUtil.getObjID(this)); + } + + if (serverConnection.isConnected()) { + sendClosingSignal(); + } + + JSONConverter.returnConverter(converter); + } + + //This method sends a signal to the server-side indicating that the inbox can be deleted, because this client is being closed. + //We don't throw any errors because the connector is about to be closed. + private void sendClosingSignal() { + URL clientURL = null; + HttpsURLConnection connection = null; + try { + // Get the appropriate URL to delete notification client + if (serverConnection.serverVersion >= 4) { + //V4+ clients use /{clientID} to delete the notification client + clientURL = getNotificationClientURL(); + } else { + //Pre-V4 clients use /{clientID}/inbox to delete the notification client + clientURL = getInboxURL(); + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, + logger.getName(), + "sendClosingSignal", + "Making a call to delete inbox [" + clientURL + "] from [" + + RESTClientMessagesUtil.getObjID(this) + "]"); + } + // Get connection to server + connection = serverConnection.getConnection(clientURL, HttpMethod.DELETE, true); + connection.setReadTimeout(serverConnection.getConnector().getReadTimeout()); + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + logger.logp(Level.FINE, logger.getName(), "sendClosingSignal", ce.getMessage(), ce); + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "sendClosingSignal", "Response code: " + responseCode); + } + + } catch (IOException io) { + logger.logp(Level.FINE, logger.getName(), "sendClosingSignal", io.getMessage(), io); + } + } + + synchronized void connectionFailed(Throwable t) { + serverConnection.connectionFailed(t); + } + + private void updateServerNotificationRegistration(NotificationTargetInformation nti, ObjectName listener, NotificationFilter filter, Object handback, Operation operation) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + final String sourceMethod = "updateServerNotificationRegistration"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + nti.getName() + " | listener: " + + listener + " | filter: " + filter + " | handback: " + + handback + " | operation: " + operation); + } + + URL serverRegistrationsURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for creating/updating ServerNotificationRegistrations + serverRegistrationsURL = getServerRegistrationsURL(); + + // Get connection to server + connection = serverConnection.getConnection(serverRegistrationsURL, HttpMethod.POST, true, nti.getRoutingInformation()); + + // Create ServerNotificationRegistration object + ServerNotificationRegistration snr = new ServerNotificationRegistration(); + snr.objectName = nti.getName(); + snr.listener = listener; + if (operation == Operation.Add) { + snr.filter = filter; + snr.handback = handback; + } + if (operation != Operation.RemoveAll) { + if (identityCache == null) + identityCache = new ObjectIdentityCache(); + snr.filterID = identityCache.getObjectIdentity(filter); + snr.handbackID = identityCache.getObjectIdentity(handback); + } + snr.operation = operation; + + // Write NotificationRegsitration JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeServerNotificationRegistration(output, snr); + output.flush(); + output.close(); + } catch (ConnectException ce) { + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw serverConnection.getRequestErrorException(sourceMethod, io, serverRegistrationsURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + // Nothing to do; no response expected + break; + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + try { + // Server response should be a serialized Throwable, and if the notification area is gone, + // this connection is no longer valid + throw serverConnection.getServerThrowable(sourceMethod, connection); + } catch (IOException io) { + serverConnection.recoverConnection(io); + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw converter.readThrowable(connection.getErrorStream()); + } catch (RuntimeOperationsException roe) { + throw roe; + } catch (ListenerNotFoundException lnf) { + throw lnf; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (IOException io) { + throw io; + } catch (ClassNotFoundException cnf) { + throw new IOException(cnf); + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw serverConnection.getBadCredentialsException(responseCode, connection); + default: + throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + private void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback, boolean matchListenerOnly) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeNotificationListener", "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + name + " | listener: " + + listener + " | filter: " + filter + " | handback: " + + handback + " | matchListenerOnly: " + matchListenerOnly); + } + + // Check if the MBean is registered and throw InstanceNotFoundException if not + // (it is possible the registration will not need updating, so we do this check first) + if (!serverConnection.isRegistered(name)) { + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + } + + // Build identifier for accessing the registration map. + // If a routing context has been set up, include the routing info (host name, server name, server user dir) as part of the key. + final NotificationTargetInformation nti; + if (serverConnection.isServerLevelRouting()) { + nti = new NotificationTargetInformation(name, serverConnection.mapRouting); + } else { + nti = new NotificationTargetInformation(name); + } + + ClientNotificationRegistration localRegistration = registrationMap.get(nti); + if (localRegistration == null) + throw new ListenerNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.LISTENER_NOT_FOUND, name)); + + localRegistration.removeNotificationListenerEntries(name, listener, filter, handback, matchListenerOnly); + if (localRegistration.isEmpty()) { + registrationMap.remove(nti); + } + + cleanupIfEmpty(); + } + + /** + * If there are no more registered listeners then we cleanup this registry and stop notification polling + */ + private void cleanupIfEmpty() { + if (registrationMap.isEmpty() && serverRegistrationList.isEmpty()) { + serverConnection.discardNotificationRegistry(); + } + } + + protected synchronized boolean restoreNotificationRegistrations(boolean sendRestoreNotification) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "restoreNotificationRegistrations", "[" + RESTClientMessagesUtil.getObjID(this) + "]"); + } + + List clientRemovalList = new ArrayList(); + List serverRemovalList = new ArrayList(); + List exceptions = null; + Iterator> cnrIterator = registrationMap.entrySet().iterator(); + // Try to restore the registration for the notification listeners we've accumulated in the registration map. + while (cnrIterator.hasNext()) { + Map.Entry entry = cnrIterator.next(); + try { + entry.getValue().createNotificationRegistration(); + } catch (IOException io) { + // Unsuccessful + return false; + } catch (InstanceNotFoundException inf) { + // Can continue, but need to note that some could not be restored + if (exceptions == null) + exceptions = new ArrayList(); + + clientRemovalList.add(entry.getKey()); + exceptions.add(inf); + } + } + + for (ServerNotificationListenerEntry snl : serverRegistrationList) { + try { + updateServerNotificationRegistration(snl.nti, snl.listener, snl.filter, snl.handback, Operation.Add); + } catch (IOException io) { + // Unsuccessful + return false; + } catch (OperationsException oe) { + // Can continue, but need to note that some could not be restored + if (exceptions == null) + exceptions = new ArrayList(); + + serverRemovalList.add(snl); + exceptions.add(oe); + } + } + + if (exceptions != null) { + for (NotificationTargetInformation clientEntry : clientRemovalList) + registrationMap.remove(clientEntry); + for (ServerNotificationListenerEntry snl : serverRemovalList) + serverRegistrationList.remove(snl); + } + + if (sendRestoreNotification) { + serverConnection.getConnector().connectionRestored(exceptions != null ? exceptions.toArray(new Exception[exceptions.size()]) : null); + } + + return true; + } + + protected URL getInboxURL() throws IOException { + return inboxURL.getURL(); + } + + protected URL getNotificationClientURL() throws IOException { + return notificationClientURL.getURL(); + } + + protected DynamicURL getRegistrationsURL() throws IOException { + return registrationsURL; + } + + protected URL getServerRegistrationsURL() throws IOException { + return serverRegistrationsURL.getURL(); + } + + class ClientNotificationRegistration { + private final NotificationTargetInformation listenerKey; + private DynamicURL registrationURL; + private final List entries; + private List serverFilters; + + ClientNotificationRegistration(NotificationTargetInformation listenerKey) { + this.listenerKey = listenerKey; + entries = new ArrayList(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "ClientNotificationRegistrion init", "[" + RESTClientMessagesUtil.getObjID(NotificationRegistry.this) + + "] | [" + RESTClientMessagesUtil.getObjID(this) + + "] | objectName: " + listenerKey.getName()); + } + } + + synchronized void addNotificationListenerEntry(NotificationListenerEntry entry) throws InstanceNotFoundException, IOException { + final boolean serverFiltersUpdated; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "addNotificationListenerEntry", "[" + RESTClientMessagesUtil.getObjID(this) + "]"); + } + + // Receive all notifications if there is no filter, or if it cannot be transmitted + // to the server for server-side filtering + final boolean receiveAllNotifications = entry.filter == null || !converter.isSupportedNotificationFilter(entry.filter); + + if (receiveAllNotifications) { + if (serverFilters != null) { + serverFilters = null; + serverFiltersUpdated = true; + } else { + serverFiltersUpdated = false; + } + } else if (serverFilters != null || entries.size() == 0) { + // if there are already server-side filters, or there are no other notification sets, + // the current filter can be added to the list + if (serverFilters == null) + serverFilters = new ArrayList(); + serverFilters.add(entry.filter); + serverFiltersUpdated = true; + } else { + // there is already at least one notification set that cannot rely on + // server side filtering + serverFiltersUpdated = false; + } + + entries.add(entry); + + if (registrationURL == null) { + createNotificationRegistration(); + } else if (serverFiltersUpdated) { + updateNotificationRegistration(); + } + } + + synchronized void removeNotificationListenerEntries(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback, boolean matchListenerOnly) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + boolean listenerFound = false; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeNotificationListenerEntries", "[" + RESTClientMessagesUtil.getObjID(this) + "] | objectName: " + + name + " | listener: " + listener + " | filter: " + filter + " | handback: " + + handback + " | matchListenerOnly: " + matchListenerOnly); + } + + Iterator entryIterator = entries.iterator(); + while (entryIterator.hasNext()) { + NotificationListenerEntry entry = entryIterator.next(); + if (entry.listener == listener && (matchListenerOnly || (entry.filter == filter && entry.handback == handback))) { + listenerFound = true; + entryIterator.remove(); + if (!matchListenerOnly) + break; + } + } + + if (!listenerFound) + throw new ListenerNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.LISTENER_NOT_FOUND, name)); + + List newServerFilters = null; + for (NotificationListenerEntry entry : entries) { + if (entry.filter == null || !converter.isSupportedNotificationFilter(entry.filter)) { + newServerFilters = null; + break; + } else { + if (newServerFilters == null) + newServerFilters = new ArrayList(); + newServerFilters.add(entry.filter); + } + } + + final boolean serverFiltersUpdated; + if ((serverFilters != null && !serverFilters.equals(newServerFilters)) || + (serverFilters == null && newServerFilters != null)) { + serverFiltersUpdated = true; + serverFilters = newServerFilters; + } else { + serverFiltersUpdated = false; + } + + if (isEmpty()) { + deleteNotificationRegistration(); + } else if (serverFiltersUpdated) { + updateNotificationRegistration(); + } + } + + private NotificationFilter[] getServerFilters() { + if (serverFilters == null) + return null; + NotificationFilter[] serverFilterArray = new NotificationFilter[serverFilters.size()]; + return serverFilters.toArray(serverFilterArray); + } + + private URL getRegistrationURL() throws IOException { + return registrationURL.getURL(); + } + + boolean isEmpty() { + return entries.isEmpty(); + } + + synchronized void handleNotification(Notification notification) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "handleNotification", "[" + RESTClientMessagesUtil.getObjID(this) + + " | Notification: " + notification); + } + + for (NotificationListenerEntry entry : entries) + entry.handleNotification(notification); + } + + synchronized void createNotificationRegistration() throws InstanceNotFoundException, IOException { + final String sourceMethod = "createNotificationRegistration"; + + URL registrationsURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for creating/updating NotificationRegistrations + registrationsURL = getRegistrationsURL().getURL(); + + // Get connection to server + connection = serverConnection.getConnection(registrationsURL, HttpMethod.POST, true, listenerKey.getRoutingInformation()); + + // Create NotificationRegistration object + NotificationRegistration nr = new NotificationRegistration(); + nr.objectName = listenerKey.getName(); + nr.filters = getServerFilters(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, RESTClientMessagesUtil.getObjID(this)); + } + + // Write NotificationRegsitration JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeNotificationRegistration(output, nr); + output.flush(); + output.close(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw serverConnection.getRequestErrorException(sourceMethod, io, registrationsURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + try { + // Process and return server response, which should be a URL + String url = converter.readString(connection.getInputStream()); + registrationURL = new DynamicURL(serverConnection.connector, url); + break; + } catch (Exception e) { + throw serverConnection.getResponseErrorException(sourceMethod, e, registrationsURL); + } + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + serverConnection.recoverConnection(ioe); + throw ioe; + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw serverConnection.getServerThrowable(sourceMethod, connection); + } catch (RuntimeOperationsException roe) { + throw roe; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (IOException io) { + throw io; + } catch (ClassNotFoundException cnf) { + throw new IOException(cnf); + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw serverConnection.getBadCredentialsException(responseCode, connection); + default: + throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + + } + + private void updateNotificationRegistration() throws InstanceNotFoundException, IOException { + final String sourceMethod = "updateNotificationRegistration"; + + URL registrationURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for this NotificationRegistration + registrationURL = getRegistrationURL(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, RESTClientMessagesUtil.getObjID(this)); + } + + // Get connection to server + connection = serverConnection.getConnection(registrationURL, HttpMethod.PUT, true, listenerKey.getRoutingInformation()); + + // Write array of NotificationFilters to JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeNotificationFilters(output, getServerFilters()); + output.flush(); + output.close(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw serverConnection.getRequestErrorException(sourceMethod, io, registrationURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "response code: " + responseCode); + } + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + // Nothing to do; no response expected + break; + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + serverConnection.recoverConnection(ioe); + throw ioe; + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw converter.readThrowable(connection.getErrorStream()); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (IOException io) { + throw io; + } catch (ClassNotFoundException cnf) { + throw new IOException(cnf); + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw serverConnection.getBadCredentialsException(responseCode, connection); + default: + throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + private void deleteNotificationRegistration() throws InstanceNotFoundException, ListenerNotFoundException, IOException { + final String sourceMethod = "deleteNotificationRegistration"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, RESTClientMessagesUtil.getObjID(this)); + } + + URL registrationURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for NotificationRegistration + registrationURL = getRegistrationURL(); + + // Get connection to server + connection = serverConnection.getConnection(registrationURL, HttpMethod.DELETE, true, listenerKey.getRoutingInformation()); + } catch (IOException io) { + throw serverConnection.getRequestErrorException(sourceMethod, io, registrationURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Response code: " + responseCode); + } + + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + // Nothing to do; no response expected + break; + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + serverConnection.recoverConnection(ioe); + throw ioe; + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw converter.readThrowable(connection.getInputStream()); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (ListenerNotFoundException lnf) { + throw lnf; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw serverConnection.getBadCredentialsException(responseCode, connection); + default: + throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + } + + /** + * @return the registrationMap + */ + public Map getRegistrationMap() { + return registrationMap; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ObjectIdentityCache.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ObjectIdentityCache.java new file mode 100755 index 000000000000..1c0404c6c9fb --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ObjectIdentityCache.java @@ -0,0 +1,78 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; +import java.util.HashMap; +import java.util.Map; + +/** + * + */ +public class ObjectIdentityCache { + + private final Map identityMap = new HashMap(); + private final ReferenceQueue referenceQueue = new ReferenceQueue(); + private int nextIdentity = Integer.MIN_VALUE + 1; + + int getObjectIdentity(Object o) { + // Clean up cleared references + ObjectReference clearedRef = (ObjectReference) referenceQueue.poll(); + while (clearedRef != null) { + identityMap.remove(clearedRef); + clearedRef = (ObjectReference) referenceQueue.poll(); + } + + if (o == null) + return Integer.MIN_VALUE; + + ObjectReference ref = new ObjectReference(o, referenceQueue); + if (identityMap.containsKey(ref)) { + return identityMap.get(ref); + } else { + if (nextIdentity == Integer.MAX_VALUE) + throw new IllegalStateException(); + final int identity = nextIdentity++; + identityMap.put(ref, identity); + return identity; + } + } + + private static class ObjectReference extends WeakReference { + private final int hashCode; + + ObjectReference(Object referent, ReferenceQueue queue) { + super(referent, queue); + hashCode = referent.hashCode(); + } + + /** {@inheritDoc} */ + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (o instanceof ObjectReference) { + ObjectReference other = (ObjectReference) o; + return other.get() == get(); + } else { + return false; + } + } + + /** {@inheritDoc} */ + @Override + public int hashCode() { + return hashCode; + } + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/RESTMBeanServerConnection.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/RESTMBeanServerConnection.java new file mode 100755 index 000000000000..a27e79f483aa --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/RESTMBeanServerConnection.java @@ -0,0 +1,2465 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.ConnectException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.channels.ClosedByInterruptException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.Attribute; +import javax.management.AttributeList; +import javax.management.AttributeNotFoundException; +import javax.management.InstanceAlreadyExistsException; +import javax.management.InstanceNotFoundException; +import javax.management.IntrospectionException; +import javax.management.InvalidAttributeValueException; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanException; +import javax.management.MBeanInfo; +import javax.management.MBeanRegistrationException; +import javax.management.MBeanServerConnection; +import javax.management.NotCompliantMBeanException; +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; +import javax.management.ObjectInstance; +import javax.management.ObjectName; +import javax.management.QueryExp; +import javax.management.ReflectionException; +import javax.management.RuntimeMBeanException; +import javax.management.RuntimeOperationsException; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSession; + +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.ws.jmx.connector.client.rest.internal.ClientConstants.HttpMethod; +import com.ibm.ws.jmx.connector.client.rest.internal.NotificationRegistry.ClientNotificationRegistration; +import com.ibm.ws.jmx.connector.client.rest.internal.resources.RESTClientMessagesUtil; +import com.ibm.ws.jmx.connector.converter.JSONConverter; +import com.ibm.ws.jmx.connector.converter.NotificationRecord; +import com.ibm.ws.jmx.connector.datatypes.CreateMBean; +import com.ibm.ws.jmx.connector.datatypes.Invocation; +import com.ibm.ws.jmx.connector.datatypes.JMXServerInfo; +import com.ibm.ws.jmx.connector.datatypes.MBeanInfoWrapper; +import com.ibm.ws.jmx.connector.datatypes.MBeanQuery; +import com.ibm.ws.jmx.connector.datatypes.ObjectInstanceWrapper; + +/** + * This class is implemented such that it should be thread-safe. + */ +class RESTMBeanServerConnection implements MBeanServerConnection { + + private static final Logger logger = Logger.getLogger(RESTMBeanServerConnection.class.getName()); + + protected static final String CLIENT_VERSION = "IBM_JMX_REST_client_v5"; + + public enum PollingMode { + FAILOVER, NOTIFICATION + }; + + private static final long NANOS_IN_A_MILLISECOND = 1000000L; + + private final AtomicBoolean isRecoveringConnection = new AtomicBoolean(); + + private ServerPollingThread serverPollingThread; + + protected final Connector connector; + private volatile boolean disconnected = false; + protected int serverVersion; + private final DynamicURL rootURL; + private DynamicURL mbeansURL, createMBeanURL, instanceOfURL, mbeanCountURL, defaultDomainURL, domainsURL, notificationsURL, fileTransferURL; + private final ConcurrentMap mbeanInfoURLMap; + private final ConcurrentMap mbeanAttributesURLMap; + private final ConcurrentMap> mbeanAttributeURLsMap; + private final ConcurrentMap> mbeanOperationURLsMap; + private final FileTransferClient fileTransferClient; + + private NotificationRegistry notificationRegistry; + + protected final HostnameVerifier hostnameVerificationDisabler; + + protected Map mapRouting = null; + + static { + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Void run() { + String oldValue = System.getProperty("sun.net.http.retryPost"); + + if (oldValue != null) { + if (logger.isLoggable(Level.INFO)) { + logger.logp(Level.INFO, logger.getName(), "StaticBlock[1]", "Value of retry post was already set: " + oldValue); + } + } else { + //Set the value on the client-side to prevent the JDK from retrying invocations. + System.setProperty("sun.net.http.retryPost", "false"); + } + + return null; + } + }); + } + + RESTMBeanServerConnection(Connector connector) throws IOException { + this.connector = connector; + + rootURL = new DynamicURL(connector, connector.getServiceURL().getURLPath()); + + // Set up HostnameVerifier to allow all host names if hostname verification is disabled + if (connector.isHostnameVerificationDisabled()) { + hostnameVerificationDisabler = new HostnameVerifier() { + + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + hostnameVerificationDisabler = null; + } + + //First we need set our initial endpoint + findInitialEndpoint(); + + // Load JMX server info to verify server is reachable + try { + loadJMXServerInfo(); + } catch (IOException e) { + //If we got an IOException for the server being down, we will have tried a recovery + //and then either we have a valid endpoint or the connector will have been automatically + //disconnected. So, if the connector is still connected, we can try 1 more time to connect + if (isConnected()) { + loadJMXServerInfo(); + } else { + throw e; + } + } + + mbeanInfoURLMap = new ConcurrentHashMap(); + mbeanAttributesURLMap = new ConcurrentHashMap(); + mbeanAttributeURLsMap = new ConcurrentHashMap>(); + mbeanOperationURLsMap = new ConcurrentHashMap>(); + fileTransferClient = new FileTransferClient(this); + + //Unless the user asked for fail interval polling to be off (by specifying a negative value), we start the thread. + if (connector.getServerFailoverInterval() >= 0) { + setPollingMode(PollingMode.FAILOVER); + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "constructor", "Initiated connector " + RESTClientMessagesUtil.getObjID(this) + " within connection: " + + connector.getConnectionId()); + } + if (connector.logFailovers()) { + String connectMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.MEMBER_CONNECT, connector.getCurrentEndpoint()); + logger.logp(Level.INFO, logger.getName(), "constructor", connectMsg); + } + } + + //Lazy initialization of NotificationRegistry + private NotificationRegistry getNotificationRegistry() throws IOException { + if (notificationRegistry == null) { + notificationRegistry = new NotificationRegistry(this); + } + return notificationRegistry; + } + + protected void setPollingMode(PollingMode mode) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "setPollingMode", "Entering setPollingMode with new mode " + mode.toString()); + } + + if (serverPollingThread != null) { + serverPollingThread.changeMode(mode); + } else { + serverPollingThread = new ServerPollingThread(mode); + serverPollingThread.start(); + } + } + + protected void discardNotificationRegistry() { + if (connector.getServerFailoverInterval() >= 0) { + setPollingMode(PollingMode.FAILOVER); + } else { + //if the user doesn't want to go into FAILOVER mode, then we're done + //with this thread for now + closePollingThread(); + } + notificationRegistry.close(); + notificationRegistry = null; + } + + private void loadJMXServerInfo() throws IOException { + final String sourceMethod = "loadJMXServerInfo"; + checkConnection(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, "Loading server info for endpoint: " + connector.getCurrentEndpoint()); + } + URL rootURL = null; + HttpsURLConnection connection = null; + try { + // Get JMX server info URL + rootURL = getRootURL(); + + // Get connection to server + connection = getConnection(rootURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, rootURL); + } + + JMXServerInfo jmx = null; + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce, true); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a JMXServerInfo + jmx = converter.readJMX(connection.getInputStream()); + break; + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, rootURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + Throwable t = getServerThrowable(sourceMethod, connection); + IOException ioe = t instanceof IOException ? (IOException) t : new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + throw ioe; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException io = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(io, true); + throw io; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + + serverVersion = jmx.version; + mbeansURL = new DynamicURL(connector, jmx.mbeansURL); + createMBeanURL = new DynamicURL(connector, jmx.createMBeanURL); + instanceOfURL = new DynamicURL(connector, jmx.instanceOfURL); + mbeanCountURL = new DynamicURL(connector, jmx.mbeanCountURL); + defaultDomainURL = new DynamicURL(connector, jmx.defaultDomainURL); + domainsURL = new DynamicURL(connector, jmx.domainsURL); + notificationsURL = new DynamicURL(connector, jmx.notificationsURL); + fileTransferURL = new DynamicURL(connector, jmx.fileTransferURL); + } + + /** {@inheritDoc} */ + @Override + public ObjectInstance createMBean(String className, + ObjectName name) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException { + try { + return createMBean(className, name, null, null, null, false, false); + } catch (InstanceNotFoundException inf) { + throw new IOException(inf); // Should never happen + } + } + + /** {@inheritDoc} */ + @Override + public ObjectInstance createMBean(String className, ObjectName name, + ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException { + return createMBean(className, name, loaderName, null, null, true, false); + } + + /** {@inheritDoc} */ + @Override + public ObjectInstance createMBean(String className, ObjectName name, Object[] params, + String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException { + try { + return createMBean(className, name, null, params, signature, false, true); + } catch (InstanceNotFoundException inf) { + throw new IOException(inf); // Should never happen + } + } + + /** {@inheritDoc} */ + @Override + public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, + String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException { + return createMBean(className, name, loaderName, params, signature, true, true); + } + + private ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature, boolean useLoader, + boolean useSignature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException { + final String sourceMethod = "createMBean"; + checkConnection(); + if (className == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.CLASS_NAME_NULL))); + else if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name))); + + URL createURL = null; + HttpsURLConnection connection = null; + JSONConverter converter = JSONConverter.getConverter(); + try { + // Get URL for creating MBeans + createURL = getCreateMBeanURL(); + + // Get connection to server + connection = getConnection(createURL, HttpMethod.POST); + + // Create CreateMBean object + CreateMBean createMBean = new CreateMBean(); + createMBean.className = className; + createMBean.objectName = name; + createMBean.loaderName = loaderName; + createMBean.params = params; + createMBean.signature = signature; + createMBean.useLoader = useLoader; + createMBean.useSignature = useSignature; + + // Write CreateMBean JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeCreateMBean(output, createMBean); + output.flush(); + output.close(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, createURL); + } finally { + JSONConverter.returnConverter(converter); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be an ObjectInstanceWrapper + ObjectInstanceWrapper wrapper = converter.readObjectInstance(connection.getInputStream()); + mbeanInfoURLMap.put(wrapper.objectInstance.getObjectName(), new DynamicURL(connector, wrapper.mbeanInfoURL)); + return wrapper.objectInstance; + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, createURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (RuntimeOperationsException roe) { + throw roe; + } catch (ReflectionException re) { + throw re; + } catch (InstanceAlreadyExistsException iae) { + throw iae; + } catch (MBeanRegistrationException mbr) { + throw mbr; + } catch (MBeanException me) { + throw me; + } catch (RuntimeMBeanException rme) { + throw rme; + } catch (NotCompliantMBeanException ncm) { + throw ncm; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException, IOException { + final String sourceMethod = "unregisterMBean"; + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + + URL mbeanURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for MBean + mbeanURL = getMBeanURL(name); + + // Get connection to server + connection = getConnection(mbeanURL, HttpMethod.DELETE); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, mbeanURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + // Clean up cached URLs + purgeMBeanURLs(name); + return; + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (MBeanRegistrationException mbr) { + throw mbr; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException, IOException { + checkConnection(); + if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + + @SuppressWarnings("unchecked") + Set results = queryMBeans(name, null, null, true); + + if (results.size() == 1) + return results.toArray(new ObjectInstance[1])[0]; + else + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + } + + @SuppressWarnings("unchecked") + private Set queryMBeans(ObjectName name, QueryExp query, String className, boolean objectInstance) throws IOException { + final String sourceMethod = "queryMBeans"; + final boolean usePOST = query != null; + + URL baseMBeansURL = null; + URL mbeansURL = null; + HttpsURLConnection connection = null; + JSONConverter converter = JSONConverter.getConverter(); + try { + // Get URL for MBeans + baseMBeansURL = getMBeansURL(); + mbeansURL = usePOST ? baseMBeansURL : getMBeansURL(name, className); + + // Get connection to server + connection = getConnection(mbeansURL, usePOST ? HttpMethod.POST : HttpMethod.GET); + + if (usePOST) { + // Create MBeanQuery object + MBeanQuery mbeanQuery = new MBeanQuery(); + mbeanQuery.objectName = name; + mbeanQuery.queryExp = query; + mbeanQuery.className = className; + + // Write MBeanQuery JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeMBeanQuery(output, mbeanQuery); + output.flush(); + output.close(); + } + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, mbeansURL); + } finally { + JSONConverter.returnConverter(converter); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a Set of ObjectInstanceWrapper + ObjectInstanceWrapper[] wrappers = converter.readObjectInstances(connection.getInputStream()); + Set mbeans = new HashSet(wrappers.length); + Map tempMBeanInfoURLMap = new HashMap(wrappers.length); + for (ObjectInstanceWrapper wrapper : wrappers) { + tempMBeanInfoURLMap.put(wrapper.objectInstance.getObjectName(), wrapper.mbeanInfoURL); + if (objectInstance) + mbeans.add(wrapper.objectInstance); + else + mbeans.add(wrapper.objectInstance.getObjectName()); + } + + processMBeanInfoURLs(tempMBeanInfoURLMap, getMBeansURL().getPath(), name == null && query == null && className == null); + + return mbeans; + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, mbeansURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + Throwable t = getServerThrowable(sourceMethod, connection); + IOException ioe = t instanceof IOException ? (IOException) t : new IOException(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE, t); + throw ioe; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException io = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(io); + throw io; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override + public Set queryMBeans(ObjectName name, QueryExp query) throws IOException { + checkConnection(); + return queryMBeans(name, query, null, true); + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override + public Set queryNames(ObjectName name, QueryExp query) throws IOException { + checkConnection(); + return queryMBeans(name, query, null, false); + } + + /** {@inheritDoc} */ + @Override + public boolean isRegistered(ObjectName name) throws IOException { + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + return false; + + @SuppressWarnings("unchecked") + Set results = queryMBeans(name, null, null, true); + return results.size() == 1; + } + + /** {@inheritDoc} */ + @Override + public Integer getMBeanCount() throws IOException { + final String sourceMethod = "getMBeanCount"; + checkConnection(); + + URL mbeanCountURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for MBean count + mbeanCountURL = getMBeanCountURL(); + + // Get connection to server + connection = getConnection(mbeanCountURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, mbeanCountURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response + return converter.readInt(connection.getInputStream()); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, mbeanCountURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + Throwable t = getServerThrowable(sourceMethod, connection); + IOException ioe = t instanceof IOException ? (IOException) t : new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + throw ioe; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException io = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(io); + throw io; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + + } + } + + /** {@inheritDoc} */ + @Override + public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, IOException { + final String sourceMethod = "getAttribute"; + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + else if (attribute == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_NAME_NULL))); + + URL attributeURL; + + try { + // Get URL for attribute + attributeURL = getAttributeURL(name, attribute); + + } catch (IntrospectionException intro) { + throw getRequestErrorException(sourceMethod, intro); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io); + } + + HttpsURLConnection connection; + try { + connection = getConnection(attributeURL, HttpMethod.GET); // Get connection to server + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributeURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a POJO + return converter.readPOJO(connection.getInputStream()); + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, attributeURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (MBeanException me) { + throw me; + } catch (AttributeNotFoundException anf) { + throw anf; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException, IOException { + final String sourceMethod = "getAttributes"; + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + else if (attributes == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_NAMES_NULL))); + + URL attributesURL; + try { + // Get URL for attributes + attributesURL = getAttributesURL(name, attributes); + } catch (IntrospectionException intro) { + throw getRequestErrorException(sourceMethod, intro); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io); + } + + HttpsURLConnection connection; + + try { + // Get connection to server + connection = getConnection(attributesURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributesURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be an AttributeList + return converter.readAttributeList(connection.getInputStream()); + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, attributesURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public void setAttribute(ObjectName name, + Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException, IOException { + final String sourceMethod = "setAttribute"; + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + else if (attribute == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_NULL))); + + URL attributeURL; + HttpsURLConnection connection; + JSONConverter converter = JSONConverter.getConverter(); + try { + // Get URL for attribute + attributeURL = getAttributeURL(name, attribute.getName()); + } catch (ConnectException ce) { + // Server is down; not a client bug + throw ce; + } catch (IntrospectionException intro) { + getRequestErrorException(sourceMethod, intro); + throw new IOException(intro); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io); + } finally { + JSONConverter.returnConverter(converter); + } + + try { + + // Get connection to server + connection = getConnection(attributeURL, HttpMethod.PUT); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributeURL); + } finally { + JSONConverter.returnConverter(converter); + } + + try { + // Write Invocation JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writePOJO(output, attribute.getValue()); + output.flush(); + output.close(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributeURL); + } finally { + JSONConverter.returnConverter(converter); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + // No content expected + return; + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (MBeanException me) { + throw me; + } catch (RuntimeMBeanException rme) { + throw rme; + } catch (AttributeNotFoundException anf) { + throw anf; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (InvalidAttributeValueException iav) { + throw iav; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + + } + + /** {@inheritDoc} */ + @Override + public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException, IOException { + final String sourceMethod = "setAttributes"; + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + else if (attributes == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_LIST_NULL))); + + URL attributesURL; + HttpsURLConnection connection; + JSONConverter converter = JSONConverter.getConverter(); + try { + // Get URL for attributes + attributesURL = getAttributesURL(name); + } catch (ConnectException ce) { + // Server is down; not a client bug + throw ce; + } catch (IntrospectionException intro) { + throw getRequestErrorException(sourceMethod, intro); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io); + } finally { + JSONConverter.returnConverter(converter); + } + + try { + + // Get connection to server + connection = getConnection(attributesURL, HttpMethod.POST); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributesURL); + } finally { + JSONConverter.returnConverter(converter); + } + try { + // Write Invocation JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeAttributeList(output, attributes); + output.flush(); + output.close(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributesURL); + } finally { + JSONConverter.returnConverter(converter); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be an AttributeList + return converter.readAttributeList(connection.getInputStream()); + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, attributesURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public Object invoke(ObjectName name, String operationName, Object[] params, + String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException, IOException { + final String sourceMethod = "invoke"; + + try { + //Look for routing MBean + if (ClientProvider.CONNECTION_ROUTING_NAME.equals(name.getKeyProperty("name")) && + ClientProvider.CONNECTION_ROUTING_DOMAIN.equals(name.getDomain())) { + + //Handle server-level routing + if (ClientProvider.CONNECTION_ROUTING_OPERATION_ASSIGN_SERVER.equals(operationName)) { + if (params.length == 3) { + //routing at server level + this.mapRouting = new HashMap(); + this.mapRouting.put(ClientProvider.ROUTING_KEY_HOST_NAME, params[0]); + this.mapRouting.put(ClientProvider.ROUTING_KEY_SERVER_USER_DIR, params[1]); + this.mapRouting.put(ClientProvider.ROUTING_KEY_SERVER_NAME, params[2]); + return Boolean.TRUE; + } + + //Handle host-level routing + } else if (ClientProvider.CONNECTION_ROUTING_OPERATION_ASSIGN_HOST.equals(operationName)) { + if (params.length == 1) { + //routing at host level + this.mapRouting = new HashMap(); + this.mapRouting.put(ClientProvider.ROUTING_KEY_HOST_NAME, params[0]); + return Boolean.TRUE; + } + } + } + + } catch (Exception e) { + throw new MBeanException(e); + } + + checkConnection(); + + //Special handling for file transfer MBean invocations + if (ClientProvider.FILE_TRANSFER_NAME.equals(name.getKeyProperty("name")) && + ClientProvider.FILE_TRANSFER_DOMAIN.equals(name.getDomain())) { + return fileTransferClient.handleOperation(operationName, params); + } + + URL invokeURL = null; + HttpsURLConnection connection = null; + JSONConverter converter = JSONConverter.getConverter(); + try { + // Get URL for invoke operation + invokeURL = getOperationURL(name, operationName); + + // Get connection to server + connection = getConnection(invokeURL, HttpMethod.POST); + + // Create Invocation object + Invocation invocation = new Invocation(); + invocation.params = params; + invocation.signature = signature; + + // Write Invocation JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeInvocation(output, invocation); + output.flush(); + output.close(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IntrospectionException intro) { + throw getRequestErrorException(sourceMethod, intro, invokeURL); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, invokeURL); + } finally { + JSONConverter.returnConverter(converter); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a POJO + return converter.readPOJO(connection.getInputStream()); + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, invokeURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (RuntimeMBeanException rme) { + throw rme; + } catch (MBeanException me) { + throw me; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + IOException e = getResponseCodeErrorException(sourceMethod, responseCode, connection); + throw e; + } + } + + /** {@inheritDoc} */ + @Override + public String getDefaultDomain() throws IOException { + final String sourceMethod = "getDefaultDomain"; + checkConnection(); + + URL defaultDomainURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for default domain + defaultDomainURL = getDefaultDomainURL(); + + // Get connection to server + connection = getConnection(defaultDomainURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, defaultDomainURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response + return converter.readString(connection.getInputStream()); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, defaultDomainURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + Throwable t = getServerThrowable(sourceMethod, connection); + IOException ioe = t instanceof IOException ? (IOException) t : new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + throw ioe; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException io = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(io); + throw io; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public String[] getDomains() throws IOException { + final String sourceMethod = "getDomains"; + checkConnection(); + + URL domainsURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for domains + domainsURL = getDomainsURL(); + + // Get connection to server + connection = getConnection(domainsURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, domainsURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response + return converter.readStringArray(connection.getInputStream()); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, domainsURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + Throwable t = getServerThrowable(sourceMethod, connection); + IOException ioe = t instanceof IOException ? (IOException) t : new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + throw ioe; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException io = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(io); + throw io; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + + } + + /** {@inheritDoc} */ + @Override + public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().addNotificationListener(name, listener, filter, handback); + } + + /** {@inheritDoc} */ + @Override + public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().addNotificationListener(name, listener, filter, handback); + } + + /** {@inheritDoc} */ + @Override + public void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().removeNotificationListener(name, listener); + } + + /** {@inheritDoc} */ + @Override + public void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, + Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().removeNotificationListener(name, listener, filter, handback); + } + + /** {@inheritDoc} */ + @Override + public void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().removeNotificationListener(name, listener); + } + + /** {@inheritDoc} */ + @Override + public void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, + Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().removeNotificationListener(name, listener, filter, handback); + } + + /** {@inheritDoc} */ + @Override + public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException { + final String sourceMethod = "getMBeanInfo"; + checkConnection(); + + URL mbeanURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for MBean + mbeanURL = getMBeanURL(name); + + // Get connection to server + connection = getConnection(mbeanURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, mbeanURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be an MBeanInfoWrapper + MBeanInfoWrapper wrapper = converter.readMBeanInfo(connection.getInputStream()); + mbeanAttributesURLMap.put(name, new DynamicURL(connector, wrapper.attributesURL)); + + //Attributes + Map attributeURLsMap = mbeanAttributeURLsMap.get(name); + final boolean updateAttributes = attributeURLsMap != null; + if (!updateAttributes) { + // Create a new Map - this map is used for future requests and must be thread safe + attributeURLsMap = new ConcurrentHashMap(); + } + processAttributeOrOperationURLs(attributeURLsMap, wrapper.attributeURLs, updateAttributes); + + if (!updateAttributes) { + //Another thread might have created/set this Map already and is about to use it, which is why + //we wait until *after* we have a valid Map and are ready to push that in. + mbeanAttributeURLsMap.putIfAbsent(name, attributeURLsMap); + } + + //Operations + Map operationURLsMap = mbeanOperationURLsMap.get(name); + final boolean updateOperations = operationURLsMap != null; + if (!updateOperations) { + // Create a new Map - this map is used for future requests and must be thread safe + operationURLsMap = new ConcurrentHashMap(); + } + processAttributeOrOperationURLs(operationURLsMap, wrapper.operationURLs, updateOperations); + + if (!updateOperations) { + //Another thread might have created/set this Map already and is about to use it, which is why + //we wait until *after* we have a valid Map and are ready to push that in. + mbeanOperationURLsMap.putIfAbsent(name, operationURLsMap); + } + + return wrapper.mbeanInfo; + + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, mbeanURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (IntrospectionException ie) { + throw ie; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public boolean isInstanceOf(ObjectName name, String className) throws InstanceNotFoundException, IOException { + final String sourceMethod = "isInstanceOf"; + checkConnection(); + if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + + URL instanceOfURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for instanceOf + instanceOfURL = getInstanceOfURL(name, className); + + // Get connection to server + connection = getConnection(instanceOfURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, instanceOfURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a boolean + return converter.readBoolean(connection.getInputStream()); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, instanceOfURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (ClassNotFoundException cnf) { + throw new IOException(cnf); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + + } + + // + // URL Methods + // + + protected URL getRootURL() throws IOException { + return rootURL.getURL(); + } + + private URL getDefaultDomainURL() throws IOException { + return defaultDomainURL.getURL(); + } + + private URL getDomainsURL() throws IOException { + return domainsURL.getURL(); + } + + URL getNotificationsURL() throws IOException { + return notificationsURL.getURL(); + } + + URL getFileTransferURL() throws IOException { + return fileTransferURL.getURL(); + } + + private URL getMBeanCountURL() throws IOException { + return mbeanCountURL.getURL(); + } + + private URL getAttributeURL(ObjectName name, + String attributeName) throws IOException, AttributeNotFoundException, InstanceNotFoundException, IntrospectionException, ReflectionException { + if (!mbeanAttributeURLsMap.containsKey(name)) + getMBeanInfo(name); + if (!mbeanAttributeURLsMap.containsKey(name)) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + else if (!mbeanAttributeURLsMap.get(name).containsKey(attributeName)) + throw new AttributeNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_NOT_FOUND, name, attributeName)); + + return mbeanAttributeURLsMap.get(name).get(attributeName).getURL(); + } + + private URL getAttributesURL(ObjectName name) throws IOException, InstanceNotFoundException, IntrospectionException, ReflectionException { + if (!mbeanAttributesURLMap.containsKey(name)) + getMBeanInfo(name); + if (!mbeanAttributesURLMap.containsKey(name)) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + + return mbeanAttributesURLMap.get(name).getURL(); + } + + private URL getAttributesURL(ObjectName name, String[] attributes) throws IOException, InstanceNotFoundException, IntrospectionException, ReflectionException { + if (attributes != null && attributes.length > 0) { + StringBuilder sb = new StringBuilder(); + final int length = attributes.length; + for (int i = 0; i < length - 1; i++) { + sb.append("attribute="); + sb.append(URLEncoder.encode(attributes[i], "UTF-8")); + sb.append("&"); + } + sb.append("attribute="); + sb.append(URLEncoder.encode(attributes[length - 1], "UTF-8")); + String attributeList = sb.toString(); + return new URL(getAttributesURL(name).toString() + "?" + + attributeList); + } else { + return getAttributesURL(name); + } + } + + private URL getOperationURL(ObjectName name, String operationName) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException { + if (!mbeanOperationURLsMap.containsKey(name)) + getMBeanInfo(name); + if (!mbeanOperationURLsMap.containsKey(name) || !mbeanOperationURLsMap.get(name).containsKey(operationName)) + throw new ReflectionException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OPERATION_NOT_FOUND, name, operationName))); + + return mbeanOperationURLsMap.get(name).get(operationName).getURL(); + } + + private URL getCreateMBeanURL() throws IOException { + return createMBeanURL.getURL(); + } + + private URL getInstanceOfURL() throws IOException { + return instanceOfURL.getURL(); + } + + private URL getInstanceOfURL(ObjectName name, String className) throws IOException { + return new URL(getInstanceOfURL().toString() + "?" + + (name != null ? "objectName=" + URLEncoder.encode(name.getCanonicalName(), "UTF-8") + "&" : "") + + (className != null ? "className=" + URLEncoder.encode(className, "UTF-8") : "")); + } + + private URL getMBeansURL() throws IOException { + return mbeansURL.getURL(); + } + + private URL getMBeansURL(ObjectName name, String instanceOf) throws IOException { + return new URL(getMBeansURL().toString() + "?" + + (name != null ? "objectName=" + URLEncoder.encode(name.getCanonicalName(), "UTF-8") + "&" : "") + + (instanceOf != null ? "className=" + URLEncoder.encode(instanceOf, "UTF-8") : "")); + } + + private URL getMBeanURL(ObjectName name) throws IOException, InstanceNotFoundException { + if (!mbeanInfoURLMap.containsKey(name)) + queryMBeans(name, null, null, true); + if (!mbeanInfoURLMap.containsKey(name)) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + return mbeanInfoURLMap.get(name).getURL(); + } + + private void purgeMBeanURLs(ObjectName name) { + mbeanInfoURLMap.remove(name); + mbeanAttributesURLMap.remove(name); + mbeanAttributeURLsMap.remove(name); + mbeanOperationURLsMap.remove(name); + } + + private void processAttributeOrOperationURLs(Map destination, Map source, boolean update) { + if (update) { + // Remove any elements that are not present in the new map + Set missingKeys = new HashSet(destination.keySet()); + missingKeys.removeAll(source.keySet()); + for (String missingKey : missingKeys) { + destination.remove(missingKey); + } + } + + for (Map.Entry e : source.entrySet()) { + if (!update || !destination.containsKey(e.getKey()) || + !destination.get(e.getKey()).getName().equals(e.getValue())) { + destination.put(e.getKey(), new DynamicURL(connector, e.getValue())); + } + } + } + + private void processMBeanInfoURLs(Map source, String parentPath, boolean complete) { + if (complete) { + // This is the complete set of MBeanInfo URLs, so remove any elements that are not present in the new map + Set missingKeys = new HashSet(mbeanInfoURLMap.keySet()); + missingKeys.removeAll(source.keySet()); + for (ObjectName missingKey : missingKeys) { + purgeMBeanURLs(missingKey); + } + } + + for (Map.Entry e : source.entrySet()) { + if (!mbeanInfoURLMap.containsKey(e.getKey()) || + !mbeanInfoURLMap.get(e.getKey()).getName().equals(e.getValue())) { + // if updating the MBeanInfo URL (because new URL did not match), other maps are now invalid, + // so purge before re-adding + if (mbeanInfoURLMap.containsKey(e.getKey())) + purgeMBeanURLs(e.getKey()); + mbeanInfoURLMap.put(e.getKey(), new DynamicURL(connector, e.getValue())); + } + } + } + + // + // Exception Message and Logging Methods + // + + synchronized void logSevereException(String sourceMethod, String errorMsg, Exception e) { + logger.logp(Level.SEVERE, logger.getName(), sourceMethod, errorMsg, e); + } + + synchronized IOException getRequestErrorException(String sourceMethod, Exception e, URL url) { + String urlString = (url != null) ? url.toString() : "null"; + String connectionId = connector.getConnectionId(); + String errorMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.REQUEST_ERROR, + urlString, connectionId); + logger.logp(Level.SEVERE, logger.getName(), sourceMethod, errorMsg, e); + return new IOException(errorMsg, e); + } + + synchronized IOException getRequestErrorException(String sourceMethod, Exception e) { + String connectionId = connector.getConnectionId(); + String errorMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.REQUEST_ERROR, + null, connectionId); + logger.logp(Level.SEVERE, logger.getName(), sourceMethod, errorMsg, e); + return new IOException(errorMsg, e); + } + + synchronized IOException getResponseErrorException(String sourceMethod, Exception e, URL url) { + String urlString = (url != null) ? url.toString() : "null"; + String connectionId = connector.getConnectionId(); + String errorMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.RESPONSE_ERROR, + urlString, connectionId); + logger.logp(Level.SEVERE, logger.getName(), sourceMethod, errorMsg, e); + return new IOException(errorMsg, e); + } + + synchronized IOException getResponseCodeErrorException(String methodName, int responseCode, HttpsURLConnection connection) { + // Did not understand response code; create an IOException with response message and log error + String responseMessage = null; + try { + responseMessage = connection.getResponseMessage(); + } catch (IOException io) { + // Use null for message + } + String errorMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.RESPONSE_CODE_ERROR, + responseCode, responseMessage, + connection.getURL().toString(), + connector.getConnectionId()); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg); + return new IOException(errorMsg); + } + + synchronized Throwable getServerThrowable(String methodName, HttpsURLConnection connection) { + Throwable t; + JSONConverter converter = JSONConverter.getConverter(); + try { + t = converter.readThrowable(connection.getErrorStream()); + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; no need to log this case + t = new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_THROWABLE_EXCEPTION), cnf); + } catch (Exception e) { + t = getResponseErrorException(methodName, e, connection.getURL()); + } finally { + JSONConverter.returnConverter(converter); + } + + return t; + } + + IOException getBadCredentialsException(int responseCode, HttpsURLConnection connection) { + // Received response code 401 or 403; problem with credentials + String responseMessage = null; + try { + responseMessage = connection.getResponseMessage(); + } catch (IOException io) { + // Use null for message + } + return new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.BAD_USER_CREDENTIALS, responseCode, responseMessage)); + } + + // -- Connection methods + + // When the connection normally closes, we disconnect after we have finished closing everything, to give everyone a chance to + //do the proper cleaning procedures. + void close() { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "close", "Close called for " + RESTClientMessagesUtil.getObjID(this) + " within connection: " + + connector.getConnectionId()); + } + + closePollingThread(); + + if (notificationRegistry != null) { + notificationRegistry.close(); + } + + if (connector.logFailovers()) { + String disconnectMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.MEMBER_DISCONNECT, connector.getCurrentEndpoint()); + logger.logp(Level.INFO, logger.getName(), "close", disconnectMsg); + } + + disconnect(); + } + + private void closePollingThread() { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "closePollingThread", "Closing thread: " + serverPollingThread.getCustomId()); + } + if (serverPollingThread != null) { + serverPollingThread.interrupt(); + + try { + serverPollingThread.join(2000); + } catch (InterruptedException e) { + //ignore..but we really shouldn't be interrupted by anybody else + } finally { + serverPollingThread = null; + } + } + } + + //When the connection fails we disconnect right away to keep anything else from happening (ie: bad connection) + synchronized void connectionFailed(Throwable t) { + if (!isConnected()) { + //another thread already disconnected this connector, so return + return; + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "connectionFailed", "Connection failed: " + RESTClientMessagesUtil.getObjID(this)); + } + + disconnect(); + + if (notificationRegistry != null) { + notificationRegistry.close(); + } + + //Emit the notification + connector.connectionFailed(t); + } + + private void disconnect() { + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "disconnect", "Disconnect called for " + RESTClientMessagesUtil.getObjID(this)); + } + this.disconnected = true; + } + + boolean isConnected() { + return !disconnected; + } + + private void checkConnection() throws IOException { + if (!isConnected()) + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.NOT_CONNECTED)); + } + + HttpsURLConnection getBasicConnection(URL url, HttpMethod method) throws IOException { + HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + connection.setDoInput(true); + connection.setDoOutput(method == HttpMethod.POST || method == HttpMethod.PUT); + connection.setUseCaches(false); + connection.setRequestMethod(method.toString()); + connection.setRequestProperty("Content-Type", ClientConstants.JSON_MIME_TYPE); + connection.setReadTimeout(connector.getReadTimeout()); + // Only add the Authorization header if we have one to add. It may + // not be present in certain flows, such as the certificate-based + // authentication. + if (connector.getBasicAuthHeader() != null) { + connection.setRequestProperty("Authorization", connector.getBasicAuthHeader()); + } + if (connector.isHostnameVerificationDisabled()) + connection.setHostnameVerifier(hostnameVerificationDisabler); + if (this.connector.getCustomSSLSocketFactory() != null) { + connection.setSSLSocketFactory(this.connector.getCustomSSLSocketFactory()); + } + + connection.setRequestProperty("User-Agent", CLIENT_VERSION); + + return connection; + } + + Connector getConnector() { + return connector; + } + + protected boolean isServerLevelRouting() { + + if ((mapRouting != null && mapRouting.size() == 3 && + isValueSet((String) mapRouting.get(ClientProvider.ROUTING_KEY_HOST_NAME)) && isValueSet((String) mapRouting.get(ClientProvider.ROUTING_KEY_SERVER_NAME)) + && isValueSet((String) mapRouting.get(ClientProvider.ROUTING_KEY_SERVER_USER_DIR)))) { + return true; + } else { + return false; + } + } + + protected boolean isHostLevelRouting() { + if ((mapRouting != null && mapRouting.size() == 1 && isValueSet((String) mapRouting.get(ClientProvider.ROUTING_KEY_HOST_NAME)))) { + return true; + } else { + return false; + } + } + + /** + * Checks if a value is null or empty. + * + * @param s The variable need to be checked. + * @return if the variable is not null and not empty. Otherwise return false. + */ + public boolean isValueSet(String s) { + return (s != null && s.trim().isEmpty() == false) ? true : false; + } + + HttpsURLConnection getConnection(URL originalUrl, HttpMethod method) throws IOException { + return getConnection(originalUrl, method, false); + } + + HttpsURLConnection getConnection(URL originalUrl, HttpMethod method, boolean ignoreProxy) throws IOException { + return getConnection(originalUrl, method, ignoreProxy, null); + } + + HttpsURLConnection getConnection(URL originalUrl, HttpMethod method, boolean ignoreProxy, Map routingInfo) throws IOException { + URL url = originalUrl; + String sURL = originalUrl.toString(); + + //For MBean routing we only care about server level routing, so that's our proxy mode. Other users/extenders of this class, + //such as file transfer, might also check for host level routing. + final boolean inProxyMode = !ignoreProxy && isServerLevelRouting(); + if (inProxyMode && sURL.indexOf(ClientConstants.ROUTER_URI) < 0) { + //If we're talking to a server that has a version at or greater than 4, then we don't need the /router URL. + final String asURL = serverVersion >= 4 ? sURL : sURL.replaceFirst(ClientConstants.CONNECTOR_URI, ClientConstants.ROUTER_URI); + try { + url = AccessController.doPrivileged( + new PrivilegedExceptionAction() { + @Override + public URL run() throws MalformedURLException { + return new URL(asURL); + } + }); + } catch (PrivilegedActionException e) { + throw new IOException(e.getMessage()); + } + + } + HttpsURLConnection connection = getBasicConnection(url, method); + // If routing info is explicitly provided to this method always set the request properties with the routing information. + if (inProxyMode || routingInfo != null) { + // Use the MBeanServerConnection's current routing context if routing info wasn't explicitly provided to this method. + if (routingInfo == null) { + routingInfo = mapRouting; + } + connection.addRequestProperty(ClientProvider.ROUTING_KEY_HOST_NAME, (String) routingInfo.get(ClientProvider.ROUTING_KEY_HOST_NAME)); + connection.addRequestProperty(ClientProvider.ROUTING_KEY_SERVER_USER_DIR, (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_USER_DIR)); + connection.addRequestProperty(ClientProvider.ROUTING_KEY_SERVER_NAME, (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_NAME)); + if (inProxyMode) { + connection.addRequestProperty(ClientProvider.READ_TIMEOUT, String.valueOf(connector.getReadTimeout())); + } + } + return connection; + } + + /** + * Attemps to recover the connection, either to the current endpoint or to other endpoints, depending + * on the configuration of this connector and availability of endpoints. + * + * If we cannot connect to any of the available endpoints, this method will disconnect the connector and any subsequent call + * attempts will throw exceptions. If we can connect to a new endpoint, or recover the connection to our old endpoint, then + * the notification area and all URLs will be setup to use the connected endpoint. + * + * Appropriate JMXConnector-level notifications are sent for all events. + * + * @param t represents the exception that led us in here, or null. + */ + protected void recoverConnection(Throwable t) { + recoverConnection(t, false); + } + + protected void recoverConnection(Throwable t, boolean skipCurrentEndpoint) { + final String methodName = "recoverConnection"; + + //We don't want to synchronize this method because we don't want a pile of threads + //to queue up waiting to come in, each doing the same connection recovery. Instead, we + //use an atomic boolean to guard entry so that only 1 thread does the actual recovery. + if (!isRecoveringConnection.compareAndSet(false, true)) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Exiting. Another thread is doing the recovery"); + } + + //another thread is currently trying to recover the connection, so we can exit. + return; + } + + //We wrap the entire code below in a try{} so that we're sure to reset the isRecoveringConnection value. + try { + + if (!isConnected()) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Connection has been closed."); + } + //the connection has been closed + return; + } + + //The first thing we do is emit the notification that we have temporarily lost connection + connector.connectionTemporarilyLost(t); + + //Get the current endpoint + final String originalEndpoint = connector.getCurrentEndpoint(); + + //Try to re-connect to the current endpoint first. This is to keep the same behaviour for non-WLM scenarios, where there is + //only 1 endpoint and the user may have configured an amount of time that they want to wait for that server to be up. For WLM + //scenarios, users can set this time to 0 so that we don't retry the current endpoint and instead move onto the other endpoints + //right away. Alternatively, WLM users can set this time to be > 0 so that they retry the current endpoint first, if they wish. + + final int maxServerRestartTime = connector.getMaxServerWaitTime(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "[" + RESTClientMessagesUtil.getObjID(this) + "] Waiting for current endpoint [" + originalEndpoint + + "] to come up. Max time: " + + maxServerRestartTime); + } + + if (!skipCurrentEndpoint && maxServerRestartTime > 0) { + final int serverStatusPollingInterval = connector.getServerStatusPollingInterval(); + final long endTime = System.nanoTime() + maxServerRestartTime * NANOS_IN_A_MILLISECOND; + + while (System.nanoTime() < endTime) { + // Try to set up new NotificationArea, re-register notifications if successful + try { + if (testConnection(originalEndpoint)) { + //Our notification registry will be null if we came into recovery mode during the connector's init + if (notificationRegistry == null) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Returning sucessfully. No notification to recover."); + } + //We still need to send the connection restored + connector.connectionRestored(null); + return; + } + notificationRegistry.setupNotificationArea(); + if (notificationRegistry.restoreNotificationRegistrations(true)) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Returning sucessfully, notification restored for current endpoint."); + } + return; + } + } + } catch (Throwable throwable) { + // ignore and try again + } + long currentTime = System.nanoTime(); + if (currentTime < endTime) { + try { + long millisToWait = (endTime - currentTime + (NANOS_IN_A_MILLISECOND - 1)) / NANOS_IN_A_MILLISECOND; // round up - to avoid 0 + Thread.sleep(Math.min(millisToWait, serverStatusPollingInterval)); + } catch (InterruptedException ie) { + // Connection being closed; return false so thread exits + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Returning false, interrupted:" + ie); + } + //disconnect (this will also emit a FAILED notification) + connectionFailed(t); + return; + } + } + } + } + + //Get the full list of endpoints. + List endpoints = connector.getEndpointList(); + + for (String endpoint : endpoints) { + //we already tried the original endpoint, so skip that one. + if (endpoint.equals(originalEndpoint)) { + continue; + } + + if (testConnection(endpoint)) { + //Set our tentative new endpoint so we can attempt to setup notifications. + //If this fails we don't need to worry about re-instating the old endpoint because we + //will either override that value with another endpoint further down the list, or if none are + //available we will fail the entire connection. + connector.setCurrentEndpoint(endpoint); + + try { + + if (notificationRegistry == null) { + //haven't setup the notification thread yet + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Returning sucessfully."); + } + //NOTE: we don't emit an OPEN notification because we're in the connector' initialization process, + //which will already emit an OPEN notification. + return; + } + + //Setup notification area on the new endpoint + notificationRegistry.setupNotificationArea(); + + //restore notifications (don't send restored notification, since we're actually using a new endpoint) + if (notificationRegistry.restoreNotificationRegistrations(false)) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Returning sucessfully, notification restored."); + } + + //everything is ready to go, so emit OPENED notification + connector.connectionOpened(); + + //Re-load the server info because it could have changed (ie: server version, URLs) + loadJMXServerInfo(); + + if (connector.logFailovers()) { + String connectMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.MEMBER_CONNECT, endpoint); + logger.logp(Level.INFO, logger.getName(), methodName, connectMsg); + } + + return; + } + //could not restore notifications, so try next endpoint + continue; + } catch (Throwable e) { + //ignore and try next endpoint + continue; + } + } + } + + //disconnect (this will also emit a FAILED notification) + connectionFailed(t); + + return; + } finally { + //we're done with the recovery (either by return or by runtime exceptions), so restore atomic state + isRecoveringConnection.set(false); + } + } + + private void findInitialEndpoint() throws IOException { + //Get the full list of endpoints. + List endpoints = connector.getEndpointList(); + String connectMsg; + + if (endpoints != null) { + if (endpoints.size() == 1) { + connector.setCurrentEndpoint(endpoints.get(0)); + return; + } + + for (String endpoint : endpoints) { + if (testConnection(endpoint)) { + connector.setCurrentEndpoint(endpoint); + return; + } + } + } + + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.NO_AVAILABLE_ENDPOINTS)); + } + + private URL getSimpleURL(String endpoint) throws MalformedURLException { + String[] endpointSegments = splitEndpoint(endpoint); + return new URL("https", endpointSegments[0], Integer.valueOf(endpointSegments[1]), "/IBMJMXConnectorREST/mbeanServer"); + } + + private boolean testConnection(String endpoint) { + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), "testConnection", "Testing connection for endpoint " + endpoint); + } + + //Build our test URL + URL testURL = null; + try { + //Make the most simple URL available on the server side + testURL = getSimpleURL(endpoint); + } catch (Exception e) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "testConnection", "Failed while making URL:" + e.getMessage()); + } + //Very unlikely to fail here, but return false if it happens + return false; + } + + //Try to connect to the simple URL + try { + HttpsURLConnection connection = getBasicConnection(testURL, HttpMethod.GET); + final int responseCode = connection.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "testConnection", "Successful!"); + } + return true; + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "testConnection", "Failed connection attempt with response code:" + responseCode); + } + return false; + + } catch (IOException e) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "testConnection", "Failed connection attempt with exception:" + e.getMessage()); + } + return false; + } + + } + + public class ServerPollingThread extends Thread { + + /** + * The current polling mode we're in. Failover vs Notification. + */ + private PollingMode mode = null; + + /** + * The amount of time this thread waits betweeen server polls. Needs + * to be volatile because other threads will trigger a change to this value. + * The actual wait interval will be directly related to the polling mode we're in. + */ + private volatile long waitInterval = 0; + + /** + * Flag used to synchronize stand-by operations + */ + private final Object waitFlag = new PollingWaitFlag(); + + /** + * Inner class to use for the standby-lock (as suggested by findbugs) + */ + private class PollingWaitFlag {} + + //Constructor + private ServerPollingThread(PollingMode mode) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "ServerPollingThread", "Created thread: " + getCustomId()); + } + // polling thread should be run as a daemon by default + setDaemon(true); + setName("JMX-REST-Client-Polling"); + changeMode(mode); + } + + public String getCustomId() { + return "ThreadID[" + this.getId() + "], from [" + connector.getConnectionId() + "]"; + } + + //This method gets called by the RESTMBeanServerConnection when certain events occur + protected void changeMode(PollingMode newMode) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "changeMode", "Changing mode from " + mode + " to " + newMode + " in thread: " + getCustomId()); + } + + //Only take action if we're changing polling mode + if (mode != newMode) { + synchronized (waitFlag) { + //Update mode + mode = newMode; + + if (mode == PollingMode.NOTIFICATION) { + waitInterval = connector.getNotificationFetchInterval(); + } else { + waitInterval = connector.getServerFailoverInterval(); + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "changeMode", "waitInterval is now: " + waitInterval); + } + + //Notify thread to wake up. Only 1 thread (serverPollingThread) will be + //potentially waiting on this flag, so we can use notify() instead of notifyAll(). + waitFlag.notify(); + } + } + } + + /** {@inheritDoc} */ + @Override + public void run() { + final String sourceMethod = "run"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, "Running thread: " + getCustomId()); + } + + JSONConverter converter = JSONConverter.getConverter(); + + mainLoop: while (!interrupted() && isConnected()) { + URL targetURL = null; + HttpsURLConnection connection = null; + + //We cache the value of "mode" during every iteration of the while loop in case + //another thread changes our polling mode during a HTTP request. We want each + //HTTP request/response to have equal modes, and only change in the next iteration. + final PollingMode currentMode = mode; + + try { + if (currentMode == PollingMode.NOTIFICATION) { + //Connect to inboxURL + targetURL = notificationRegistry.getInboxURL(); + connection = getConnection(targetURL, HttpMethod.GET, true); + connection.setReadTimeout(getConnector().getNotificationReadTimeout()); + } else { + //Connect to a simple URL to ping server + targetURL = getSimpleURL(connector.getCurrentEndpoint()); + connection = getConnection(targetURL, HttpMethod.GET, true); + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Making a call to URL [" + targetURL + "] inside thread: " + getCustomId()); + } + + } catch (IOException io) { + //If we got here we have problems other than server connection, so we must fail right away + logger.logp(Level.FINE, logger.getName(), sourceMethod, io.getMessage(), io); + connectionFailed(getRequestErrorException(sourceMethod, io, targetURL)); + break mainLoop; + } + + try { + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, "Response code: " + responseCode); + } + + } catch (ConnectException ce) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, ce.getMessage(), ce); + recoverConnection(ce); + continue mainLoop; + } catch (IOException io) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, io.getMessage(), io); + continue mainLoop; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + try { + + if (currentMode == PollingMode.NOTIFICATION) { + // Process and return server response, which should be an array of Notifications + NotificationRecord[] notificationRecords = converter.readNotificationRecords(connection.getInputStream()); + + if (notificationRecords != null && isConnected()) { + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Received " + notificationRecords.length + " notifications"); + } + + for (NotificationRecord nr : notificationRecords) { + Notification n = nr.getNotification(); + Object source = n.getSource(); + if (!(source instanceof ObjectName)) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, "Notification source was not ObjectName: " + source); + getConnector().notificationLost(n); + continue; + } + + // Deliver the notification + ClientNotificationRegistration localRegistration = notificationRegistry.getRegistrationMap().get(nr.getNotificationTargetInformation()); + if (localRegistration != null) { + try { + localRegistration.handleNotification(n); + } catch (Exception e) { + logSevereException(sourceMethod, RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.NOTIFICATION_LOST), e); + getConnector().notificationLost(n); + } + } else { + getConnector().notificationLost(n); + } + } + + if (notificationRecords.length > 0) { + //try to fetch right away, in case this is a burst of notifications + continue mainLoop; + } + } + } else { + //no-op for failover polling, just break into the sleep segment + } + break; + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, e.getMessage(), e); + throw getResponseErrorException(sourceMethod, e, targetURL); + } + case HttpURLConnection.HTTP_NOT_FOUND: + Throwable ex = new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.URL_NOT_FOUND)); + logger.logp(Level.FINE, logger.getName(), sourceMethod, ex.getMessage()); + recoverConnection(ex); + continue mainLoop; + + case HttpURLConnection.HTTP_GONE: + // Notification area went away; try to re-establish + Throwable t = getServerThrowable(sourceMethod, connection); + logger.logp(Level.FINE, logger.getName(), sourceMethod, t.getMessage()); + recoverConnection(t); + continue mainLoop; + + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + Throwable ie = getServerThrowable(sourceMethod, connection); + logger.logp(Level.FINE, sourceMethod, logger.getName(), ie.getMessage()); + throw ie; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } catch (ClosedByInterruptException ie) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, ie.getMessage()); + break mainLoop; + } catch (Throwable t) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, t.getMessage()); + //If we get an unknown exception in this polling thread we must try to reconnect, which + //will disconnect the connector if the server is not returning proper requests. + recoverConnection(t); + continue mainLoop; + } + + //We need to wait a certain amount of time before making the next request + if (waitInterval > 0) { + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Calling sleep for " + waitInterval + " milliseconds on thread: " + getCustomId()); + } + try { + synchronized (waitFlag) { + waitFlag.wait(waitInterval); + } + } catch (InterruptedException e) { + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, "Interrupted sleep in thread: " + getCustomId()); + } + } + } + } + + JSONConverter.returnConverter(converter); + } + } + + /** + * Properly split a given endpoint into host/port. + * + * @param endpoint in the form host:port, where host could be a named host, an IPv4 or IPv6 address. + * @return a String array where [0] is the host and [1] is the port. + */ + public static String[] splitEndpoint(String endpoint) { + //The way our endpoints are constructed ensures that we will always have a ":" present..so don't need to check for -1 + final int lastColon = endpoint.lastIndexOf(":"); + String[] splitString = new String[2]; + splitString[0] = endpoint.substring(0, lastColon); + splitString[1] = endpoint.substring(lastColon + 1, endpoint.length()); + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "splitEndpoint", "Split " + endpoint + " into " + splitString[0] + " and " + splitString[1]); + } + + return splitString; + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ServerNotificationListenerEntry.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ServerNotificationListenerEntry.java new file mode 100755 index 000000000000..fb6b90c62170 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ServerNotificationListenerEntry.java @@ -0,0 +1,62 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.NotificationFilter; +import javax.management.ObjectName; + +import com.ibm.ws.jmx.connector.converter.NotificationTargetInformation; + +class ServerNotificationListenerEntry { + public final NotificationTargetInformation nti; + public final ObjectName listener; + public final NotificationFilter filter; + public final Object handback; + + private static final Logger logger = Logger.getLogger(ServerNotificationListenerEntry.class.getName()); + + /** + * @param listener + * @param filter + * @param handback + */ + ServerNotificationListenerEntry(NotificationTargetInformation nti, ObjectName listener, NotificationFilter filter, Object handback) { + this.nti = nti; + this.listener = listener; + this.filter = filter; + this.handback = handback; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "init", "targetInfo: " + nti + " | listener: " + listener + " | filter: " + filter + " | handback: " + handback); + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ServerNotificationListenerEntry)) + return false; + ServerNotificationListenerEntry other = (ServerNotificationListenerEntry) o; + return nti.equals(other.nti) && listener.equals(other.listener) && filter == other.filter && handback == other.handback; + } + + @Override + public int hashCode() { + return nti.hashCode() + listener.hashCode() + + (filter != null ? filter.hashCode() : 0) + + (handback != null ? handback.hashCode() : 0); + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/package-info.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/package-info.java new file mode 100755 index 000000000000..59084992b273 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/package-info.java @@ -0,0 +1,17 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.0 + */ +@org.osgi.annotation.versioning.Version("1.0") +package com.ibm.ws.jmx.connector.client.rest.internal; + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessagesUtil.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessagesUtil.java new file mode 100755 index 000000000000..39798e602286 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessagesUtil.java @@ -0,0 +1,48 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal.resources; + +import java.text.MessageFormat; +import java.util.ResourceBundle; + +/** + * + */ +public class FileTransferClientMessagesUtil { + + private static final ResourceBundle logMessages = ResourceBundle.getBundle("com.ibm.ws.jmx.connector.client.rest.internal.resources.FileTransferClientMessages"); + + // Error messages + public static final String CLIENT_ERROR = "filetransfer.client.error"; + public static final String SERVER_ERROR = "filetransfer.server.error"; + public static final String BAD_CREDENTIALS = "filetransfer.client.bad.credentials"; + public static final String RESPONSE_CODE_ERROR = "filetransfer.response.code.error"; + public static final String UNSUPPORTED_OPERATION = "filetransfer.unsupported.operation"; + + // Info messages + public static final String CLIENT_INIT = "filetransfer.client.init"; + public static final String DOWNLOAD_TO_FILE = "filetransfer.download.file"; + public static final String UPLOAD_FROM_FILE = "filetransfer.upload.file"; + public static final String DELETE_FILE = "filetransfer.delete.file"; + public static final String DELETE_ALL = "filetransfer.delete.all"; + + public static String getMessage(String messageName, Object... arguments) { + if (arguments.length > 0) + return MessageFormat.format(logMessages.getString(messageName), arguments); + else + return logMessages.getString(messageName); + } + + public static String getObjID(Object obj) { + return obj.getClass().getSimpleName() + "@" + System.identityHashCode(obj); + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessagesUtil.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessagesUtil.java new file mode 100755 index 000000000000..af3d56b5ea3e --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessagesUtil.java @@ -0,0 +1,75 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal.resources; + +import java.text.MessageFormat; +import java.util.ResourceBundle; + +/** + * + */ +public class RESTClientMessagesUtil { + + private static final ResourceBundle logMessages = ResourceBundle.getBundle("com.ibm.ws.jmx.connector.client.rest.internal.resources.RESTClientMessages"); + + // Severe log messages + public static final String REQUEST_ERROR = "jmx.rest.client.request.error"; + public static final String RESPONSE_ERROR = "jmx.rest.client.response.error"; + public static final String RESPONSE_CODE_ERROR = "jmx.rest.client.response.code.error"; + + // Exception messages + public static final String SERVER_THROWABLE_EXCEPTION = "jmx.rest.client.server.throwable.exception"; + public static final String SERVER_RESULT_EXCEPTION = "jmx.rest.client.server.result.exception"; + public static final String NOT_CONNECTED = "jmx.rest.client.not.connected"; + public static final String URL_NOT_FOUND = "jmx.rest.client.url.not.found"; + public static final String CLASS_NAME_NULL = "jmx.rest.client.class.name.null"; + public static final String ATTRIBUTE_NAME_NULL = "jmx.rest.client.attribute.name.null"; + public static final String ATTRIBUTE_NAMES_NULL = "jmx.rest.client.attribute.names.null"; + public static final String ATTRIBUTE_NULL = "jmx.rest.client.attribute.null"; + public static final String ATTRIBUTE_LIST_NULL = "jmx.rest.client.attribute.list.null"; + public static final String OBJECT_NAME_NULL = "jmx.rest.client.object.name.null"; + public static final String UNEXPECTED_SERVER_THROWABLE = "jmx.rest.client.unexpected.server.throwable"; + + // Exception messages with parameters + public static final String BAD_CREDENTIALS = "jmx.rest.client.bad.credentials"; + public static final String BAD_USER_CREDENTIALS = "jmx.rest.client.bad.user.credentials"; + public static final String OBJECT_NAME_PATTERN = "jmx.rest.client.object.name.pattern"; + public static final String INSTANCE_NOT_FOUND = "jmx.rest.client.instance.not.found"; + public static final String ATTRIBUTE_NOT_FOUND = "jmx.rest.client.attribute.not.found"; + public static final String OPERATION_NOT_FOUND = "jmx.rest.client.operation.not.found"; + public static final String LISTENER_NOT_FOUND = "jmx.rest.client.listener.not.found"; + + // Connection listener messages + public static final String NOTIFICATION_LOST = "jmx.rest.client.notification.lost"; + public static final String CONNECTION_FAILED = "jmx.rest.client.connection.failed"; + public static final String CONNECTION_TEMPORARILY_LOST = "jmx.rest.client.connection.temporarily.lost"; + public static final String CONNECTION_RESTORED_WITH_EXCEPTIONS = "jmx.rest.client.connection.restored.with.exceptions"; + public static final String CONNECTION_RESTORED = "jmx.rest.client.connection.restored"; + public static final String MEMBER_CONNECT = "jmx.rest.client.connection.connect"; + public static final String MEMBER_DISCONNECT = "jmx.rest.client.connection.disconnect"; + + // Endpoint related messages + public static final String NULL_SERVICE_URL = "jmx.rest.client.connection.illegal.argument"; + public static final String INVALID_ENDPOINT = "jmx.rest.client.connection.invalid.endpoint"; + public static final String NO_AVAILABLE_ENDPOINTS = "jmx.rest.client.connection.no.endpoints"; + + public static String getMessage(String messageName, Object... arguments) { + if (arguments.length > 0) + return MessageFormat.format(logMessages.getString(messageName), arguments); + else + return logMessages.getString(messageName); + } + + public static String getObjID(Object obj) { + return obj.getClass().getSimpleName() + "@" + System.identityHashCode(obj); + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/package-info.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/package-info.java new file mode 100755 index 000000000000..32487a53f4b4 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/package-info.java @@ -0,0 +1,16 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.4.0 + */ +@org.osgi.annotation.versioning.Version("1.4.0") +package com.ibm.ws.jmx.connector.client.rest; diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java new file mode 100755 index 000000000000..caa62fa9de2c --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java @@ -0,0 +1,4418 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012,2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.converter; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.Array; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.Stack; +import java.util.TreeMap; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.Attribute; +import javax.management.AttributeChangeNotification; +import javax.management.AttributeChangeNotificationFilter; +import javax.management.AttributeList; +import javax.management.Descriptor; +import javax.management.ImmutableDescriptor; +import javax.management.MBeanAttributeInfo; +import javax.management.MBeanConstructorInfo; +import javax.management.MBeanInfo; +import javax.management.MBeanNotificationInfo; +import javax.management.MBeanOperationInfo; +import javax.management.MBeanParameterInfo; +import javax.management.MBeanServerNotification; +import javax.management.MalformedObjectNameException; +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationFilterSupport; +import javax.management.ObjectInstance; +import javax.management.ObjectName; +import javax.management.QueryExp; +import javax.management.openmbean.ArrayType; +import javax.management.openmbean.CompositeData; +import javax.management.openmbean.CompositeDataSupport; +import javax.management.openmbean.CompositeType; +import javax.management.openmbean.OpenDataException; +import javax.management.openmbean.OpenType; +import javax.management.openmbean.SimpleType; +import javax.management.openmbean.TabularData; +import javax.management.openmbean.TabularDataSupport; +import javax.management.openmbean.TabularType; +import javax.management.relation.MBeanServerNotificationFilter; +import javax.management.relation.RelationNotification; +import javax.management.remote.JMXConnectionNotification; +import javax.management.timer.TimerNotification; + +import com.ibm.json.java.JSON; +import com.ibm.json.java.JSONArray; +import com.ibm.json.java.JSONArtifact; +import com.ibm.json.java.JSONObject; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.ws.jmx.connector.datatypes.ConversionException; +import com.ibm.ws.jmx.connector.datatypes.CreateMBean; +import com.ibm.ws.jmx.connector.datatypes.Invocation; +import com.ibm.ws.jmx.connector.datatypes.JMXServerInfo; +import com.ibm.ws.jmx.connector.datatypes.MBeanInfoWrapper; +import com.ibm.ws.jmx.connector.datatypes.MBeanQuery; +import com.ibm.ws.jmx.connector.datatypes.NotificationArea; +import com.ibm.ws.jmx.connector.datatypes.NotificationRegistration; +import com.ibm.ws.jmx.connector.datatypes.NotificationSettings; +import com.ibm.ws.jmx.connector.datatypes.ObjectInstanceWrapper; +import com.ibm.ws.jmx.connector.datatypes.ServerNotificationRegistration; +import com.ibm.ws.jmx.connector.datatypes.ServerNotificationRegistration.Operation; + +/** + * Class used to convert JSON data for use as input and output to the JMX/REST + * connector. + *

+ * Note that the internals of this class are NOT thread safe, but the contract + * to obtain an instance is. Do not use the same instance of this class in + * multiple threads. Obtain a new instance each time an action is required + * using the following pattern: + *

{@code JSONConverter converter = JSONConverter.getConverter();}
{@code ...}
{@code JSONConverter.returnConverter(converter); } + */ +public class JSONConverter { + private static final Logger logger = Logger.getLogger(JSONConverter.class.getName()); + private static final boolean USE_BASE64_FOR_POJO = false; + private static final boolean USE_BASE64_FOR_MBEANINFO = false; + + private static DefaultSerializationHelper defaultHelper = new DefaultSerializationHelper(); + private static SerializationHelper helper = defaultHelper; + + // All supported interfaces/classes. + private static enum TYPE { + _Byte, _Short, _Integer, _Long, _Float, _Double, _Character, _Boolean, + Byte, Short, Integer, Long, Float, Double, Character, Boolean, + String, BigInteger, BigDecimal, Date, ObjectName, + + Object, + Collection, Map, + CompositeData, TabularData, + + List, Set, + ArrayList, LinkedList, Vector, + HashMap, Hashtable, TreeMap, + HashSet, + CompositeDataSupport, TabularDataSupport + } + + // Map from supported classes to Type enumeration, so that we can + // switch on the returned value. Implementations classes corresponding + // to the second half of the constants map to the base concepts: + // Collection / Map / CompositeData / TabularData. + // This map is used for writing and reading. + private static final Map, TYPE> SupportedClasses = new HashMap, TYPE>(); + static { + SupportedClasses.put(Byte.TYPE, TYPE._Byte); + SupportedClasses.put(Short.TYPE, TYPE._Short); + SupportedClasses.put(Integer.TYPE, TYPE._Integer); + SupportedClasses.put(Long.TYPE, TYPE._Long); + SupportedClasses.put(Float.TYPE, TYPE._Float); + SupportedClasses.put(Double.TYPE, TYPE._Double); + SupportedClasses.put(Character.TYPE, TYPE._Character); + SupportedClasses.put(Boolean.TYPE, TYPE._Boolean); + SupportedClasses.put(Byte.class, TYPE.Byte); + SupportedClasses.put(Short.class, TYPE.Short); + SupportedClasses.put(Integer.class, TYPE.Integer); + SupportedClasses.put(Long.class, TYPE.Long); + SupportedClasses.put(Float.class, TYPE.Float); + SupportedClasses.put(Double.class, TYPE.Double); + SupportedClasses.put(Character.class, TYPE.Character); + SupportedClasses.put(Boolean.class, TYPE.Boolean); + SupportedClasses.put(String.class, TYPE.String); + SupportedClasses.put(BigInteger.class, TYPE.BigInteger); + SupportedClasses.put(BigDecimal.class, TYPE.BigDecimal); + SupportedClasses.put(Date.class, TYPE.Date); + SupportedClasses.put(ObjectName.class, TYPE.ObjectName); + + SupportedClasses.put(Object.class, TYPE.Object); + SupportedClasses.put(Collection.class, TYPE.Collection); + SupportedClasses.put(Map.class, TYPE.Map); + SupportedClasses.put(CompositeData.class, TYPE.CompositeData); + SupportedClasses.put(TabularData.class, TYPE.TabularData); + + SupportedClasses.put(List.class, TYPE.Collection); + SupportedClasses.put(Set.class, TYPE.Collection); + SupportedClasses.put(ArrayList.class, TYPE.Collection); + SupportedClasses.put(LinkedList.class, TYPE.Collection); + SupportedClasses.put(Vector.class, TYPE.Collection); + SupportedClasses.put(HashMap.class, TYPE.Map); + SupportedClasses.put(Hashtable.class, TYPE.Map); + SupportedClasses.put(TreeMap.class, TYPE.Map); + SupportedClasses.put(HashSet.class, TYPE.Collection); + SupportedClasses.put(CompositeDataSupport.class, TYPE.CompositeData); + SupportedClasses.put(TabularDataSupport.class, TYPE.TabularData); + } + + // Set of 13 simple value classes corresponding to values that can be + // represented as Strings, hence used as keys in simple maps. + // Unlike SimpleValues, this one doesn't include java.lang.Object. + // This map is used only during writing. + private static final Set> SimpleKeys = new HashSet>(); + static { + SimpleKeys.add(Byte.class); + SimpleKeys.add(Short.class); + SimpleKeys.add(Integer.class); + SimpleKeys.add(Long.class); + SimpleKeys.add(Float.class); + SimpleKeys.add(Double.class); + SimpleKeys.add(Character.class); + SimpleKeys.add(Boolean.class); + SimpleKeys.add(String.class); + SimpleKeys.add(BigInteger.class); + SimpleKeys.add(BigDecimal.class); + SimpleKeys.add(Date.class); + SimpleKeys.add(ObjectName.class); + } + + // Set of 8 primitive, 8 corresponding built-in, and String classes. + // Array of these types can't contain instance of other classes. + private static final Set> SimpleArrays = new HashSet>(); + static { + SimpleArrays.add(Byte.TYPE); + SimpleArrays.add(Short.TYPE); + SimpleArrays.add(Integer.TYPE); + SimpleArrays.add(Long.TYPE); + SimpleArrays.add(Float.TYPE); + SimpleArrays.add(Double.TYPE); + SimpleArrays.add(Character.TYPE); + SimpleArrays.add(Boolean.TYPE); + SimpleArrays.add(Byte.class); + SimpleArrays.add(Short.class); + SimpleArrays.add(Integer.class); + SimpleArrays.add(Long.class); + SimpleArrays.add(Float.class); + SimpleArrays.add(Double.class); + SimpleArrays.add(Character.class); + SimpleArrays.add(Boolean.class); + SimpleArrays.add(String.class); + } + + // Set of 14 simple value classes corresponding to values that can be + // represented as Strings. + // This map is used only during reading. + private static final Map SimpleValues = new HashMap(); + static { + SimpleValues.put(Byte.class.getName(), TYPE.Byte); + SimpleValues.put(Short.class.getName(), TYPE.Short); + SimpleValues.put(Integer.class.getName(), TYPE.Integer); + SimpleValues.put(Long.class.getName(), TYPE.Long); + SimpleValues.put(Float.class.getName(), TYPE.Float); + SimpleValues.put(Double.class.getName(), TYPE.Double); + SimpleValues.put(Character.class.getName(), TYPE.Character); + SimpleValues.put(Boolean.class.getName(), TYPE.Boolean); + SimpleValues.put(String.class.getName(), TYPE.String); + SimpleValues.put(BigInteger.class.getName(), TYPE.BigInteger); + SimpleValues.put(BigDecimal.class.getName(), TYPE.BigDecimal); + SimpleValues.put(Date.class.getName(), TYPE.Date); + SimpleValues.put(Object.class.getName(), TYPE.Object); + SimpleValues.put(ObjectName.class.getName(), TYPE.ObjectName); + } + + // The map from class names to the simple open types. + // This map is only used during reading. + private static final Map> Name2SimpleTypes = new HashMap>(); + static { + // Don't need to worry about VOID + Name2SimpleTypes.put(Byte.class.getName(), SimpleType.BYTE); + Name2SimpleTypes.put(Short.class.getName(), SimpleType.SHORT); + Name2SimpleTypes.put(Integer.class.getName(), SimpleType.INTEGER); + Name2SimpleTypes.put(Long.class.getName(), SimpleType.LONG); + Name2SimpleTypes.put(Float.class.getName(), SimpleType.FLOAT); + Name2SimpleTypes.put(Double.class.getName(), SimpleType.DOUBLE); + Name2SimpleTypes.put(Character.class.getName(), SimpleType.CHARACTER); + Name2SimpleTypes.put(Boolean.class.getName(), SimpleType.BOOLEAN); + Name2SimpleTypes.put(String.class.getName(), SimpleType.STRING); + Name2SimpleTypes.put(BigInteger.class.getName(), SimpleType.BIGINTEGER); + Name2SimpleTypes.put(BigDecimal.class.getName(), SimpleType.BIGDECIMAL); + Name2SimpleTypes.put(Date.class.getName(), SimpleType.DATE); + Name2SimpleTypes.put(ObjectName.class.getName(), SimpleType.OBJECTNAME); + } + + // The simple open types to the type enumerations. + // This map is only used during reading. + private static final Map, TYPE> SimpleOpenTypes = new HashMap, TYPE>(); + static { + // Don't need to worry about VOID + SimpleOpenTypes.put(SimpleType.BYTE, TYPE.Byte); + SimpleOpenTypes.put(SimpleType.SHORT, TYPE.Short); + SimpleOpenTypes.put(SimpleType.INTEGER, TYPE.Integer); + SimpleOpenTypes.put(SimpleType.LONG, TYPE.Long); + SimpleOpenTypes.put(SimpleType.FLOAT, TYPE.Float); + SimpleOpenTypes.put(SimpleType.DOUBLE, TYPE.Double); + SimpleOpenTypes.put(SimpleType.CHARACTER, TYPE.Character); + SimpleOpenTypes.put(SimpleType.BOOLEAN, TYPE.Boolean); + SimpleOpenTypes.put(SimpleType.STRING, TYPE.String); + SimpleOpenTypes.put(SimpleType.BIGINTEGER, TYPE.BigInteger); + SimpleOpenTypes.put(SimpleType.BIGDECIMAL, TYPE.BigDecimal); + SimpleOpenTypes.put(SimpleType.DATE, TYPE.Date); + SimpleOpenTypes.put(SimpleType.OBJECTNAME, TYPE.ObjectName); + } + + // Map from names of complex structure classes to the type enumerations. + // This map is only used during reading. + private static final Map StructuredClasses = new HashMap(); + static { + StructuredClasses.put(ArrayList.class.getName(), TYPE.ArrayList); + StructuredClasses.put(LinkedList.class.getName(), TYPE.LinkedList); + StructuredClasses.put(Vector.class.getName(), TYPE.Vector); + StructuredClasses.put(HashMap.class.getName(), TYPE.HashMap); + StructuredClasses.put(Hashtable.class.getName(), TYPE.Hashtable); + StructuredClasses.put(TreeMap.class.getName(), TYPE.TreeMap); + StructuredClasses.put(HashSet.class.getName(), TYPE.HashSet); + StructuredClasses.put(CompositeDataSupport.class.getName(), TYPE.CompositeDataSupport); + StructuredClasses.put(TabularDataSupport.class.getName(), TYPE.TabularDataSupport); + } + + // Names of JSON object members. + private static final String N_API = "api"; + private static final byte[] OM_API = { '"', 'a', 'p', 'i', '"', ':' }; + private static final String N_ATTRIBUTENAME = "attributeName"; + private static final byte[] OM_ATTRIBUTENAME = { '"', 'a', 't', 't', 'r', 'i', 'b', 'u', 't', 'e', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_ATTRIBUTES = "attributes"; + private static final byte[] OM_ATTRIBUTES = { '"', 'a', 't', 't', 'r', 'i', 'b', 'u', 't', 'e', 's', '"', ':' }; + private static final String N_ATTRIBUTES_URL = "attributes_URL"; + private static final byte[] OM_ATTRIBUTES_URL = { '"', 'a', 't', 't', 'r', 'i', 'b', 'u', 't', 'e', 's', '_', 'U', 'R', 'L', '"', ':' }; + private static final String N_ATTRIBUTETYPE = "attributeType"; + private static final byte[] OM_ATTRIBUTETYPE = { '"', 'a', 't', 't', 'r', 'i', 'b', 'u', 't', 'e', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_CLASSNAME = "className"; + private static final byte[] OM_CLASSNAME = { '"', 'c', 'l', 'a', 's', 's', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_CLIENT = "client"; + private static final byte[] OM_CLIENT = { '"', 'c', 'l', 'i', 'e', 'n', 't', '"', ':' }; + private static final String N_CONNECTIONID = "connectionId"; + private static final byte[] OM_CONNECTIONID = { '"', 'c', 'o', 'n', 'n', 'e', 'c', 't', 'i', 'o', 'n', 'I', 'd', '"', ':' }; + private static final String N_CONSTRUCTORS = "constructors"; + private static final byte[] OM_CONSTRUCTORS = { '"', 'c', 'o', 'n', 's', 't', 'r', 'u', 'c', 't', 'o', 'r', 's', '"', ':' }; + private static final String N_CREATEMBEAN = "createMBean"; + private static final byte[] OM_CREATEMBEAN = { '"', 'c', 'r', 'e', 'a', 't', 'e', 'M', 'B', 'e', 'a', 'n', '"', ':' }; + private static final String N_DEFAULTDOMAIN = "defaultDomain"; + private static final byte[] OM_DEFAULTDOMAIN = { '"', 'd', 'e', 'f', 'a', 'u', 'l', 't', 'D', 'o', 'm', 'a', 'i', 'n', '"', ':' }; + private static final String N_DELIVERYINTERVAL = "deliveryInterval"; + private static final byte[] OM_DELIVERYINTERVAL = { '"', 'd', 'e', 'l', 'i', 'v', 'e', 'r', 'y', 'I', 'n', 't', 'e', 'r', 'v', 'a', 'l', '"', ':' }; + private static final String N_DESCRIPTION = "description"; + private static final byte[] OM_DESCRIPTION = { '"', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'i', 'o', 'n', '"', ':' }; + private static final String N_DESCRIPTOR = "descriptor"; + private static final byte[] OM_DESCRIPTOR = { '"', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', '"', ':' }; + private static final String N_DIMENSION = "dimension"; + private static final byte[] OM_DIMENSION = { '"', 'd', 'i', 'm', 'e', 'n', 's', 'i', 'o', 'n', '"', ':' }; + private static final String N_DISABLED = "disabled"; + private static final byte[] OM_DISABLED = { '"', 'd', 'i', 's', 'a', 'b', 'l', 'e', 'd', '"', ':' }; + private static final String N_DOMAINS = "domains"; + private static final byte[] OM_DOMAINS = { '"', 'd', 'o', 'm', 'a', 'i', 'n', 's', '"', ':' }; + private static final String N_ELEMENTTYPE = "elementType"; + private static final byte[] OM_ELEMENTTYPE = { '"', 'e', 'l', 'e', 'm', 'e', 'n', 't', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_ENABLED = "enabled"; + private static final byte[] OM_ENABLED = { '"', 'e', 'n', 'a', 'b', 'l', 'e', 'd', '"', ':' }; + private static final String N_ENTRIES = "entries"; + private static final byte[] OM_ENTRIES = { '"', 'e', 'n', 't', 'r', 'i', 'e', 's', '"', ':' }; + private static final String N_FILE_TRANSFER = "fileTransfer"; + private static final byte[] OM_FILE_TRANSFER = { '"', 'f', 'i', 'l', 'e', 'T', 'r', 'a', 'n', 's', 'f', 'e', 'r', '"', ':' }; + private static final String N_FILTER = "filter"; + private static final byte[] OM_FILTER = { '"', 'f', 'i', 'l', 't', 'e', 'r', '"', ':' }; + private static final String N_FILTERID = "filterID"; + private static final byte[] OM_FILTERID = { '"', 'f', 'i', 'l', 't', 'e', 'r', 'I', 'D', '"', ':' }; + private static final String N_FILTERS = "filters"; + private static final byte[] OM_FILTERS = { '"', 'f', 'i', 'l', 't', 'e', 'r', 's', '"', ':' }; + private static final String N_GRAPH = "graph"; + private static final byte[] OM_GRAPH = { '"', 'g', 'r', 'a', 'p', 'h', '"', ':' }; + private static final String N_HANDBACK = "handback"; + private static final byte[] OM_HANDBACK = { '"', 'h', 'a', 'n', 'd', 'b', 'a', 'c', 'k', '"', ':' }; + private static final String N_HANDBACKID = "handbackID"; + private static final byte[] OM_HANDBACKID = { '"', 'h', 'a', 'n', 'd', 'b', 'a', 'c', 'k', 'I', 'D', '"', ':' }; + private static final String N_HOSTNAME = "hostName"; + private static final byte[] OM_HOSTNAME = { '"', 'h', 'o', 's', 't', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_IMPACT = "impact"; + private static final byte[] OM_IMPACT = { '"', 'i', 'm', 'p', 'a', 'c', 't', '"', ':' }; + private static final String N_INBOX = "inbox"; + private static final byte[] OM_INBOX = { '"', 'i', 'n', 'b', 'o', 'x', '"', ':' }; + private static final String N_INBOXEXPIRY = "inboxExpiry"; + private static final byte[] OM_INBOXEXPIRTY = { '"', 'i', 'n', 'b', 'o', 'x', 'E', 'x', 'p', 'i', 'r', 'y', '"', ':' }; + private static final String N_INDEXNAMES = "indexNames"; + private static final byte[] OM_INDEXNAMES = { '"', 'i', 'n', 'd', 'e', 'x', 'N', 'a', 'm', 'e', 's', '"', ':' }; + private static final String N_INSTANCEOF = "instanceOf"; + private static final byte[] OM_INSTANCEOF = { '"', 'i', 'n', 's', 't', 'a', 'n', 'c', 'e', 'O', 'f', '"', ':' }; + private static final String N_ISIS = "isIs"; + private static final byte[] OM_ISIS = { '"', 'i', 's', 'I', 's', '"', ':' }; + private static final String N_ISREADABLE = "isReadable"; + private static final byte[] OM_ISREADABLE = { '"', 'i', 's', 'R', 'e', 'a', 'd', 'a', 'b', 'l', 'e', '"', ':' }; + private static final String N_ISWRITABLE = "isWritable"; + private static final byte[] OM_ISWRITABLE = { '"', 'i', 's', 'W', 'r', 'i', 't', 'a', 'b', 'l', 'e', '"', ':' }; + private static final String N_ITEMS = "items"; + private static final byte[] OM_ITEMS = { '"', 'i', 't', 'e', 'm', 's', '"', ':' }; + private static final String N_LISTENER = "listener"; + private static final byte[] OM_LISTENER = { '"', 'l', 'i', 's', 't', 'e', 'n', 'e', 'r', '"', ':' }; + private static final String N_LOADERNAME = "loaderName"; + private static final byte[] OM_LOADERNAME = { '"', 'l', 'o', 'a', 'd', 'e', 'r', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_KEY = "key"; + private static final byte[] OM_KEY = { '"', 'k', 'e', 'y', '"', ':' }; + private static final String N_KEYTYPE = "keyType"; + private static final byte[] OM_KEYTYPE = { '"', 'k', 'e', 'y', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_MBEANCOUNT = "mbeanCount"; + private static final byte[] OM_MBEANCOUNT = { '"', 'm', 'b', 'e', 'a', 'n', 'C', 'o', 'u', 'n', 't', '"', ':' }; + private static final String N_MBEANNAME = "mbeanName"; + private static final byte[] OM_MBEANNAME = { '"', 'm', 'b', 'e', 'a', 'n', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_MBEANS = "mbeans"; + private static final byte[] OM_MBEANS = { '"', 'm', 'b', 'e', 'a', 'n', 's', '"', ':' }; + private static final String N_MBEANSTOUNREGISTER = "mbeansToUnregister"; + private static final byte[] OM_MBEANSTOUNREGISTER = { '"', 'm', 'b', 'e', 'a', 'n', 's', 'T', 'o', 'U', 'n', 'r', 'e', 'g', 'i', 's', 't', 'e', 'r', '"', ':' }; + private static final String N_MESSAGE = "message"; + private static final byte[] OM_MESSAGE = { '"', 'm', 'e', 's', 's', 'a', 'g', 'e', '"', ':' }; + private static final String N_NAME = "name"; + private static final byte[] OM_NAME = { '"', 'n', 'a', 'm', 'e', '"', ':' }; + private static final String N_NAMES = "names"; + private static final byte[] OM_NAMES = { '"', 'n', 'a', 'm', 'e', 's', '"', ':' }; + private static final String N_NEWROLEVALUE = "newRoleValue"; + private static final byte[] OM_NEWROLEVALUE = { '"', 'n', 'e', 'w', 'R', 'o', 'l', 'e', 'V', 'a', 'l', 'u', 'e', '"', ':' }; + private static final String N_NEWVALUE = "newValue"; + private static final byte[] OM_NEWVALUE = { '"', 'n', 'e', 'w', 'V', 'a', 'l', 'u', 'e', '"', ':' }; + private static final String N_NOTIFICATIONID = "notificationID"; + private static final byte[] OM_NOTIFICATIONID = { '"', 'n', 'o', 't', 'i', 'f', 'i', 'c', 'a', 't', 'i', 'o', 'n', 'I', 'D', '"', ':' }; + private static final String N_NOTIFICATIONS = "notifications"; + private static final byte[] OM_NOTIFICATIONS = { '"', 'n', 'o', 't', 'i', 'f', 'i', 'c', 'a', 't', 'i', 'o', 'n', 's', '"', ':' }; + private static final String N_NOTIFTYPES = "notifTypes"; + private static final byte[] OM_NOTIFTYPES = { '"', 'n', 'o', 't', 'i', 'f', 'T', 'y', 'p', 'e', 's', '"', ':' }; + private static final String N_OBJECTNAME = "objectName"; + private static final byte[] OM_OBJECTNAME = { '"', 'o', 'b', 'j', 'e', 'c', 't', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_OLDROLEVALUE = "oldRoleValue"; + private static final byte[] OM_OLDROLEVALUE = { '"', 'o', 'l', 'd', 'R', 'o', 'l', 'e', 'V', 'a', 'l', 'u', 'e', '"', ':' }; + private static final String N_OLDVALUE = "oldValue"; + private static final byte[] OM_OLDVALUE = { '"', 'o', 'l', 'd', 'V', 'a', 'l', 'u', 'e', '"', ':' }; + private static final String N_OPENTYPE = "openType"; + private static final byte[] OM_OPENTYPE = { '"', 'o', 'p', 'e', 'n', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_OPENTYPECLASS = "openTypeClass"; + private static final byte[] OM_OPENTYPECLASS = { '"', 'o', 'p', 'e', 'n', 'T', 'y', 'p', 'e', 'C', 'l', 'a', 's', 's', '"', ':' }; + private static final String N_OPENTYPES = "openTypes"; + private static final byte[] OM_OPENTYPES = { '"', 'o', 'p', 'e', 'n', 'T', 'y', 'p', 'e', 's', '"', ':' }; + private static final String N_OPERATION = "operation"; + private static final byte[] OM_OPERATION = { '"', 'o', 'p', 'e', 'r', 'a', 't', 'i', 'o', 'n', '"', ':' }; + private static final String N_OPERATIONS = "operations"; + private static final byte[] OM_OPERATIONS = { '"', 'o', 'p', 'e', 'r', 'a', 't', 'i', 'o', 'n', 's', '"', ':' }; + private static final String N_PARAMS = "params"; + private static final byte[] OM_PARAMS = { '"', 'p', 'a', 'r', 'a', 'm', 's', '"', ':' }; + private static final String N_QUERYEXP = "queryExp"; + private static final byte[] OM_QUERYEXP = { '"', 'q', 'u', 'e', 'r', 'y', 'E', 'x', 'p', '"', ':' }; + private static final String N_REGISTRATIONS = "registrations"; + private static final byte[] OM_REGISTRATIONS = { '"', 'r', 'e', 'g', 'i', 's', 't', 'r', 'a', 't', 'i', 'o', 'n', 's', '"', ':' }; + private static final String N_RELATIONID = "relationId"; + private static final byte[] OM_RELATIONID = { '"', 'r', 'e', 'l', 'a', 't', 'i', 'o', 'n', 'I', 'd', '"', ':' }; + private static final String N_RELATIONTYPENAME = "relationTypeName"; + private static final byte[] OM_RELATIONTYPENAME = { '"', 'r', 'e', 'l', 'a', 't', 'i', 'o', 'n', 'T', 'y', 'p', 'e', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_RETURNTYPE = "returnType"; + private static final byte[] OM_RETURNTYPE = { '"', 'r', 'e', 't', 'u', 'r', 'n', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_ROLENAME = "roleName"; + private static final byte[] OM_ROLENAME = { '"', 'r', 'o', 'l', 'e', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_ROWTYPE = "rowType"; + private static final byte[] OM_ROWTYPE = { '"', 'r', 'o', 'w', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_SEQUENCENUMBER = "sequenceNumber"; + private static final byte[] OM_SEQUENCENUMBER = { '"', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 'N', 'u', 'm', 'b', 'e', 'r', '"', ':' }; + private static final String N_SERIALIZED = "serialized"; + private static final byte[] OM_SERIALIZED = { '"', 's', 'e', 'r', 'i', 'a', 'l', 'i', 'z', 'e', 'd', '"', ':' }; + private static final String N_SERVERNAME = "serverName"; + private static final byte[] OM_SERVERNAME = { '"', 's', 'e', 'r', 'v', 'e', 'r', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_SERVERREGISTRATIONS = "serverRegistrations"; + private static final byte[] OM_SERVERREGISTRATIONS = { '"', 's', 'e', 'r', 'v', 'e', 'r', 'R', 'e', 'g', 'i', 's', 't', 'r', 'a', 't', 'i', 'o', 'n', 's', '"', ':' }; + private static final String N_SERVERUSERDIR = "serverUserDir"; + private static final byte[] OM_SERVERUSERDIR = { '"', 's', 'e', 'r', 'v', 'e', 'r', 'U', 's', 'e', 'r', 'D', 'i', 'r', '"', ':' }; + private static final String N_SIGNATURE = "signature"; + private static final byte[] OM_SIGNATURE = { '"', 's', 'i', 'g', 'n', 'a', 't', 'u', 'r', 'e', '"', ':' }; + private static final String N_SIMPLEKEY = "simpleKey"; + private static final byte[] OM_SIMPLEKEY = { '"', 's', 'i', 'm', 'p', 'l', 'e', 'K', 'e', 'y', '"', ':' }; + private static final String N_SOURCE = "source"; + private static final byte[] OM_SOURCE = { '"', 's', 'o', 'u', 'r', 'c', 'e', '"', ':' }; + // "stacktrace" is not read by the Java client. + // private static final String N_STACKTRACE = "stackTrace"; + private static final byte[] OM_STACKTRACE = { '"', 's', 't', 'a', 'c', 'k', 'T', 'r', 'a', 'c', 'e', '"', ':' }; + private static final String N_THROWABLE = "throwable"; + private static final byte[] OM_THROWABLE = { '"', 't', 'h', 'r', 'o', 'w', 'a', 'b', 'l', 'e', '"', ':' }; + private static final String N_TIMESTAMP = "timeStamp"; + private static final byte[] OM_TIMESTAMP = { '"', 't', 'i', 'm', 'e', 'S', 't', 'a', 'm', 'p', '"', ':' }; + private static final String N_TYPE = "type"; + private static final byte[] OM_TYPE = { '"', 't', 'y', 'p', 'e', '"', ':' }; + private static final String N_TYPENAME = "typeName"; + private static final byte[] OM_TYPENAME = { '"', 't', 'y', 'p', 'e', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_TYPES = "types"; + private static final byte[] OM_TYPES = { '"', 't', 'y', 'p', 'e', 's', '"', ':' }; + private static final String N_URL = "URL"; + private static final byte[] OM_URL = { '"', 'U', 'R', 'L', '"', ':' }; + private static final String N_USELOADER = "useLoader"; + private static final byte[] OM_USELOADER = { '"', 'u', 's', 'e', 'L', 'o', 'a', 'd', 'e', 'r', '"', ':' }; + private static final String N_USERDATA = "userData"; + private static final byte[] OM_USERDATA = { '"', 'u', 's', 'e', 'r', 'D', 'a', 't', 'a', '"', ':' }; + private static final String N_USESIGNATURE = "useSignature"; + private static final byte[] OM_USESIGNATURE = { '"', 'u', 's', 'e', 'S', 'i', 'g', 'n', 'a', 't', 'u', 'r', 'e', '"', ':' }; + private static final String N_VALUE = "value"; + private static final byte[] OM_VALUE = { '"', 'v', 'a', 'l', 'u', 'e', '"', ':' }; + private static final String N_VALUES = "values"; + private static final byte[] OM_VALUES = { '"', 'v', 'a', 'l', 'u', 'e', 's', '"', ':' }; + private static final String N_VERSION = "version"; + private static final byte[] OM_VERSION = { '"', 'v', 'e', 'r', 's', 'i', 'o', 'n', '"', ':' }; + + private static final byte[] LONG_MIN = { '-', '9', '2', '2', '3', '3', '7', + '2', '0', '3', '6', '8', '5', '4', + '7', '7', '5', '8', '0', '8' }; + private static final byte[] INT_MIN = { '-', '2', '1', '4', '7', '4', '8', + '3', '6', '4', '8' }; + private static final byte[] TRUE = { 't', 'r', 'u', 'e' }; + private static final byte[] FALSE = { 'f', 'a', 'l', 's', 'e' }; + private static final byte[] NULL = { 'n', 'u', 'l', 'l' }; + private static final Object OBJECT = new Object(); + + // Maps used by base64 encoding/decoding + private static final byte[] BASE64 = new byte[64]; + private static final byte[] BASE64_D = new byte[128]; + static { + for (int i = 0; i < 128; i++) { + BASE64_D[i] = -1; + } + for (byte i = 0; i < 26; i++) { + BASE64[i] = (byte) (i + 'A'); + BASE64_D[i + 'A'] = i; + } + for (int i = 0; i < 26; i++) { + BASE64[i + 26] = (byte) (i + 'a'); + BASE64_D[i + 'a'] = (byte) (i + 26); + } + for (int i = 0; i < 10; i++) { + BASE64[i + 52] = (byte) (i + '0'); + BASE64_D[i + '0'] = (byte) (i + 52); + } + BASE64[62] = '+'; + BASE64[63] = '/'; + BASE64_D['+'] = 62; + BASE64_D['/'] = 63; + BASE64_D['='] = 0; + } + + // Pool of converters, used by the server. + private static final Stack POOL = new Stack(); + + // Byte buffer for writing integers and encoding base64 values. + // Make sure the buffer is long enough to hold LONG_MIN, and is divisible + // by 3, for base64 encoding. + private final byte[] BYTE_BUFFER = new byte[LONG_MIN.length / 3 * 3 + 3]; + + // Whether the next array/object item is the first. If not, need to write ','. + private boolean firstItem; + + // ByteArrayOutputStream used for encoding String to base64 + private final ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream(); + + // Base64OutputStream used to base64 encoding its content + private final Base64OutputStream base64Stream = new Base64OutputStream(); + + // Class for providing base64 encoding capability to an OutputStream + private class Base64OutputStream extends OutputStream { + private OutputStream out; + private int count; + + private void start(OutputStream out) { + this.out = out; + this.count = 0; + } + + @Override + public void write(int b) throws IOException { + // If the buffer is already full, base64-encode it. + // The size is divisible by 3, so no padding is done. + if (count == BYTE_BUFFER.length) { + encodeBase64(); + count = 0; + } + BYTE_BUFFER[count++] = (byte) b; + } + + @Override + public void write(byte b[], int off, int len) throws IOException { + int left = BYTE_BUFFER.length - count; + // If we have more than what the buffer can hold + while (len > left) { + // Fill the buffer and base64 encode it + // The size is divisible by 3, so no padding is done. + System.arraycopy(b, off, BYTE_BUFFER, count, left); + count = BYTE_BUFFER.length; + encodeBase64(); + len -= left; + off += left; + left = BYTE_BUFFER.length; + } + // Copy the rest into the buffer + System.arraycopy(b, off, BYTE_BUFFER, count, len); + count += len; + } + + @Override + public void flush() throws IOException { + // Encode and write out any pending bytes + if (count > 0) { + encodeBase64(); + } + } + + private void end() throws IOException { + flush(); + out = null; + } + + private void encodeBase64() throws IOException { + final int left = count % 3; + int pos = 0, b1, b2, b3; + // For every 3-byte sequence + for (; pos < count - left;) { + b1 = BYTE_BUFFER[pos++]; + b2 = BYTE_BUFFER[pos++]; + b3 = BYTE_BUFFER[pos++]; + // Write out 4 bytes + out.write(BASE64[(b1 >> 2) & 0x3f]); + out.write(BASE64[((b1 & 0x3) << 4) | ((b2 >> 4) & 0xf)]); + out.write(BASE64[((b2 & 0xf) << 2) | ((b3 >> 6) & 0x3)]); + out.write(BASE64[b3 & 0x3f]); + } + // 1 byte is left. Need 2 padding chars '==' + if (left == 1) { + b1 = BYTE_BUFFER[pos]; + out.write(BASE64[(b1 >> 2) & 0x3f]); + out.write(BASE64[(b1 & 0x3) << 4]); + out.write('='); + out.write('='); + } + // 2 bytes are left. Need 1 padding char '=' + else if (left == 2) { + b1 = BYTE_BUFFER[pos++]; + b2 = BYTE_BUFFER[pos++]; + out.write(BASE64[(b1 >> 2) & 0x3f]); + out.write(BASE64[((b1 & 0x3) << 4) | ((b2 >> 4) & 0xf)]); + out.write(BASE64[(b2 & 0xf) << 2]); + out.write('='); + } + count = 0; + } + } + + /** + * Retrieve an instance of the JSON converter. When the converter is no + * longer needed, it can be returned to a global pool for reuse, by + * calling {@link #returnConverter(JSONConverter)}. + * + * @return an instance of the JSONConverter. {@code null} is not returned. + */ + public static JSONConverter getConverter() { + synchronized (POOL) { + if (!POOL.empty()) { + return POOL.pop(); + } + } + return new JSONConverter(); + } + + /** + * Returns the JSONConverter instance to the global pool for reuse later. + * + * @param converter the JSONConverter to return. {@code null} is not supported. + */ + public static void returnConverter(JSONConverter converter) { + if (!POOL.contains(converter)) + POOL.push(converter); + } + + // Use getConverter() + private JSONConverter() {} + + /** + * Encode an integer value as JSON. An array is used to wrap the value: + * [ Integer ] + * + * @param out The stream to write JSON to + * @param value The integer value to encode + * @throws IOException If an I/O error occurs + * @see #readInt(InputStream) + */ + public void writeInt(OutputStream out, int value) throws IOException { + writeStartArray(out); + writeIntInternal(out, value); + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve an integer value. + * + * @param in The stream to read JSON from + * @return The decoded integer value + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeInt(OutputStream, int) + */ + public int readInt(InputStream in) throws ConversionException, IOException { + JSONArray json = parseArray(in); + if (json.size() != 1) { + throwConversionException("readInt() expects one item in the array: [ Integer ].", json); + } + return readIntInternal(json.get(0)); + } + + /** + * Encode a boolean value as JSON. An array is used to wrap the value: + * [ true | false ] + * + * @param out The stream to write JSON to + * @param value The boolean value to encode + * @throws IOException If an I/O error occurs + * @see #readBoolean(InputStream) + */ + public void writeBoolean(OutputStream out, boolean value) throws IOException { + writeStartArray(out); + writeBooleanInternal(out, value); + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve an boolean value. + * + * @param in The stream to read JSON from + * @return The decoded boolean value + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeInt(OutputStream, int) + */ + public boolean readBoolean(InputStream in) throws ConversionException, IOException { + JSONArray json = parseArray(in); + if (json.size() != 1) { + throwConversionException("readBoolean() expects one item in the array: [ true | false ].", json); + } + return readBooleanInternal(json.get(0)); + } + + /** + * Encode a String value as JSON. An array is used to wrap the value: + * [ String ] + * + * @param out The stream to write JSON to + * @param value The String value to encode. + * @throws IOException If an I/O error occurs + * @see #readString(InputStream) + */ + public void writeString(OutputStream out, String value) throws IOException { + writeStartArray(out); + writeStringInternal(out, value); + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve a String value. + * + * @param in The stream to read JSON from + * @return The decoded String value + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeString(OutputStream, String) + */ + public String readString(InputStream in) throws ConversionException, IOException { + JSONArray json = parseArray(in); + if (json.size() != 1) { + throwConversionException("readString() expects one item in the array: [ String ].", json); + } + return readStringInternal(json.get(0)); + } + + /** + * Encode a String array as JSON: + * [ String* ] + * + * @param out The stream to write JSON to + * @param value The String array to encode. Can't be null. + * @throws IOException If an I/O error occurs + */ + public void writeStringArray(OutputStream out, String[] value) throws IOException { + writeStringArrayInternal(out, value); + } + + /** + * Decode a JSON document to retrieve a String array. + * + * @param in The stream to read JSON from + * @return The decoded String array + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeStringArray(OutputStream, String[]) + */ + public String[] readStringArray(InputStream in) throws ConversionException, IOException { + return readStringArrayInternal(parse(in)); + } + + /** + * Encode an Object as JSON. + * + * Format: + * + * { + * serialized: Base64, ? // If object has cyclic references. Otherwise use the following fields instead. + * value: Value, ? + * type: Type, ? + * openTypes: [ OpenType * ], ? // Only if open types are used + * } + * + * *** Value *** + * + * 1. For "null" value, or a value that's not expressible in JSON + * + * null + * + * 2. For a simple value (primitive, String, BigInteger/Decimal, Date, + * ObjectName), or Object. For Object, "" is used. + * + * String + * + * 3. For array or collection + * + * [ Value* ] + * + * 4. For map where all keys are simple values + * + * { + * String: Value * + * } + * + * 5. For map with complex keys + * + * [ {key: Value, value: Value}* ] + * + * 6. For CompositeData + * + * { + * String: Value * + * } + * + * 7. and TabularData + * + * [ CompositeData* ] + * + * *** Type *** + * + * 1. For "null" value + * + * null + * + * 2. For a simple value, arrays of primitives or final simple values, + * or Object. For Object, "" is used. + * + * String // The class name + * + * 3. Otherwise + * + * { + * class: String, // Class name of the object + * serialized: Base64 ? // Optional: If the class is not supported. The java serialization of the value. + * } + * + * The following additional fields apply depending on the kind of value. + * + * 3.1 For complex array or collection classes: + * + * { + * items: [ Type* ] + * } + * + * 3.4 For maps + * + * { + * simpleKey: boolean, // Whether all keys are simple. Then each entry has a "key" field. + * entries: [ + * { + * key: String, ? // For simple key + * keyType: Type, + * value: Type + * } * + * ] + * + * 3.5 For CompositeData and TabularData + * + * { + * openType: Integer // Reference to the OpenType array in root Type + * } + * + * *** OpenType *** + * + * 1. For SimpleType instances: + * + * String // The name of the simple type. + * + * 2. For all other OpenTypes: + * + * { + * openTypeClass: String, // The OpenType class. + * serialized: Base64 // Optional: If the class is not supported. The java serialization of the OpenType object. + * + * className: String, + * typeName: String, + * description: String, + * } + * + * 2.1 ArrayType + * + * { + * dimension: Integer, + * elementType: Integer, + * } + * + * 2.2 CompositeType + * + * { + * items: { String: { description: String, type: Integer } *} + * } + * + * 2.3 TabularType + * + * { + * rowType: Integer, + * indexNames: [String*] + * } + * + * @param out The stream to write JSON to + * @param value The Object to encode. Can be null. + * @throws IOException If an I/O error occurs + * @see #readPOJO(InputStream) + */ + public void writePOJO(OutputStream out, Object value) throws IOException { + writePOJOInternal(out, value); + } + + /** + * Decode a JSON document to retrieve an Object. + * + * @param in The stream to read JSON from + * @return The decoded Object + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writePOJO(OutputStream, Object) + */ + public Object readPOJO(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + return readPOJOInternal(parse(in)); + } + + /** + * Encode a JMX instance as JSON: + * { + * "version" : Integer, + * "mbeans" : URL, + * "createMBean" : URL, + * "mbeanCount" : URL, + * "defaultDomain" : URL, + * "domains" : URL, + * "notifications" : URL, + * "instanceOf" : URL + * } + * + * @param out The stream to write JSON to + * @param value The JMX instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readJMX(InputStream) + */ + public void writeJMX(OutputStream out, JMXServerInfo value) throws IOException { + assert value != null; + writeStartObject(out); + writeIntField(out, OM_VERSION, value.version); + writeStringField(out, OM_MBEANS, value.mbeansURL); + writeStringField(out, OM_CREATEMBEAN, value.createMBeanURL); + writeStringField(out, OM_MBEANCOUNT, value.mbeanCountURL); + writeStringField(out, OM_DEFAULTDOMAIN, value.defaultDomainURL); + writeStringField(out, OM_DOMAINS, value.domainsURL); + writeStringField(out, OM_NOTIFICATIONS, value.notificationsURL); + writeStringField(out, OM_INSTANCEOF, value.instanceOfURL); + writeStringField(out, OM_FILE_TRANSFER, value.fileTransferURL); + writeStringField(out, OM_API, value.apiURL); + writeStringField(out, OM_GRAPH, value.graphURL); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a JMX instance. + * + * @param in The stream to read JSON from + * @return The decoded JMX instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeJMX(OutputStream, JMXServerInfo) + */ + public JMXServerInfo readJMX(InputStream in) throws ConversionException, IOException { + JSONObject json = parseObject(in); + JMXServerInfo ret = new JMXServerInfo(); + ret.version = readIntInternal(json.get(N_VERSION)); + ret.mbeansURL = readStringInternal(json.get(N_MBEANS)); + ret.createMBeanURL = readStringInternal(json.get(N_CREATEMBEAN)); + ret.mbeanCountURL = readStringInternal(json.get(N_MBEANCOUNT)); + ret.defaultDomainURL = readStringInternal(json.get(N_DEFAULTDOMAIN)); + ret.domainsURL = readStringInternal(json.get(N_DOMAINS)); + ret.notificationsURL = readStringInternal(json.get(N_NOTIFICATIONS)); + ret.instanceOfURL = readStringInternal(json.get(N_INSTANCEOF)); + ret.fileTransferURL = readStringInternal(json.get(N_FILE_TRANSFER)); + ret.apiURL = readStringInternal(json.get(N_API)); + ret.graphURL = readStringInternal(json.get(N_GRAPH)); + return ret; + } + + /** + * Encode an ObjectInstanceWrapper instance as JSON: + * { + * "objectName" : ObjectName, + * "className" : String, + * "URL" : URL, + * } + * + * @param out The stream to write JSON to + * @param value The ObjectInstanceWrapper instance to encode. + * The value and value.objectInstance can't be null. + * @throws IOException If an I/O error occurs + * @see #readObjectInstance(InputStream) + */ + public void writeObjectInstance(OutputStream out, ObjectInstanceWrapper value) throws IOException { + // ObjectInstance has no known sub-class. + assert value != null && value.objectInstance != null; + writeStartObject(out); + writeObjectNameField(out, OM_OBJECTNAME, value.objectInstance.getObjectName()); + writeStringField(out, OM_CLASSNAME, value.objectInstance.getClassName()); + writeStringField(out, OM_URL, value.mbeanInfoURL); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve an ObjectInstanceWrapper instance. + * + * @param in The stream to read JSON from + * @return The decoded ObjectInstanceWrapper instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeObjectInstance(OutputStream, ObjectInstanceWrapper) + */ + public ObjectInstanceWrapper readObjectInstance(InputStream in) throws ConversionException, IOException { + return readObjectInstanceInternal(parse(in)); + } + + /** + * Encode an ObjectInstanceWrapper array as JSON: + * [ ObjectInstanceWrapper* ] + * + * @param out The stream to write JSON to + * @param value The ObjectInstanceWrapper array to encode. Can't be null. + * And none of its entries can be null. + * @throws IOException If an I/O error occurs + * @see #readObjectInstances(InputStream) + * @see #writeObjectInstance(OutputStream, ObjectInstanceWrapper) + */ + public void writeObjectInstanceArray(OutputStream out, ObjectInstanceWrapper[] value) throws IOException { + assert value != null; + writeStartArray(out); + for (ObjectInstanceWrapper item : value) { + writeArrayItem(out); + writeObjectInstance(out, item); + } + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve an ObjectInstanceWrapper array. + * + * @param in The stream to read JSON from + * @return The decoded ObjectInstanceWrapper array + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeObjectInstanceArray(OutputStream, ObjectInstanceWrapper[]) + * @see #readObjectInstance(InputStream) + */ + public ObjectInstanceWrapper[] readObjectInstances(InputStream in) throws ConversionException, IOException { + JSONArray json = parseArray(in); + ObjectInstanceWrapper[] ret = new ObjectInstanceWrapper[json.size()]; + int pos = 0; + for (Object item : json) { + ret[pos++] = readObjectInstanceInternal(item); + } + return ret; + } + + /** + * Encode an MBeanQuery instance as JSON: + * { + * "objectName" : ObjectName, + * "queryExp" : Base64, + * "className" : String, + * } + * + * @param out The stream to write JSON to + * @param value The MBeanQuery instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readMBeanQuery(InputStream) + */ + public void writeMBeanQuery(OutputStream out, MBeanQuery value) throws IOException { + assert value != null; + writeStartObject(out); + writeObjectNameField(out, OM_OBJECTNAME, value.objectName); + // TODO: Produce proper JSON for QueryExp? + writeSerializedField(out, OM_QUERYEXP, value.queryExp); + writeStringField(out, OM_CLASSNAME, value.className); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve an MBeanQuery instance. + * + * @param in The stream to read JSON from + * @return The decoded MBeanQuery instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeMBeanQuery(OutputStream, MBeanQuery) + */ + public MBeanQuery readMBeanQuery(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + MBeanQuery ret = new MBeanQuery(); + ret.objectName = readObjectName(json.get(N_OBJECTNAME)); + Object queryExp = readSerialized(json.get(N_QUERYEXP)); + if (queryExp != null && !(queryExp instanceof QueryExp)) { + throwConversionException("readMBeanQuery() receives an instance that's not a QueryExp.", json.get(N_QUERYEXP)); + } + ret.queryExp = (QueryExp) queryExp; + ret.className = readStringInternal(json.get(N_CLASSNAME)); + return ret; + } + + /** + * Encode a CreateMBean instance as JSON: + * { + * "className" : String, + * "objectName" : ObjectName, + * "loaderName" : ObjectName, + * "params" : [ POJO* ], + * "signature" : [ String* ], + * "useLoader" : Boolean, + * "useSignatue" : Boolean + * } + * + * @param out The stream to write JSON to + * @param value The CreateMBean instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readCreateMBean(InputStream) + */ + public void writeCreateMBean(OutputStream out, CreateMBean value) throws IOException { + assert value != null; + writeStartObject(out); + writeStringField(out, OM_CLASSNAME, value.className); + writeObjectNameField(out, OM_OBJECTNAME, value.objectName); + writeObjectNameField(out, OM_LOADERNAME, value.loaderName); + writePOJOArrayField(out, OM_PARAMS, value.params); + writeStringArrayField(out, OM_SIGNATURE, value.signature); + writeBooleanField(out, OM_USELOADER, value.useLoader); + writeBooleanField(out, OM_USESIGNATURE, value.useSignature); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a CreateMBean instance. + * + * @param in The stream to read JSON from + * @return The decoded CreateMBean instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeCreateMBean(OutputStream, CreateMBean) + */ + public CreateMBean readCreateMBean(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + CreateMBean ret = new CreateMBean(); + ret.objectName = readObjectName(json.get(N_OBJECTNAME)); + ret.className = readStringInternal(json.get(N_CLASSNAME)); + ret.loaderName = readObjectName(json.get(N_LOADERNAME)); + ret.params = readPOJOArray(json.get(N_PARAMS)); + ret.signature = readStringArrayInternal(json.get(N_SIGNATURE)); + ret.useLoader = readBooleanInternal(json.get(N_USELOADER)); + ret.useSignature = readBooleanInternal(json.get(N_USESIGNATURE)); + return ret; + } + + /** + * Encode an MBeanInfoWrapper instance as JSON: + * { + * "className" : String, + * "description" : String, + * "descriptor" : Descriptor, + * "attributes" : [ MBeanAttributeInfo* ], + * "attributes_URL" : URL, + * "constructors" : [ MBeanConstructorInfo* ], + * "notifications" : [ MBeanNotificationInfo* ], + * "operations" : [ MBeanOperationInfo* ] + * } + * + * Descriptor: + * { + * "names" : [ String* ],{ + * "values" : [ POJO* ] + * } + * + * MBeanAttributeInfo: + * { + * "name" : String, + * "type" : String, + * "description" : String, + * "descriptor" : Descriptor, + * "isIs" : Boolean, + * "isReadable" : Boolean, + * "isWritable" : Boolean, + * "URL" : URL + * } + * + * MBeanConstructorInfo: + * { + * "name" : String, + * "description" : String, + * "descriptor" : Descriptor, + * "signature" : [ MBeanParameterInfo* ] + * } + * + * MBeanParameterInfo: + * { + * "name" : String, + * "type" : String, + * "description" : String, + * "descriptor" : Descriptor + * } + * + * MBeanNotificationInfo: + * { + * "name" : String, + * "description" : String, + * "descriptor" : Descriptor, + * "notifTypes" [ String* ] + * } + * + * MBeanOperationInfo: + * { + * "name" : String, + * "description" : String, + * "descriptor" : Descriptor, + * "impact" : Integer, + * "returnType" : String, + * "signature" : [ MBeanParameterInfo* ], + * "URI" : URI + * } + * + * @param out The stream to write JSON to + * @param value The MBeanInfoWrapper instance to encode. + * The value and its members can't be null. + * @throws IOException If an I/O error occurs + * @see #readMBeanInfo(InputStream) + */ + public void writeMBeanInfo(OutputStream out, MBeanInfoWrapper value) throws IOException { + // TODO: MBeanInfo has 2 sub-classes, Model*Support and Open*Support. + // How to handle them? "Open" has references to OpenTMBean*Info. + // Model has more convenience methods for retrieving individual + // items, and methods to set the descriptors. + // Same for subclasses of the various items. + assert value != null && value.mbeanInfo != null && value.attributeURLs != null && value.operationURLs != null; + writeStartObject(out); + if (USE_BASE64_FOR_MBEANINFO) { + writeSerializedField(out, OM_SERIALIZED, value.mbeanInfo); + writeStringField(out, OM_ATTRIBUTES_URL, value.attributesURL); + writeSerializedField(out, OM_ATTRIBUTES, value.attributeURLs); + writeSerializedField(out, OM_OPERATIONS, value.operationURLs); + return; + } + if (value.mbeanInfo.getClass() != MBeanInfo.class) { + writeSerializedField(out, OM_SERIALIZED, value.mbeanInfo); + } + writeStringField(out, OM_CLASSNAME, value.mbeanInfo.getClassName()); + writeStringField(out, OM_DESCRIPTION, value.mbeanInfo.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, value.mbeanInfo.getDescriptor()); + writeAttributes(out, OM_ATTRIBUTES, value.mbeanInfo.getAttributes(), value.attributeURLs); + writeStringField(out, OM_ATTRIBUTES_URL, value.attributesURL); + writeConstructors(out, OM_CONSTRUCTORS, value.mbeanInfo.getConstructors()); + writeNotifications(out, OM_NOTIFICATIONS, value.mbeanInfo.getNotifications()); + writeOperations(out, OM_OPERATIONS, value.mbeanInfo.getOperations(), value.operationURLs); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve an MBeanInfoWrapper instance. + * + * Note that all descriptors are of class ImmutableDescriptor. + * + * @param in The stream to read JSON from + * @return The decoded MBeanInfoWrapper instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeMBeanInfo(OutputStream, MBeanInfoWrapper) + */ + @SuppressWarnings("unchecked") + public MBeanInfoWrapper readMBeanInfo(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + MBeanInfoWrapper ret = new MBeanInfoWrapper(); + if (USE_BASE64_FOR_MBEANINFO) { + Object o = readSerialized(json.get(N_SERIALIZED)); + if (!(o instanceof MBeanInfo)) { + throwConversionException("readMBeanInfo() receives an instance that's not a MBeanInfo.", json.get(N_SERIALIZED)); + } + ret.mbeanInfo = (MBeanInfo) o; + ret.attributesURL = readStringInternal(json.get(N_ATTRIBUTES_URL)); + o = readSerialized(json.get(OM_ATTRIBUTES)); + if (!(o instanceof HashMap)) { + throwConversionException("readMBeanInfo() receives an instance that's not a HashMap.", json.get(OM_ATTRIBUTES)); + } + ret.attributeURLs = (Map) o; + o = readSerialized(json.get(OM_OPERATIONS)); + if (!(o instanceof HashMap)) { + throwConversionException("readMBeanInfo() receives an instance that's not a HashMap.", json.get(OM_OPERATIONS)); + } + ret.operationURLs = (Map) o; + return ret; + } + ret.attributeURLs = new HashMap(); + ret.operationURLs = new HashMap(); + String className = readStringInternal(json.get(N_CLASSNAME)); + String description = readStringInternal(json.get(N_DESCRIPTION)); + Descriptor descriptor = readDescriptor(json.get(N_DESCRIPTOR)); + MBeanAttributeInfo[] attributes = readAttributes(json.get(N_ATTRIBUTES), ret.attributeURLs); + String attributeURL = readStringInternal(json.get(N_ATTRIBUTES_URL)); + MBeanConstructorInfo[] constructors = readConstructors(json.get(N_CONSTRUCTORS)); + MBeanNotificationInfo[] notifications = readNotifications(json.get(N_NOTIFICATIONS)); + MBeanOperationInfo[] operations = readOperations(json.get(N_OPERATIONS), ret.operationURLs); + ret.attributesURL = attributeURL; + Object o = json.get(N_SERIALIZED); + if (o != null) { + o = readSerialized(o); + if (!(o instanceof MBeanInfo)) { + throwConversionException("readMBeanInfo() receives an instance that's not a MBeanInfo.", json.get(N_SERIALIZED)); + } + ret.mbeanInfo = (MBeanInfo) o; + } else { + ret.mbeanInfo = new MBeanInfo(className, description, attributes, + constructors, operations, notifications, + descriptor); + } + return ret; + } + + /** + * Encode an AttributeList instance as JSON: + * [ { + * "name" : String, + * "value" : POJO + * }* ] + * + * @param out The stream to write JSON to + * @param value The AttributeList instance to encode. Can be null, + * but its Attribute items can't be null. + * @throws IOException If an I/O error occurs + * @see #readAttributeList(InputStream) + */ + public void writeAttributeList(OutputStream out, AttributeList value) throws IOException { + // AttributeList has no known sub-class. + writeStartArray(out); + if (value != null) { + for (Attribute item : value.asList()) { + assert item != null; + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writePOJOField(out, OM_VALUE, item.getValue()); + writeEndObject(out); + } + } + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve an AttributeList instance. + * + * @param in The stream to read JSON from + * @return The decoded AttributeList instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeAttributeList(OutputStream, AttributeList) + */ + public AttributeList readAttributeList(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONArray json = parseArray(in); + AttributeList ret = new AttributeList(); + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readAttributeList() receives an items that's not a JSONObject.", item); + } + JSONObject jo = (JSONObject) item; + String name = readStringInternal(jo.get(N_NAME)); + Object value = readPOJOInternal(jo.get(N_VALUE)); + ret.add(new Attribute(name, value)); + } + return ret; + } + + /** + * Encode an Invocation instance as JSON: + * { + * "params" : [ POJO* ], + * "signature" : [ String* ] + * } + * + * @param out The stream to write JSON to + * @param value The Invocation instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readInvocation(InputStream) + */ + public void writeInvocation(OutputStream out, Invocation value) throws IOException { + assert value != null; + writeStartObject(out); + writePOJOArrayField(out, OM_PARAMS, value.params); + writeStringArrayField(out, OM_SIGNATURE, value.signature); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve an Invocation instance. + * + * @param in The stream to read JSON from + * @return The decoded Invocation instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeInvocation(OutputStream, Invocation) + */ + public Invocation readInvocation(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + Invocation ret = new Invocation(); + ret.params = readPOJOArray(json.get(N_PARAMS)); + ret.signature = readStringArrayInternal(json.get(N_SIGNATURE)); + return ret; + } + + /** + * Encode a NotificationArea instance as JSON: + * { + * "registrations" : URL, + * "serverRegistrations" : URL, + * "inbox" : URL + * } + * + * @param out The stream to write JSON to + * @param value The NotificationArea instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readNotificationArea(InputStream) + */ + public void writeNotificationArea(OutputStream out, NotificationArea value) throws IOException { + assert value != null; + writeStartObject(out); + writeStringField(out, OM_REGISTRATIONS, value.registrationsURL); + writeStringField(out, OM_SERVERREGISTRATIONS, value.serverRegistrationsURL); + writeStringField(out, OM_INBOX, value.inboxURL); + writeStringField(out, OM_CLIENT, value.clientURL); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a NotificationArea instance. + * + * @param in The stream to read JSON from + * @return The decoded NotificationArea instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeNotificationArea(OutputStream, NotificationArea) + */ + public NotificationArea readNotificationArea(InputStream in) throws ConversionException, IOException { + JSONObject json = parseObject(in); + NotificationArea ret = new NotificationArea(); + ret.registrationsURL = readStringInternal(json.get(N_REGISTRATIONS)); + ret.serverRegistrationsURL = readStringInternal(json.get(N_SERVERREGISTRATIONS)); + ret.inboxURL = readStringInternal(json.get(N_INBOX)); + ret.clientURL = readStringInternal(json.get(N_CLIENT)); + return ret; + } + + /** + * Encode a NotificationRegistration instance as JSON: + * { + * "objectName" : ObjectName, + * "filters" : [ NotificationFilter* ] + * } + * + * @param out The stream to write JSON to + * @param value The NotificationRegistration instance to encode. + * Can't be null. See writeNotificationFilters() for + * requirements on the filters. + * @throws IOException If an I/O error occurs + * @see #readNotificationRegistration(InputStream) + * @see #writeNotificationFilters(OutputStream, NotificationFilter[]) + */ + public void writeNotificationRegistration(OutputStream out, NotificationRegistration value) throws IOException { + assert value != null; + writeStartObject(out); + writeObjectNameField(out, OM_OBJECTNAME, value.objectName); + writeNotificationFiltersField(out, OM_FILTERS, value.filters); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a NotificationRegistration instance. + * + * @param in The stream to read JSON from + * @return The decoded NotificationRegistration instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeNotificationRegistration(OutputStream, NotificationRegistration) + */ + public NotificationRegistration readNotificationRegistration(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + NotificationRegistration ret = new NotificationRegistration(); + ret.objectName = readObjectName(json.get(N_OBJECTNAME)); + ret.filters = readNotificationFiltersInternal(json.get(N_FILTERS)); + return ret; + } + + /** + * Encode a ServerNotificationRegistration instance as JSON: + * { + * "operation" : ("Add" | "RemoveAll" | "RemoveSpecific") + * "objectName" : ObjectName, + * "listener" : ObjectName, + * "filter" : NotificationFilter, + * "handback" : POJO, + * "filterID" : Integer, + * "handbackID" : Integer + * } + * + * @param out The stream to write JSON to + * @param value The ServerNotificationRegistration instance to encode. + * Can't be null. + * @throws IOException If an I/O error occurs + * @see #readServerNotificationRegistration(InputStream) + */ + public void writeServerNotificationRegistration(OutputStream out, ServerNotificationRegistration value) throws IOException { + assert value != null; + writeStartObject(out); + boolean hasOperation = value.operation != null; + if (hasOperation) { + writeSimpleStringField(out, OM_OPERATION, value.operation.name()); + } + writeObjectNameField(out, OM_OBJECTNAME, value.objectName); + writeObjectNameField(out, OM_LISTENER, value.listener); + writeNotificationFilterField(out, OM_FILTER, value.filter); + writePOJOField(out, OM_HANDBACK, value.handback); + if (hasOperation) { + writeIntField(out, OM_FILTERID, value.filterID); + writeIntField(out, OM_HANDBACKID, value.handbackID); + } + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a ServerNotificationRegistration instance. + * + * @param in The stream to read JSON from + * @return The decoded ServerNotificationRegistration instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeServerNotificationRegistration(OutputStream, ServerNotificationRegistration) + */ + public ServerNotificationRegistration readServerNotificationRegistration(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + ServerNotificationRegistration ret = new ServerNotificationRegistration(); + String name = readStringInternal(json.get(N_OPERATION)); + ret.operation = name != null ? Operation.valueOf(name) : null; + ret.objectName = readObjectName(json.get(N_OBJECTNAME)); + ret.listener = readObjectName(json.get(N_LISTENER)); + ret.filter = readNotificationFilterInternal(json.get(N_FILTER), true); + ret.handback = readPOJOInternal(json.get(N_HANDBACK)); + ret.filterID = readIntInternal(json.get(N_FILTERID)); + ret.handbackID = readIntInternal(json.get(N_HANDBACKID)); + return ret; + } + + /** + * Check if a NotificationFilter is a standard filter that can be + * send to a JMX server. + * + * @param filter The filter to check. Can't be null. + * @return Whether the filter is a standard one + */ + public boolean isSupportedNotificationFilter(NotificationFilter filter) { + Class clazz = filter.getClass(); + return clazz == AttributeChangeNotificationFilter.class || + clazz == MBeanServerNotificationFilter.class || + clazz == NotificationFilterSupport.class; + } + + /** + * Encode a NotificationFilter array as JSON: + * [ NotificationFilter* ] + * + * Format of NotificationFilter: + * { + * className: "AttributeChangeNotificationFilter" | "MBeanServerNotificationFilter" | "NotificationFilterSupport", + * enabled: [ String* ], // For AttributeChangeNotificationFilter and MBeanServerNotificationFilter + * disabled: [ String* ], // For MBeanServerNotificationFilter + * types: [ String* ], // For MBeanServerNotificationFilter and NotificationFilterSupport + * } + * + * @param out The stream to write JSON to + * @param value The NotificationFilter array to encode. Can be null. + * The individual filters can't be null either. They must be of + * one of the 3 known filter classes. + * @throws IOException If an I/O error occurs + * @see #readNotificationFilters(InputStream) + */ + public void writeNotificationFilters(OutputStream out, NotificationFilter[] value) throws IOException { + writeNotificationFiltersInternal(out, value); + } + + /** + * Decode a JSON document to retrieve a NotificationFilter array. + * + * @param in The stream to read JSON from + * @return The decoded NotificationFilter array + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeNotificationFilters(OutputStream, NotificationFilter[]) + */ + public NotificationFilter[] readNotificationFilters(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + return readNotificationFiltersInternal(parseArray(in)); + } + + /** + * Encode an array of Notification instance as JSON: + * + * @param out The stream to write JSON to + * @param value The Notification array to encode. Value can be null, + * but its items can't be null. + * The "source" of the items must be an instance of ObjectName. + * @throws IOException If an I/O error occurs + * @see #readNotifications(InputStream) + */ + public void writeNotifications(OutputStream out, Notification[] value) throws IOException { + final NotificationRecord[] records; + if (value != null) { + records = new NotificationRecord[value.length]; + for (int i = 0; i < value.length; ++i) { + Notification n = value[i]; + if (n != null) { + Object source = n.getSource(); + NotificationRecord nr; + if (source instanceof ObjectName) { + nr = new NotificationRecord(n, (ObjectName) source); + } else { + nr = new NotificationRecord(n, (source != null) ? source.toString() : null); + } + records[i] = nr; + } + } + } else { + records = null; + } + writeNotificationRecords(out, records); + } + + /** + * Encode an array of NotificationRecord instance as JSON: + * [ { + * "className" : "String", // The class name of the Notification object + * "serialized" : "Base64", // If the object is not of one of the known + * // classes, then base64 serialize it. + * "type" : String, + * "source" : POJO, + * "sequenceNumber" : Long, + * "timeStamp" : Long, + * "message" : String, + * "userData" : POJO, + * + * "hostName" : String, // For routed Notifications only + * "serverName" : String, + * "serverUserDir" : String, + * + * "attributeName" : String, // For AttributeChangeNotification only + * "attributeType" : String, + * "oldValue", POJO, + * "newValue", POJO, + * + * "connectionId" : String, // For JMXConnectionNotification + * + * "mbeanName" : String, // For MBeanServerNotification + * + * "relationId" : String, // For RelationNotification + * "relationTypeName" : String, + * "objectName" : String, + * "mbeansToUnregister" : [ String* ], + * "roleName" : String, + * "oldRoleValue" : [String*], + * "newRoleValue" : [String*], + * + * "notificationID" : Integer, // For TimerNotification + * } * ] + * + * @param out The stream to write JSON to + * @param value The NotificationRecord array to encode. Value can be null, + * but its items can't be null. + * The "source" of the items must be an instance of ObjectName. + * @throws IOException If an I/O error occurs + * @see #readNotificationRecords(InputStream) + */ + public void writeNotificationRecords(OutputStream out, NotificationRecord[] value) throws IOException { + writeStartArray(out); + if (value == null) { + writeEndArray(out); + return; + } + + for (NotificationRecord nr : value) { + assert nr != null; + Notification item = nr.getNotification(); + assert item != null; + writeArrayItem(out); + writeStartObject(out); + + // Fields common to all notification classes + Class clazz = item.getClass(); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + writeStringField(out, OM_TYPE, item.getType()); + ObjectName on = null; + if (item.getSource() instanceof String) { + try { + on = new ObjectName((String) item.getSource()); + } catch (Exception e) { + } + } else { + on = (ObjectName) item.getSource(); + } + + writeObjectNameField(out, OM_SOURCE, on); + writeLongField(out, OM_SEQUENCENUMBER, item.getSequenceNumber()); + writeLongField(out, OM_TIMESTAMP, item.getTimeStamp()); + writeStringField(out, OM_MESSAGE, item.getMessage()); + writePOJOField(out, OM_USERDATA, item.getUserData()); + + // Write routing information (host name, server name, server user dir) if this is a routed notification. + final Map routingInfo = nr.getNotificationTargetInformation().getRoutingInformation(); + if (routingInfo != null) { + String hostName = (String) routingInfo.get(ClientProvider.ROUTING_KEY_HOST_NAME); + String serverName = (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_NAME); + String serverUserDir = (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_USER_DIR); + + assert hostName != null; + assert serverName != null; + assert serverUserDir != null; + + writeStringField(out, OM_HOSTNAME, hostName); + writeStringField(out, OM_SERVERNAME, serverName); + writeStringField(out, OM_SERVERUSERDIR, serverUserDir); + } + + if (clazz == Notification.class) { + } else if (clazz == AttributeChangeNotification.class) { + AttributeChangeNotification v = (AttributeChangeNotification) item; + writeStringField(out, OM_ATTRIBUTENAME, v.getAttributeName()); + writeStringField(out, OM_ATTRIBUTETYPE, v.getAttributeType()); + writePOJOField(out, OM_OLDVALUE, v.getOldValue()); + writePOJOField(out, OM_NEWVALUE, v.getNewValue()); + } else if (clazz == JMXConnectionNotification.class) { + JMXConnectionNotification v = (JMXConnectionNotification) item; + writeStringField(out, OM_CONNECTIONID, v.getConnectionId()); + } else if (clazz == MBeanServerNotification.class) { + MBeanServerNotification v = (MBeanServerNotification) item; + writeObjectNameField(out, OM_MBEANNAME, v.getMBeanName()); + } else if (clazz == RelationNotification.class) { + RelationNotification v = (RelationNotification) item; + writeStringField(out, OM_RELATIONID, v.getRelationId()); + writeStringField(out, OM_RELATIONTYPENAME, v.getRelationTypeName()); + writeObjectNameField(out, OM_OBJECTNAME, v.getObjectName()); + String roleName = v.getRoleName(); + if (roleName == null) { + writeObjectNameListField(out, OM_MBEANSTOUNREGISTER, v.getMBeansToUnregister()); + } else { + writeStringField(out, OM_ROLENAME, v.getRoleName()); + writeObjectNameListField(out, OM_OLDROLEVALUE, v.getOldRoleValue()); + writeObjectNameListField(out, OM_NEWROLEVALUE, v.getNewRoleValue()); + } + } else if (clazz == TimerNotification.class) { + TimerNotification v = (TimerNotification) item; + writeIntField(out, OM_NOTIFICATIONID, v.getNotificationID()); + } else { + // MonitorNotification and TimerAlarmClockNotification are + // known, but either the class or the constructor is not + // visible, and we have to use base64. + // SnmpTableEntryNotification is a sun specific implementation. + writeSerializedField(out, OM_SERIALIZED, item); + } + + writeEndObject(out); + } + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve an array of Notification instances. + * + * @param in The stream to read JSON from + * @return The decoded Notification array + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeNotifications(OutputStream, Notification[]) + */ + public Notification[] readNotifications(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + final NotificationRecord[] records = readNotificationRecords(in); + final Notification[] ret = new Notification[records.length]; + for (int i = 0; i < records.length; ++i) { + ret[i] = records[i].getNotification(); + } + return ret; + } + + /** + * Decode a JSON document to retrieve an array of NotificationRecord instances. + * + * @param in The stream to read JSON from + * @return The non-null decoded NotificationRecord array + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeNotificationRecords(OutputStream, NotificationRecord[]) + */ + public NotificationRecord[] readNotificationRecords(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONArray json = parseArray(in); + int size = json.size(); + NotificationRecord[] ret = new NotificationRecord[size]; + for (int i = 0; i < size; i++) { + Object o = json.get(i); + if (!(o instanceof JSONObject)) { + throwConversionException("readNotifications() expects a JSONObject.", o); + } + JSONObject obj = (JSONObject) o; + + // Fields common to all Notification classes. + String className = readStringInternal(obj.get(N_CLASSNAME)); + String type = readStringInternal(obj.get(N_TYPE)); + ObjectName source = readObjectName(obj.get(N_SOURCE)); + long sequenceNumber = readLongInternal(obj.get(N_SEQUENCENUMBER)); + long timeStamp = readLongInternal(obj.get(N_TIMESTAMP)); + String message = readStringInternal(obj.get(N_MESSAGE)); + Object userData = readPOJOInternal(obj.get(N_USERDATA)); + + // Read routing information (host name, server name, server user dir) if this is a routed notification. + String hostName = readStringInternal(obj.get(N_HOSTNAME)); + String serverName; + String serverUserDir; + if (hostName != null) { + serverName = readStringInternal(obj.get(N_SERVERNAME)); + serverUserDir = readStringInternal(obj.get(N_SERVERUSERDIR)); + } else { + serverName = null; + serverUserDir = null; + } + + Notification n; + if ("javax.management.Notification".equals(className)) { + n = new Notification(type, source, sequenceNumber, timeStamp, message); + } else if ("javax.management.AttributeChangeNotification".equals(className)) { + if (!AttributeChangeNotification.ATTRIBUTE_CHANGE.equals(type)) { + throwConversionException("Type for AttributeChangeNotification should be ATTRIBUTE_CHANGE", o); + } + String attributeName = readStringInternal(obj.get(N_ATTRIBUTENAME)); + String attributeType = readStringInternal(obj.get(N_ATTRIBUTETYPE)); + Object oldValue = readPOJOInternal(obj.get(N_OLDVALUE)); + Object newValue = readPOJOInternal(obj.get(N_NEWVALUE)); + n = new AttributeChangeNotification(source, sequenceNumber, timeStamp, message, + attributeName, attributeType, oldValue, newValue); + } else if ("javax.management.remote.JMXConnectionNotification".equals(className)) { + String connectionId = readStringInternal(obj.get(N_CONNECTIONID)); + n = new JMXConnectionNotification(type, source, connectionId, sequenceNumber, message, userData); + // Replace the value set by the constructor + n.setTimeStamp(timeStamp); + } else if ("javax.management.MBeanServerNotification".equals(className)) { + ObjectName objectName = readObjectName(obj.get(N_MBEANNAME)); + n = new MBeanServerNotification(type, source, sequenceNumber, objectName); + // Replace the value set by the constructor + n.setTimeStamp(timeStamp); + } else if ("javax.management.relation.RelationNotification".equals(className)) { + String relationId = readStringInternal(obj.get(N_RELATIONID)); + String typeName = readStringInternal(obj.get(N_RELATIONTYPENAME)); + ObjectName objectName = readObjectName(obj.get(N_OBJECTNAME)); + String roleName = readStringInternal(obj.get(N_ROLENAME)); + if (roleName == null) { + List mbeansToUnregister = readObjectNameList(obj.get(N_MBEANSTOUNREGISTER)); + n = new RelationNotification(type, source, sequenceNumber, timeStamp, message, + relationId, typeName, objectName, mbeansToUnregister); + } else { + List oldValue = readObjectNameList(obj.get(N_OLDROLEVALUE)); + List newValue = readObjectNameList(obj.get(N_NEWROLEVALUE)); + n = new RelationNotification(type, source, sequenceNumber, timeStamp, message, + relationId, typeName, objectName, + roleName, oldValue, newValue); + } + } else if ("javax.management.timer.TimerNotification".equals(className)) { + Integer notificationID = readIntInternal(obj.get(N_NOTIFICATIONID)); + n = new TimerNotification(type, source, sequenceNumber, timeStamp, message, notificationID); + } else { + Object serialized = readSerialized(obj.get(N_SERIALIZED)); + if (!(serialized instanceof Notification)) { + throwConversionException("readNotifications() expects a Notification.", o); + } + n = (Notification) serialized; + } + + n.setUserData(userData); + + final NotificationRecord nr; + if (hostName != null) { + nr = new NotificationRecord(n, source, hostName, serverName, serverUserDir); + } else { + nr = new NotificationRecord(n, source); + } + ret[i] = nr; + } + return ret; + } + + /** + * Encode a NotificationSettings instance as JSON: + * { + * "deliveryInterval" : Integer + * } + * + * @param out The stream to write JSON to + * @param value The NotificationSettings instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readNotificationSettings(InputStream) + */ + public void writeNotificationSettings(OutputStream out, NotificationSettings value) throws IOException { + assert value != null; + writeStartObject(out); + writeIntField(out, OM_DELIVERYINTERVAL, value.deliveryInterval); + writeIntField(out, OM_INBOXEXPIRTY, value.inboxExpiry); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a NotificationSettings instance. + * + * @param in The stream to read JSON from + * @return The decoded NotificationSettings instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeNotificationSettings(OutputStream, NotificationSettings) + */ + public NotificationSettings readNotificationSettings(InputStream in) throws ConversionException, IOException { + JSONObject json = parseObject(in); + NotificationSettings ret = new NotificationSettings(); + ret.deliveryInterval = readIntInternal(json.get(N_DELIVERYINTERVAL)); + ret.inboxExpiry = readIntInternal(json.get(N_INBOXEXPIRY)); + return ret; + } + + /** + * Encode a Throwable instance as JSON: + * { + * "throwable" : Base64, + * "stackTrace" : String + * } + * + * @param out The stream to write JSON to + * @param value The Throwable instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readThrowable(InputStream) + */ + public void writeThrowable(OutputStream out, Throwable value) throws IOException { + assert value != null; + writeStartObject(out); + writeSerializedField(out, OM_THROWABLE, value); + StringWriter sw = new StringWriter(); + value.printStackTrace(new PrintWriter(sw)); + writeStringField(out, OM_STACKTRACE, sw.toString()); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a Throwable instance. + * + * @param in The stream to read JSON from + * @return The decoded Throwable instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeThrowable(OutputStream, Throwable) + */ + public Throwable readThrowable(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + byte[] byteInputStream = convertInputStreamToBytes(in); + ByteArrayInputStream bais = new ByteArrayInputStream(byteInputStream); + JSONObject json = null; + try { + json = parseObject(bais); + } catch (IOException ex) { + bais.reset(); + throw new RuntimeException(convertStreamToString(bais)); + } + Object t = readSerialized(json.get(N_THROWABLE)); + if (!(t instanceof Throwable)) { + throwConversionException("readThrowable() receives an instance that's not a Throwable.", json.get(N_THROWABLE)); + } + return (Throwable) t; + } + + /** + * Converts inputstream to bytearray + * + * @param in + * @return + * @throws IOException + */ + private byte[] convertInputStreamToBytes(InputStream in) throws IOException { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + + int len; + byte[] data = new byte[16384]; + + while ((len = in.read(data, 0, data.length)) != -1) { + buffer.write(data, 0, len); + } + + buffer.flush(); + return buffer.toByteArray(); + } + + /** + * Converts inputstream to String + * + * @param in + * @return + * @throws IOException + */ + + private String convertStreamToString(InputStream input) throws IOException { + BufferedReader reader = new BufferedReader(new InputStreamReader(input)); + StringBuilder sb = new StringBuilder(); + String line = null; + + while ((line = reader.readLine()) != null) { + sb.append(line); + } + + input.close(); + return sb.toString(); + } + + /** + * Encode a String in base64. The content of the string is first encoded + * as UTF-8 bytes, the bytes are then base64 encoded. The resulting base64 + * value is returned as a String. + * + * @param value The String to encode + * @return The encoded base64 String + * @throws ConversionException If the String content can not be UTF-8 encoded. + */ + public String encodeStringAsBase64(String value) throws ConversionException { + try { + return encodeStringAsBase64Internal(value); + } catch (IOException e) { + // Will never happen + return null; + } + } + + @SuppressWarnings("deprecation") + private String encodeStringAsBase64Internal(String value) throws ConversionException, IOException { + final Base64OutputStream out = base64Stream; + byteArrayOS.reset(); + out.start(byteArrayOS); + for (int i = 0; i < value.length(); i++) { + char ch = value.charAt(i); + if (ch < 0x80) { + // 1-byte + out.write(ch); + } else if (ch < 0x800) { + // 2-byte + out.write(0xC0 | (ch >> 6)); + out.write(0x80 | (0x3F & ch)); + } else if (ch < 0xD800 || ch >= 0xE000) { + // 3-byte + out.write(0xE0 | (ch >> 12)); + out.write(0x80 | (0x3F & (ch >> 6))); + out.write(0x80 | (0x3F & ch)); + } else if (ch < 0xDC00) { + // 4-byte. Surrogate pair. + if (i == value.length() - 1) { + // Error if second half is missing + utf8EncodeError(value); + } else { + char ch2 = value.charAt(i + 1); + if (ch2 >= 0xDC00 && ch2 < 0xE000) { + int c = 0x00010000 + ((ch - 0xD800) << 10) + (ch2 - 0xDC00); + out.write(0xF0 | (c >> 18)); /* no mask needed */ + out.write(0x80 | (0x3F & (c >> 12))); + out.write(0x80 | (0x3F & (c >> 6))); + out.write(0x80 | (0x3F & c)); + i++; + } else { + // Error if second half is out of range + utf8EncodeError(value); + } + } + } else { + // Error if first half is out of range + utf8EncodeError(value); + } + } + out.end(); + // Base64 encoded String only has ASCII characters. + return byteArrayOS.toString(0); + } + + private void writeStartObject(OutputStream out) throws IOException { + out.write('{'); + firstItem = true; + } + + private void writeFieldName(OutputStream out, byte[] name) throws IOException { + if (firstItem) { + firstItem = false; + } else { + out.write(','); + } + out.write(name); + } + + private void writeSimpleFieldName(OutputStream out, String name) throws IOException { + if (firstItem) { + firstItem = false; + } else { + out.write(','); + } + writeSimpleString(out, name); + out.write(':'); + } + + private void escapeFieldName(OutputStream out, String name) throws IOException { + if (firstItem) { + firstItem = false; + } else { + out.write(','); + } + writeStringInternal(out, name); + out.write(':'); + } + + private void writeEndObject(OutputStream out) throws IOException { + out.write('}'); + firstItem = false; + } + + private void writeStartArray(OutputStream out) throws IOException { + out.write('['); + firstItem = true; + } + + private void writeArrayItem(OutputStream out) throws IOException { + if (firstItem) { + firstItem = false; + } else { + out.write(','); + } + } + + private void writeEndArray(OutputStream out) throws IOException { + out.write(']'); + firstItem = false; + } + + /** + * Debug (dump) the contents of an input stream. This effectively copies + * the input stream into a byte array, dumps one and then returns another. + * If logging is not enabled, nothing happens. + * + * @param in + * @throws IOException + */ + private InputStream debugInputStream(InputStream in) throws IOException { + if (logger.isLoggable(Level.FINEST)) { + final byte[] buffer = new byte[1024]; + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + int len; + String line; + + logger.finest("[START] Dumping the InputStream that will be passed to JSON.parse()"); + while ((len = in.read(buffer)) > -1) { + baos.write(buffer, 0, len); + } + baos.flush(); + + ByteArrayInputStream dumpIn = new ByteArrayInputStream(baos.toByteArray()); + BufferedReader br = new BufferedReader(new InputStreamReader(dumpIn)); + while ((line = br.readLine()) != null) { + logger.finest(line); + } + logger.finest("[END] Dumping the InputStream that will be passed to JSON.parse()"); + + return new ByteArrayInputStream(baos.toByteArray()); + } else { + return in; + + } + } + + /** + * Parse (and possible debug) the InputStream as a JSONArtifact. + * + * @param in + * @return + * @throws IOException + */ + private JSONArtifact debugAndParse(InputStream in) throws IOException { + return JSON.parse(debugInputStream(in)); + } + + private Object parse(InputStream in) throws IOException { + return debugAndParse(in); + } + + private JSONObject parseObject(InputStream in) throws ConversionException, IOException { + JSONArtifact json = debugAndParse(in); + if (!(json instanceof JSONObject)) { + throwConversionException("parseObject() receives an instance that's not a JSONObject.", json); + } + return (JSONObject) json; + } + + private JSONArray parseArray(InputStream in) throws ConversionException, IOException { + JSONArtifact json = debugAndParse(in); + if (!(json instanceof JSONArray)) { + throwConversionException("parseArray() receives an instance that's not a JSONArray.", json); + } + return (JSONArray) json; + } + + private byte readByteInternal(Object in) throws ConversionException { + int value = readIntInternal(in); + if (value > Byte.MAX_VALUE || value < Byte.MIN_VALUE) { + throwConversionException("readByteInternal() receives an out-of-range value.", in); + } + return (byte) value; + } + + private short readShortInternal(Object in) throws ConversionException { + int value = readIntInternal(in); + if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) { + throwConversionException("readShortInternal() receives an out-of-range value.", in); + } + return (short) value; + } + + private void writeIntField(OutputStream out, byte[] name, int value) throws IOException { + writeFieldName(out, name); + writeIntInternal(out, value); + } + + private void writeIntInternal(OutputStream out, int value) throws IOException { + out.write('"'); + encodeInt(out, value); + out.write('"'); + } + + private void encodeInt(OutputStream out, int value) throws IOException { + if (value < 0) { + // -Integer.MIN_VALUE is out of "int" range. Special-casing it. + if (value == Integer.MIN_VALUE) { + out.write(INT_MIN); + return; + } + + // Turn value to positive so that % and / work as expected. + out.write('-'); + value = -value; + } + + // Write from right to left + final byte[] bytes = BYTE_BUFFER; + int pos = BYTE_BUFFER.length; + do { + int q = value / 10; + int r = value - (q << 3) - (q << 1); // same as (value - q * 10) + value = q; + bytes[--pos] = (byte) (r + '0'); + } while (value != 0); + + out.write(bytes, pos, BYTE_BUFFER.length - pos); + } + + private int readIntInternal(Object in) throws ConversionException { + if (in == null) { + return 0; + } + + if (!(in instanceof String)) { + throwConversionException("readIntInternal() expects a String.", in); + } + try { + return Integer.parseInt((String) in); + } catch (NumberFormatException e) { + throwConversionException(e, in); + return 0; + } + } + + private void writeLongField(OutputStream out, byte[] name, long value) throws IOException { + writeFieldName(out, name); + writeLongInternal(out, value); + } + + private void writeLongInternal(OutputStream out, long value) throws IOException { + out.write('"'); + encodeLong(out, value); + out.write('"'); + } + + private void encodeLong(OutputStream out, long value) throws IOException { + if (value < 0) { + // -Long.MIN_VALUE is out of "long" range. Special-casing it. + if (value == Long.MIN_VALUE) { + out.write(LONG_MIN); + return; + } + + // Turn value to positive so that % and / work as expected. + out.write('-'); + value = -value; + } + + // Write from right to left + final byte[] bytes = BYTE_BUFFER; + int pos = BYTE_BUFFER.length; + do { + long q = value / 10; + long r = value - (q << 3) - (q << 1); // same as (value - q * 10) + value = q; + bytes[--pos] = (byte) (r + '0'); + } while (value != 0); + + out.write(bytes, pos, BYTE_BUFFER.length - pos); + } + + private long readLongInternal(Object in) throws ConversionException { + if (!(in instanceof String)) { + throwConversionException("readLongInternal() expects a String.", in); + } + try { + return Long.parseLong((String) in); + } catch (NumberFormatException e) { + throwConversionException(e, in); + return 0; + } + } + + private float readFloatInternal(Object in) throws ConversionException { + if (!(in instanceof String)) { + throwConversionException("readFloatInternal() expects a String.", in); + } + try { + return Float.parseFloat((String) in); + } catch (NumberFormatException e) { + throwConversionException(e, in); + return 0; + } + } + + private double readDoubleInternal(Object in) throws ConversionException { + if (!(in instanceof String)) { + throwConversionException("readDoubleInternal() expects a String.", in); + } + try { + return Double.parseDouble((String) in); + } catch (NumberFormatException e) { + throwConversionException(e, in); + return 0; + } + } + + private char readCharInternal(Object in) throws ConversionException { + if (!(in instanceof String)) { + throwConversionException("readCharInternal() expects a String.", in); + } + String str = (String) in; + if (str.length() != 1) { + throwConversionException("readCharInternal() expects a String of length 1.", in); + } + return str.charAt(0); + } + + private void writeBooleanField(OutputStream out, byte[] name, boolean value) throws IOException { + writeFieldName(out, name); + writeBooleanInternal(out, value); + } + + private void writeBooleanInternal(OutputStream out, boolean value) throws IOException { + out.write(value ? TRUE : FALSE); + } + + private boolean readBooleanInternal(Object in) throws ConversionException { + if (!(in instanceof Boolean)) { + throwConversionException("readBooleanInternal() expects a Boolean.", in); + } + return ((Boolean) in).booleanValue(); + } + + private void writeSimpleStringField(OutputStream out, byte[] name, CharSequence value) throws IOException { + writeFieldName(out, name); + writeSimpleString(out, value); + } + + // Called for ASCII Strings that don't contain any need-to-escape characters. + // The value can't be null. + private void writeSimpleString(OutputStream out, CharSequence value) throws IOException { + out.write('"'); + for (int i = 0; i < value.length(); i++) { + out.write(value.charAt(i)); + } + out.write('"'); + } + + private void writeStringField(OutputStream out, byte[] name, String value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStringInternal(out, value); + } + + private void writeStringInternal(OutputStream out, String value) throws IOException { + if (value == null) { + out.write(NULL); + return; + } + + out.write('"'); + escapeString(out, value); + out.write('"'); + } + + private void escapeString(OutputStream out, String value) throws IOException { + for (int i = 0; i < value.length(); i++) { + char ch = value.charAt(i); + // Escape '"' and '\' + if (ch == '"') { + out.write('\\'); + out.write('"'); + } else if (ch == '\\') { + out.write('\\'); + out.write('\\'); + } else if (ch >= 0x80) { + // Multi-byte chars + if (ch < 0x800) { + // 2-byte + out.write(0xC0 | (ch >> 6)); + out.write(0x80 | (0x3F & ch)); + } else if (ch < 0xD800 || ch >= 0xE000) { + // 3-byte + out.write(0xE0 | (ch >> 12)); + out.write(0x80 | (0x3F & (ch >> 6))); + out.write(0x80 | (0x3F & ch)); + } else if (ch < 0xDC00) { + // 4-byte. Surrogate pair. + if (i == value.length() - 1) { + // Error if second half is missing + writeInvalidChar(out, ch); + } else { + char ch2 = value.charAt(i + 1); + if (ch2 >= 0xDC00 && ch2 < 0xE000) { + int c = 0x00010000 + ((ch - 0xD800) << 10) + (ch2 - 0xDC00); + out.write(0xF0 | (c >> 18)); /* no mask needed */ + out.write(0x80 | (0x3F & (c >> 12))); + out.write(0x80 | (0x3F & (c >> 6))); + out.write(0x80 | (0x3F & c)); + i++; + } else { + // Error if second half is out of range + writeInvalidChar(out, ch); + } + } + } else { + // Error if first half is out of range + writeInvalidChar(out, ch); + } + } else if (ch >= 0x20) { + // Common case: ASCII and not special + out.write(ch); + } else { + // Escape control characters. + out.write('\\'); + switch (ch) { + case 8: + out.write('b'); + break; + case 9: + out.write('t'); + break; + case 0xA: + out.write('n'); + break; + case 0xC: + out.write('f'); + break; + case 0xD: + out.write('r'); + break; + default: + out.write('u'); + out.write('0'); + out.write('0'); + out.write(hex(ch >> 4)); + out.write(hex(ch & 0xf)); + } + } + } + } + + private void writeInvalidChar(OutputStream out, char value) throws IOException { + out.write('\\'); + out.write('u'); + out.write(hex(value >> 12)); + out.write(hex((value >> 8) & 0xf)); + out.write(hex((value >> 4) & 0xf)); + out.write(hex(value & 0xf)); + } + + private byte hex(int value) { + return (byte) (value < 10 ? value + '0' : value + 'A' - 10); + } + + private String readStringInternal(Object in) throws ConversionException { + if (in == null) { + return null; + } + if (!(in instanceof String)) { + throwConversionException("readStringInternal() expects a String.", in); + } + // The JSON parser already decoded the string. + return (String) in; + } + + private void writeStringArrayField(OutputStream out, byte[] name, String[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStringArrayInternal(out, value); + } + + private void writeStringArrayInternal(OutputStream out, String[] value) throws IOException { + writeStartArray(out); + if (value != null) { + for (String s : value) { + writeArrayItem(out); + writeStringInternal(out, s); + } + } + writeEndArray(out); + } + + private String[] readStringArrayInternal(Object in) throws ConversionException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readStringArrayInternal() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + int size = json.size(); + String[] ret = new String[size]; + for (int i = 0; i < size; i++) { + ret[i] = readStringInternal(json.get(i)); + } + return ret; + } + + private void writeSerializedField(OutputStream out, byte[] name, Object value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeSerialized(out, value); + } + + private void writeSerialized(OutputStream out, Object value) throws IOException { + if (value == null) { + out.write(NULL); + return; + } + out.write('"'); + base64Stream.start(out); + ObjectOutputStream objectOut = new ObjectOutputStream(base64Stream); + objectOut.writeObject(value); + base64Stream.end(); + out.write('"'); + } + + private Object readSerialized(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof String)) { + throwConversionException("readSerialized() expects a String.", in); + } + String value = (String) in; + int slen = value.length(); + if (slen == 0 || slen / 4 * 4 != slen) { + base64DecodeError(in); + } + int blen = slen / 4 * 3; + byte[] binary = new byte[blen]; + int c1 = 0, c2 = 0, c3 = 0, c4 = 0, pos = 0; + for (int i = 0; i < slen;) { + c1 = value.charAt(i++); + c2 = value.charAt(i++); + c3 = value.charAt(i++); + c4 = value.charAt(i++); + if (c1 >= BASE64_D.length || BASE64_D[c1] == -1 || + c2 >= BASE64_D.length || BASE64_D[c2] == -1 || + c2 >= BASE64_D.length || BASE64_D[c3] == -1 || + c2 >= BASE64_D.length || BASE64_D[c4] == -1) { + base64DecodeError(in); + } + c1 = BASE64_D[c1]; + c2 = BASE64_D[c2]; + c3 = BASE64_D[c3]; + c4 = BASE64_D[c4]; + binary[pos++] = (byte) ((c1 << 2) | (c2 >> 4)); + binary[pos++] = (byte) ((c2 << 4) | (c3 >> 2)); + binary[pos++] = (byte) ((c3 << 6) | c4); + } + + if (value.charAt(slen - 1) == '=') { + if (binary[--blen] != 0) { + base64DecodeError(in); + } + if (value.charAt(slen - 2) == '=') { + if (binary[--blen] != 0) { + base64DecodeError(in); + } + } + } + + return helper.readObject(in, blen, binary); + } + + public static void setSerializationHelper(SerializationHelper sh) { + if (null == sh) { + helper = defaultHelper; + } else { + helper = sh; + } + } + + private void writePOJOField(OutputStream out, byte[] name, Object value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writePOJOInternal(out, value); + } + + private void writePOJOInternal(OutputStream out, Object value) throws IOException { + if (USE_BASE64_FOR_POJO) { + writeStartObject(out); + if (value != null) { + writeSimpleStringField(out, OM_CLASSNAME, value.getClass().getName()); + writeSerializedField(out, OM_SERIALIZED, value); + } + writeEndObject(out); + return; + } + + writeStartObject(out); + // Merge this with the "writeType" method? + // Then need to write "type" content into the byateArrayOS. + if (hasCycle(value, new Stack())) { + // If the value object contains cycle, then java-serialize it. + writeSerializedField(out, OM_SERIALIZED, value); + } else { + writeFieldName(out, OM_VALUE); + writePOJOValue(out, value); + writeFieldName(out, OM_TYPE); + List> openTypes = new ArrayList>(); + writePOJOType(out, value, openTypes); + writeOpenTypes(out, openTypes); + } + writeEndObject(out); + } + + private boolean hasCycle(Object value, Stack seen) { + if (value == null) { + return false; + } + + for (Object o : seen) { + if (o == value) { + return true; + } + } + + Class clazz = value.getClass(); + + if (clazz.isArray()) { + Class componentType = clazz.getComponentType(); + if (componentType.isPrimitive()) { + return false; + } + + Class leaf = componentType; + while (leaf.isArray()) { + leaf = leaf.getComponentType(); + } + if (SupportedClasses.get(leaf) == null) { + return false; + } + + if (SimpleArrays.contains(leaf)) { + return false; + } + + seen.push(value); + for (Object o : (Object[]) value) { + if (hasCycle(o, seen)) { + return true; + } + } + seen.pop(); + return false; + } + + TYPE type = SupportedClasses.get(clazz); + if (type == null) { + return false; + } + + switch (type) { + case Byte: + case Short: + case Integer: + case Long: + case Float: + case Double: + case Character: + case Boolean: + case String: + case BigInteger: + case BigDecimal: + case Date: + case Object: + return false; + case Collection: + seen.push(value); + for (Object o : (Collection) value) { + if (hasCycle(o, seen)) { + return true; + } + } + seen.pop(); + return false; + case Map: + Map map = (Map) value; + seen.push(value); + for (Entry entry : map.entrySet()) { + if (hasCycle(entry.getKey(), seen)) { + return true; + } + if (hasCycle(entry.getValue(), seen)) { + return true; + } + } + seen.pop(); + return false; + case CompositeData: + CompositeData composite = (CompositeData) value; + seen.push(value); + for (String key : composite.getCompositeType().keySet()) { + if (hasCycle(composite.get(key), seen)) { + return true; + } + } + seen.pop(); + return false; + case TabularData: + TabularData tabular = (TabularData) value; + seen.push(value); + for (Object o : tabular.values()) { + if (hasCycle(o, seen)) { + return true; + } + } + seen.pop(); + return false; + } + return false; + } + + private void writePOJOValue(OutputStream out, Object value) throws IOException { + if (value == null) { + // - For "null" value: + // value: null + out.write(NULL); + return; + } + + Class clazz = value.getClass(); + + if (clazz.isArray()) { + // - For array + // value: [ Value* ] + Class componentType = clazz.getComponentType(); + if (componentType.isPrimitive()) { + writePrimitiveArray(out, value, componentType); + return; + } + + writeStartArray(out); + for (Object o : (Object[]) value) { + writeArrayItem(out); + writePOJOValue(out, o); + } + writeEndArray(out); + return; + } + + TYPE type = SupportedClasses.get(clazz); + if (type == null) { + if (value instanceof TabularData) { + type = TYPE.TabularData; + } else if (value instanceof CompositeData) { + type = TYPE.CompositeData; + } else if (value instanceof Map) { + type = TYPE.Map; + } else if (value instanceof Collection) { + type = TYPE.Collection; + } else if (value instanceof BigInteger) { + type = TYPE.BigInteger; + } else if (value instanceof BigDecimal) { + type = TYPE.BigDecimal; + } else if (value instanceof Date) { + type = TYPE.Date; + } else if (value instanceof ObjectName) { + type = TYPE.ObjectName; + } else { + // - For a value that's not expressible in JSON: + // null + out.write(NULL); + return; + } + } + + switch (type) { + case Byte: + case Short: + case Integer: + case Long: + case Float: + case Double: + case Boolean: + case BigInteger: + case BigDecimal: + // These value are ASCII without \ or " character, so no + // escaping is needed. + // - For a simple value + // value: String representation + writeSimpleString(out, value.toString()); + return; + case String: + writeStringInternal(out, (String) value); + return; + case ObjectName: + writeObjectName(out, (ObjectName) value); + return; + case Date: + writeLongInternal(out, ((Date) value).getTime()); + return; + case Object: + // - For an Object: + // value: "". "null" isn't very accurate. + writeSimpleString(out, ""); + return; + case Character: + // Could be special; may need to escape. + writeStringInternal(out, value.toString()); + return; + case Collection: + // - For Collection + // value: [ Value* ] + writeStartArray(out); + for (Object o : (Collection) value) { + writeArrayItem(out); + writePOJOValue(out, o); + } + writeEndArray(out); + return; + case Map: + Map map = (Map) value; + if (map.isEmpty()) { + writeStartObject(out); + writeEndObject(out); + return; + } + boolean simpleKey = true; + for (Object key : map.keySet()) { + // If a key is "null", then treat as complex key + if (key == null || !SimpleKeys.contains(key.getClass())) { + simpleKey = false; + break; + } + } + if (simpleKey) { + // - For map with simple key: + // value: { + // String: Value * + // } + writeStartObject(out); + for (Entry entry : map.entrySet()) { + Object key = entry.getKey(); + Object v = entry.getValue(); + if (key instanceof String) { + escapeFieldName(out, (String) key); + } else { + writeSimpleFieldName(out, key.toString()); + } + writePOJOValue(out, v); + } + writeEndObject(out); + } else { + // -For map with complex keys + // value: [ {key: Value, value: Value}* ] + writeStartArray(out); + for (Entry entry : map.entrySet()) { + Object key = entry.getKey(); + writeArrayItem(out); + writeStartObject(out); + writeFieldName(out, OM_KEY); + writePOJOValue(out, key); + writeFieldName(out, OM_VALUE); + writePOJOValue(out, entry.getValue()); + writeEndObject(out); + } + writeEndArray(out); + } + return; + case CompositeData: + // - For CompositeData + // value: { + // String: Value * // Key can't be null + // } + CompositeData composite = (CompositeData) value; + writeStartObject(out); + for (String key : composite.getCompositeType().keySet()) { + escapeFieldName(out, key); + writePOJOValue(out, composite.get(key)); + } + writeEndObject(out); + return; + case TabularData: + // - TabularData + // value: [ CompositeData * ] + TabularData tabular = (TabularData) value; + writeStartArray(out); + for (Object item : tabular.values()) { + writeArrayItem(out); + writePOJOValue(out, item); + } + writeEndArray(out); + return; + } + } + + private void writePrimitiveArray(OutputStream out, Object value, Class component) throws IOException { + switch (SupportedClasses.get(component)) { + case _Byte: + case Byte: + writeStartArray(out); + for (byte v : (byte[]) value) { + writeArrayItem(out); + writeIntInternal(out, v); + } + writeEndArray(out); + break; + case _Short: + case Short: + writeStartArray(out); + for (short v : (short[]) value) { + writeArrayItem(out); + writeIntInternal(out, v); + } + writeEndArray(out); + break; + case _Integer: + case Integer: + writeStartArray(out); + for (int v : (int[]) value) { + writeArrayItem(out); + writeIntInternal(out, v); + } + writeEndArray(out); + break; + case _Long: + case Long: + writeStartArray(out); + for (long v : (long[]) value) { + writeArrayItem(out); + writeLongInternal(out, v); + } + writeEndArray(out); + break; + case _Float: + case Float: + writeStartArray(out); + for (Float v : (Float[]) value) { + writeArrayItem(out); + writeSimpleString(out, Float.toString(v)); + } + writeEndArray(out); + break; + case _Double: + case Double: + writeStartArray(out); + for (Double v : (Double[]) value) { + writeArrayItem(out); + writeSimpleString(out, Double.toString(v)); + } + writeEndArray(out); + break; + case _Character: + case Character: + writeStartArray(out); + for (char v : (char[]) value) { + writeArrayItem(out); + writeIntInternal(out, v); + } + writeEndArray(out); + break; + case _Boolean: + case Boolean: + writeStartArray(out); + for (boolean v : (boolean[]) value) { + writeArrayItem(out); + out.write(v ? TRUE : FALSE); + } + writeEndArray(out); + break; + default: + break; + } + } + + private void writePOJOType(OutputStream out, Object value, List> openTypes) throws IOException { + if (value == null) { + // - For "null" value: + // type: null + out.write(NULL); + return; + } + + Class clazz = value.getClass(); + + if (clazz.isArray()) { + // - For simple array + // type: String + // - For complex array + // type: { + // className: String, ? + // value: Base64, ? + // items: [ Type* ] ? + // } + Class componentType = clazz.getComponentType(); + if (componentType.isPrimitive()) { + writeSimpleString(out, clazz.getName()); + return; + } + + Class leaf = componentType; + while (leaf.isArray()) { + leaf = leaf.getComponentType(); + } + if (SupportedClasses.get(leaf) == null) { + // Unknown array type. Java serialize it + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + writeSerializedField(out, OM_VALUE, value); + writeEndObject(out); + // And do not produce type information for the subtree. + return; + } + + if (SimpleArrays.contains(leaf)) { + writeSimpleString(out, clazz.getName()); + // Don't need further type information for simple arrays + return; + } + + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + writeFieldName(out, OM_ITEMS); + writeStartArray(out); + + for (Object o : (Object[]) value) { + writeArrayItem(out); + writePOJOType(out, o, openTypes); + } + writeEndArray(out); + writeEndObject(out); + return; + } + + TYPE type = SupportedClasses.get(clazz); + if (type == null) { + // Unknown array type. Java serialize it + // type: { + // className: String, ? + // value: Base64, ? + // } + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + writeSerializedField(out, OM_VALUE, value); + writeEndObject(out); + // And do not produce type information for the subtree. + return; + } + + switch (type) { + case Byte: + case Short: + case Integer: + case Long: + case Float: + case Double: + case Character: + case Boolean: + case String: + case BigInteger: + case BigDecimal: + case Date: + case ObjectName: + case Object: + // - For a simple value + // type: String (class name) + // These value are ASCII without \ or " character, so no + // escaping is needed. + writeSimpleString(out, clazz.getName()); + return; + case Collection: + // - For Collection + // type: { + // className: String, + // items: [ Type* ] + // } + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + writeFieldName(out, OM_ITEMS); + writeStartArray(out); + for (Object o : (Collection) value) { + writeArrayItem(out); + writePOJOType(out, o, openTypes); + } + writeEndArray(out); + writeEndObject(out); + return; + case Map: + Map map = (Map) value; + // - For maps + // type: { + // className: String, + // simpleKey: boolean, + // entries: [ + // { + // key:String, ? // For simple key + // keyType:Type, + // value:Type + // } * + // ] + // } + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + if (map.isEmpty()) { + writeEndObject(out); + return; + } + + boolean simpleKey = true; + for (Object key : map.keySet()) { + // If a key is "null", then treat as complex key + if (key == null || !SimpleKeys.contains(key.getClass())) { + simpleKey = false; + break; + } + } + + writeBooleanField(out, OM_SIMPLEKEY, simpleKey); + writeFieldName(out, OM_ENTRIES); + writeStartArray(out); + for (Entry entry : map.entrySet()) { + Object key = entry.getKey(); + writeArrayItem(out); + writeStartObject(out); + if (simpleKey) { + if (key instanceof String) { + writeStringField(out, OM_KEY, (String) key); + } else { + writeSimpleStringField(out, OM_KEY, key.toString()); + } + } + writeFieldName(out, OM_KEYTYPE); + writePOJOType(out, key, openTypes); + writeFieldName(out, OM_VALUE); + writePOJOType(out, entry.getValue(), openTypes); + writeEndObject(out); + } + writeEndArray(out); + writeEndObject(out); + return; + case CompositeData: + // - For CompositeData + // type: { + // className: String, + // openType: Integer // Reference to the OpenType array in root Type + // } + CompositeData composite = (CompositeData) value; + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + CompositeType ct = composite.getCompositeType(); + writeOpenTypeField(out, OM_OPENTYPE, ct, openTypes); + writeEndObject(out); + return; + case TabularData: + // - TabularData + // type: { + // className: String, + // openType: Integer // Reference to the OpenType array in root Type + // } + TabularData tabular = (TabularData) value; + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + TabularType tt = tabular.getTabularType(); + writeOpenTypeField(out, OM_OPENTYPE, tt, openTypes); + writeEndObject(out); + break; + default: + break; + } + } + + private void writeOpenTypeField(OutputStream out, byte[] name, OpenType openType, List> openTypes) throws IOException { + int idx = openTypes.indexOf(openType); + if (idx < 0) { + writeIntField(out, name, openTypes.size()); + openTypes.add(openType); + } else { + writeIntField(out, name, idx); + } + } + + private void writeOpenTypes(OutputStream out, List> openTypes) throws IOException { + if (openTypes.isEmpty()) { + return; + } + + writeFieldName(out, OM_OPENTYPES); + writeStartArray(out); + for (int i = 0; i < openTypes.size(); i++) { + writeArrayItem(out); + OpenType ot = openTypes.get(i); + Class clazz = ot.getClass(); + if (clazz == SimpleType.class) { + // - For SimpleType instances: + // String // The name of the simple type. + writeSimpleString(out, ((SimpleType) ot).getTypeName()); + } else { + // - For all other OpenTypes: + // { + // openTypeClass: String, + // className: String, + // typeName: String, + // description: String, + // } + writeStartObject(out); + writeSimpleStringField(out, OM_OPENTYPECLASS, clazz.getName()); + writeSimpleStringField(out, OM_CLASSNAME, ot.getClassName()); + writeStringField(out, OM_TYPENAME, ot.getTypeName()); + writeStringField(out, OM_DESCRIPTION, ot.getDescription()); + if (clazz == ArrayType.class) { + // - ArrayType + // { + // dimension: Integer, + // elementType: Integer, + // } + ArrayType at = (ArrayType) ot; + writeIntField(out, OM_DIMENSION, at.getDimension()); + OpenType elemntType = at.getElementOpenType(); + writeOpenTypeField(out, OM_ELEMENTTYPE, elemntType, openTypes); + } else if (clazz == CompositeType.class) { + // - CompositeType + // { + // items: [ { key: String, description: String, type: Integer } *] + // } + CompositeType ct = (CompositeType) ot; + writeFieldName(out, OM_ITEMS); + writeStartArray(out); + for (String key : ct.keySet()) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_KEY, key); + writeStringField(out, OM_DESCRIPTION, ct.getDescription(key)); + writeOpenTypeField(out, OM_TYPE, ct.getType(key), openTypes); + writeEndObject(out); + } + writeEndArray(out); + } else if (clazz == TabularType.class) { + // - TabularType + // { + // rowType: Integer, + // indexNames: [String*] + // } + TabularType tt = (TabularType) ot; + writeOpenTypeField(out, OM_ROWTYPE, tt.getRowType(), openTypes); + writeFieldName(out, OM_INDEXNAMES); + writeStartArray(out); + for (String name : tt.getIndexNames()) { + writeArrayItem(out); + writeStringInternal(out, name); + } + writeEndArray(out); + } else { + // - For unknown OpenTypes + // { + // serialized: Base64 + // } + writeSerializedField(out, OM_SERIALIZED, ot); + } + writeEndObject(out); + } + } + writeEndArray(out); + } + + private Object readPOJOInternal(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONObject)) { + throwConversionException("readPOJOInternal() expects a JSONObject.", in); + } + JSONObject json = (JSONObject) in; + Object o = json.get(N_SERIALIZED); + if (o != null) { + // If the original object contains cycle, then java-deserialize it. + return readSerialized(o); + } + if (USE_BASE64_FOR_POJO) { + return null; + } + OpenType[] openTypes = readOpenTypes(json.get(N_OPENTYPES)); + return readPOJOValue(json.get(N_VALUE), json.get(N_TYPE), openTypes); + } + + private OpenType[] readOpenTypes(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readOpenTypes() expects a JSONArray.", in); + } + + JSONArray json = (JSONArray) in; + int size = json.size(); + OpenType[] openTypes = new OpenType[size]; + try { + for (int i = 0; i < size; i++) { + readOpenType(json, i, openTypes); + } + } catch (OpenDataException e) { + throwConversionException(e, in); + } + return openTypes; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private OpenType readOpenType(JSONArray json, int i, OpenType[] openTypes) throws ConversionException, ClassNotFoundException, OpenDataException { + if (openTypes[i] != null) { + return openTypes[i]; + } + Object o = json.get(i); + if (o instanceof String) { + openTypes[i] = Name2SimpleTypes.get(o); + if (openTypes[i] == null) { + throwConversionException("readOpenType() received an unknown simple type name.", o); + } + return openTypes[i]; + } + + if (!(o instanceof JSONObject)) { + throwConversionException("readOpenType() expects a JSONObject.", o); + } + + JSONObject type = (JSONObject) o; + Object serialized = type.get(N_SERIALIZED); + if (serialized != null) { + Object ret = readSerialized(serialized); + if (!(ret instanceof OpenType)) { + throwConversionException("readOpenType() expects an OpenType.", serialized); + } + return openTypes[i] = (OpenType) ret; + } + + String openTypeClass = readStringInternal(type.get(N_OPENTYPECLASS)); + if ("javax.management.openmbean.ArrayType".equals(openTypeClass)) { + int dimension = readIntInternal(type.get(N_DIMENSION)); + int elementType = readIntInternal(type.get(N_ELEMENTTYPE)); + if (elementType < 0 || elementType >= openTypes.length) { + throwConversionException("readOpenType() receives an out-of-range open type index.", type.get(N_ELEMENTTYPE)); + } + OpenType etype = readOpenType(json, elementType, openTypes); + if (etype instanceof SimpleType) { + return openTypes[i] = new ArrayType((SimpleType) etype, true); + } else { + return openTypes[i] = new ArrayType(dimension, etype); + } + } + + if ("javax.management.openmbean.CompositeType".equals(openTypeClass)) { + String typeName = readStringInternal(type.get(N_TYPENAME)); + String description = readStringInternal(type.get(N_DESCRIPTION)); + + o = type.get(N_ITEMS); + if (!(o instanceof JSONArray)) { + throwConversionException("readOpenType() expects a JSONArray.", o); + } + + JSONArray items = (JSONArray) o; + int size = items.size(); + String[] itemNames = new String[size]; + String[] itemDescriptions = new String[size]; + OpenType[] itemTypes = new OpenType[size]; + for (int p = 0; p < size; p++) { + o = items.get(p); + if (!(o instanceof JSONObject)) { + throwConversionException("readOpenType() expects a JSONObject.", o); + } + + JSONObject item = (JSONObject) o; + itemNames[p] = readStringInternal(item.get(N_KEY)); + itemDescriptions[p] = readStringInternal(item.get(N_DESCRIPTION)); + int itemType = readIntInternal(item.get(N_TYPE)); + if (itemType < 0 || itemType >= openTypes.length) { + throwConversionException("readOpenType() receives an out-of-range open type index.", item.get(N_TYPE)); + } + itemTypes[p] = readOpenType(json, itemType, openTypes); + } + return openTypes[i] = new CompositeType(typeName, description, itemNames, itemDescriptions, itemTypes); + } + + if ("javax.management.openmbean.TabularType".equals(openTypeClass)) { + String typeName = readStringInternal(type.get(N_TYPENAME)); + String description = readStringInternal(type.get(N_DESCRIPTION)); + int rowType = readIntInternal(type.get(N_ROWTYPE)); + if (rowType < 0 || rowType >= openTypes.length) { + throwConversionException("readOpenType() receives an out-of-range open type index.", type.get(N_ROWTYPE)); + } + + OpenType rtype = readOpenType(json, rowType, openTypes); + if (!(rtype instanceof CompositeType)) { + throwConversionException("readOpenType() expects a CompositeType.", rtype); + } + + o = type.get(N_INDEXNAMES); + if (!(o instanceof JSONArray)) { + throwConversionException("readOpenType() expects a JSONArray.", o); + } + + JSONArray names = (JSONArray) o; + int size = names.size(); + String[] indexNames = new String[size]; + for (int p = 0; p < size; p++) { + // Service change 119678: + // Original code: indexNames[i] = readStringInternal(names.get(p)); + indexNames[p] = readStringInternal(names.get(p)); + } + return openTypes[i] = new TabularType(typeName, description, (CompositeType) rtype, indexNames); + } + + throwConversionException("readOpenType() received an unknown open type class.", openTypeClass); + return null; + } + + private Object readPOJOValue(Object value, Object type, OpenType[] openTypes) throws ConversionException, ClassNotFoundException { + if (type == null) { + return null; + } + + if (type instanceof String) { + String tstr = (String) type; + TYPE t = SimpleValues.get(tstr); + if (t == null) { + if (tstr.length() > 0 && tstr.charAt(0) == '[') { + return readSimpleArray(value, Class.forName(tstr)); + } + throwConversionException("readPOJOValue() received an unknown class name.", type); + } + return readSimpleValue(value, t); + } + + if (!(type instanceof JSONObject)) { + throwConversionException("readPOJOValue() expects a JSONObject.", type); + } + + JSONObject tjson = (JSONObject) type; + Object o = tjson.get(N_VALUE); + if (o != null) { + return readSerialized(o); + } + + o = tjson.get(N_CLASSNAME); + if (o == null || !(o instanceof String)) { + throwConversionException("readPOJOValue() expects a String.", o); + } + + String className = (String) o; + TYPE t = StructuredClasses.get(className); + if (t == null) { + if (className.length() > 0 && className.charAt(0) == '[') { + return readComplexArray(value, Class.forName(className), tjson.get(N_ITEMS), openTypes); + } + throwConversionException("readPOJOValue() received an unknown class name.", o); + } + switch (t) { + case ArrayList: + return readCollectionValue(value, tjson, new ArrayList(), openTypes); + case LinkedList: + return readCollectionValue(value, tjson, new LinkedList(), openTypes); + case Vector: + return readCollectionValue(value, tjson, new Vector(), openTypes); + case HashSet: + return readCollectionValue(value, tjson, new HashSet(), openTypes); + case HashMap: + return readMapValue(value, tjson, new HashMap(), openTypes); + case Hashtable: + return readMapValue(value, tjson, new Hashtable(), openTypes); + case TreeMap: + return readMapValue(value, tjson, new TreeMap(), openTypes); + case CompositeDataSupport: + case TabularDataSupport: + int ot = readIntInternal(tjson.get(N_OPENTYPE)); + return readOpenData(value, openTypes[ot]); + } + + return null; + } + + private Object readSimpleValue(Object value, TYPE t) throws ConversionException { + if (value == null) { + return null; + } + if (!(value instanceof String)) { + throwConversionException("readSimpleValue() expects a String.", value); + } + String vstr = (String) value; + switch (t) { + case Byte: + return Byte.valueOf(vstr); + case Short: + return Short.valueOf(vstr); + case Integer: + return Integer.valueOf(vstr); + case Long: + return Long.valueOf(vstr); + case Float: + return Float.valueOf(vstr); + case Double: + return Double.valueOf(vstr); + case Character: + if (vstr.length() != 1) { + throwConversionException("readSimpleValue() expects a String of length 1 for Characgter.", value); + } + return Character.valueOf(vstr.charAt(0)); + case Boolean: + return Boolean.valueOf(vstr); + case String: + return vstr; + case BigInteger: + return new BigInteger(vstr); + case BigDecimal: + return new BigDecimal(vstr); + case Date: + return new Date(readLongInternal(vstr)); + case ObjectName: + return readObjectName(vstr); + case Object: + if (vstr.length() != 0) { + throwConversionException("readSimpleValue() expects an empty String for Object.", value); + } + return OBJECT; + } + return null; + } + + private Object readSimpleArray(Object value, Class array) throws ConversionException { + if (value == null) { + return null; + } + if (!(value instanceof JSONArray)) { + throwConversionException("readSimpleArray() expects a JSONArray.", value); + } + JSONArray json = (JSONArray) value; + int size = json.size(); + Class component = array.getComponentType(); + if (component.isArray()) { + Object[] ret = (Object[]) Array.newInstance(component, size); + for (int i = 0; i < size; i++) { + ret[i] = readSimpleArray(json.get(i), component); + } + return ret; + } + if (component.isPrimitive()) { + return readPrimitiveArray(json, SupportedClasses.get(component)); + } + + Object[] ret = (Object[]) Array.newInstance(component, size); + for (int i = 0; i < size; i++) { + ret[i] = readSimpleValue(json.get(i), SupportedClasses.get(component)); + } + return ret; + } + + private Object readPrimitiveArray(JSONArray value, TYPE type) throws ConversionException { + int size = value.size(); + switch (type) { + case _Byte: + case Byte: + byte[] bytes = new byte[size]; + for (int i = 0; i < size; i++) { + bytes[i] = readByteInternal(value.get(i)); + } + return bytes; + case _Short: + case Short: + short[] shorts = new short[size]; + for (int i = 0; i < size; i++) { + shorts[i] = readShortInternal(value.get(i)); + } + return shorts; + case _Integer: + case Integer: + int[] ints = new int[size]; + for (int i = 0; i < size; i++) { + ints[i] = readIntInternal(value.get(i)); + } + return ints; + case _Long: + case Long: + long[] longs = new long[size]; + for (int i = 0; i < size; i++) { + longs[i] = readLongInternal(value.get(i)); + } + return longs; + case _Float: + case Float: + float[] floats = new float[size]; + for (int i = 0; i < size; i++) { + floats[i] = readFloatInternal(value.get(i)); + } + return floats; + case _Double: + case Double: + double[] doubles = new double[size]; + for (int i = 0; i < size; i++) { + doubles[i] = readDoubleInternal(value.get(i)); + } + return doubles; + case _Character: + case Character: + char[] chars = new char[size]; + for (int i = 0; i < size; i++) { + chars[i] = readCharInternal(value.get(i)); + } + return chars; + case _Boolean: + case Boolean: + boolean[] bools = new boolean[size]; + for (int i = 0; i < size; i++) { + bools[i] = readBooleanInternal(value.get(i)); + } + return bools; + } + return null; + } + + private Object readComplexArray(Object value, Class array, Object type, OpenType[] openTypes) throws ConversionException, ClassNotFoundException { + if (!(value instanceof JSONArray)) { + throwConversionException("readComplexArray() expects a JSONArray.", value); + } + if (!(type instanceof JSONArray)) { + throwConversionException("readComplexArray() expects a JSONArray.", type); + } + JSONArray vjson = (JSONArray) value; + JSONArray tjson = (JSONArray) type; + int size = tjson.size(); + if (size != vjson.size()) { + throwConversionException("readComplexArray() expects same size from value and type arrays.", null); + } + + Object[] ret = (Object[]) Array.newInstance(array.getComponentType(), size); + for (int i = 0; i < size; i++) { + ret[i] = readPOJOValue(vjson.get(i), tjson.get(i), openTypes); + } + return ret; + } + + private Object readCollectionValue(Object value, JSONObject t, Collection ret, OpenType[] openTypes) throws ConversionException, ClassNotFoundException { + Object type = t.get(N_ITEMS); + if (!(value instanceof JSONArray)) { + throwConversionException("readCollectionValue() expects a JSONArray.", value); + } + if (!(type instanceof JSONArray)) { + throwConversionException("readCollectionValue() expects a JSONArray.", type); + } + + JSONArray vjson = (JSONArray) value; + JSONArray tjson = (JSONArray) type; + if (vjson.size() != tjson.size()) { + throwConversionException("readCollectionValue() expects same size from value and type arrays.", null); + } + for (int i = 0; i < tjson.size(); i++) { + ret.add(readPOJOValue(vjson.get(i), tjson.get(i), openTypes)); + } + return ret; + } + + private Object readMapValue(Object value, JSONObject t, Map ret, OpenType[] openTypes) throws ConversionException, ClassNotFoundException { + if (value == null) { + return ret; + } + + Object simple = t.get(N_SIMPLEKEY); + + if (simple == null) { + return ret; + } + + if (!(simple instanceof Boolean)) { + throwConversionException("readMapValue() expects a Boolean.", simple); + } + boolean simpleKey = ((Boolean) simple).booleanValue(); + + Object type = t.get(N_ENTRIES); + if (!(type instanceof JSONArray)) { + throwConversionException("readMapValue() expects a JSONArray.", type); + } + JSONArray tjson = (JSONArray) type; + + if (simpleKey) { + if (!(value instanceof JSONObject)) { + throwConversionException("readMapValue() expects a JSONObject.", value); + } + JSONObject vjson = (JSONObject) value; + if (tjson.size() != vjson.size()) { + throwConversionException("readMapValue() expects same size from value and type arrays.", null); + } + for (Object e : tjson) { + if (!(e instanceof JSONObject)) { + throwConversionException("readMapValue() expects a JSONObject.", e); + } + JSONObject entry = (JSONObject) e; + Object k = entry.get(N_KEY); + if (!(k instanceof String)) { + throwConversionException("readMapValue() expects a String.", k); + } + String key = (String) k; + ret.put(readPOJOValue(key, entry.get(N_KEYTYPE), openTypes), + readPOJOValue(vjson.get(key), entry.get(N_VALUE), openTypes)); + } + } else { + if (!(value instanceof JSONArray)) { + throwConversionException("readMapValue() expects a JSONArray.", value); + } + JSONArray vjson = (JSONArray) value; + if (tjson.size() != vjson.size()) { + throwConversionException("readMapValue() expects same size from value and type arrays.", null); + } + for (int i = 0; i < tjson.size(); i++) { + Object te = tjson.get(i); + if (!(te instanceof JSONObject)) { + throwConversionException("readMapValue() expects a JSONObject.", te); + } + JSONObject tentry = (JSONObject) te; + Object ve = vjson.get(i); + if (!(ve instanceof JSONObject)) { + throwConversionException("readMapValue() expects a JSONObject.", ve); + } + JSONObject ventry = (JSONObject) ve; + ret.put(readPOJOValue(ventry.get(N_KEY), tentry.get(N_KEYTYPE), openTypes), + readPOJOValue(ventry.get(N_VALUE), tentry.get(N_VALUE), openTypes)); + } + } + return ret; + } + + private Object readOpenData(Object value, OpenType openType) throws ConversionException { + if (value == null) { + return null; + } + if (openType instanceof SimpleType) { + return readSimpleValue(value, SimpleOpenTypes.get(openType)); + } + if (openType instanceof ArrayType) { + ArrayType at = (ArrayType) openType; + OpenType elementOT = at.getElementOpenType(); + Class elementType = null; + try { + elementType = Class.forName(elementOT.getClassName()); + } catch (ClassNotFoundException e) { + // Should never happen. All open type names are known. + } + + if (!(value instanceof JSONArray)) { + throwConversionException("readOpenData() expects a JSONArray.", value); + } + JSONArray json = (JSONArray) value; + + if (at.isPrimitiveArray()) { + return readPrimitiveArray(json, SupportedClasses.get(elementType)); + } + + int size = json.size(); + Object[] ret = (Object[]) Array.newInstance(elementType, size); + for (int i = 0; i < size; i++) { + ret[i] = readOpenData(json.get(i), elementOT); + } + return ret; + } else if (openType instanceof CompositeType) { + return readCompositeData(value, (CompositeType) openType); + } else if (openType instanceof TabularType) { + TabularType tt = (TabularType) openType; + CompositeType row = tt.getRowType(); + if (!(value instanceof JSONArray)) { + throwConversionException("readOpenData() expects a JSONArray.", value); + } + JSONArray json = (JSONArray) value; + + TabularDataSupport ret = new TabularDataSupport(tt); + for (Object o : json) { + ret.put(readCompositeData(o, row)); + } + return ret; + } + return null; + } + + private CompositeData readCompositeData(Object value, CompositeType ct) throws ConversionException { + Set keys = ct.keySet(); + if (!(value instanceof JSONObject)) { + throwConversionException("readCompositeData() expects a JSONObject.", value); + } + JSONObject json = (JSONObject) value; + + int size = keys.size(); + if (size != json.size()) { + throwConversionException("readCompositeData() expects the same number of entries as in the type.", json); + } + + String[] names = new String[size]; + Object[] values = new Object[size]; + int i = 0; + for (String key : keys) { + names[i] = key; + values[i++] = readOpenData(json.get(key), ct.getType(key)); + } + try { + return new CompositeDataSupport(ct, names, values); + } catch (OpenDataException e) { + // Should never happen. All names/values are constructed based + // on the open type. + } + return null; + } + + private void writePOJOArrayField(OutputStream out, byte[] name, Object[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writePOJOArray(out, value); + } + + private void writePOJOArray(OutputStream out, Object[] value) throws IOException { + writeStartArray(out); + for (Object o : value) { + writeArrayItem(out); + writePOJOInternal(out, o); + } + writeEndArray(out); + } + + private Object[] readPOJOArray(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readPOJOArray() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + int size = json.size(); + Object[] ret = new Object[size]; + for (int i = 0; i < size; i++) { + ret[i] = readPOJOInternal(json.get(i)); + } + return ret; + } + + private void writeObjectNameListField(OutputStream out, byte[] name, List value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (ObjectName item : value) { + writeArrayItem(out); + writeObjectName(out, item); + } + writeEndArray(out); + } + + private List readObjectNameList(Object in) throws ConversionException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readObjectNameList() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + int size = json.size(); + List ret = new ArrayList(size); + for (Object o : json) { + ret.add(readObjectName(o)); + } + return ret; + } + + private void writeObjectNameField(OutputStream out, byte[] name, ObjectName value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeObjectName(out, value); + } + + private void writeObjectName(OutputStream out, ObjectName value) throws IOException { + // ObjectName has no known sub-class. + writeStringInternal(out, value.toString()); + } + + private ObjectName readObjectName(Object in) throws ConversionException { + if (in == null) { + return null; + } + try { + return new ObjectName(readStringInternal(in)); + } catch (MalformedObjectNameException e) { + throwConversionException(e, in); + return null; + } + } + + private ObjectInstanceWrapper readObjectInstanceInternal(Object in) throws ConversionException { + if (!(in instanceof JSONObject)) { + throwConversionException("readObjectInstanceInternal() expects a JSONObject.", in); + } + JSONObject json = (JSONObject) in; + ObjectName objectName = readObjectName(json.get(N_OBJECTNAME)); + String className = readStringInternal(json.get(N_CLASSNAME)); + ObjectInstanceWrapper ret = new ObjectInstanceWrapper(); + ret.objectInstance = new ObjectInstance(objectName, className); + ret.mbeanInfoURL = readStringInternal(json.get(N_URL)); + return ret; + } + + private void writeDescriptor(OutputStream out, byte[] name, Descriptor value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartObject(out); + String[] names = value.getFieldNames(); + writeStringArrayField(out, OM_NAMES, names); + writePOJOArrayField(out, OM_VALUES, value.getFieldValues(names)); + writeEndObject(out); + } + + private Descriptor readDescriptor(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONObject)) { + throwConversionException("readDescriptor() expects a JSONObject.", in); + } + JSONObject json = (JSONObject) in; + String[] names = readStringArrayInternal(json.get(N_NAMES)); + Object[] values = readPOJOArray(json.get(N_VALUES)); + // All descriptors (on the client side) are immutable + return new ImmutableDescriptor(names, values); + } + + private void writeAttributes(OutputStream out, byte[] name, MBeanAttributeInfo[] value, Map urls) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (MBeanAttributeInfo item : value) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writeStringField(out, OM_TYPE, item.getType()); + writeStringField(out, OM_DESCRIPTION, item.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, item.getDescriptor()); + writeBooleanField(out, OM_ISIS, item.isIs()); + writeBooleanField(out, OM_ISREADABLE, item.isReadable()); + writeBooleanField(out, OM_ISWRITABLE, item.isWritable()); + assert urls.containsKey(item.getName()); + writeStringField(out, OM_URL, urls.get(item.getName())); + writeEndObject(out); + } + writeEndArray(out); + } + + private MBeanAttributeInfo[] readAttributes(Object in, Map urls) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readAttributes() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + MBeanAttributeInfo[] ret = new MBeanAttributeInfo[json.size()]; + int pos = 0; + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readAttributes() expects a JSONObject.", item); + } + JSONObject value = (JSONObject) item; + String name = readStringInternal(value.get(N_NAME)); + String type = readStringInternal(value.get(N_TYPE)); + String description = readStringInternal(value.get(N_DESCRIPTION)); + boolean isReadable = readBooleanInternal(value.get(N_ISREADABLE)); + boolean isWritable = readBooleanInternal(value.get(N_ISWRITABLE)); + boolean isIs = readBooleanInternal(value.get(N_ISIS)); + Descriptor descriptor = readDescriptor(value.get(N_DESCRIPTOR)); + ret[pos++] = new MBeanAttributeInfo(name, type, description, + isReadable, isWritable, isIs, + descriptor); + urls.put(name, readStringInternal(value.get(N_URL))); + } + return ret; + } + + private void writeConstructors(OutputStream out, byte[] name, MBeanConstructorInfo[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (MBeanConstructorInfo item : value) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writeStringField(out, OM_DESCRIPTION, item.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, item.getDescriptor()); + writeParameters(out, OM_SIGNATURE, item.getSignature()); + writeEndObject(out); + } + writeEndArray(out); + } + + private MBeanConstructorInfo[] readConstructors(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readConstructors() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + MBeanConstructorInfo[] ret = new MBeanConstructorInfo[json.size()]; + int pos = 0; + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readConstructors() expects a JSONObject.", item); + } + JSONObject value = (JSONObject) item; + String name = readStringInternal(value.get(N_NAME)); + String description = readStringInternal(value.get(N_DESCRIPTION)); + MBeanParameterInfo[] signature = readParameters(value.get(N_SIGNATURE)); + Descriptor descriptor = readDescriptor(value.get(N_DESCRIPTOR)); + ret[pos++] = new MBeanConstructorInfo(name, description, + signature, descriptor); + } + return ret; + } + + private void writeParameters(OutputStream out, byte[] name, MBeanParameterInfo[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (MBeanParameterInfo item : value) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writeStringField(out, OM_TYPE, item.getType()); + writeStringField(out, OM_DESCRIPTION, item.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, item.getDescriptor()); + writeEndObject(out); + } + writeEndArray(out); + } + + private MBeanParameterInfo[] readParameters(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readParameters() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + MBeanParameterInfo[] ret = new MBeanParameterInfo[json.size()]; + int pos = 0; + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readParameters() expects a JSONObject.", item); + } + JSONObject value = (JSONObject) item; + String name = readStringInternal(value.get(N_NAME)); + String type = readStringInternal(value.get(N_TYPE)); + String description = readStringInternal(value.get(N_DESCRIPTION)); + Descriptor descriptor = readDescriptor(value.get(N_DESCRIPTOR)); + ret[pos++] = new MBeanParameterInfo(name, type, description, + descriptor); + } + return ret; + } + + private void writeNotifications(OutputStream out, byte[] name, MBeanNotificationInfo[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (MBeanNotificationInfo item : value) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writeStringField(out, OM_DESCRIPTION, item.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, item.getDescriptor()); + writeStringArrayField(out, OM_NOTIFTYPES, item.getNotifTypes()); + writeEndObject(out); + } + writeEndArray(out); + } + + private MBeanNotificationInfo[] readNotifications(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readNotifications() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + MBeanNotificationInfo[] ret = new MBeanNotificationInfo[json.size()]; + int pos = 0; + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readNotifications() expects a JSONObject.", item); + } + JSONObject value = (JSONObject) item; + String name = readStringInternal(value.get(N_NAME)); + String description = readStringInternal(value.get(N_DESCRIPTION)); + String[] notifTypes = readStringArrayInternal(value.get(N_NOTIFTYPES)); + Descriptor descriptor = readDescriptor(value.get(N_DESCRIPTOR)); + ret[pos++] = new MBeanNotificationInfo(notifTypes, name, description, + descriptor); + } + return ret; + } + + private void writeOperations(OutputStream out, byte[] name, MBeanOperationInfo[] value, Map urls) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (MBeanOperationInfo item : value) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writeStringField(out, OM_DESCRIPTION, item.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, item.getDescriptor()); + writeIntField(out, OM_IMPACT, item.getImpact()); + writeStringField(out, OM_RETURNTYPE, item.getReturnType()); + writeParameters(out, OM_SIGNATURE, item.getSignature()); + assert urls.containsKey(item.getName()); + writeStringField(out, OM_URL, urls.get(item.getName())); + writeEndObject(out); + } + writeEndArray(out); + } + + private MBeanOperationInfo[] readOperations(Object in, Map urls) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readOperations() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + MBeanOperationInfo[] ret = new MBeanOperationInfo[json.size()]; + int pos = 0; + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readOperations() expects a JSONObject.", item); + } + JSONObject value = (JSONObject) item; + String description = readStringInternal(value.get(N_DESCRIPTION)); + String name = readStringInternal(value.get(N_NAME)); + int impact = readIntInternal(value.get(N_IMPACT)); + String returnType = readStringInternal(value.get(N_RETURNTYPE)); + MBeanParameterInfo[] signature = readParameters(value.get(N_SIGNATURE)); + Descriptor descriptor = readDescriptor(value.get(N_DESCRIPTOR)); + ret[pos++] = new MBeanOperationInfo(name, description, signature, + returnType, impact, descriptor); + urls.put(name, readStringInternal(value.get(N_URL))); + } + return ret; + } + + private void writeNotificationFiltersField(OutputStream out, byte[] name, NotificationFilter[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeNotificationFiltersInternal(out, value); + } + + private void writeNotificationFiltersInternal(OutputStream out, NotificationFilter[] value) throws IOException { + writeStartArray(out); + if (value != null) { + for (NotificationFilter item : value) { + writeArrayItem(out); + writeNotificationFilterInternal(out, item, false); + } + } + writeEndArray(out); + } + + private void writeNotificationFilterInternal(OutputStream out, NotificationFilter value, boolean allowOther) throws IOException { + assert value != null; + writeStartObject(out); + Class clazz = value.getClass(); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + if (clazz == AttributeChangeNotificationFilter.class) { + writeFieldName(out, OM_ENABLED); + writeStartArray(out); + for (String e : ((AttributeChangeNotificationFilter) value).getEnabledAttributes()) { + writeArrayItem(out); + writeStringInternal(out, e); + } + writeEndArray(out); + } else if (clazz == MBeanServerNotificationFilter.class) { + MBeanServerNotificationFilter filter = (MBeanServerNotificationFilter) value; + byte[] fieldName = OM_ENABLED; + Vector list = filter.getEnabledObjectNames(); + if (list == null) { + fieldName = OM_DISABLED; + list = filter.getDisabledObjectNames(); + } + writeFieldName(out, fieldName); + writeStartArray(out); + for (ObjectName e : list) { + writeArrayItem(out); + writeStringInternal(out, e.toString()); + } + writeEndArray(out); + writeFieldName(out, OM_TYPES); + writeStartArray(out); + for (String e : ((MBeanServerNotificationFilter) value).getEnabledTypes()) { + writeArrayItem(out); + writeStringInternal(out, e); + } + writeEndArray(out); + } else if (clazz == NotificationFilterSupport.class) { + writeFieldName(out, OM_TYPES); + writeStartArray(out); + for (String e : ((NotificationFilterSupport) value).getEnabledTypes()) { + writeArrayItem(out); + writeStringInternal(out, e); + } + writeEndArray(out); + } else if (allowOther) { + writeSerializedField(out, OM_SERIALIZED, value); + } else { + // The caller guarantees that only the known classes are used. + assert false; + } + writeEndObject(out); + } + + private void writeNotificationFilterField(OutputStream out, byte[] name, NotificationFilter value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeNotificationFilterInternal(out, value, true); + } + + private NotificationFilter[] readNotificationFiltersInternal(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readNotificationFiltersInternal() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + NotificationFilter[] ret = new NotificationFilter[json.size()]; + int pos = 0; + for (Object item : json) { + if ((ret[pos++] = readNotificationFilterInternal(item, false)) == null) { + throwConversionException("readNotificationFilterInternal() received a null NotificationListener.", in); + } + } + return ret; + } + + private NotificationFilter readNotificationFilterInternal(Object in, boolean allowOther) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONObject)) { + throwConversionException("readNotificationFilterInternal() expects a JSONObject.", in); + } + JSONObject json = (JSONObject) in; + String className = readStringInternal(json.get(N_CLASSNAME)); + if ("javax.management.AttributeChangeNotificationFilter".equals(className)) { + AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter(); + String[] enabled = readStringArrayInternal(json.get(N_ENABLED)); + for (String item : enabled) { + filter.enableAttribute(item); + } + return filter; + } else if ("javax.management.relation.MBeanServerNotificationFilter".equals(className)) { + MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter(); + String[] enabled = readStringArrayInternal(json.get(N_ENABLED)); + if (enabled != null) { + for (String item : enabled) { + filter.enableObjectName(readObjectName(item)); + } + } else { + String[] disabled = readStringArrayInternal(json.get(N_DISABLED)); + + if (disabled != null) { + if (disabled.length == 0) { + filter.enableAllObjectNames(); + } else { + for (String item : disabled) { + filter.disableObjectName(readObjectName(item)); + } + } + } + } + String[] types = readStringArrayInternal(json.get(N_TYPES)); + for (String item : types) { + filter.enableType(item); + } + return filter; + } else if ("javax.management.NotificationFilterSupport".equals(className)) { + NotificationFilterSupport filter = new NotificationFilterSupport(); + String[] types = readStringArrayInternal(json.get(N_TYPES)); + for (String item : types) { + filter.enableType(item); + } + return filter; + } else if (allowOther) { + Object o = readSerialized(json.get(N_SERIALIZED)); + if (!(o instanceof NotificationFilter)) { + throwConversionException("readNotificationFilterInternal() expects a NotificationFilter.", in); + } + return (NotificationFilter) o; + } + throwConversionException("readNotificationFilterInternal() received an unknown filter class.", className); + return null; + } + + private void utf8EncodeError(Object json) throws ConversionException { + throwConversionException("encodeStringAsBase64Internal() can't encode the value in UTF-8.", json); + } + + private void base64DecodeError(Object json) throws ConversionException { + throwConversionException("readSerialized() received invalid base64 string.", json); + } + + private static String combineErrorMessage(String message, Object json) throws ConversionException { + try { + if (json instanceof JSONArtifact) { + message = message + "\n\t" + ((JSONArtifact) json).serialize(true); + } else if (json != null) { + message = message + "\n\t" + json.toString(); + } + } catch (IOException e) { + // Should never happen + } + return message; + } + + private static void throwConversionException(String message, Object json) throws ConversionException { + throw new ConversionException(combineErrorMessage(message, json)); + } + + public static void throwConversionException(Throwable t, Object json) throws ConversionException { + throw new ConversionException(combineErrorMessage(t.getMessage(), json), t); + } + + static class DefaultSerializationHelper implements SerializationHelper { + + @Override + public Object readObject(Object in, int blen, byte[] binary) throws ClassNotFoundException, ConversionException { + try { + return new ObjectInputStream(new ByteArrayInputStream(binary, 0, blen)).readObject(); + } catch (IOException e) { + throwConversionException(e, in); + return null; + } + } + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationRecord.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationRecord.java new file mode 100755 index 000000000000..e3fb940bbaa8 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationRecord.java @@ -0,0 +1,52 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.converter; + +import javax.management.Notification; +import javax.management.ObjectName; + +/** + * Data structure containing a JMX Notification and information about which target it came from. + */ +public final class NotificationRecord { + + private final Notification n; + private final NotificationTargetInformation nti; + + public NotificationRecord(Notification n, ObjectName name) { + this.n = n; + this.nti = new NotificationTargetInformation(name); + } + + public NotificationRecord(Notification n, String name) { + this.n = n; + this.nti = new NotificationTargetInformation(name); + } + + public NotificationRecord(Notification n, ObjectName name, String hostName, String serverName, String serverUserDir) { + this.n = n; + this.nti = new NotificationTargetInformation(name, hostName, serverName, serverUserDir); + } + + public NotificationRecord(Notification n, String name, String hostName, String serverName, String serverUserDir) { + this.n = n; + this.nti = new NotificationTargetInformation(name, hostName, serverName, serverUserDir); + } + + public Notification getNotification() { + return n; + } + + public NotificationTargetInformation getNotificationTargetInformation() { + return nti; + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationTargetInformation.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationTargetInformation.java new file mode 100755 index 000000000000..0ff818359b5c --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationTargetInformation.java @@ -0,0 +1,120 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.converter; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import javax.management.ObjectName; + +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; + +/** + * Routing information for a JMX Notification which helps the connector + * to correlate a Notification with the appropriate NotificationListener. + * Combined with the ObjectName, the routing information provides a unique + * identifier for an MBean in a cluster of servers. + */ +public final class NotificationTargetInformation { + + private ObjectName name; + private final String nameAsString; + private final Map routingInfo; + + public NotificationTargetInformation(ObjectName name) { + this(name.getCanonicalName()); + this.name = name; + } + + public NotificationTargetInformation(String name) { + this.nameAsString = name; + this.routingInfo = null; + } + + public NotificationTargetInformation(ObjectName name, String hostName, String serverName, String serverUserDir) { + this(name.getCanonicalName(), hostName, serverName, serverUserDir); + this.name = name; + } + + public NotificationTargetInformation(String name, String hostName, String serverName, String serverUserDir) { + Map routingInfo = new HashMap(); + routingInfo.put(ClientProvider.ROUTING_KEY_HOST_NAME, hostName); + routingInfo.put(ClientProvider.ROUTING_KEY_SERVER_NAME, serverName); + routingInfo.put(ClientProvider.ROUTING_KEY_SERVER_USER_DIR, serverUserDir); + this.nameAsString = name; + this.routingInfo = Collections.unmodifiableMap(routingInfo); + } + + public NotificationTargetInformation(ObjectName name, Map routingInfo) { + this(name.getCanonicalName(), routingInfo); + this.name = name; + } + + public NotificationTargetInformation(String name, Map routingInfo) { + this.nameAsString = name; + this.routingInfo = (routingInfo != null) ? Collections.unmodifiableMap(new HashMap(routingInfo)) : null; + } + + // Returns null if this object was not constructed with an ObjectName. + public ObjectName getName() { + return name; + } + + public String getNameAsString() { + return nameAsString; + } + + public Map getRoutingInformation() { + return routingInfo; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof NotificationTargetInformation)) { + return false; + } + NotificationTargetInformation other = (NotificationTargetInformation) obj; + return (nameAsString == other.nameAsString || (nameAsString != null && nameAsString.equals(other.nameAsString))) && + (routingInfo == other.routingInfo || (routingInfo != null && routingInfo.equals(other.routingInfo))); + } + + @Override + public int hashCode() { + if (routingInfo != null) { + int hash = routingInfo.hashCode() * 37; + if (nameAsString != null) { + hash += nameAsString.hashCode(); + } + return hash; + } else if (nameAsString != null) { + return nameAsString.hashCode(); + } + return 0; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("[ObjectName: "); + sb.append(nameAsString); + if (routingInfo != null) { + sb.append(", RoutingInfo: "); + sb.append(routingInfo); + } + sb.append(']'); + return sb.toString(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/SerializationHelper.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/SerializationHelper.java new file mode 100755 index 000000000000..4e96f87549e1 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/SerializationHelper.java @@ -0,0 +1,20 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.converter; + +import com.ibm.ws.jmx.connector.datatypes.ConversionException; + +public interface SerializationHelper { + + public Object readObject(Object in, int blen, byte[] binary) throws ClassNotFoundException, ConversionException; + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/package-info.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/package-info.java new file mode 100755 index 000000000000..5517c821851d --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/package-info.java @@ -0,0 +1,17 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.0 + */ +@org.osgi.annotation.versioning.Version("1.0") +package com.ibm.ws.jmx.connector.converter; + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ConversionException.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ConversionException.java new file mode 100755 index 000000000000..d0524432ad5f --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ConversionException.java @@ -0,0 +1,24 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +public final class ConversionException extends Exception { + private static final long serialVersionUID = -2548273252032545919L; + + public ConversionException(String message) { + super(message); + } + + public ConversionException(String message, Throwable t) { + super(message, t); + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/CreateMBean.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/CreateMBean.java new file mode 100755 index 000000000000..dcc068e985e6 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/CreateMBean.java @@ -0,0 +1,21 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import javax.management.ObjectName; + +public final class CreateMBean { + public ObjectName objectName, loaderName; + public String className, signature[]; + public Object params[]; + public boolean useLoader, useSignature; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/Invocation.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/Invocation.java new file mode 100755 index 000000000000..d886c59a24ec --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/Invocation.java @@ -0,0 +1,20 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +/** + * + */ +public final class Invocation { + public String signature[]; + public Object params[]; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/JMXServerInfo.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/JMXServerInfo.java new file mode 100755 index 000000000000..f522876b1e4e --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/JMXServerInfo.java @@ -0,0 +1,20 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012-2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +/** + * + */ +public final class JMXServerInfo { + public int version; + public String mbeansURL, createMBeanURL, mbeanCountURL, defaultDomainURL, domainsURL, notificationsURL, instanceOfURL, fileTransferURL, apiURL, graphURL; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanInfoWrapper.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanInfoWrapper.java new file mode 100755 index 000000000000..e27806290579 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanInfoWrapper.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import java.util.Map; + +import javax.management.MBeanInfo; + +/** + * + */ +public final class MBeanInfoWrapper { + public MBeanInfo mbeanInfo; + public String attributesURL; + public Map attributeURLs, operationURLs; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanQuery.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanQuery.java new file mode 100755 index 000000000000..b329fa0e82c6 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanQuery.java @@ -0,0 +1,24 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import javax.management.ObjectName; +import javax.management.QueryExp; + +/** + * + */ +public final class MBeanQuery { + public ObjectName objectName; + public QueryExp queryExp; + public String className; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationArea.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationArea.java new file mode 100755 index 000000000000..7d1a199fb530 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationArea.java @@ -0,0 +1,19 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +/** + * + */ +public final class NotificationArea { + public String registrationsURL, serverRegistrationsURL, inboxURL, clientURL; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationRegistration.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationRegistration.java new file mode 100755 index 000000000000..87adcd57d0c4 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationRegistration.java @@ -0,0 +1,23 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import javax.management.NotificationFilter; +import javax.management.ObjectName; + +/** + * + */ +public final class NotificationRegistration { + public ObjectName objectName; + public NotificationFilter filters[]; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationSettings.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationSettings.java new file mode 100755 index 000000000000..e82f19b36372 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationSettings.java @@ -0,0 +1,17 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +public final class NotificationSettings { + public int deliveryInterval; + public int inboxExpiry; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ObjectInstanceWrapper.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ObjectInstanceWrapper.java new file mode 100755 index 000000000000..c7521a71bc8b --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ObjectInstanceWrapper.java @@ -0,0 +1,22 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import javax.management.ObjectInstance; + +/** + * + */ +public final class ObjectInstanceWrapper { + public ObjectInstance objectInstance; + public String mbeanInfoURL; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ServerNotificationRegistration.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ServerNotificationRegistration.java new file mode 100755 index 000000000000..d45ca1e35977 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ServerNotificationRegistration.java @@ -0,0 +1,27 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import javax.management.NotificationFilter; +import javax.management.ObjectName; + +public final class ServerNotificationRegistration { + public enum Operation { + Add, RemoveAll, RemoveSpecific + } + + public Operation operation; + public ObjectName objectName, listener; + public NotificationFilter filter; + public Object handback; + public int filterID, handbackID; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/package-info.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/package-info.java new file mode 100755 index 000000000000..735402c84334 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/package-info.java @@ -0,0 +1,17 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.0 + */ +@org.osgi.annotation.versioning.Version("1.0") +package com.ibm.ws.jmx.connector.datatypes; + diff --git a/dev/com.ibm.ws.jmx_fat/.classpath b/dev/com.ibm.ws.jmx_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.jmx_fat/.classpath.gradle b/dev/com.ibm.ws.jmx_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.jmx_fat/.gitignore b/dev/com.ibm.ws.jmx_fat/.gitignore new file mode 100644 index 000000000000..27e131e35a6b --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.jmx_fat/.project b/dev/com.ibm.ws.jmx_fat/.project new file mode 100755 index 000000000000..7aea1fcf31c8 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.jmx_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..2d37f3472a86 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +encoding/=UTF-8 +eclipse.preferences.version=1 diff --git a/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..462d94d2e7b7 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert diff --git a/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..bf3c1827a5dc --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +sp_cleanup.add_missing_override_annotations=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.remove_unnecessary_nls_tags=true +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.sort_members=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_unused_private_members=false +org.eclipse.jdt.ui.staticondemandthreshold=99 +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_annotations=true +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.organize_imports=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.always_use_blocks=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.never_use_blocks=false +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members_all=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.always_use_this_for_non_static_field_access=false +eclipse.preferences.version=1 +org.eclipse.jdt.ui.ondemandthreshold=99 +sp_cleanup.add_missing_methods=false +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.format_source_code=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.correct_indentation=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ignorelowercasenames=true +sp_cleanup.add_serial_version_id=false diff --git a/dev/com.ibm.ws.jmx_fat/bnd.bnd b/dev/com.ibm.ws.jmx_fat/bnd.bnd new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.jmx_fat/bnd.bnd.gradle b/dev/com.ibm.ws.jmx_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.jmx_fat/build-test.xml b/dev/com.ibm.ws.jmx_fat/build-test.xml new file mode 100755 index 000000000000..64159bf99af6 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/build-test.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.resolver_test/build.nogradle b/dev/com.ibm.ws.jmx_fat/build.gradle similarity index 100% rename from dev/com.ibm.ws.repository.resolver_test/build.nogradle rename to dev/com.ibm.ws.jmx_fat/build.gradle diff --git a/dev/com.ibm.ws.jmx_fat/delivery.sets b/dev/com.ibm.ws.jmx_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/AttachSupport.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/AttachSupport.java new file mode 100755 index 000000000000..8b73d8a9d3b1 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/AttachSupport.java @@ -0,0 +1,128 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat; + +import java.io.File; +import java.lang.reflect.UndeclaredThrowableException; +import java.util.List; +import java.util.Properties; + +import javax.management.MBeanServerConnection; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +import com.ibm.ws.jmx.fat.attach.VirtualMachineDescriptorProxy; +import com.ibm.ws.jmx.fat.attach.VirtualMachineProxy; +import com.ibm.ws.jmx.fat.attach.VirtualMachineProxyHelper; + +/** + * + */ +public class AttachSupport { + + private static String LOCAL_CONNECTOR_ADDRESS = "com.sun.management.jmxremote.localConnectorAddress"; + + MBeanServerConnection mbsc = null; + + public AttachSupport() throws Exception { + System.setProperty("com.ibm.tools.attach.timeout", "5000"); + List vms = VirtualMachineProxyHelper.list(); + System.out.println("Found the following vms: " + vms); + + for (VirtualMachineDescriptorProxy vmd : vms) { + VirtualMachineProxy vm = null; + try { + vm = VirtualMachineProxyHelper.attach(vmd); + } catch (Exception e) { + continue; + } + + System.out.println("Working with vm " + vm); + + try { + Properties props = vm.getSystemProperties(); + Object bvtServer = props.getProperty("com.ibm.ws.jmx.test.fat"); + System.out.println("Found system property " + bvtServer); + + if (bvtServer != null) { + // Search for the value of "localConnectorAddress" within the VM's system properties and agent properties. + // Oracle's examples check the agent properties but have been finding in practice that the value is found + // from a system property. Trying both in case agent properties are used on some platforms to expose + // the value of "localConnectorAddress". + String connectorAddr = vm.getSystemProperties().getProperty(LOCAL_CONNECTOR_ADDRESS); + System.out.println("Local connector address (system property): " + connectorAddr); + + if (connectorAddr == null) { + connectorAddr = vm.getAgentProperties().getProperty(LOCAL_CONNECTOR_ADDRESS); + System.out.println("Local connector address (agent property): " + connectorAddr); + + // It looks like the 'management' agent hasn't been loaded. Try to load it and read the system property again. + if (connectorAddr == null) { + long start = System.currentTimeMillis(); + System.out.println("Starting the management agent ..." + start); + + final String javaHome = vm.getSystemProperties().getProperty("java.home"); + // Try to load the agent jar from "java.home"/lib. Assumes that "java.home" points to JDK_BASE_DIR/jre. + String agent = javaHome + File.separator + "lib" + File.separator + "management-agent.jar"; + try { + vm.loadAgent(agent); + } catch (UndeclaredThrowableException e) { + Throwable t = e.getCause(); + if (t != null && "AgentLoadException".equals(t.getClass().getSimpleName())) { + // The agent wasn't found. Perhaps "java.home" is pointing to the JDK_BASE_DIR. Try again with "java.home"/jre/lib. + agent = javaHome + File.separator + "jre" + File.separator + "lib" + File.separator + "management-agent.jar"; + vm.loadAgent(agent); + } else { + throw e; + } + } + long end = System.currentTimeMillis(); + System.out.println("Management agent started... " + end + ", took ~" + ((end - start) / 1000) + " seconds"); + + connectorAddr = vm.getSystemProperties().getProperty(LOCAL_CONNECTOR_ADDRESS); + System.out.println("Local connector address (system property): " + connectorAddr); + + if (connectorAddr == null) { + connectorAddr = vm.getAgentProperties().getProperty(LOCAL_CONNECTOR_ADDRESS); + System.out.println("Local connector address (agent property): " + connectorAddr); + } + } + } + + if (connectorAddr != null) { + JMXServiceURL url = new JMXServiceURL(connectorAddr); + System.out.println("JMXServiceURL: " + url); + + JMXConnector connector = JMXConnectorFactory.connect(url); + System.out.println("JMXConnector: " + connector); + + mbsc = connector.getMBeanServerConnection(); + System.out.println("MBeanServerConnection: " + mbsc); + } + return; + } + } finally { + try { + vm.detach(); + } catch (Exception e) { + // Detach failed. Ignore and move on to the next VM. + } + } + } + throw new RuntimeException("Could not find the server VM"); + } + + public MBeanServerConnection getMBeanServer() { + return mbsc; + } +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/ClientConnector.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/ClientConnector.java new file mode 100755 index 000000000000..c3bfc43ca173 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/ClientConnector.java @@ -0,0 +1,60 @@ +package com.ibm.ws.jmx.fat; + +import java.io.IOException; +import java.net.MalformedURLException; + +import javax.management.MBeanServerConnection; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +/** + * + */ +public class ClientConnector { + + MBeanServerConnection mbsc = null; + + public ClientConnector() { + int port = Integer.valueOf(System.getProperty("JMXTest", "8999")); + String URL = "service:jmx:rmi:///jndi/rmi://localhost:" + port + "/server"; + System.out.println("JMX ClientConnector URL " + URL); + + JMXServiceURL url; + try { + url = new JMXServiceURL(URL); + } catch (MalformedURLException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + JMXConnector jmxc; + try { + jmxc = JMXConnectorFactory.connect(url, null); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + try { + mbsc = jmxc.getMBeanServerConnection(); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public MBeanServerConnection getMBeanServer() { + return mbsc; + } +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/FATSuite.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/FATSuite.java new file mode 100755 index 000000000000..baaab80aa513 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/FATSuite.java @@ -0,0 +1,22 @@ +package com.ibm.ws.jmx.fat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ + JMXTest.class }) +public class FATSuite {} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/JMXTest.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/JMXTest.java new file mode 100755 index 000000000000..c4fb6b32ed3b --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/JMXTest.java @@ -0,0 +1,239 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.Set; + +import javax.management.InstanceNotFoundException; +import javax.management.JMX; +import javax.management.MBeanInfo; +import javax.management.MBeanOperationInfo; +import javax.management.MBeanServerConnection; +import javax.management.MBeanServerDelegate; +import javax.management.MBeanServerDelegateMBean; +import javax.management.ObjectName; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class JMXTest { + + protected static LibertyServer server; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.jmx.fat"); + server.installSystemFeature("jmxtest-1.0"); + server.copyFileToLibertyInstallRoot("lib", "bundles/com.ibm.ws.jmx.fat_1.0.0.jar"); + + server.startServer("JMXTest.log"); + server.waitForStringInLog("CWWKE0002I"); + assertNotNull("FeatureManager should report update is complete", + server.waitForStringInLog("CWWKF0008I")); + assertNotNull("Server should report it has started", + server.waitForStringInLog("CWWKF0011I")); + assertNotNull("JMXConnectorServer started not found", server.waitForStringInTrace("SERVER_READY|JMXConnectorServer is ready")); + } + + @AfterClass + public static void tearDown() throws Exception { + + if (server != null && server.isStarted()) { + server.stopServer(); + } + server.uninstallSystemFeature("jmxtest-1.0"); + } + + public JMXTest() { + super(); + } + + @Test + public void testMBeanConnector() throws Exception { + ClientConnector cc = new ClientConnector(); + checkMBeanServerConnection(cc.getMBeanServer()); + } + + @Test + public void testMBeanLocalConnector() throws Exception { + String serverRoot = server.getServerRoot(); + LocalConnector lc = new LocalConnector(serverRoot); + checkMBeanServerConnection(lc.getMBeanServer()); + + compareFileContent(lc.getStateFile(), lc.getWorkAreaFile()); + } + + /** + * @param stateFile + * @param workAreaFile + * @throws IOException + */ + private void compareFileContent(File stateFile, File workAreaFile) throws IOException { + BufferedReader reader = new BufferedReader(new FileReader(stateFile)); + String stateLine = reader.readLine(); + reader.close(); + reader = new BufferedReader(new FileReader(workAreaFile)); + String workAreaLine = reader.readLine(); + reader.close(); + + assertEquals("The content of the local address file in the logs/state and workarea files should be the same", stateLine, workAreaLine); + } + + @Test + @Ignore + // Disabling this test. The Attach API has been very unstable + // and is not being used by the tools for connecting to JMX. + public void testMBeanAttachAPI() throws Exception { + AttachSupport as = new AttachSupport(); + checkMBeanServerConnection(as.getMBeanServer()); + } + + @Test + public void testMBeanNotLoaded() throws Exception { + ClientConnector cc = new ClientConnector(); + MBeanServerConnection server = cc.getMBeanServer(); + ObjectName beanCounterName = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.beanCounter"); + + int before = (Integer) server.getAttribute(beanCounterName, "beanCount"); + + ObjectName on = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.testBean3"); + @SuppressWarnings("unused") + MBeanInfo info = server.getMBeanInfo(on); + + int after = (Integer) server.getAttribute(beanCounterName, "beanCount"); + + assertTrue(after == before + 1); + } + + // Simple method that demands the pattern provided matches exactly one mbean + private MBeanInfo getMBeanInfo(MBeanServerConnection connection, ObjectName pattern) throws Exception { + Set mbeans = connection.queryNames(pattern, null); + assertTrue("Expected one mbean matching pattern " + pattern + ", found: " + mbeans.size(), mbeans.size() == 1); + ObjectName name = mbeans.iterator().next(); + MBeanInfo result = connection.getMBeanInfo(name); + assertTrue("No mbean info for " + name, result != null); + return result; + } + + @Test + public void testOSGiMBeans() throws Exception { + ClientConnector cc = new ClientConnector(); + final MBeanServerConnection server = cc.getMBeanServer(); + + //this ObjectName is also ObjectNameConstants.OSGI_CONFIGURATION_ADMIN_MBEAN_NAME + MBeanInfo info = getMBeanInfo(server, new ObjectName("osgi.compendium:service=cm,version=1.3,*")); + MBeanOperationInfo[] ops = info.getOperations(); + + // Check that only read-only operations are available from ConfigurationAdmin. + assertTrue(containsOperation(ops, "getProperties")); + assertTrue(!containsOperation(ops, "deleteForLocation")); + final String mbeanClassName = info.getClassName(); + assertTrue("com.ibm.ws.jmx.internal.ReadOnlyConfigurationAdmin".equals(mbeanClassName)); + + // Sanity check with a few other OSGi JMX MBeans. + // Ensures the delayed registration is working correctly. + //this ObjectName is also ObjectNameConstants.OSGI_FRAMEWORK_MBEAN_NAME + info = getMBeanInfo(server, new ObjectName("osgi.core:type=framework,version=1.7,*")); + assertTrue(info != null); + assertTrue(containsOperation(info.getOperations(), "restartFramework")); + assertTrue(containsOperation(info.getOperations(), "shutdownFramework")); + + //this ObjectName is also ObjectNameConstants.OSGI_BUNDLE_STATE_MBEAN_NAME + info = getMBeanInfo(server, new ObjectName("osgi.core:type=bundleState,version=1.7,*")); + assertTrue(info != null); + assertTrue(containsOperation(info.getOperations(), "listBundles")); + + } + + @Test + public void testDelayedOSGiMBeans() throws Exception { + ClientConnector cc = new ClientConnector(); + final MBeanServerConnection server = cc.getMBeanServer(); + + ObjectName tester = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.delayedMbeanTester"); + ObjectName bean1 = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.delayedMbeanTester.Bean1"); + ObjectName bean2 = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.delayedMbeanTester.Bean2"); + server.invoke(tester, "register", null, null); + + try { + server.getMBeanInfo(bean1); + fail("Expected InstanceNotFoundException"); + } catch (InstanceNotFoundException e) { + //expected + } + server.invoke(tester, "allow1Service", null, null); + //this should work if delayed mbeans are implemented correctly + assertNotNull("Expected successful delayed mbean instantiation", server.getMBeanInfo(bean1)); + + try { + server.getMBeanInfo(bean2); + fail("Expected InstanceNotFoundException"); + } catch (InstanceNotFoundException e) { + //expected + } + + server.invoke(tester, "unregister", null, null); + } + + private boolean containsOperation(MBeanOperationInfo[] ops, String name) { + for (MBeanOperationInfo op : ops) { + if (name.equals(op.getName())) { + return true; + } + } + return false; + } + + private void checkMBeanServerConnection(MBeanServerConnection server) throws Exception { + assertNotNull("Server must not be null", server); + + int numBeans = server.getMBeanCount(); + assertTrue("Number of beans shoud be greater than or equal to 2, numBeans=" + numBeans, numBeans >= 2); + + Set set = server.queryNames(null, null); + + ObjectName on1 = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.testBean1"); + ObjectName on2 = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.testBean2"); + + assertTrue("Set must contain object name '" + on1 + "': found " + set, set.contains(on1)); + assertTrue("Set must contain object name '" + on1 + "': found " + set, set.contains(on2)); + + MBeanInfo info = server.getMBeanInfo(on1); + assertNotNull("MBeanInfo for object name 1 must not be null", info); + + info = server.getMBeanInfo(on2); + assertNotNull("MBeanInfo for object name 2 must not be null", info); + + MBeanServerDelegateMBean serverDelegate = JMX.newMBeanProxy(server, MBeanServerDelegate.DELEGATE_NAME, MBeanServerDelegateMBean.class); + System.out.println("Server delegate: " + serverDelegate); + System.out.println("Mbean server id: " + serverDelegate.getMBeanServerId()); + assertTrue("Expected that server ID starts with WebSphere", + serverDelegate.getMBeanServerId().startsWith("WebSphere")); + } +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/LocalConnector.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/LocalConnector.java new file mode 100755 index 000000000000..44ab6b6fb5d0 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/LocalConnector.java @@ -0,0 +1,105 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; + +import javax.management.MBeanServerConnection; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +/** + * + */ +public class LocalConnector { + + private static final String CONNECTOR_ADDRESS_FILE_NAME = "com.ibm.ws.jmx.local.address"; + + MBeanServerConnection mbsc = null; + + private File stateFile; + private File workAreaFile; + + public LocalConnector(String serverRoot) throws IOException { + if (serverRoot == null || serverRoot.length() == 0) { + throw new RuntimeException("server.root property is not set"); + } + serverRoot = serverRoot.replaceAll("\\\\", "/"); + String connectorFile = serverRoot + "/logs/state/" + CONNECTOR_ADDRESS_FILE_NAME; + System.out.println(connectorFile); + + stateFile = new File(connectorFile); + workAreaFile = new File(serverRoot, "workarea/" + CONNECTOR_ADDRESS_FILE_NAME); + + if (stateFile.exists()) { + String connectorAddr = null; + BufferedReader br = null; + try { + br = new BufferedReader(new InputStreamReader(new FileInputStream(stateFile), "UTF-8")); + connectorAddr = br.readLine(); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + try { + if (br != null) { + br.close(); + } + } catch (IOException e) { + // ignore + } + } + if (connectorAddr != null) { + System.out.println("JMX connector address: " + connectorAddr); + JMXConnector connector = null; + try { + JMXServiceURL url = new JMXServiceURL(connectorAddr); + connector = JMXConnectorFactory.connect(url); + System.out.println("JMX Connector: " + connector); + mbsc = connector.getMBeanServerConnection(); + if (mbsc != null) { + return; //Successful, return. + } + } catch (IOException ioe) { + if (connector != null) { + try { + connector.close(); + } catch (IOException e) { + // ignore + } + } + throw (ioe); + } + } else { + System.out.println("JMXConnection: JMX connector address is null. The connector address file is " + stateFile.getAbsolutePath()); + } + } else { + System.out.println("JMXConnection: JMX address file doesn't exist. The connector address file is " + stateFile.getAbsolutePath()); + } + } + + public MBeanServerConnection getMBeanServer() { + return mbsc; + } + + public File getStateFile() { + return stateFile; + } + + public File getWorkAreaFile() { + return workAreaFile; + } +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ForwardingInvocationHandler.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ForwardingInvocationHandler.java new file mode 100755 index 000000000000..7a8fdab15129 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ForwardingInvocationHandler.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat.attach; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * + */ +class ForwardingInvocationHandler implements InvocationHandler { + + private final Object target; + + public ForwardingInvocationHandler(Object target) { + this.target = target; + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + final String name = method.getName(); + if ("getBackingObject".equals(name) && + method.getDeclaringClass() == ObjectProxy.class) { + return target; + } + final Class[] types = method.getParameterTypes(); + try { + Method m = target.getClass().getMethod(name, types); + m.setAccessible(true); + return m.invoke(target, args); + } catch (InvocationTargetException e) { + throw e.getCause(); + } + } +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ObjectProxy.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ObjectProxy.java new file mode 100755 index 000000000000..a26938936ba1 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ObjectProxy.java @@ -0,0 +1,21 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat.attach; + +/** + * + */ +interface ObjectProxy { + + public Object getBackingObject(); + +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineDescriptorProxy.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineDescriptorProxy.java new file mode 100755 index 000000000000..dd2470d6127b --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineDescriptorProxy.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat.attach; + +/** + * + */ +public interface VirtualMachineDescriptorProxy { + + public String displayName(); + + public String id(); + + public String toString(); + +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxy.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxy.java new file mode 100755 index 000000000000..292f5ba9c71b --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxy.java @@ -0,0 +1,44 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat.attach; + +import java.io.IOException; +import java.util.Properties; + +/** + * + */ +public interface VirtualMachineProxy { + + public void detach() throws IOException; + + public String id(); + + public Properties getAgentProperties() throws IOException; + + public Properties getSystemProperties() throws IOException; + + public void loadAgent(String agent) throws IOException; + + public void loadAgent(String agent, String options) throws IOException; + + public void loadAgentLibrary(String agentLibrary) throws IOException; + + public void loadAgentLibrary(String agentLibrary, String options) throws IOException; + + public void loadAgentPath(String agentPath) throws IOException; + + public void loadAgentPath(String agentPath, String options) throws IOException; + + public String toString(); + +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxyHelper.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxyHelper.java new file mode 100755 index 000000000000..20b4ad85a938 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxyHelper.java @@ -0,0 +1,153 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat.attach; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.List; + +/** + * + */ +public final class VirtualMachineProxyHelper { + + private static final String IBM_VIRTUAL_MACHINE = "com.ibm.tools.attach.VirtualMachine"; + private static final String SUN_VIRTUAL_MACHINE = "com.sun.tools.attach.VirtualMachine"; + + private static final String IBM_VIRTUAL_MACHINE_DESCRIPTOR = "com.ibm.tools.attach.VirtualMachineDescriptor"; + private static final String SUN_VIRTUAL_MACHINE_DESCRIPTOR = "com.sun.tools.attach.VirtualMachineDescriptor"; + + private static final Class VIRTUAL_MACHINE_CLASS; + private static final Class VIRTUAL_MACHINE_DESCRIPTOR_CLASS; + static { + Class c1 = null; + Class c2 = null; + try { + // Attempt to load the IBM flavor of the Attach API. + c1 = Class.forName(IBM_VIRTUAL_MACHINE); + c2 = Class.forName(IBM_VIRTUAL_MACHINE_DESCRIPTOR); + } catch (ClassNotFoundException e) { + try { + // Not an IBM JDK. Attempt to load the Oracle/Sun flavor of the Attach API. + // This requires tools.jar. We cannot assume it's on the system classpath + // so we add it to the search path of the ClassLoader. + String javaHome = System.getProperty("java.home"); + // Assumes "java.home" points to JDK_BASE_DIR/jre or JDK_BASE_DIR + File toolsJarLocation1 = new File(javaHome + File.separator + ".." + File.separator + "lib" + File.separator + "tools.jar"); + File toolsJarLocation2 = new File(javaHome + File.separator + "lib" + File.separator + "tools.jar"); + ClassLoader cl = URLClassLoader.newInstance(new URL[] { toolsJarLocation1.toURI().toURL(), + toolsJarLocation2.toURI().toURL() }); + c1 = Class.forName(SUN_VIRTUAL_MACHINE, true, cl); + c2 = Class.forName(SUN_VIRTUAL_MACHINE_DESCRIPTOR, true, cl); + } catch (MalformedURLException e2) { + throw new IllegalStateException(e2); + } catch (ClassNotFoundException e2) { + throw new IllegalStateException("An implementation of the Attach API was not found.", e2); + } + } + VIRTUAL_MACHINE_CLASS = c1; + VIRTUAL_MACHINE_DESCRIPTOR_CLASS = c2; + } + + public static VirtualMachineProxy attach(String id) throws IOException { + try { + Method attachMethod = VIRTUAL_MACHINE_CLASS.getMethod("attach", String.class); + attachMethod.setAccessible(true); + Object vm = attachMethod.invoke(null, id); + if (vm != null) { + return (VirtualMachineProxy) Proxy.newProxyInstance(VirtualMachineProxy.class.getClassLoader(), + new Class[] { VirtualMachineProxy.class }, + new ForwardingInvocationHandler(vm)); + } + return null; + } catch (NoSuchMethodException e) { + throw new IllegalStateException(e); + } catch (IllegalArgumentException e) { + throw new IllegalStateException(e); + } catch (IllegalAccessException e) { + throw new IllegalStateException(e); + } catch (InvocationTargetException e) { + throw new IllegalStateException(e); + } + } + + public static VirtualMachineProxy attach(VirtualMachineDescriptorProxy vmd) throws IOException { + Object _vmd = null; + if (vmd instanceof ObjectProxy) { + _vmd = ((ObjectProxy) vmd).getBackingObject(); + } else if (vmd != null) { + throw new IllegalArgumentException("Unsupported proxy instance."); + } + try { + Method attachMethod = VIRTUAL_MACHINE_CLASS.getMethod("attach", VIRTUAL_MACHINE_DESCRIPTOR_CLASS); + attachMethod.setAccessible(true); + Object vm = attachMethod.invoke(null, _vmd); + if (vm != null) { + return (VirtualMachineProxy) Proxy.newProxyInstance(VirtualMachineProxy.class.getClassLoader(), + new Class[] { VirtualMachineProxy.class }, + new ForwardingInvocationHandler(vm)); + } + return null; + } catch (NoSuchMethodException e) { + throw new IllegalStateException(e); + } catch (IllegalArgumentException e) { + throw new IllegalStateException(e); + } catch (IllegalAccessException e) { + throw new IllegalStateException(e); + } catch (InvocationTargetException e) { + throw new IllegalStateException(e); + } + } + + public static List list() { + try { + Method attachMethod = VIRTUAL_MACHINE_CLASS.getMethod("list"); + attachMethod.setAccessible(true); + @SuppressWarnings("rawtypes") + List list = (List) attachMethod.invoke(null); + if (list == null) { + return null; + } + final int size = list.size(); + List _list = new ArrayList(size); + for (int i = 0; i < size; ++i) { + Object vmd = list.get(i); + if (vmd != null) { + _list.add((VirtualMachineDescriptorProxy) Proxy.newProxyInstance(VirtualMachineDescriptorProxy.class.getClassLoader(), + new Class[] { VirtualMachineDescriptorProxy.class, ObjectProxy.class }, + new ForwardingInvocationHandler(vmd))); + } else { + _list.add(null); + } + } + return _list; + } catch (NoSuchMethodException e) { + throw new IllegalStateException(e); + } catch (IllegalArgumentException e) { + throw new IllegalStateException(e); + } catch (IllegalAccessException e) { + throw new IllegalStateException(e); + } catch (InvocationTargetException e) { + throw new IllegalStateException(e); + } + } + + private VirtualMachineProxyHelper() {} + +} diff --git a/dev/com.ibm.ws.jmx_fat/publish/.gitignore b/dev/com.ibm.ws.jmx_fat/publish/.gitignore new file mode 100644 index 000000000000..7ad6e8cac5fb --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/publish/.gitignore @@ -0,0 +1,2 @@ +/bundles +/files diff --git a/dev/com.ibm.ws.jmx_fat/publish/features/jmxtest-1.0.mf b/dev/com.ibm.ws.jmx_fat/publish/features/jmxtest-1.0.mf new file mode 100755 index 000000000000..5b5e26ae2ea2 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/publish/features/jmxtest-1.0.mf @@ -0,0 +1,8 @@ + +Subsystem-ManifestVersion: 1 +IBM-ShortName: jmxtest-1.0 +Subsystem-SymbolicName: com.ibm.websphere.jmx.jmxtest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.jmx.fat;version=0 +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/bootstrap.properties b/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/bootstrap.properties new file mode 100755 index 000000000000..703551895b39 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/bootstrap.properties @@ -0,0 +1,5 @@ +bootstrap.include=../testports.properties +com.ibm.ws.logging.trace.specification=*=info=enabled:\ +logservice=all=enabled:\ +com.ibm.ws.jmx.internal=all:\ +com.ibm.ws.kernel.boot.jmx.internal=all:\ diff --git a/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/server.xml b/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/server.xml new file mode 100755 index 000000000000..90b60256d515 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/server.xml @@ -0,0 +1,8 @@ + + + + localConnector-1.0 + timedexit-1.0 + jmxtest-1.0 + + diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/bnd.bnd b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/bnd.bnd new file mode 100755 index 000000000000..2af06f6876c0 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/bnd.bnd @@ -0,0 +1,51 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: JMX Test bundle +Bundle-SymbolicName: com.ibm.ws.jmx.fat +Bundle-Description: Test bundle for the jmx project + +# optional... +WS-TraceGroup: projectExample + +Private-Package: com.ibm.ws.jmx.test.fat + +Import-Package: !*.internal.*, org.osgi.framework;version="1.3", * + +#Include-Resource: OSGI-INF=bvt-bundle/resources/OSGI-INF + +-dsannotations=com.ibm.ws.jmx.test.fat.DelayedMbeanTester + +Service-Component: \ + com.ibm.ws.jmx.test.fat.testBean1;\ + implementation:=com.ibm.ws.jmx.test.fat.TestBean1;\ + provide:='javax.management.DynamicMBean';\ + immediate:=true;\ + configuration-policy:=ignore;\ + properties:="service.vendor=IBM,jmx.objectname=WebSphere:name=com.ibm.ws.jmx.test.fat.testBean1",\ + com.ibm.ws.jmx.test.fat.testBean2;\ + implementation:=com.ibm.ws.jmx.test.fat.TestBean2;\ + provide:='javax.management.DynamicMBean';\ + immediate:=true;\ + configuration-policy:=ignore;\ + properties:="service.vendor=IBM,jmx.objectname=WebSphere:name=com.ibm.ws.jmx.test.fat.testBean2",\ + com.ibm.ws.jmx.test.fat.testBean3;\ + implementation:=com.ibm.ws.jmx.test.fat.TestBean3;\ + provide:='javax.management.DynamicMBean';\ + immediate:=false;\ + configuration-policy:=ignore;\ + properties:="service.vendor=IBM,jmx.objectname=WebSphere:name=com.ibm.ws.jmx.test.fat.testBean3",\ + com.ibm.ws.jmx.test.fat.beanCounter;\ + implementation:=com.ibm.ws.jmx.test.fat.BeanCounter;\ + jmxServer=com.ibm.ws.jmx.PlatformMBeanService;\ + provide:='javax.management.DynamicMBean';\ + immediate:=true;\ + configuration-policy:=ignore;\ + properties:="service.vendor=IBM,jmx.objectname=WebSphere:name=com.ibm.ws.jmx.test.fat.beanCounter",\ + ServerTestConnector;\ + implementation:=com.ibm.ws.jmx.test.fat.ServerConnector;\ + jmxServer=com.ibm.ws.jmx.PlatformMBeanService;\ + immediate:=true;\ + properties:="service.vendor=IBM" diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/BeanCounter.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/BeanCounter.java new file mode 100755 index 000000000000..47afc8a04104 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/BeanCounter.java @@ -0,0 +1,94 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +import java.lang.reflect.Field; + +import javax.management.AttributeNotFoundException; +import javax.management.MBeanException; +import javax.management.MBeanServer; +import javax.management.ReflectionException; + +import org.osgi.framework.ServiceReference; +import org.osgi.service.component.ComponentContext; + +import com.ibm.ws.jmx.PlatformMBeanService; + +/** + * + */ +public class BeanCounter extends TestBean { + + ServiceReference mbeanServerRef; + MBeanServer mBeanServer; + PlatformMBeanService mbeanService; + + /** + * @param name + */ + public BeanCounter() { + super(BeanCounter.class.getName()); + + } + + public void activate(ComponentContext compContext) { + mbeanService = null; + try { + mbeanService = compContext.locateService("jmxServer", mbeanServerRef); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public void deactivate(ComponentContext compContext) {} + + public void setJmxServer(ServiceReference mbeanServerRef) { + this.mbeanServerRef = mbeanServerRef; + } + + public void unsetJmxServer(ServiceReference mbeanServer) {} + + public int getNonDelayedBeanCount() { + MBeanServer server = mbeanService.getMBeanServer(); + try { + Class clazz = server.getClass(); + Field f = clazz.getDeclaredField("last"); + f.setAccessible(true); + server = (MBeanServer) f.get(server); + } catch (Exception e) { + e.printStackTrace(); + } + mBeanServer = server; + return mBeanServer.getMBeanCount(); + } + + @Override + public Object getAttribute(String s) throws AttributeNotFoundException, MBeanException, ReflectionException { + return "beanCount".equals(s) ? getNonDelayedBeanCount() : super.getAttribute(s); + } + + // @Override + // public MBeanInfo getMBeanInfo() { + // try { + // Class clazz = this.getClass(); + // Method getter = clazz.getDeclaredMethod("getNonDelayedBeanCount", null); + // MBeanAttributeInfo aInfo = new MBeanAttributeInfo("beanCount", "beanCounter.beanCount", getter, null); + // MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[] { aInfo }; + // MBeanInfo info = new MBeanInfo(toString(), "bean counter", attrs, null, null, null); + // return info; + // } catch (Exception e) { + // e.printStackTrace(); + // throw new RuntimeException(e); + // } + // } +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTester.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTester.java new file mode 100755 index 000000000000..58896d35bd00 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTester.java @@ -0,0 +1,102 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +import java.util.Hashtable; + +import javax.management.DynamicMBean; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ConfigurationPolicy; + +/** + * Registers and unregisters some "delayed" mbeans that don't like to return the service references + */ +@Component(configurationPolicy = ConfigurationPolicy.IGNORE, + property = { "jmx.objectname=WebSphere:name=com.ibm.ws.jmx.test.fat.delayedMbeanTester" }) +public class DelayedMbeanTester implements DelayedMbeanTesterMBean { + + private BundleContext bundleContext; + private ServiceRegistration reg1; + private boolean allow1; + private ServiceRegistration reg2; + + protected void activate(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + + protected void deactivate() { + this.bundleContext = null; + } + + /* + * (non-Javadoc) + * + * @see com.ibm.ws.jmx.test.fat.DelayedMbeanTesterMBean#register() + */ + @Override + public void register() { + Hashtable properties1 = new Hashtable(); + properties1.put("jmx.objectname", "WebSphere:name=com.ibm.ws.jmx.test.fat.delayedMbeanTester.Bean1"); + reg1 = bundleContext.registerService(DynamicMBean.class.getName(), + new ServiceFactory() { + + @Override + public TestBean getService(Bundle bundle, ServiceRegistration registration) { + return allow1 ? new TestBean("delayed1") : null; + } + + @Override + public void ungetService(Bundle bundle, ServiceRegistration registration, TestBean service) {} + }, + properties1); + Hashtable properties2 = new Hashtable(); + properties2.put("jmx.objectname", "WebSphere:name=com.ibm.ws.jmx.test.fat.delayedMbeanTester.Bean2"); + reg2 = bundleContext.registerService(DynamicMBean.class.getName(), + new ServiceFactory() { + + @Override + public TestBean getService(Bundle bundle, ServiceRegistration registration) { + return null; + } + + @Override + public void ungetService(Bundle bundle, ServiceRegistration registration, TestBean service) {} + }, + properties2); + } + + /* + * (non-Javadoc) + * + * @see com.ibm.ws.jmx.test.fat.DelayedMbeanTesterMBean#allow1Service() + */ + @Override + public void allow1Service() { + allow1 = true; + } + + /* + * (non-Javadoc) + * + * @see com.ibm.ws.jmx.test.fat.DelayedMbeanTesterMBean#unregister() + */ + @Override + public void unregister() { + reg1.unregister(); + reg2.unregister(); + } +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTesterMBean.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTesterMBean.java new file mode 100755 index 000000000000..2ee1918a7faa --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTesterMBean.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +/** + * + */ +public interface DelayedMbeanTesterMBean { + + void register(); + + void allow1Service(); + + void unregister(); + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/Messages.properties b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/Messages.properties new file mode 100755 index 000000000000..c19eb03f6494 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/Messages.properties @@ -0,0 +1,4 @@ +STARTED=Registry started with URL {0}. +SERVER=MBeanServer obtained with domains {0}. +SERVER_READY=JMXConnectorServer is ready with open connections {0}. +SERVER_STOPPED=JMXConnectorServer is stopped. diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/ServerConnector.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/ServerConnector.java new file mode 100755 index 000000000000..46d1aa5ae43b --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/ServerConnector.java @@ -0,0 +1,161 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.rmi.NoSuchObjectException; +import java.rmi.RemoteException; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; +import java.rmi.server.UnicastRemoteObject; + +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; +import javax.management.remote.JMXServiceURL; + +import org.osgi.framework.ServiceReference; +import org.osgi.service.component.ComponentContext; + +import com.ibm.websphere.ras.Tr; +import com.ibm.websphere.ras.TraceComponent; +import com.ibm.ws.jmx.PlatformMBeanService; +import com.ibm.wsspi.kernel.service.utils.OsgiPropertyUtils; + +/** + * + */ +public class ServerConnector { + private static final TraceComponent tc = Tr.register(ServerConnector.class); + + String URL; + JMXConnectorServer cs; + ComponentContext context; + ServiceReference mbeanServerRef; + Registry registry; + + public ServerConnector() { + super(); + cs = null; + context = null; + mbeanServerRef = null; + registry = null; + } + + public void activate(ComponentContext compContext) { + context = compContext; + + int port = Integer.valueOf(OsgiPropertyUtils.getProperty("bvt.prop.JMXTest", "8999")); + final String URL = "service:jmx:rmi:///jndi/rmi://localhost:" + port + "/server"; + + registry = null; + try { + registry = LocateRegistry.createRegistry(port); + } catch (RemoteException e1) { + // TODO Auto-generated catch block + // Do you need FFDC here? Remember FFDC instrumentation and @FFDCIgnore + // https://websphere.pok.ibm.com/~alpine/secure/docs/dev/API/com.ibm.ws.ras/com/ibm/ws/ffdc/annotation/FFDCIgnore.html + e1.printStackTrace(); + throw new RuntimeException(e1); + } + Tr.info(tc, "STARTED", URL); + + Runnable r = new Runnable() { + + @Override + public void run() { + PlatformMBeanService mbeanServer = null; + try { + mbeanServer = context.locateService("jmxServer", mbeanServerRef); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + Tr.info(tc, "SERVER", strings(mbeanServer.getMBeanServer().getDomains())); + + JMXServiceURL url = null; + try { + url = new JMXServiceURL(URL); + } catch (MalformedURLException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + + try { + cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbeanServer.getMBeanServer()); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + + try { + cs.start(); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + Tr.info(tc, "SERVER_READY", strings(cs.getConnectionIds())); + } + }; + Thread thr = new Thread(r); + thr.start(); + + } + + public void deactivate(ComponentContext compContext) { + try { + cs.stop(); + } catch (IOException e) { + // TODO Auto-generated catch block + // Do you need FFDC here? Remember FFDC instrumentation and @FFDCIgnore + // https://websphere.pok.ibm.com/~alpine/secure/docs/dev/API/com.ibm.ws.ras/com/ibm/ws/ffdc/annotation/FFDCIgnore.html + e.printStackTrace(); + throw new RuntimeException(e); + } + context = null; + try { + UnicastRemoteObject.unexportObject(registry, true); + } catch (NoSuchObjectException e) { + // TODO Auto-generated catch block + // Do you need FFDC here? Remember FFDC instrumentation and @FFDCIgnore + // https://websphere.pok.ibm.com/~alpine/secure/docs/dev/API/com.ibm.ws.ras/com/ibm/ws/ffdc/annotation/FFDCIgnore.html + e.printStackTrace(); + } + registry = null; + Tr.info(tc, "SERVER_STOPPED"); + } + + public void setJmxServer(ServiceReference mbeanServerRef) { + this.mbeanServerRef = mbeanServerRef; + } + + public void unsetJmxServer(ServiceReference mbeanServer) { + cs = null; + } + + private static String strings(String[] strs) { + StringBuilder str = new StringBuilder("["); + if (strs != null) { + boolean first = true; + for (String s : strs) { + if (first) { + first = false; + } else { + str.append(','); + } + str.append(s); + } + } + str.append(']'); + return str.toString(); + } +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean.java new file mode 100755 index 000000000000..1cd79c13a6d1 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean.java @@ -0,0 +1,97 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +import java.util.Map; + +import javax.management.Attribute; +import javax.management.AttributeList; +import javax.management.AttributeNotFoundException; +import javax.management.DynamicMBean; +import javax.management.InvalidAttributeValueException; +import javax.management.MBeanException; +import javax.management.MBeanInfo; +import javax.management.ReflectionException; + +/** + * + */ +public class TestBean implements DynamicMBean { + + private final String name; + + protected TestBean(String name) { + System.setProperty("com.ibm.ws.jmx.test.fat", "true"); + this.name = name; + } + + /** + * DS method to activate this component. + * Best practice: this should be a protected method, not public or private + * + * @param properties : Map containing service properties + */ + protected void activate(Map properties) {} + + /** + * DS method to deactivate this component. + * Best practice: this should be a protected method, not public or private + * + * @param reason int representation of reason the component is stopping + */ + protected void deactivate(int reason) {} + + @Override + public String toString() { + return name; + } + + /** {@inheritDoc} */ + @Override + public Object getAttribute(String arg0) throws AttributeNotFoundException, MBeanException, ReflectionException { + return toString(); + } + + /** {@inheritDoc} */ + @Override + public AttributeList getAttributes(String[] arg0) { + // TODO Auto-generated method stub + return null; + } + + /** {@inheritDoc} */ + @Override + public MBeanInfo getMBeanInfo() { + return new MBeanInfo(name, "test bean", null, null, null, null); + } + + /** {@inheritDoc} */ + @Override + public Object invoke(String arg0, Object[] arg1, String[] arg2) throws MBeanException, ReflectionException { + // TODO Auto-generated method stub + return null; + } + + /** {@inheritDoc} */ + @Override + public void setAttribute(Attribute arg0) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { + // TODO Auto-generated method stub + + } + + /** {@inheritDoc} */ + @Override + public AttributeList setAttributes(AttributeList arg0) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean1.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean1.java new file mode 100755 index 000000000000..065c567bfca1 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean1.java @@ -0,0 +1,21 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +/** + * + */ +public class TestBean1 extends TestBean { + public TestBean1() { + super(TestBean1.class.getName()); + } +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean2.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean2.java new file mode 100755 index 000000000000..dcce080f80ee --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean2.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +/** + * + */ +public class TestBean2 extends TestBean { + + public TestBean2() { + super(TestBean2.class.getName()); + + // System.out.println("$$$$$$$$$$$$$$$$$$$$$$$ in TestBean2"); + } + +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean3.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean3.java new file mode 100755 index 000000000000..a41516778bb0 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean3.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +/** + * + */ +public class TestBean3 extends TestBean { + + public TestBean3() { + super(TestBean3.class.getName()); + + // System.out.println("###################### in TestBean3.ctor"); + } + +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/package-info.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/package-info.java new file mode 100755 index 000000000000..f6a5d5d09105 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/package-info.java @@ -0,0 +1,19 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.0 + */ +@TraceOptions(traceGroup = "projectExample", messageBundle = "com.ibm.ws.jmx.test.fat.Messages") +package com.ibm.ws.jmx.test.fat; + +import com.ibm.websphere.ras.annotation.TraceOptions; + diff --git a/dev/com.ibm.ws.jmx_test/.classpath b/dev/com.ibm.ws.jmx_test/.classpath index c04b9f920f9e..bd880329225d 100755 --- a/dev/com.ibm.ws.jmx_test/.classpath +++ b/dev/com.ibm.ws.jmx_test/.classpath @@ -1,13 +1,7 @@ - - - - - - - - - + + + diff --git a/dev/com.ibm.ws.jmx_test/.classpath.gradle b/dev/com.ibm.ws.jmx_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.jmx_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.jmx_test/.project b/dev/com.ibm.ws.jmx_test/.project index f8f7bbb2d8a0..640eb665451c 100755 --- a/dev/com.ibm.ws.jmx_test/.project +++ b/dev/com.ibm.ws.jmx_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.jmx_test/bnd.bnd b/dev/com.ibm.ws.jmx_test/bnd.bnd new file mode 100755 index 000000000000..33248a2a60ee --- /dev/null +++ b/dev/com.ibm.ws.jmx_test/bnd.bnd @@ -0,0 +1,19 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.jmx;version=latest diff --git a/dev/com.ibm.ws.jmx_test/bnd.bnd.gradle b/dev/com.ibm.ws.jmx_test/bnd.bnd.gradle new file mode 100755 index 000000000000..33248a2a60ee --- /dev/null +++ b/dev/com.ibm.ws.jmx_test/bnd.bnd.gradle @@ -0,0 +1,19 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.jmx;version=latest diff --git a/dev/com.ibm.ws.runtime.update_bvt/build.nogradle b/dev/com.ibm.ws.jmx_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.runtime.update_bvt/build.nogradle rename to dev/com.ibm.ws.jmx_test/build.gradle diff --git a/dev/com.ibm.ws.kernel.boot_bvt/.classpath b/dev/com.ibm.ws.kernel.boot_bvt/.classpath index 25e481a30a86..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.kernel.boot_bvt/.classpath +++ b/dev/com.ibm.ws.kernel.boot_bvt/.classpath @@ -1,20 +1,7 @@ - - - - - - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.kernel.boot_bvt/.classpath.gradle b/dev/com.ibm.ws.kernel.boot_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_bvt/.project b/dev/com.ibm.ws.kernel.boot_bvt/.project index f658dcef08bb..a45664c529d0 100755 --- a/dev/com.ibm.ws.kernel.boot_bvt/.project +++ b/dev/com.ibm.ws.kernel.boot_bvt/.project @@ -11,13 +11,13 @@ - com.ibm.ws.rasplugin.RASValidationBuilder + bndtools.core.bndbuilder org.eclipse.jdt.core.javanature - com.ibm.ws.rasplugin.RASValidationNature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.kernel.boot_bvt/bnd.bnd b/dev/com.ibm.ws.kernel.boot_bvt/bnd.bnd new file mode 100755 index 000000000000..49b6b67bb05c --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_bvt/bnd.bnd @@ -0,0 +1,17 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.ws.kernel.boot;version=latest diff --git a/dev/com.ibm.ws.kernel.boot_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.boot_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..49b6b67bb05c --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_bvt/bnd.bnd.gradle @@ -0,0 +1,17 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.ws.kernel.boot;version=latest diff --git a/dev/com.ibm.ws.runtime.update_test/build.nogradle b/dev/com.ibm.ws.kernel.boot_bvt/build.gradle similarity index 100% rename from dev/com.ibm.ws.runtime.update_test/build.nogradle rename to dev/com.ibm.ws.kernel.boot_bvt/build.gradle diff --git a/dev/com.ibm.ws.kernel.boot_fat/.classpath b/dev/com.ibm.ws.kernel.boot_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/.classpath.gradle b/dev/com.ibm.ws.kernel.boot_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/.gitignore b/dev/com.ibm.ws.kernel.boot_fat/.gitignore new file mode 100644 index 000000000000..9fb7b834a975 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.gitignore @@ -0,0 +1,5 @@ +*.log* +/TestBundleDeactivate.txt +/coverage.ec +/lib +/reports diff --git a/dev/com.ibm.ws.kernel.boot_fat/.project b/dev/com.ibm.ws.kernel.boot_fat/.project new file mode 100755 index 000000000000..86c8544a2b1e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.boot_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..845c3083c7df --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..fadbc117581b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=true +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd b/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.kernel.boot_fat/build-test.xml b/dev/com.ibm.ws.kernel.boot_fat/build-test.xml new file mode 100755 index 000000000000..305d7ade58be --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/build-test.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.security.utility_bvt/build.nogradle b/dev/com.ibm.ws.kernel.boot_fat/build.gradle similarity index 100% rename from dev/com.ibm.ws.security.utility_bvt/build.nogradle rename to dev/com.ibm.ws.kernel.boot_fat/build.gradle diff --git a/dev/com.ibm.ws.kernel.boot_fat/delivery.sets b/dev/com.ibm.ws.kernel.boot_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/FATSuite.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/FATSuite.java new file mode 100755 index 000000000000..1bbe7536a7bc --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/FATSuite.java @@ -0,0 +1,59 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import com.ibm.ws.kernel.boot.commandline.CreateCommandTest; +import com.ibm.ws.kernel.boot.commandline.DumpCommandTest; +import com.ibm.ws.kernel.boot.commandline.PauseResumeCommandTest; +import com.ibm.ws.kernel.boot.commandline.StartCommandTest; +import com.ibm.ws.kernel.boot.commandport.ServerCommandPortTest; +import com.ibm.ws.kernel.boot.internal.commands.LogLevelPropertyTest; +import com.ibm.ws.kernel.boot.internal.commands.PackageCommandTest; +import com.ibm.ws.kernel.provisioning.KernelChangeTest; +import com.ibm.ws.kernel.provisioning.ProvisioningTest; +import com.ibm.wsspi.kernel.embeddable.EmbeddedServerAddProductExtensionMultipleTest; +import com.ibm.wsspi.kernel.embeddable.EmbeddedServerAddProductExtensionTest; +import com.ibm.wsspi.kernel.embeddable.EmbeddedServerTest; + +/** + * Collection of a few fast example tests + */ +@RunWith(Suite.class) +/* + * The classes specified in the @SuiteClasses annotation + * below should only be mainline test cases that complete + * in a combined total of 5 minutes or less. + */ +@SuiteClasses({ + EmbeddedServerTest.class, + EmbeddedServerAddProductExtensionTest.class, + EmbeddedServerAddProductExtensionMultipleTest.class, + ProvisioningTest.class, + KernelChangeTest.class, + ServerStartTest.class, + ServerStartAsServiceTest.class, + ShutdownTest.class, + ServerCommandPortTest.class, + DumpCommandTest.class, + PackageCommandTest.class, + LogLevelPropertyTest.class, + CreateCommandTest.class, + StartCommandTest.class, + ServerClasspathTest.class, + ServerStartJVMOptionsTest.class, + PauseResumeCommandTest.class +}) +public class FATSuite {} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/OnlyRunOnWinRule.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/OnlyRunOnWinRule.java new file mode 100644 index 000000000000..e8c45e8428d3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/OnlyRunOnWinRule.java @@ -0,0 +1,41 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * Rule to run on Windows. + */ +public class OnlyRunOnWinRule implements TestRule { + + /** This constant is exposed to any test code to use. It is true iff the FAT is running on z/OS. */ + public static final boolean IS_RUNNING_ON_WINDOWS = System.getProperty("os.name").toLowerCase().contains("windows"); + + @Override + public Statement apply(final Statement statement, final Description description) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + if (IS_RUNNING_ON_WINDOWS) { + statement.evaluate(); + } else { + Log.info(description.getTestClass(), description.getMethodName(), "Test class or method is skipped due to run on Windows rule"); + } + } + }; + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerClasspathTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerClasspathTest.java new file mode 100644 index 000000000000..b4381d98d19a --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerClasspathTest.java @@ -0,0 +1,84 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertEquals; + +import java.util.Iterator; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import componenttest.custom.junit.runner.OnlyRunInJava7Rule; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Tests what can and cannot be loaded by the server's JVM classpath. + */ +public class ServerClasspathTest { + + private static final String SERVER_NAME = "com.ibm.ws.kernel.boot.classpath.fat"; + + private static final LibertyServer server = LibertyServerFactory.getLibertyServer(SERVER_NAME); + + private static final String[] EXPECTED_PACKAGES = { "com.ibm.ws.kernel", "java.", "javax.", "sun.", + "org.osgi.framework", "com.ibm.crypto", "com.ibm.security", + "com.ibm.misc", "com.ibm.xml", "com.ibm.nio", "com.ibm.jvm", + "org.apache.xerces", "com.ibm.Compiler", "com.ibm.oti", + "org.omg.CORBA", "com.sun", "org.xml.sax", "com.ibm.jit", + "com.ibm.jsse2", "com.ibm.lang.management", "com.ibm.tools.attach", + "com.ibm.virtualization.management", "com.ibm.wsspi.kernel", + "jdk.xml.internal", // Windows, Sun + "jdk.net" // Java 8, Sun 1.7 + }; + + @ClassRule + public static final TestRule java7Rule = new OnlyRunInJava7Rule(); + + @BeforeClass + public static void before() throws Exception { + server.startServer(); + } + + @AfterClass + public static void after() throws Exception { + server.stopServer(); + } + + @Test + public void testJvmAppClasspath() throws Exception { + //TODO: check logs for any packages that are not in the expected packages list + StringBuilder unexpectedPackages = new StringBuilder(); + List pkgsOnCP = server.findStringsInLogs("AppLoader can load: .*", server.getConsoleLogFile()); + Iterator iter = pkgsOnCP.iterator(); + boolean allowed; + while (iter.hasNext()) { + allowed = false; + String pkg = iter.next().substring("AppLoader can load: ".length()); + for (String allowedPkg : EXPECTED_PACKAGES) { + if (pkg.startsWith(allowedPkg)) { + allowed = true; + break; + } + } + if (!allowed) { + unexpectedPackages.append(" " + pkg); + } + } + assertEquals("Found unexpected packages in the server JVM's application classpath", "", unexpectedPackages.toString()); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartAsServiceTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartAsServiceTest.java new file mode 100644 index 000000000000..bd65dd6d56b5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartAsServiceTest.java @@ -0,0 +1,140 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.ProtocolException; +import java.net.URL; + +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This test bucket tests the server startup process. + */ +public class ServerStartAsServiceTest { + private static final Class c = ServerStartAsServiceTest.class; + + private static final String SERVER_NAME = "ServerStartAsServiceTest"; + + private static LibertyServer server; + + @ClassRule + public static final TestRule onWinRule = new OnlyRunOnWinRule(); + + @Test + /** + * test Liberty Server to Register, Start, Stop and Unregister as a Windows Service + * + * @throws Exception + */ + public void testWinServiceLifeCycle() throws Exception { + final String METHOD_NAME = "testWinServiceLifeCycle"; + Log.entering(c, METHOD_NAME); + + Log.info(c, METHOD_NAME, "calling LibertyServerFactory.getLibertyServer(SERVER_NAME, ON): " + SERVER_NAME); + server = LibertyServerFactory.getLibertyServer(SERVER_NAME, LibertyServerFactory.WinServiceOption.ON); + + Log.info(c, METHOD_NAME, "calling server.startServer()"); + server.startServer(); + + Log.info(c, METHOD_NAME, "calling server.waitForStringInLog('CWWKF0011I')"); + server.waitForStringInLog("CWWKF0011I"); + + assertTrue("the server should have been started", server.isStarted()); + + Log.info(c, METHOD_NAME, "calling server.stopServer(): " + SERVER_NAME); + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + @Test + /** + * test Liberty Server to Register, Start, Stop and Unregister as a Windows Service + * test snoop can be installed and accessed. + * + * @throws Exception + */ + public void testWinServiceAppAccess() throws Exception { + final String METHOD_NAME = "testWinServiceAppAccess"; + + Log.entering(c, METHOD_NAME); + + Log.info(c, METHOD_NAME, "calling LibertyServerFactory.getLibertyServer(SERVER_NAME, ON): " + SERVER_NAME); + server = LibertyServerFactory.getLibertyServer(SERVER_NAME, LibertyServerFactory.WinServiceOption.ON); + + Log.info(c, METHOD_NAME, "calling server.startServer()"); + server.startServer(); + + Log.info(c, METHOD_NAME, "calling server.waitForStringInLog('CWWKF0011I')"); + server.waitForStringInLog("CWWKF0011I"); + + assertTrue("the server should have been started", server.isStarted()); + + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/snoop"); + Log.info(c, METHOD_NAME, "Calling Snoop Application with URL=" + url.toString()); + HttpURLConnection con = getHttpConnection(url); + BufferedReader br = getConnectionStream(con); + String line = br.readLine(); + assertTrue("The response did not contain the \'Snoop Servlet\'", + line.contains("Snoop Servlet")); + + Log.info(c, METHOD_NAME, "return line: " + line); + + Log.info(c, METHOD_NAME, "calling server.stopServer(): " + SERVER_NAME); + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This method is used to get a connection stream from an HTTP connection. It + * gives the output from the webpage that it gets from the connection + * + * @param con The connection to the HTTP address + * @return The Output from the webpage + */ + private static BufferedReader getConnectionStream(HttpURLConnection con) throws IOException { + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + return br; + } + + /** + * This method creates a connection to a webpage and then reutrns the connection + * + * @param url The Http Address to connect to + * @return The connection to the http address + */ + private static HttpURLConnection getHttpConnection(URL url) throws IOException, ProtocolException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + return con; + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartJVMOptionsTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartJVMOptionsTest.java new file mode 100644 index 000000000000..2207aa68e5d3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartJVMOptionsTest.java @@ -0,0 +1,457 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* WLP Copyright IBM Corp. 2016 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.Enumeration; +import java.util.Properties; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class ServerStartJVMOptionsTest { + private static final Class c = ServerStartJVMOptionsTest.class; + + private static final String SERVER_NAME = "com.ibm.ws.kernel.boot.serverstart.fat"; + static String executionDir; + + private static LibertyServer server; + static File dirs; + static File dirs2; + static File jvmoptionsconfigdefaults; + static File jvmoptionsserverroot; + static File jvmoptionsconfigoverrides; + static File etcjvmoptions; + static File sharedjvmoptions; + static File bootstrapPropFile; + + @BeforeClass + public static void before() { + server = LibertyServerFactory.getLibertyServer(SERVER_NAME); + executionDir = server.getInstallRoot(); + dirs = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "configDropins" + File.separator + "defaults"); + dirs2 = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "configDropins" + File.separator + "overrides"); + jvmoptionsconfigdefaults = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "configDropins" + File.separator + "defaults" + File.separator + "jvm.options"); + jvmoptionsserverroot = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "jvm.options"); + jvmoptionsconfigoverrides = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "configDropins" + File.separator + "overrides" + File.separator + "jvm.options"); + etcjvmoptions = new File(executionDir + File.separator + "etc" + File.separator + "jvm.options"); + sharedjvmoptions = new File(executionDir + File.separator + "usr" + File.separator + "shared" + File.separator + "jvm.options"); + bootstrapPropFile = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "bootstrap.properties"); + } + + @AfterClass + public static void after() throws Exception { + if (server.isStarted()) { + server.stopServer(); + } + } + + /** + * This test ensures the server can be started with no jvm.options files or merged.jvm.options file + * + * @throws Exception + */ + @Test + public void testServerStartNoJVMOptions() throws Exception { + final String METHOD_NAME = "testServerStartNoJVMOptions"; + Log.entering(c, METHOD_NAME); + + String command = "bin" + File.separator + "server"; + String[] parms = new String[2]; + parms[0] = "start"; + parms[1] = SERVER_NAME; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + initialize(); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "server start stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "server start stderr = " + po.getStderr()); + + server.waitForStringInLog("CWWKF0011I"); + server.resetStarted(); + + assertTrue("the server should have been started", server.isStarted()); + + server.stopServer(); + } + + /** + * This test ensures the server fails over to etc/jvm.options if none are found + * + * @throws Exception + */ + @Test + public void testServerStartNoJVMOptionsETCFailover() throws Exception { + final String METHOD_NAME = "testServerStartNoJVMOptionsETCFailover"; + Log.entering(c, METHOD_NAME); + + String command = "bin" + File.separator + "server"; + String[] parms = new String[2]; + parms[0] = "start"; + parms[1] = SERVER_NAME; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + initialize(); + + Writer isw = new OutputStreamWriter(new FileOutputStream(etcjvmoptions), "UTF-8"); + BufferedWriter bw = new BufferedWriter(isw); + bw.write("-DTest1=Test1"); + bw.close(); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "server start stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "server start stderr = " + po.getStderr()); + + server.waitForStringInLog("CWWKF0011I"); + server.resetStarted(); + + server.serverDump(); + File[] filesAfterDump = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME).listFiles(); + + File dumpFile = new File(""); + for (File f : filesAfterDump) { + String fileName = f.getName(); + Log.info(c, METHOD_NAME, "Found file: " + fileName); + if (fileName.startsWith(SERVER_NAME + ".dump") && fileName.endsWith(".zip")) { + dumpFile = f; + break; + } + } + + if (dumpFile.getPath().compareTo("") == 0) { + fail("The Dump File was not found"); + } + + ZipFile zipFile = new ZipFile(dumpFile); + + boolean foundTest1 = false; + for (Enumeration en = zipFile.entries(); en.hasMoreElements();) { + ZipEntry entry = en.nextElement(); + String entryName = entry.getName(); + if (entryName.endsWith("JavaRuntimeInformation.txt")) { + InputStream inputstream = zipFile.getInputStream(entry); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream)); + String line; + int i = 0; + while ((line = reader.readLine()) != null) { + Log.info(c, METHOD_NAME, "Run" + i + ": " + line); + if (line.contains("-DTest1=Test1")) { + foundTest1 = true; + break; + } + i++; + } + + reader.close(); + inputstream.close(); + } + } + + zipFile.close(); + dumpFile.delete(); + assertTrue("The jvm option was not found", foundTest1); + + server.stopServer(); + } + + /** + * This test ensures the server can be started with one jvm.options file + * + * @throws Exception + */ + @Test + public void testServerStartOneJVMOption() throws Exception { + final String METHOD_NAME = "testServerStartOneJVMOption"; + Log.entering(c, METHOD_NAME); + + String command = "bin" + File.separator + "server"; + String[] parms = new String[2]; + parms[0] = "start"; + parms[1] = SERVER_NAME; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + initialize(); + + Writer isw = new OutputStreamWriter(new FileOutputStream(jvmoptionsconfigdefaults), "UTF-8"); + BufferedWriter bw = new BufferedWriter(isw); + bw.write("-DTest1=Test1"); + bw.close(); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "server start stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "server start stderr = " + po.getStderr()); + server.waitForStringInLog("CWWKF0011I"); + server.resetStarted(); + + server.serverDump(); + File[] filesAfterDump = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME).listFiles(); + + File dumpFile = new File(""); + for (File f : filesAfterDump) { + String fileName = f.getName(); + Log.info(c, METHOD_NAME, "Found file: " + fileName); + if (fileName.startsWith(SERVER_NAME + ".dump") && fileName.endsWith(".zip")) { + dumpFile = f; + break; + } + } + + if (dumpFile.getPath().compareTo("") == 0) { + fail("The Dump File was not found"); + } + + ZipFile zipFile = new ZipFile(dumpFile); + + boolean foundTest1 = false; + for (Enumeration en = zipFile.entries(); en.hasMoreElements();) { + ZipEntry entry = en.nextElement(); + String entryName = entry.getName(); + if (entryName.endsWith("JavaRuntimeInformation.txt")) { + InputStream inputstream = zipFile.getInputStream(entry); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream)); + String line; + int i = 0; + while ((line = reader.readLine()) != null) { + Log.info(c, METHOD_NAME, "Run" + i + ": " + line); + if (line.contains("-DTest1=Test1")) { + foundTest1 = true; + break; + } + i++; + } + + reader.close(); + inputstream.close(); + } + } + + zipFile.close(); + dumpFile.delete(); + assertTrue("The jvm option was not found", foundTest1); + + server.stopServer(); + } + + /** + * This test ensures the server can be started with all jvm.options files and + * the right options are used at the end + * + * @throws Exception + */ + @Test + @Mode(TestMode.LITE) + public void testServerStartAllJVMOptions() throws Exception { + final String METHOD_NAME = "testServerStartAllJVMOptions"; + Log.entering(c, METHOD_NAME); + + String command = "bin" + File.separator + "server"; + String[] parms = new String[2]; + parms[0] = "start"; + parms[1] = SERVER_NAME; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + initialize(); + + Writer isw = new OutputStreamWriter(new FileOutputStream(jvmoptionsconfigdefaults), "UTF-8"); + BufferedWriter bw = new BufferedWriter(isw); + bw.write("-DTest=Bad Value\n"); + bw.write("-DTest2=Bad Value\n"); + bw.write("-DTest3=Good Value\n"); + bw.write("-Xmx512m\n"); + bw.close(); + Writer isw2 = new OutputStreamWriter(new FileOutputStream(jvmoptionsserverroot), "UTF-8"); + BufferedWriter bw2 = new BufferedWriter(isw2); + bw2.write("-DTest=Good Value\n"); + bw2.write("-DTest4=Bad Value\n"); + bw2.write("-DTest5=Good Value\n"); + bw2.write("-Xmx1024m\n"); + bw2.close(); + Writer isw3 = new OutputStreamWriter(new FileOutputStream(jvmoptionsconfigoverrides), "UTF-8"); + BufferedWriter bw3 = new BufferedWriter(isw3); + bw3.write("-DTest2=Good Value\n"); + bw3.write("-DTest4=Good Value\n"); + bw3.write("-DTest6=Good Value\n"); + bw3.write("-XX:MaxPermSize=512m"); + bw3.close(); + Writer isw4 = new OutputStreamWriter(new FileOutputStream(sharedjvmoptions), "UTF-8"); + BufferedWriter bw4 = new BufferedWriter(isw4); + bw4.write("-DTest2=Bad Value\n"); + bw4.write("-DTest7=Good Value\n"); + bw4.close(); + Writer isw5 = new OutputStreamWriter(new FileOutputStream(etcjvmoptions), "UTF-8"); + BufferedWriter bw5 = new BufferedWriter(isw5); + bw5.write("-DTest8=Bad Value\n"); + bw5.close(); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "server start stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "server start stderr = " + po.getStderr()); + server.waitForStringInLog("CWWKF0011I"); + server.resetStarted(); + + server.serverDump(); + File[] filesAfterDump = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME).listFiles(); + + File dumpFile = new File(""); + for (File f : filesAfterDump) { + String fileName = f.getName(); + Log.info(c, METHOD_NAME, "Found file: " + fileName); + if (fileName.startsWith(SERVER_NAME + ".dump") && fileName.endsWith(".zip")) { + dumpFile = f; + break; + } + } + + if (dumpFile.getPath().compareTo("") == 0) { + fail("The Dump File was not found"); + } + + ZipFile zipFile = new ZipFile(dumpFile); + + boolean[] foundTest = new boolean[8]; + for (int i = 0; i < 8; i++) { + foundTest[i] = false; + } + for (Enumeration en = zipFile.entries(); en.hasMoreElements();) { + ZipEntry entry = en.nextElement(); + String entryName = entry.getName(); + if (entryName.endsWith("JavaHeapInfo.txt")) { + InputStream inputstream = zipFile.getInputStream(entry); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream)); + String line; + int i = 0; + while ((line = reader.readLine()) != null) { + if (line.contains("MaxHeapSizeLimit")) { + String num[] = line.split(":"); + int heapsize = Integer.parseInt(num[1].substring(1)); + assertTrue("JVM Option " + i + " wasn't found", (heapsize == 1073741824)); + } + } + } + if (entryName.endsWith("JavaRuntimeInformation.txt")) { + boolean afterSysProps = false; + InputStream inputstream = zipFile.getInputStream(entry); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream)); + String line; + int i = 0; + while ((line = reader.readLine()) != null) { + Log.info(c, "testJVMOptionsMergingAllOptions", "Run" + i + ": " + line); + if (line.contains("Java System Properties")) { + afterSysProps = true; + } + if (line.contains("-XX:MaxPermSize=512m")) { + foundTest[0] = true; + } + if (afterSysProps) { + if (line.contains("Test3=Good")) { + foundTest[1] = true; + } else if (line.contains("Test=Good Value")) { + foundTest[2] = true; + } else if (line.contains("Test5=Good Value")) { + foundTest[3] = true; + } else if (line.contains("Test2=Good Value")) { + foundTest[4] = true; + } else if (line.contains("Test4=Good Value")) { + foundTest[5] = true; + } else if (line.contains("Test6=Good Value")) { + foundTest[6] = true; + } else if (line.contains("Test7=Good Value")) { + foundTest[7] = true; + } else if (line.contains("Test=Bad Value")) { + fail("Contains Option 'Test=Bad Value' that it shouldn't"); + } else if (line.contains("Test2=Bad Value")) { + fail("Contains Option 'Test2=Bad Value' that it shouldn't"); + } else if (line.contains("Test4=Bad Value")) { + fail("Contains Option 'Test4=Bad Value' that it shouldn't"); + } else if (line.contains("Test2=Bad Value")) { + fail("Contains Option 'Test2=Bad Value' that it shouldn't"); + } else if (line.contains("Test8=Bad Value")) { + fail("Contains Option 'Test8=Bad Value' that it shouldn't"); + } + } + i++; + } + reader.close(); + inputstream.close(); + } + } + + zipFile.close(); + for (int i = 0; i < 8; i++) { + assertTrue("JVM Option " + i + " wasn't found", foundTest[i]); + } + + server.stopServer(); + } + + public void initialize() { + dirs.mkdirs(); + dirs2.mkdirs(); + if (jvmoptionsconfigdefaults.exists()) { + jvmoptionsconfigdefaults.delete(); + } + if (jvmoptionsserverroot.exists()) { + jvmoptionsserverroot.delete(); + } + if (jvmoptionsconfigoverrides.exists()) { + jvmoptionsconfigoverrides.delete(); + } + if (sharedjvmoptions.exists()) { + sharedjvmoptions.delete(); + } + if (etcjvmoptions.exists()) { + etcjvmoptions.delete(); + } + if (bootstrapPropFile.exists()) { + bootstrapPropFile.delete(); + } + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartTest.java new file mode 100755 index 000000000000..7f1e4ea87a9d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartTest.java @@ -0,0 +1,153 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Properties; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This test bucket tests the server startup process. + */ +public class ServerStartTest { + private static final Class c = ServerStartTest.class; + + private static final String SERVER_NAME = "com.ibm.ws.kernel.boot.serverstart.fat"; + private static final String SYMLINK_NAME = "com.ibm.ws.kernel.boot.serverstart.fat.symlink"; + + private static LibertyServer server; + + @Rule + public TestName testName = new TestName(); + + @Before + public void before() { + server = LibertyServerFactory.getLibertyServer(SERVER_NAME); + } + + @After + public void after() throws Exception { + server.stopServer(); + } + + @Test + /** + * This test validates that the server start script functions correctly when the CDPATH environment variable + * is present. + * + * @throws Exception + */ + public void testServerStartWithCDPATH() throws Exception { + final String METHOD_NAME = "testServerStartWithCDPATH"; + Log.entering(c, METHOD_NAME); + + // issuing the command from the Liberty install root while supplying the bin directory as + // part of the command itself causes the server script to cd to the bin directory, which + // is where we noticed problems when CDPATH is set + String executionDir = server.getInstallRoot(); + String command = "bin" + File.separator + "server"; + + String[] parms = new String[2]; + parms[0] = "start"; + parms[1] = SERVER_NAME; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "server start stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "server start stderr = " + po.getStderr()); + + server.waitForStringInLog("CWWKF0011I"); + + // because we didn't start the server using the LibertyServer APIs, we need to have it detect + // its started state so it will stop and save logs properly + server.resetStarted(); + + assertTrue("the server should have been started", server.isStarted()); + + Log.exiting(c, METHOD_NAME); + } + + @Test + /** + * This test validates that the server start functions correctly when the server is referenced + * via a symbolic link (on those systems which support same) + * + * @throws Exception + */ + public void testServerStartViaSymbolicLink() throws Exception + { + String linkCommand = "/bin/ln"; + + // only try this test if the unix ln command exists and can be executed + File ln = new File(linkCommand); + if (ln.exists() && ln.canExecute()) { + // Copy the server directory elsewhere + String originalPath = server.getServerRoot(); + String relocatedPath = server.getServerRoot() + "/../../" + server.getServerName(); + String copyCommand = "cp"; + String[] copyParms = new String[] { "-r", originalPath, relocatedPath }; // Make sure -r works on all these platforms... + ProgramOutput po = server.getMachine().execute(copyCommand, copyParms); + + // Set up the symlink + String symPath = server.getServerRoot() + "/../" + SYMLINK_NAME; + String unlinkCommand = "rm"; + String[] unlinkParms = new String[] { symPath }; + po = server.getMachine().execute(unlinkCommand, unlinkParms); + + String[] linkParms = new String[] { "-s", relocatedPath, symPath }; // Symbolic link relocated copy as + po = server.getMachine().execute(linkCommand, linkParms); + + // Get a handle to the alias.Note that this must use a new entry point to get a handle to an already configured server. + LibertyServer symlink_server = LibertyServerFactory.getExistingLibertyServer(SYMLINK_NAME); + + // Confirm it can start and stop + server.stopServer(); // Pause the original + symlink_server.startServer(); // Start the alias (and confirm) + symlink_server.stopServer(); // stop the alias (and confirm) + server.startServer(); // Resume original (in case following test needs it). + } + + } + + @Test + /** + * This test ensures that the servers starts without error when using the -Xfuture command line + * argument. This argument enforces strict class file verification. One customer ran into + * BundleExceptions due to empty package-info.class files (defect 177872). + */ + public void testServerStartWithDashXFutureCmdArg() throws Exception { + server.copyFileToTempDir("server.xml", "origServer.xml"); + try { + server.setServerConfigurationFile("Xfuture/server.xml"); + server.copyFileToLibertyServerRoot("Xfuture/jvm.options"); + + server.startServer(); + } finally { + server.deleteDirectoryFromLibertyServerRoot("jvm.options"); + server.setServerConfigurationFile("tmp/origServer.xml"); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ShutdownTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ShutdownTest.java new file mode 100755 index 000000000000..3d8e6c97941f --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ShutdownTest.java @@ -0,0 +1,101 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ShutdownTest { + private static final Class c = ShutdownTest.class; + + @Rule + public final TestName testName = new TestName(); + + LibertyServer server; + + @Before + public void before() { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.shutdown.fat"); + } + + @After + public void after() throws Exception { + // We stop the server by other means, so wait for that stop to finish, + // and then call stopServer to save logs, reset log offsets, etc. + server.waitForStringInLog("CWWKE0036I"); + server.stopServer(); + } + + private void runTest(String exitMethodName) throws Exception { + final String m = testName.getMethodName(); + Log.entering(c, m); + try { + server.startServer(m + ".log"); + + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/shutdownfat?exit=" + exitMethodName); + try { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + Log.info(c, m, "HTTP response: " + con.getResponseCode()); + + InputStream in = con.getInputStream(); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + + for (String line; (line = reader.readLine()) != null;) { + Log.info(c, m, "Output: " + line); + } + } finally { + try { + in.close(); + } catch (IOException e) { + Log.error(c, m, e); + } + } + } catch (Throwable t) { + // The server might die before the response can be written. + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw)); + Log.info(ShutdownTest.class, "testSystemExit", "Ignoring " + sw.toString()); + } + + server.waitForStringInLog("CWWKE0084I:.*" + exitMethodName); + } finally { + Log.exiting(c, m); + } + } + + @Test + public void testSystemExit() throws Exception { + runTest("System.exit"); + } + + @Test + public void testRuntimeExit() throws Exception { + runTest("Runtime.exit"); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/CreateCommandTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/CreateCommandTest.java new file mode 100755 index 000000000000..b9b3b1c02cb9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/CreateCommandTest.java @@ -0,0 +1,78 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.commandline; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import componenttest.common.apiservices.Bootstrap; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.utils.LibertyServerUtils; + +/** + * + */ +public class CreateCommandTest { + + private final static double javaLevel = Double.parseDouble(System.getProperty("java.specification.version")); + + private final static String serverName = "com.ibm.ws.kernel.boot.commandline.CreateCommandTest"; + private static Bootstrap bootstrap; + private static Machine machine; + private static String installPath;; + private static String defaultServerPath;; + + @BeforeClass + public static void setup() throws Exception { + bootstrap = Bootstrap.getInstance(); + machine = LibertyServerUtils.createMachine(bootstrap); + installPath = LibertyFileManager.getInstallPath(bootstrap); + defaultServerPath = installPath + "/usr/servers/" + serverName; + } + + @Before + public void cleanupBeforeRun() throws Exception { + // since we are not using the normal LibertyServer class for this server, + // we need to make sure to explicitly clean up. We do this before running + // the test in order to preserve the contents on disk. + if (LibertyFileManager.libertyFileExists(machine, defaultServerPath)) { + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, defaultServerPath); + } + } + + @Test + public void testIsServerEnvCreated() throws Exception { + + ProgramOutput po = LibertyServerUtils.executeLibertyCmd(bootstrap, "server", "create", serverName); + assertEquals("Unexpected return code from server create command", 0, po.getReturnCode()); + + // check that server directory was created + assertTrue("Expected server directory to exist at " + defaultServerPath + ", but does not", LibertyFileManager.libertyFileExists(machine, defaultServerPath)); + + // check that server.xml exists + String serverXmlPath = defaultServerPath + "/server.xml"; + assertTrue("Expected server.xml file to exist at " + serverXmlPath + ", but does not", LibertyFileManager.libertyFileExists(machine, serverXmlPath)); + + // if we are running in a JVM that is version 1.8 or higher, we also need to check for the server.env file + if (javaLevel >= 1.8) { + String serverEnvPath = defaultServerPath + "/server.env"; + assertTrue("Expected server.env file to exist at " + serverEnvPath + ", but does not", LibertyFileManager.libertyFileExists(machine, serverEnvPath)); + } + + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/DumpCommandTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/DumpCommandTest.java new file mode 100755 index 000000000000..c4c15ea5c1fb --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/DumpCommandTest.java @@ -0,0 +1,154 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.commandline; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; + +import java.io.File; +import java.util.Properties; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class DumpCommandTest { + private static final Class c = DumpCommandTest.class; + + @Rule + public final TestName testName = new TestName(); + + private static LibertyServer server; + private static File serverRoot; + private static boolean isIBM_JVM = false; + + @BeforeClass + public static void before() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.shutdown.fat"); + Log.info(c, "before", "starting server"); + server.startServer("DumpCommandTest.log"); + serverRoot = new File(server.getServerRoot()); + + String javaHome = server.getMachineJavaJDK(); + Properties env = new Properties(); + env.setProperty("JAVA_HOME", javaHome); + String javaBinDir = javaHome + "/bin"; + ProgramOutput javaVersionOutput = server.getMachine().execute(javaBinDir + "/java", new String[] { "-version" }, javaBinDir, env); + String stdout = javaVersionOutput.getStdout(); + String stderr = javaVersionOutput.getStderr(); + Log.info(c, "before", "java -version stdout: " + stdout); + Log.info(c, "before", "java -version stderr: " + stderr); + assertEquals("Unexpected return code from java -version", 0, javaVersionOutput.getReturnCode()); + + if ((stdout != null && stdout.contains("IBM")) || (stderr != null && stderr.contains("IBM"))) { + isIBM_JVM = true; + } + } + + @AfterClass + public static void after() throws Exception { + // We stop the server by other means, but call stopServer in order to + // save logs, reset log offsets, etc. + server.stopServer(); + } + + /** + * Tests the command line tool: server javadump <serverName> + * Test will pass if the command executes successfully and (if using an + * IBM JVM) creates a file, "javacore*.txt", in the server root dir. + * Non-IBM JDKs do not produce javacores - and the javadump command + * does not usually return successfully on these platforms, so this test + * only runs on IBM JDKs. + */ + @Test + public void testJavadump() throws Exception { + assumeTrue(isIBM_JVM); + File[] filesBeforeDump = serverRoot.listFiles(); + Log.info(c, "testJavadump", "javadump"); + ProgramOutput output = server.javadumpThreads(); + assertEquals("Unexpected output code running javadump", 0, output.getReturnCode()); + + assertNotNull("Did not see expected CWWKE0068I in logs", server.waitForStringInLog("CWWKE0068I.*javacore")); + + File[] filesAfterDump = serverRoot.listFiles(); + assertTrue("Did not find expected additional files in serverRoot: " + serverRoot.getAbsolutePath(), + filesBeforeDump.length < filesAfterDump.length); + boolean foundJavacoreFile = false; + for (File f : filesAfterDump) { + String fileName = f.getName(); + Log.info(c, "testJavadump", "Found file: " + fileName); + if (fileName.startsWith("javacore") && fileName.endsWith(".txt")) { + foundJavacoreFile = true; + break; + } + } + assertTrue("Expected javacore*.txt file not found in serverRoot: " + serverRoot.getAbsolutePath(), foundJavacoreFile); + + Log.info(c, "testJavadump", "exit success"); + } + + /** + * Tests the command line tool: server dump <serverName> --include=heap,system,thread + * Test will pass if the command executes successfully and creates a file, + * "dump.<serverName>.dump*.zip", in the server root dir. Non-IBM JDKs do not produce + * artifacts like javacores, heap dumps, system cores in the same way as IBM JDKs - and the + * dump command does not usually return successfully on these platforms, so this test + * only runs on IBM JDKs. + */ + @Test + public void testDump() throws Exception { + assumeTrue(isIBM_JVM); + File[] filesBeforeDump = serverRoot.listFiles(); + Log.info(c, "testDump", "dump"); + ProgramOutput output = server.serverDump("heap,system,thread"); + + assertEquals("Unexpected output code running dump", 0, output.getReturnCode()); + + assertNotNull("Did not find expected CWWKE0068I message for heap dump in logs", server.waitForStringInLog("CWWKE0068I.*phd")); //heap dump + if (server.getMachine().getOperatingSystem() == OperatingSystem.ZOS) { + assertNotNull("Did not find expected CWWKE0092I message for java system dump on zos in logs", server.waitForStringInLog("CWWKE0092I")); + } else { + assertNotNull("Did not find expected CWWKE0068I message for system core in logs", server.waitForStringInLog("CWWKE0068I.*dmp")); //system core + } + assertNotNull("Did not find expected CWWKE0068I message for javacore in logs", server.waitForStringInLog("CWWKE0068I.*javacore")); //javacore + + File[] filesAfterDump = serverRoot.listFiles(); + assertTrue("Did not find expected additional files in serverRoot: " + serverRoot.getAbsolutePath(), + filesBeforeDump.length < filesAfterDump.length); + String serverName = server.getServerName(); + boolean foundDumpZip = false; + for (File f : filesAfterDump) { + String fileName = f.getName(); + Log.info(c, "testDump", "Found file: " + fileName); + if (fileName.startsWith(serverName + ".dump") && fileName.endsWith(".zip")) { + foundDumpZip = true; + break; + } + } + assertTrue("Expected .dump*.zip file not found in serverRoot: " + serverRoot.getAbsolutePath(), foundDumpZip); + + Log.info(c, "testDump", "exit success"); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/PauseResumeCommandTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/PauseResumeCommandTest.java new file mode 100644 index 000000000000..91b4572bc108 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/PauseResumeCommandTest.java @@ -0,0 +1,158 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.commandline; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class PauseResumeCommandTest { + + private static final Class c = PauseResumeCommandTest.class; + + private static final String PAUSE_RESUME_SERVER_NAME = "com.ibm.ws.kernel.boot.pause.resume.fat"; + + private static final LibertyServer pauseResumeServer = LibertyServerFactory.getLibertyServer(PAUSE_RESUME_SERVER_NAME); + + @Before + public void setup() throws Exception { + pauseResumeServer.startServer(); + } + + @After + public void teardown() throws Exception { + pauseResumeServer.stopServer("CWWKE093*"); + } + + /** + * Tests the case where the "server pause" command is issued and no + * pauseable components exist + * + * @throws Exception + */ + @Test + public void testPauseNoPauseableComponents() throws Exception { + final String METHOD_NAME = "testPauseNoPauseableComponents"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("pause", null).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0933W", 10000)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the case where the "server resume" command is issued and no + * pauseable components exist + * + * @throws Exception + */ + @Test + public void testResumeNoPauseableComponents() throws Exception { + final String METHOD_NAME = "testResumeNoPauseableComponents"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("resume", null).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0934W", 10000)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the case where the "server pause" command is issued with an empty target list. + * + * @throws Exception + */ + @Test + public void testPauseEmptyTargetList() throws Exception { + final String METHOD_NAME = "testPauseEmptyTargetList"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("pause", new String[] { "--target=" }).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0931W", 10000)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the case where the "server resume" command is issued with an empty target list. + * + * @throws Exception + */ + @Test + public void testResumeEmptyTargetList() throws Exception { + final String METHOD_NAME = "testResumeEmptyTargetList"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("resume", new String[] { "--target=" }).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0932W", 10000)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the case where the "server resume" command is issued with an invalid target. + * + * @throws Exception + */ + @Test + public void testPauseInvalidTarget() throws Exception { + final String METHOD_NAME = "testPauseInvalidTarget"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("pause", new String[] { "--target=InvalidTarget" }).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0935W", + 10000)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the case where the "server resume" command is issued with an empty target list. + * + * @throws Exception + */ + @Test + public void testResumeInvalidTarget() throws Exception { + final String METHOD_NAME = "testResumeInvalidTarget"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("resume", new String[] { "--target=InvalidTarget" }).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0936W", + 10000)); + + Log.exiting(c, METHOD_NAME); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/StartCommandTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/StartCommandTest.java new file mode 100755 index 000000000000..5875ce635371 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/StartCommandTest.java @@ -0,0 +1,90 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.commandline; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import componenttest.common.apiservices.Bootstrap; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.utils.LibertyServerUtils; + +/** + * + */ +public class StartCommandTest { + + private final static double javaLevel = Double.parseDouble(System.getProperty("java.specification.version")); + + private final static String defaultServerName = "defaultServer"; + private static Bootstrap bootstrap; + private static Machine machine; + private static String installPath; + private static String defaultServerPath; + + @BeforeClass + public static void setup() throws Exception { + bootstrap = Bootstrap.getInstance(); + machine = LibertyServerUtils.createMachine(bootstrap); + installPath = LibertyFileManager.getInstallPath(bootstrap); + defaultServerPath = installPath + "/usr/servers/" + defaultServerName; + } + + @Before + public void cleanupBeforeRun() throws Exception { + // since we are not using the normal LibertyServer class for this server, + // we need to make sure to explicitly clean up. We do this before running + // the test in order to preserve the contents on disk. + + if (LibertyFileManager.libertyFileExists(machine, defaultServerPath)) { + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, defaultServerPath); + } + } + + /** + * Tests the case where the "server run" command is issued and defaultServer + * does not exist. In this case, defaultServer is created on the fly. + * + * @throws Exception + */ + @Test + public void testIsServerEnvCreatedForImplicitServerCreate() throws Exception { + + ProgramOutput po = LibertyServerUtils.executeLibertyCmd(bootstrap, "server", "start"); + assertEquals("Unexpected return code from server start command", 0, po.getReturnCode()); + + try { + // check that server directory was created + assertTrue("Expected server directory to exist at " + defaultServerPath + ", but does not", LibertyFileManager.libertyFileExists(machine, defaultServerPath)); + + // check that server.xml exists + String serverXmlPath = defaultServerPath + "/server.xml"; + assertTrue("Expected server.xml file to exist at " + serverXmlPath + ", but does not", LibertyFileManager.libertyFileExists(machine, serverXmlPath)); + + // if we are running in a JVM that is version 1.8 or higher, we also need to check for the server.env file + if (javaLevel >= 1.8) { + String serverEnvPath = defaultServerPath + "/server.env"; + assertTrue("Expected server.env file to exist at " + serverEnvPath + ", but does not", LibertyFileManager.libertyFileExists(machine, serverEnvPath)); + } + } finally { + po = LibertyServerUtils.executeLibertyCmd(bootstrap, "server", "stop"); + assertEquals("Unexpected return code from server stop command", 0, po.getReturnCode()); + } + + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandport/ServerCommandPortTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandport/ServerCommandPortTest.java new file mode 100755 index 000000000000..45d791dcc4de --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandport/ServerCommandPortTest.java @@ -0,0 +1,243 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.commandport; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.InputStreamReader; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +/** + * This test bucket validates the functionality of the server command port, the port that is used by the server script + * to communicate with a running server, if required. + */ +public class ServerCommandPortTest { + private static final String COMMAND_PORT_DISABLED_SERVER_NAME = "com.ibm.ws.kernel.boot.commandport.disabled.fat"; + private static final String COMMAND_PORT_ENABLED_SERVER_NAME = "com.ibm.ws.kernel.boot.commandport.enabled.fat"; + + private static final LibertyServer commandPortDisabledServer = LibertyServerFactory.getLibertyServer(COMMAND_PORT_DISABLED_SERVER_NAME); + private static final LibertyServer commandPortEnabledServer = LibertyServerFactory.getLibertyServer(COMMAND_PORT_ENABLED_SERVER_NAME); + + private static final boolean isMac = System.getProperty("os.name", "unknown").toLowerCase().indexOf("mac os") >= 0; + + @Rule + public TestName testName = new TestName(); + + @Test + /** + * This test validates the functionality of a server with the command port disabled. The server script has + * only limited ability to administer a server with the command port disabled. + * + * @throws Exception + */ + public void testServerCommandPortDisabled() throws Exception { + LibertyServer server = commandPortDisabledServer; + + // server should start, but with a warning message that we can't actually tell if it completed starting + // because the command port is disabled + // + // NOTE: don't use "server.startServer()" because this causes the LibertyServer to remember that it is + // started and it will try to stop it during test cleanup, failing due to command port disablement + String output = server.executeServerScript("start", null).getStdout(); + + try { + // there are two messages for starting a server, one that contains a process ID and one that does not; + // either message indicates success of the start command for this purpose + assertTrue(output.contains("CWWKE0088W") || output.contains("CWWKE0087W")); + server.waitForStringInLog("CWWKF0011I"); + + // save the PID to validate the server status command - note that on Windows, the PID is not returned + // as part of the start message, so we can't always perform this verification + int serverPid = getServerPid(output); + + // server status should work as usual, since the command port is not needed for it + output = server.executeServerScript("status", null).getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " is running")); + + if (serverPid > 0) { + assertTrue(output.contains("with process ID " + serverPid)); + } + + // ensure that the command port in the .sCommand file is -1 + assertEquals(-1, getCommandPort(server)); + + // generating a java dump should produce an error saying that the dump can't be taken due to command + // port disablement + output = server.executeServerScript("javadump", null).getStdout(); + assertTrue(output.contains("CWWKE0091E")); + + // generating a server dump should produce a warning saying that the dump was taken, but that some + // information is missing + output = server.executeServerScript("dump", null).getStdout(); + assertTrue(output.contains("CWWKE0090W")); + validateDumpFile(output, server, COMMAND_PORT_DISABLED_SERVER_NAME); + + // stopping the server should produce an error + output = server.executeServerScript("stop", null).getStdout(); + assertTrue(output.contains("CWWKE0089E")); + } finally { + Log.info(ServerCommandPortTest.class, "testServerCommandPortDisabled", + "Stop the server via a servlet since the command port is disabled."); + try { + // make sure the shutdown app is available before using it to shutdown the server + server.validateAppLoaded("shutdownfat"); + + HttpUtils.findStringInUrl(server, "/shutdownfat", "exit="); + } catch (Throwable t) { + Log.error(ServerCommandPortTest.class, "testServerCommandPortDisabled", t); + } + server.waitForStringInLog("CWWKE0036I"); + + // make sure logs are collected (not stopping the normal way...no command port) + server.postStopServerArchive(); + } + } + + @Test + /** + * This test validates the functionality of a server with the command port enabled. + * + * @throws Exception + */ + public void testServerCommandPortEnabled() throws Exception { + LibertyServer server = commandPortEnabledServer; + + String output = server.startServer().getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " started")); + + // save the PID to validate the server status command - note that on Windows, the PID is not returned + // as part of the start message, so we can't always perform this verification + int serverPid = getServerPid(output); + + // validate server status command + output = server.executeServerScript("status", null).getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " is running")); + + if (serverPid > 0) { + assertTrue(output.contains("with process ID " + serverPid)); + } + + // ensure that the command port in the .sCommand file is greater than 0 + assertTrue(getCommandPort(server) > 0); + + // validate server javadump command on all platforms except mac, because javadump + // is unreliable on hotspot jvms + if (!isMac) { + output = server.executeServerScript("javadump", null).getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " dump complete in")); + validateDumpFile(output, server, COMMAND_PORT_ENABLED_SERVER_NAME); + } + + // validate server dump command + output = server.executeServerScript("dump", null).getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " dump complete in")); + validateDumpFile(output, server, COMMAND_PORT_ENABLED_SERVER_NAME); + + // validate server stop command + output = server.stopServer().getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " stopped.")); + + // make sure server really stopped + output = server.executeServerScript("status", null).getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " is not running.")); + } + + /** + * Validates the existence of a dump file. The dump file name is parsed from the input parameter, + * which is the output of the server script command that requested the dump. + * + * @param outputMessage the output of the server script command that requested the dump + */ + private void validateDumpFile(String outputMessage, LibertyServer server, final String serverName) throws Exception { + String dumpFileName = null; + + // The format of the dump complete message is: + // Server dump complete in . + // The filename comes after "in" and has a period attached. + boolean foundServerName = false; + String[] words = outputMessage.split("\\s+"); + for (int i = 0; i < words.length; i++) { + // we are checking for the message header here to avoid a Mac JDK bug + // that prints a message that includes the word "in" but then causes a + // StringIndexOutOfBoundsException below. This check could be removed + // when the Mac bug is fixed, but it doesn't hurt to leave it in. + // See defects 124026 and 123011 for more details. + if (i > 0 && words[i - 1].equals("Server") && words[i].equals(serverName)) { + foundServerName = true; + } else if (words[i].equals("in") && foundServerName && i < (words.length - 1)) { + dumpFileName = words[i + 1]; + + int serverRootLength = server.getServerRoot().length(); + int periodIndex = dumpFileName.length() - 1; + + // strip the server root off the front and the period off the end + dumpFileName = dumpFileName.substring(serverRootLength, periodIndex); + break; + } + } + + // verify that the server dump file exists and that *something* is inside it + RemoteFile dumpFile = server.getFileFromLibertyServerRoot(dumpFileName); + assertTrue(dumpFile.exists()); + assertTrue(dumpFile.length() > 0); + } + + /** + * Parses and returns the server PID from the output of the server start command. + * + * @param outputMessage the output of the server start command + * @return the server's PID, or -1 if the PID cannot be parsed from the command output + */ + private int getServerPid(String outputMessage) throws Exception { + // The format of the server started message is: + // Server started with process ID . + // The PID comes after "ID" and has a period or comma attached. + String[] words = outputMessage.split("\\s+"); + for (int i = 0; i < words.length; i++) { + if (words[i].equals("ID")) { + String pidString = words[i + 1]; + pidString = pidString.substring(0, pidString.length() - 2); // strip trailing period + return Integer.parseInt(pidString); + } + } + return -1; + } + + /** + * Gets the current command port for the specified server. Note that this is + * NOT something that is visible to the customer. This is a test of our own + * internals added as a secondary verification that command port enablement + * and disablement works. + * + * @param server the server to get the command port for + * @return the server's command port + */ + private int getCommandPort(LibertyServer server) throws Exception { + RemoteFile commandFile = server.getFileFromLibertyServerRoot("workarea/.sCommand"); + BufferedReader reader = new BufferedReader(new InputStreamReader(commandFile.openForReading())); + String line = reader.readLine(); + reader.close(); + return Integer.parseInt(line.split(":")[1]); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/LogLevelPropertyTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/LogLevelPropertyTest.java new file mode 100755 index 000000000000..719827714991 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/LogLevelPropertyTest.java @@ -0,0 +1,122 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.commands; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.util.Locale; +import java.util.Map; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class LogLevelPropertyTest { + + private static LibertyServer server; + private static boolean isMac; + private static boolean isZos; + + @BeforeClass + public static void before() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.bootstrap.output.fat"); + + String osName = System.getProperty("os.name", "unknown").toLowerCase(Locale.ROOT); + + Map options = server.getJvmOptionsAsMap(); + String maxPermSize = "-XX:MaxPermSize"; + if (options.containsKey(maxPermSize)) { + options.remove(maxPermSize); + } + + // Temporary debug for 130858. + isZos = osName.contains("z/os"); + if (isZos) { + String option = "-Xtrace:output=shared_classes.trc,maximal={j9shr}"; + Log.info(LogLevelPropertyTest.class, "before", "Adding " + option + " for z/OS"); + options.put(option, null); + + } + + server.setJvmOptions(options); + + server.startServer(); + + isMac = osName.indexOf("mac os") >= 0; + } + + @Test + public void testLogLevelPropertyDisabled() throws Exception { + try { + if (isMac) { + // There might (with Java7 on some versions of the OS) be garbage in console.log that is + // printed by the JVM (we have no control over it). It looks something like this: + // objc[25086]: Class JavaLaunchHelper is implemented in both /.../jre/bin/java and /.../jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. + // only test for the empty console log if that message isn't present + if (server.waitForStringInLog("objc.*", 0, server.getConsoleLogFile()) == null) { + assertEquals("Console log file was not empty.", 0, server.getConsoleLogFile().length()); + } + } else if (server.isJavaVersion8() && server.isOracleJVM()) { + // On Oracle JDK 8, the JVM will complain about the MaxPermSize option + if (server.waitForStringInLog(".*support was removed in 8.0", 0, server.getConsoleLogFile()) == null) { + assertEquals("Console log file was not empty.", 0, server.getConsoleLogFile().length()); + } + } else { + assertEquals("Console log file was not empty.", 0, server.getConsoleLogFile().length()); + } + } finally { + // Temporary debug for 130858. + if (isZos) { + final Class c = LogLevelPropertyTest.class; + final String m = "testLogLevelPropertyDisabled"; + + Machine machine = server.getMachine(); + ProgramOutput output = machine.execute("ls", + new String[] { + "-l", + new File(server.getUserDir(), "servers/.classCache").getAbsolutePath(), + new File(server.getUserDir(), "servers/.classCache/javasharedresources").getAbsolutePath() }); + Log.info(c, m, "ls -l diagnostic return code: " + output.getReturnCode()); + Log.info(c, m, "ls -l diagnostic stdout: " + output.getStdout()); + Log.info(c, m, "ls -l diagnostic stderr: " + output.getStderr()); + + output = machine.execute("ipcs"); + Log.info(c, m, "icps diagnostic return code: " + output.getReturnCode()); + Log.info(c, m, "icps diagnostic stdout: " + output.getStdout()); + Log.info(c, m, "icps diagnostic stderr: " + output.getStderr()); + + output = machine.execute(new File(server.getMachineJavaJDK(), "../bin/jar").getAbsolutePath(), + new String[] { + "cfM", + // Weird extension to avoid filtering. + new File(server.getServerRoot(), "scControlFiles.zip.diag").getAbsolutePath(), + new File(server.getUserDir(), "servers/.classCache").getAbsolutePath() + }); + Log.info(c, m, "jar cf diagnostic return code: " + output.getReturnCode()); + Log.info(c, m, "jar cf diagnostic stdout: " + output.getStdout()); + Log.info(c, m, "jar cf diagnostic stderr: " + output.getStderr()); + } + } + } + + @AfterClass + public static void after() throws Exception { + server.stopServer(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/PackageCommandTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/PackageCommandTest.java new file mode 100755 index 000000000000..077146d6e798 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/PackageCommandTest.java @@ -0,0 +1,171 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.commands; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; + +import java.io.FileNotFoundException; +import java.util.Enumeration; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.jar.Manifest; + +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class PackageCommandTest { + + /** + * The package command requires that the lib/extract directory exists, as this directory + * contains a required manifest, self extractable classes, etc. If this directory does + * not exist, then the command should print this message: + *
+ * CWWKE0922E: The package command cannot complete because the installation is missing the lib/extract directory. + *
+ * This test verifies that this error message is printed. + *
+ * Note: This test assumes that the lib/extract directory is already missing. As of today, the + * FAT environment's installation of WLP does not include this directory. If we end up creating that + * directory in the FAT environment, then we'll need to find another way to run this test - as we + * probably don't want to delete a directory in the FAT environment's installation. + * + * @throws Exception + */ + @Test + public void testCorrectErrorMessageWhenLibExtractDirIsMissing() throws Exception { + // Pick any server, doesn't matter. + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.bootstrap.fat"); + // Only run the test if the lib/extract directory does not exist + try { + server.getFileFromLibertyInstallRoot("lib/extract"); + assumeTrue(false); // the directory exists, so we skip this test. + } catch (FileNotFoundException ex) { + //expected - the directory does not exist - so proceed. + } + + String stdout = server.executeServerScript("package", new String[] { "--include=minify" }).getStdout(); + + assertTrue("Did not find expected failure message, CWWKE0922E", stdout.contains("CWWKE0922E")); + } + + /** + * Packages --include=minify,runnable jar and verifies correct content. + * This test is not run if: + * 1) platform is z/OS (jar archive not supported) + * 2) wlp/lib/extract directory does not exist + * + * @throws Exception + */ + @Test + public void testCreateRunnableJar() throws Exception { + // Pick any server, doesn't matter. + String serverName = "com.ibm.ws.kernel.bootstrap.fat"; + String jarFileName = serverName + ".jar"; + String mainClass = "wlp.lib.extract.SelfExtractRun"; + + // Doesn't work on z/OS (because you can't package into a jar on z/OS) + assumeTrue(!System.getProperty("os.name").equals("z/OS")); + + LibertyServer server = LibertyServerFactory.getLibertyServer(serverName); + + // Only run the test if the lib/extract directory exists + try { + server.getFileFromLibertyInstallRoot("lib/extract"); + + String stdout = server.executeServerScript("package", new String[] { "--archive=" + jarFileName, "--include=runnable" }).getStdout(); + + assertTrue("Could not package server " + serverName, stdout.contains("Server " + serverName + " package complete")); + + JarFile jarFile = new JarFile(server.getFileFromLibertyServerRoot(jarFileName).getAbsolutePath()); + + // Check the manifest for headers that should be in there. + Manifest mf = jarFile.getManifest(); + assertNotNull("There should be a manifest in the jar file", mf); + + // make sure it'a a runnable jar + assertEquals(mainClass, mf.getMainAttributes().getValue("Main-Class")); + + // Check that the self-extract and the server's entries are in the jar + Enumeration entries = jarFile.entries(); + assertTrue(entries.hasMoreElements()); + + boolean foundSelfExtractRun = false; + while (entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + foundSelfExtractRun |= entry.getName().startsWith("wlp/lib/extract/SelfExtractRun.class"); + } + + assertTrue(foundSelfExtractRun); + + } catch (FileNotFoundException ex) { + assumeTrue(false); // the directory does not exist, so we skip this test. + } + } + + /** + * Make sure that when packaging a jar archive using --include=usr, + * the resulting jar files does NOT contain the self-extract files. + */ + @Test + public void testPackageJarArchiveWithIncludeEqualsUsr() throws Exception { + + // NOTE: This test won't work cuz the necessary MANIFEST files and + // self-extract files (wlp/lib/extract/*) aren't present in our test environment. + assumeTrue(false); + + // Doesn't work on z/OS (cuz you can't package into a jar on z/OS) + assumeTrue(!System.getProperty("os.name").equals("z/OS")); + + // Pick any server, doesn't matter. + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.bootstrap.fat"); + + String jarFileName = "package.usr.jar"; + + String stdout = server.executeServerScript("package", + new String[] { "--archive=" + jarFileName, + "--include=usr" }).getStdout(); + + JarFile jarFile = new JarFile(server.getFileFromLibertyServerRoot(jarFileName).getAbsolutePath()); + + // Check the manifest for headers that should be in there. + Manifest mf = jarFile.getManifest(); + assertNotNull("There should be a manifest in the jar file", mf); + + assertTrue(mf.getMainAttributes().containsKey("Applies-To")); + assertEquals("com.ibm.websphere.appserver", mf.getMainAttributes().getValue("Applies-To")); + assertEquals("false", mf.getMainAttributes().getValue("Extract-Installer")); + + // Check that the self-extract and the server's entries are in the jar + Enumeration entries = jarFile.entries(); + assertTrue(entries.hasMoreElements()); + + boolean foundServerEntry = false; + boolean foundSelfExtractEntry = false; + while (entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + foundServerEntry |= entry.getName().startsWith("wlp/usr/servers/com.ibm.ws.kernel.bootstrap.fat"); + foundSelfExtractEntry |= entry.getName().startsWith("wlp/lib/extract"); + } + + assertTrue(foundServerEntry); + assertTrue(foundSelfExtractEntry); + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/KernelChangeTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/KernelChangeTest.java new file mode 100755 index 000000000000..3d5e1681e017 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/KernelChangeTest.java @@ -0,0 +1,80 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.provisioning; + +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class KernelChangeTest { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.bootstrap.fat"); + + @Rule + public TestName testName = new TestName(); + + @After + public void tearDown() throws Exception { + server.stopServer(); + } + + @Test + public void testKernelChangeRestart() throws Exception { + // Start the server (wait for server started message) + server.startServer("part1.console.log"); + + // Make sure no error messages in console.log + List output = server.findStringsInLogs("ERROR.*", server.getConsoleLogFile()); + assertTrue("We should not see error messages in the log. output=" + output, output.isEmpty()); + + // Stop the server (WARM) + server.stopServer(false); + + // Save logs, switch bootstrap.properties files to enable hpel + server.renameLibertyServerRootFile("logs/messages.log", "logs/part1.messages.log"); + server.renameLibertyServerRootFile("logs/trace.log", "logs/part1.trace.log"); + server.renameLibertyServerRootFile("bootstrap.properties", "bootstrap.properties.orig"); + server.renameLibertyServerRootFile("bootstrap.properties.hpel", "bootstrap.properties"); + + // Start the server with HPEL (WARM) + server.startServer("part2.console.log", false, false); + + // Make sure no error messages in console.log + output = server.findStringsInLogs("ERROR.*", server.getConsoleLogFile()); + assertTrue("We should not see error messages in the log. output=" + output, output.isEmpty()); + + // Stop the server (WARM) + server.stopServer(false); + + // Save logs, switch back to disable hpel again + server.renameLibertyServerRootFile("bootstrap.properties", "bootstrap.properties.hpel"); + server.renameLibertyServerRootFile("bootstrap.properties.orig", "bootstrap.properties"); + + // Start the server WITHOUT HPEL again + server.startServer("part3.console.log", false, false); + + // Make sure no error messages in console.log + output = server.findStringsInLogs("ERROR.*", server.getConsoleLogFile()); + assertTrue("We should not see error messages in the log. output=" + output, output.isEmpty()); + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/ProvisioningTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/ProvisioningTest.java new file mode 100755 index 000000000000..75d8307fbc99 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/ProvisioningTest.java @@ -0,0 +1,700 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.provisioning; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ProvisioningTest { + + private static final Class c = ProvisioningTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.provisioning.fat"); + + private static final String BUNDLE_NAME = "ProvisioningTestBundle"; + private static final String INTERIM_FIX_BUNDLE_NAME = "ProvisioningInterimFixesTestBundle"; + private static final String FEATURE_MF = "provisioningTest-1.0.mf"; + private static final String FIX_DATA = "workarea/platform/fix.data"; + private static final String V100 = "1.0.0"; + private static final String V101 = "1.0.1"; + private static final String V102 = "1.0.2"; + private static final String V1099 = "1.0.99"; + private static final String V10100 = "1.0.100"; + private static final String V101APAR1 = "1.0.1.201202020001-APAR0001"; + private static final String V101APAR2 = "1.0.1.201203030001-APAR0002"; + private static final String V101TEST = "1.0.1.201204040001-TestAPAR0001"; + private static final String V102APAR1 = "1.0.2.201201010001-APAR0001"; + + private static final String INTERIM_FIX_FEATURE = "provisioningInterimFixTest-1.0.mf"; + private static final String INTERIM_FIXES_FEATURE = "provisioningInterimFixesTest-1.0.mf"; + + private static String getBundleAndVersionName(String bundleVersion) { + return BUNDLE_NAME + "_" + bundleVersion; + } + + private static String getJarName(String bundleVersion) { + return BUNDLE_NAME + "_" + bundleVersion + ".jar"; + } + + private static String getRegularExpression(String bundleVersion) { + // see com.ibm.ws.kernel.provisioning.Activator.start method. + return "com.ibm.ws.kernel.provisioning.Activator.start bundle name = \\[" + BUNDLE_NAME + "\\], bundle version = \\[" + bundleVersion + "\\]"; + } + + private static void deleteTestBundleJars() throws Exception { + final String METHOD_NAME = "deleteTestBundleJars"; + + List filenames; + filenames = server.listLibertyInstallRoot("lib", BUNDLE_NAME); + Log.info(c, METHOD_NAME, "found " + filenames.size() + " bundle jars to delete."); + for (String filename : filenames) { + server.deleteFileFromLibertyInstallRoot("lib/" + filename); + } + filenames = server.listLibertyInstallRoot("lib", BUNDLE_NAME); + Log.info(c, METHOD_NAME, "found " + filenames.size() + " bundle jars after delete."); + + filenames = server.listLibertyInstallRoot("lib", INTERIM_FIX_BUNDLE_NAME); + Log.info(c, METHOD_NAME, "found " + filenames.size() + " bundle jars to delete."); + for (String filename : filenames) { + server.deleteFileFromLibertyInstallRoot("lib/" + filename); + } + filenames = server.listLibertyInstallRoot("lib", INTERIM_FIX_BUNDLE_NAME); + Log.info(c, METHOD_NAME, "found " + filenames.size() + " bundle jars after delete."); + } + + /* + * Delete any test bundle jars from the server's lib directory. There should be none + * present as they are removed after each test, but just in case there was abnormal + * termination of a test run we check before running the first test. We also add the + * feature that we're testing to the servers feature dir. + */ + @BeforeClass + public static void classSetUp() throws Exception { + final String METHOD_NAME = "classSetUp"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) { + server.stopServer(); + } + deleteTestBundleJars(); + server.copyFileToLibertyInstallRoot("lib/features", FEATURE_MF); + server.copyFileToLibertyInstallRoot("lib/features", INTERIM_FIX_FEATURE); + server.copyFileToLibertyInstallRoot("lib/features", INTERIM_FIXES_FEATURE); + server.saveServerConfiguration(); + + Log.exiting(c, METHOD_NAME); + } + + /* + * The test feature manifest file is copied into the server's lib/features directory by + * the test framework. After each test method we remove the corresponding bundle jar + * files, so the next test can install the bundle jars it needs without those from + * previous test methods interfering. This method deletes the feature manifest file after + * the last test so the final state of the server is that both the test feature manifest + * and the test bundle jars are removed (i.e. no artifacts from this test class remain in + * the server). + */ + @AfterClass + public static void classTearDown() throws Exception { + final String METHOD_NAME = "classTearDown"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) { + server.stopServer(); + } + if (server.fileExistsInLibertyInstallRoot("lib/features/" + FEATURE_MF)) { + Log.info(c, METHOD_NAME, "lib/features/" + FEATURE_MF + " will be deleted."); + server.deleteFileFromLibertyInstallRoot("lib/features/" + FEATURE_MF); + } + + if (server.fileExistsInLibertyInstallRoot("lib/features/" + INTERIM_FIX_FEATURE)) { + Log.info(c, METHOD_NAME, "lib/features/" + INTERIM_FIX_FEATURE + " will be deleted."); + server.deleteFileFromLibertyInstallRoot("lib/features/" + INTERIM_FIX_FEATURE); + } + + if (server.fileExistsInLibertyInstallRoot("lib/features/" + INTERIM_FIXES_FEATURE)) { + Log.info(c, METHOD_NAME, "lib/features/" + INTERIM_FIXES_FEATURE + " will be deleted."); + server.deleteFileFromLibertyInstallRoot("lib/features/" + INTERIM_FIXES_FEATURE); + } + + Log.exiting(c, METHOD_NAME); + } + + @After + public void tearDown() throws Exception { + final String METHOD_NAME = "tearDown"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) { + server.stopServer(); + } + + server.restoreServerConfiguration(); + + deleteTestBundleJars(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when a number of interim fixes are installed, and displayed in the logs, that the output + * doesn't contain duplicate APAR entries. + */ + @Test + public void testSingleInterimFixOutput() throws Exception { + final String METHOD_NAME = "testSingleInterimFixOutput"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle4_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle4_1.0.0.20130101.jar"); + server.setServerConfigurationFile("singleInterimFixServer.xml"); + server.startServer(); + + String msgId = "CWWKF0015I"; + String interimFixesMsg = server.waitForStringInLog(msgId); + assertNotNull("There should be CWWKF0015I messages in the log", interimFixesMsg); + + assertTrue("APAR0007 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains("APAR0007")); + int APAR0007Pos = interimFixesMsg.indexOf("APAR0007"); + assertTrue("There are duplicated APAR0007 entries in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.indexOf("APAR0007", APAR0007Pos + 1) == -1); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when a number of interim fixes are installed, and displayed in the logs, that the output + * doesn't contain duplicate APAR entries. + */ + @Test + public void testInterimFixesOutput() throws Exception { + final String METHOD_NAME = "testInterimFixesOutput"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle1_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle1_1.0.0.20130101.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle2_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle2_1.0.0.20130101.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle3_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle3_1.0.0.20130101.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle4_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle4_1.0.0.20130101.jar"); + server.setServerConfigurationFile("interimFixesServer.xml"); + server.startServer(); + + String msgId = "CWWKF0015I"; + String interimFixesMsg = server.waitForStringInLog(msgId); + assertNotNull("There should be CWWKF0015I messages in the log", interimFixesMsg); + + assertTrue("APAR0005 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains("APAR0005")); + int APAR0005Pos = interimFixesMsg.indexOf("APAR0005"); + assertTrue("There are duplicated APAR0005 entries in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.indexOf("APAR0005", APAR0005Pos + 1) == -1); + + assertTrue("APAR0006 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains("APAR0006")); + int APAR0006Pos = interimFixesMsg.indexOf("APAR0006"); + assertTrue("There are duplicated APAR0006 entries in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.indexOf("APAR0006", APAR0006Pos + 1) == -1); + + assertTrue("APAR0007 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains("APAR0007")); + int APAR0007Pos = interimFixesMsg.indexOf("APAR0007"); + assertTrue("There are duplicated APAR0007 entries in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.indexOf("APAR0007", APAR0007Pos + 1) == -1); + + assertTrue("APAR0008 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains("APAR0008")); + int APAR0008Pos = interimFixesMsg.indexOf("APAR0008"); + assertTrue("There are duplicated APAR0008 entries in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.indexOf("APAR0008", APAR0008Pos + 1) == -1); + + // Now ensure that one of the APAR numbers that are prefixed with a space in the manifest header isn't also in the list. + assertFalse("APAR0008 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains(" APAR0008")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that the runtime can load a feature bundle. + */ + @Test + public void testBundleIsInstalled() throws Exception { + final String METHOD_NAME = "testBundleIsInstalled"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V100)); + server.startServer(); + + regex = getRegularExpression(V100); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V100) + " should have been started.", found); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that the runtime always loads the latest version of the bundle. In the test we have 2 bundles + * a different versions, and check that the newer one is loaded. We then stop the server, add another bundle, and + * ensure that this newest one is installed correctly. + */ + @Test + public void testLatestBundleVersionIsInstalled() throws Exception { + final String METHOD_NAME = "testLatestBundleVersionIsInstalled"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V100)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.startServer(); + + regex = getRegularExpression(V100); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V100) + " should not have been started.", !found); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should have been started.", found); + + server.stopServer(); + server.copyFileToLibertyInstallRoot("lib", getJarName(V102)); + server.startServer(); + + regex = getRegularExpression(V102); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V102) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when an ifix that doesn't match any existing fixpack bundles is added to + * the server runtime dir, the ifix bundle will be ignored. + */ + @Test + public void testInvalidIFixIsIgnored1() throws Exception { + final String METHOD_NAME = "testInvalidIFixIsIgnored1"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V100)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.startServer(); + + regex = getRegularExpression(V101APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR1) + " should not have been started.", !found); + + regex = getRegularExpression(V100); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V100) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when an ifix that doesn't match any existing fixpack bundles is added to + * the server runtime dir, the ifix bundle will be ignored, but if another valid ifix bundle is + * present, that that bundle is installed. + */ + @Test + public void testInvalidIFixIsIgnored2() throws Exception { + final String METHOD_NAME = "testInvalidIFixIsIgnored2"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V102APAR1)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should not have been started.", !found); + + regex = getRegularExpression(V102APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V102APAR1) + " should not have been started.", !found); + + regex = getRegularExpression(V101APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR1) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when an ifix that matches an existing fixpack bundle is added to + * the server runtime dir, the ifix bundle will be installed. + */ + @Test + public void testValidIFixIsInstalled1() throws Exception { + final String METHOD_NAME = "testValidIFixIsInstalled1"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should not have been started.", !found); + + regex = getRegularExpression(V101APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR1) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when an ifix that matches an existing fixpack bundle is added to + * the server runtime dir, the ifix bundle will be installed. + */ + @Test + public void testValidIFixIsInstalled2() throws Exception { + final String METHOD_NAME = "testValidIFixIsInstalled2"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should have been started.", found); + + server.stopServer(); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should not have been started.", !found); + + regex = getRegularExpression(V101APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR1) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test is testing that when an ifix is installed and the server is warm started, the ifix + * will be installed. + */ + @Test + public void testValidIFixIsInstalledWarmStart() throws Exception { + final String METHOD_NAME = "testValidIFixIsInstalledWarmStart"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should have been started.", found); + + server.stopServer(); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.startServer(false); + + // for V8.5, warm-start does not result in an update. + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a bundle for a newer release isn't installed into the runtime. + * New releases have a micro version which are incremental factors of 100. + */ + @Test + public void testNextReleaseBundleIsIgnored() throws Exception { + final String METHOD_NAME = "testNextReleaseBundleIsIgnored"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V1099)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V10100)); + server.startServer(); + + regex = getRegularExpression(V10100); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V10100) + " should not have been started.", !found); + + regex = getRegularExpression(V1099); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V1099) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when a bundle has manifest headers of IBM-Test-Fixes and IBM-Interim-Fixes + * the contents are output to the server logs. + */ + @Test + public void testAPARManifestHeadersAreLogged() throws Exception { + final String METHOD_NAME = "testAPARManifestHeadersAreLogged"; + + Log.entering(c, METHOD_NAME); + + final String V101APAR1_IFIX_HEADER = ": APAR0001"; + final String V101TEST_TFIX_HEADER = ": TestAPAR0001"; + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.startServer(); + + assertTrue(FIX_DATA + " file missing.", server.fileExistsInLibertyServerRoot(FIX_DATA)); + + found = !server.findStringsInFileInLibertyServerRoot(".*" + V101APAR1_IFIX_HEADER + ".*", FIX_DATA).isEmpty(); + assertTrue(V101APAR1 + " should have corresponding text \"" + V101APAR1_IFIX_HEADER + "\" in " + FIX_DATA, found); + + server.stopServer(); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101TEST)); + server.startServer(); + + assertTrue(FIX_DATA + " file missing.", server.fileExistsInLibertyServerRoot(FIX_DATA)); + + regex = ".*" + V101APAR1_IFIX_HEADER + ".*"; + found = !server.findStringsInFileInLibertyServerRoot(regex, FIX_DATA).isEmpty(); + assertTrue(V101APAR1 + " should not have corresponding text \"" + V101APAR1_IFIX_HEADER + "\" in " + FIX_DATA, !found); + + regex = ".*" + V101TEST_TFIX_HEADER + ".*"; + found = !server.findStringsInFileInLibertyServerRoot(regex, FIX_DATA).isEmpty(); + assertTrue(V101TEST + " should have corresponding text \"" + V101TEST_TFIX_HEADER + "\" in " + FIX_DATA, found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when a new ifix is installed, it is installed rather than any older versions. + */ + @Test + public void testSupercedingIFixIsInstalled() throws Exception { + final String METHOD_NAME = "testSupercedingIFixIsInstalled"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR2)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should not have been started.", !found); + + regex = getRegularExpression(V101APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR1) + " should not have been started.", !found); + + regex = getRegularExpression(V101APAR2); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR2) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + private static final LibertyServer fpServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.provisioning.fat.fingerprint"); + private final String fingerprintFileName = "service.fingerprint"; + private final String fingerprintLocation = "lib/versions"; + private final String fingerprintFileRelativePath = fingerprintLocation + "/" + fingerprintFileName; + private final String fingerprintFileAbsPath = fpServer.getInstallRoot() + fingerprintFileRelativePath; + private final String fingerprintFileAbsPathOld = fingerprintFileAbsPath + ".old"; + + private void mockApplyFix() throws Exception { + //backup the existing service fingerprint + LibertyFileManager.renameLibertyFile(fpServer.getMachine(), fingerprintFileAbsPath, fingerprintFileAbsPathOld); + //copy a mock fingerprint file + fpServer.copyFileToLibertyInstallRoot(fingerprintLocation, "service.fingerprint"); + } + + private void mockRemoveFix() throws Exception { + //remove the mock fingerprint file + fpServer.deleteFileFromLibertyInstallRoot(fingerprintFileRelativePath); + //restore the original service fingerprint + LibertyFileManager.renameLibertyFile(fpServer.getMachine(), fingerprintFileAbsPathOld, fingerprintFileAbsPath); + } + + @Rule + public TestName name = new TestName(); + + private void validateCleanStartWithFixAfterNStarts(int n) throws Exception { + try { + for (int i = 1; i <= n; i++) { + //perform a clean start the first time + fpServer.startServer(name.getMethodName() + "_prestart" + i + "_console.log", (i == 1) ? true : false); + //stop the server and apply the mock service + fpServer.stopServer(); + } + try { + mockApplyFix(); + //copy a marker file into the work area so we can see if it gets cleaned + fpServer.copyFileToLibertyServerRoot("workarea", "marker"); + //specify that we don't want a clean start from the test framework + //because we want it to happen automatically + fpServer.startServer(name.getMethodName() + "_console.log", false); + boolean markerExists = fpServer.fileExistsInLibertyServerRoot("workarea/marker"); + assertFalse("The workarea marker file existed when it should not have, the server did not automatically clean start when the server fingerprint changed after the server had been started " + + n + " times", + markerExists); + } finally { + mockRemoveFix(); + } + } finally { + //now stop and collect the logs + fpServer.stopServer(); + } + } + + /** + * APAR 117401: prove that the server gets clean started when service is applied + * For one previous server start + * + * @throws Exception + */ + @Test + public void testFixCausesCleanOnePreviousStart() throws Exception { + validateCleanStartWithFixAfterNStarts(1); + } + + /** + * APAR 117401: prove that the server gets clean started when service is applied + * For multiple previous server starts + * + * @throws Exception + */ + @Test + public void testFixCausesCleanMultiplePreviousStarts() throws Exception { + validateCleanStartWithFixAfterNStarts(3); + } + + /** + * APAR 117401: validate that the start is warm (not clean) when no service has been applied + * + * @throws Exception + */ + @Test + public void testServerDoesNotCleanStartIfNoFix() throws Exception { + try { + //initially clean start + fpServer.startServer(name.getMethodName() + "_clean_console.log", true); + //stop and collect logs + fpServer.stopServer(false); + //copy a marker file into the work area so we can see if it gets cleaned + fpServer.copyFileToLibertyServerRoot("workarea", "marker"); + //warm start the server + fpServer.startServer(name.getMethodName() + "_warm_console.log", false); + //assert the marker file is still there + boolean markerExists = fpServer.fileExistsInLibertyServerRoot("workarea/marker"); + assertTrue("The workarea marker file did not exist when it should have, the server clean started even though there was no fingerprint change", markerExists); + } finally { + //now stop and collect the logs + fpServer.stopServer(); + } + } + + /** + * Make sure that a server restart causes the server state directory to clear. + * + * @throws Exception + */ + @Test + public void testCleanStateDir() throws Exception { + try { + fpServer.copyFileToLibertyServerRoot("logs/state/", "marker"); + fpServer.startServer(); + assertFalse("The server marker should have been deleted from the state dir on server startup", fpServer.fileExistsInLibertyServerRoot("logs/state/marker")); + } finally { + fpServer.stopServer(); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionMultipleTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionMultipleTest.java new file mode 100755 index 000000000000..f595552f2375 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionMultipleTest.java @@ -0,0 +1,203 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.wsspi.kernel.embeddable; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import junit.framework.AssertionFailedError; + +public class EmbeddedServerAddProductExtensionMultipleTest { + + static final Class c = EmbeddedServerAddProductExtensionMultipleTest.class; + + static LibertyServer ls = null; + static Object driver = null; + + static File wsServerBundle = null; + static File testServerClasses = null; + + static Class driverClazz = null; + + public String testName; + + static String serverName = "com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat"; + public static File outputAutoFVTDirectory; + + @Rule + public TestRule testInvoker = new TestRule() { + @Override + public Statement apply(final Statement stmt, final Description desc) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + try { + testName = desc.getMethodName(); + embeddedServerTestHelper(testName); + stmt.evaluate(); + } finally { + testName = null; + } + } + }; + } + }; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + final String METHOD_NAME = "setUpBeforeClass"; + + // Save this off for the tearDown method to manually copy logs from /NonDefaultUser + // folder to /autoFVT/output/servers/ folder. + outputAutoFVTDirectory = new File("output/servers", serverName); + Log.info(c, METHOD_NAME, "outputAutoFVTDirectory: " + outputAutoFVTDirectory.getAbsolutePath()); + + // Find the necessary bundles in our install image + ls = LibertyServerFactory.getLibertyServer("com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat"); + testServerClasses = new File("build/classes"); + + wsServerBundle = new File(ls.getInstallRoot() + "/bin/tools/ws-server.jar"); + + String userDir = ls.getUserDir(); + String outputDir = userDir + "/servers"; + + Log.info(c, METHOD_NAME, "wsServerBundle: " + wsServerBundle.getAbsolutePath()); + Log.info(c, METHOD_NAME, "testServerClasses: " + testServerClasses.getAbsolutePath()); + + URLClassLoader classloader = new URLClassLoader(new URL[] { wsServerBundle.toURI().toURL(), + testServerClasses.toURI().toURL() }) { + // Borrowed from the bvt tests + @Override + protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + Class result = null; + + if (name == null || name.length() == 0) + return null; + + result = findLoadedClass(name); + + if (result == null && name != null) { + try { + // Try to load the class from the child classpath first... + result = findClass(name); + } catch (ClassNotFoundException cnfe) { + result = super.loadClass(name, resolve); + } + } + + return result; + } + }; + + driverClazz = classloader.loadClass("com.ibm.wsspi.kernel.embeddable.EmbeddedServerDriver"); + Constructor dCTOR = driverClazz.getConstructor(String.class, String.class, String.class); + driver = dCTOR.newInstance(serverName, userDir, outputDir); + } + + @AfterClass + public static void tearDown() throws Throwable { + final String METHOD_NAME = "tearDown"; + + // Manually copying server logs since they are in a non-default location + // and build script copy does not pick them up. + outputAutoFVTDirectory.mkdirs(); + Log.info(c, METHOD_NAME, "Copying directory from " + + ls.getUserDir() + "/servers/" + serverName + " to " + + outputAutoFVTDirectory.getAbsolutePath()); + + File srcDir = new File(ls.getUserDir() + "/servers/" + serverName); + copyDirectory(srcDir, outputAutoFVTDirectory.getAbsoluteFile()); + } + + @Test + public void testAddProductExtensionMultiple() throws Throwable {} + + private static void embeddedServerTestHelper(final String REMOTE_METHOD_NAME) throws Throwable { + final String METHOD_NAME = "embeddedServerTestHelper"; + Log.info(c, METHOD_NAME, "Preparing to run: " + REMOTE_METHOD_NAME); + + Method testMethod = driverClazz.getDeclaredMethod(REMOTE_METHOD_NAME); + + Method initMethod = driverClazz.getDeclaredMethod("init", new Class[] { String.class }); + + Method tearDownMethod = driverClazz.getDeclaredMethod("tearDown"); + + Method getFailuresMethod = driverClazz.getDeclaredMethod("getFailures"); + + try { + + initMethod.invoke(driver, new Object[] { REMOTE_METHOD_NAME }); + testMethod.invoke(driver); + tearDownMethod.invoke(driver); + + List failures = (List) getFailuresMethod.invoke(driver); + for (AssertionFailedError fail : failures) + Log.info(driverClazz, REMOTE_METHOD_NAME, fail.getMessage()); + + if (!failures.isEmpty()) + //add string buffer here to show failures in detail + assertTrue("Failures found " + failures, false); + } catch (InvocationTargetException t) { + throw t.getCause(); + } + } + + public static void copyDirectory(File source, File target) throws IOException { + if (source.isDirectory()) { + if (!target.exists()) { + target.mkdir(); + } + + String[] children = source.list(); + for (int i = 0; i < children.length; i++) { + copyDirectory(new File(source, children[i]), + new File(target, children[i])); + } + } else { + InputStream in = new FileInputStream(source); + OutputStream out = new FileOutputStream(target); + + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + in.close(); + out.close(); + } + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionTest.java new file mode 100755 index 000000000000..3566074f5fb0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionTest.java @@ -0,0 +1,203 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.wsspi.kernel.embeddable; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import junit.framework.AssertionFailedError; + +public class EmbeddedServerAddProductExtensionTest { + + static final Class c = EmbeddedServerAddProductExtensionTest.class; + + static LibertyServer ls = null; + static Object driver = null; + + static File wsServerBundle = null; + static File testServerClasses = null; + + static Class driverClazz = null; + + public String testName; + + static String serverName = "com.ibm.wsspi.kernel.embeddable.add.product.extension.fat"; + public static File outputAutoFVTDirectory; + + @Rule + public TestRule testInvoker = new TestRule() { + @Override + public Statement apply(final Statement stmt, final Description desc) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + try { + testName = desc.getMethodName(); + embeddedServerTestHelper(testName); + stmt.evaluate(); + } finally { + testName = null; + } + } + }; + } + }; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + final String METHOD_NAME = "setUpBeforeClass"; + + // Save this off for the tearDown method to manually copy logs from /NonDefaultUser + // folder to /autoFVT/output/servers/ folder. + outputAutoFVTDirectory = new File("output/servers", serverName); + Log.info(c, METHOD_NAME, "outputAutoFVTDirectory: " + outputAutoFVTDirectory.getAbsolutePath()); + + // Find the necessary bundles in our install image + ls = LibertyServerFactory.getLibertyServer("com.ibm.wsspi.kernel.embeddable.add.product.extension.fat"); + testServerClasses = new File("build/classes"); + + wsServerBundle = new File(ls.getInstallRoot() + "/bin/tools/ws-server.jar"); + + String userDir = ls.getUserDir(); + String outputDir = userDir + "/servers"; + + Log.info(c, METHOD_NAME, "wsServerBundle: " + wsServerBundle.getAbsolutePath()); + Log.info(c, METHOD_NAME, "testServerClasses: " + testServerClasses.getAbsolutePath()); + + URLClassLoader classloader = new URLClassLoader(new URL[] { wsServerBundle.toURI().toURL(), + testServerClasses.toURI().toURL() }) { + // Borrowed from the bvt tests + @Override + protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + Class result = null; + + if (name == null || name.length() == 0) + return null; + + result = findLoadedClass(name); + + if (result == null && name != null) { + try { + // Try to load the class from the child classpath first... + result = findClass(name); + } catch (ClassNotFoundException cnfe) { + result = super.loadClass(name, resolve); + } + } + + return result; + } + }; + + driverClazz = classloader.loadClass("com.ibm.wsspi.kernel.embeddable.EmbeddedServerDriver"); + Constructor dCTOR = driverClazz.getConstructor(String.class, String.class, String.class); + driver = dCTOR.newInstance(serverName, userDir, outputDir); + } + + @AfterClass + public static void tearDown() throws Throwable { + final String METHOD_NAME = "tearDown"; + + // Manually copying server logs since they are in a non-default location + // and build script copy does not pick them up. + outputAutoFVTDirectory.mkdirs(); + Log.info(c, METHOD_NAME, "Copying directory from " + + ls.getUserDir() + "/servers/" + serverName + " to " + + outputAutoFVTDirectory.getAbsolutePath()); + + File srcDir = new File(ls.getUserDir() + "/servers/" + serverName); + copyDirectory(srcDir, outputAutoFVTDirectory.getAbsoluteFile()); + } + + @Test + public void testAddProductExtension() throws Throwable {} + + private static void embeddedServerTestHelper(final String REMOTE_METHOD_NAME) throws Throwable { + final String METHOD_NAME = "embeddedServerTestHelper"; + Log.info(c, METHOD_NAME, "Preparing to run: " + REMOTE_METHOD_NAME); + + Method testMethod = driverClazz.getDeclaredMethod(REMOTE_METHOD_NAME); + + Method initMethod = driverClazz.getDeclaredMethod("init", new Class[] { String.class }); + + Method tearDownMethod = driverClazz.getDeclaredMethod("tearDown"); + + Method getFailuresMethod = driverClazz.getDeclaredMethod("getFailures"); + + try { + + initMethod.invoke(driver, new Object[] { REMOTE_METHOD_NAME }); + testMethod.invoke(driver); + tearDownMethod.invoke(driver); + + List failures = (List) getFailuresMethod.invoke(driver); + for (AssertionFailedError fail : failures) + Log.info(driverClazz, REMOTE_METHOD_NAME, fail.getMessage()); + + if (!failures.isEmpty()) + //add string buffer here to show failures in detail + assertTrue("Failures found " + failures, false); + } catch (InvocationTargetException t) { + throw t.getCause(); + } + } + + public static void copyDirectory(File source, File target) throws IOException { + if (source.isDirectory()) { + if (!target.exists()) { + target.mkdir(); + } + + String[] children = source.list(); + for (int i = 0; i < children.length; i++) { + copyDirectory(new File(source, children[i]), + new File(target, children[i])); + } + } else { + InputStream in = new FileInputStream(source); + OutputStream out = new FileOutputStream(target); + + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + in.close(); + out.close(); + } + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerDriver.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerDriver.java new file mode 100755 index 000000000000..c5eff7df837c --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerDriver.java @@ -0,0 +1,609 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013, 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.wsspi.kernel.embeddable; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.PrintStream; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.Scanner; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.kernel.boot.ReturnCode; +import com.ibm.ws.kernel.boot.cmdline.Utils; +import com.ibm.wsspi.kernel.embeddable.Server.Result; + +import junit.framework.Assert; +import junit.framework.AssertionFailedError; + +public class EmbeddedServerDriver implements ServerEventListener { + + private final Class c = EmbeddedServerDriver.class; + private String CURRENT_METHOD_NAME = null; + + private CountDownLatch startingEventOccurred; + private CountDownLatch startedEventOccurred; + private CountDownLatch stoppedEventOccurred; + private CountDownLatch failedEventOccurred; + + private String serverName = null; + private String userDir = null; + private String outputDir = null; + + private ServerBuilder sb = null; + private Server server = null; + private Result result = null; + private Properties props = null; + private Properties props2 = null; + private Properties props3 = null; + + private List failures = null; + + public EmbeddedServerDriver(String serverName, String userDir, String outputDir) throws UnsupportedEncodingException { + this.serverName = serverName; + this.userDir = userDir; + this.outputDir = outputDir; + this.props = new Properties(); + this.props.setProperty("com.ibm.websphere.productId", "com.ibm.cicsts"); + this.props.setProperty("com.ibm.websphere.productInstall", "wlp/usr/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest"); + this.props2 = new Properties(); + this.props2.setProperty("com.ibm.websphere.productId", "com.ibm.cicstsb"); + this.props2.setProperty("com.ibm.websphere.productInstall", "wlp/usr/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb"); + this.props3 = new Properties(); + this.props3.setProperty("com.ibm.websphere.productId", "com.ibm.cicsts"); + this.props3.setProperty("com.ibm.websphere.productInstall", "wlp/usr/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest"); + init("EmbeddedServerDriver"); + } + + public void init(String CURRENT_METHOD_NAME) throws UnsupportedEncodingException { + this.CURRENT_METHOD_NAME = CURRENT_METHOD_NAME; + + Log.info(c, "init", "Setting up for " + this.CURRENT_METHOD_NAME); + + startingEventOccurred = new CountDownLatch(1); + startedEventOccurred = new CountDownLatch(1); + stoppedEventOccurred = new CountDownLatch(1); + failedEventOccurred = new CountDownLatch(1); + + failures = new ArrayList(); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + System.setOut(new PrintStream(baos, true, "UTF-8")); + + sb = new ServerBuilder(); + if (CURRENT_METHOD_NAME.equals("testAddProductExtension")) { + Log.info(c, "init", "current method name is testAddProductExtension "); + server = sb.setName(serverName).setOutputDir(new File(outputDir)).setUserDir(new File(userDir)).addProductExtension("productA", + props).setServerEventListener(this).build(); + } else if (CURRENT_METHOD_NAME.equals("testAddProductExtensionMultiple")) { + Log.info(c, "init", "current method name is testAddProductExtensionMultiple "); + server = sb.setName(serverName).setOutputDir(new File(outputDir)).setUserDir(new File(userDir)).addProductExtension("productA", + props3).addProductExtension("productB", + props2).setServerEventListener(this).build(); + + } else { + server = sb.setName(serverName).setOutputDir(new File(outputDir)).setUserDir(new File(userDir)).setServerEventListener(this).build(); + } + + String serverConsoleOutput = new String(baos.toByteArray(), "UTF-8"); + Log.info(c, "init", "consoleOutput = " + serverConsoleOutput); + + result = null; + checkServerRunning(false); // server should be stopped + } + + public void tearDown() { + Log.info(c, "init", "Cleaning up after " + this.CURRENT_METHOD_NAME); + + if (server != null) { + Future stopFuture = server.stop(); + stopFuture.cancel(true); + } + + startingEventOccurred = null; + startedEventOccurred = null; + stoppedEventOccurred = null; + failedEventOccurred = null; + } + + public void testStoppingAStoppedServer() { + + // Stop a stopped server + Future stopFuture = server.stop(); + try { + result = stopFuture.get(); + dumpResult("Stopping a stopped server", result); + Assert.assertFalse("Stopping a stopped server should not be successful", result.successful()); + Assert.assertEquals("Should have a redundant operation returned", ReturnCode.REDUNDANT_ACTION_STATUS.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Stop operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Stop operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(false); // server should be stopped + } + + public void testStartingAStoppedServer() { + PrintStream originalSysOut = System.out; + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + System.setOut(new PrintStream(baos, true, "UTF-8")); + coldStartServer(); + verifyServerEvent("\"STARTING\" ServerEvent should have fired", startingEventOccurred); + verifyServerEvent("\"STARTED\" ServerEvent should have fired", startedEventOccurred); + + String serverConsoleOutput = new String(baos.toByteArray(), "UTF-8"); + Log.info(c, "testStartingAStoppedServer", "consoleOutput = " + serverConsoleOutput); + try { + Assert.assertTrue("No indication that application started", serverConsoleOutput.contains("CWWKZ0001I: Application simpleApp started")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for app started message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + // PI20344: Verify that Utils.java is using the correct user dir + String utilsUserDirAbsolutePath = Utils.getUserDir().getAbsolutePath().replace('\\', '/'); + String userDirAbsolutePath = userDir.replace('\\', '/'); + Log.info(c, "testStartingAStoppedServer", "UserDirAbsolutePath=[" + userDirAbsolutePath + "] utilsUserDirAbsolutePath=[" + utilsUserDirAbsolutePath + "]"); + Assert.assertTrue("Utils.userDir() should be using the java property with any luck at all.", userDirAbsolutePath.equals(utilsUserDirAbsolutePath)); + + stopRunningServer(); + } catch (UnsupportedEncodingException ex) { + } finally { + System.setOut(originalSysOut); + } + } + + public void testAddProductExtension() { + PrintStream originalSysOut = System.out; + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + System.setOut(new PrintStream(baos, true, "UTF-8")); + coldStartServer(); + verifyServerEvent("\"STARTING\" ServerEvent should have fired", startingEventOccurred); + verifyServerEvent("\"STARTED\" ServerEvent should have fired", startedEventOccurred); + + String serverConsoleOutput = new String(baos.toByteArray(), "UTF-8"); + Log.info(c, "testAddProductExtension", "consoleOutput = " + serverConsoleOutput); + try { + Assert.assertTrue("No indication that application started", serverConsoleOutput.contains("CWWKZ0001I: Application simpleApp started")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for app started message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + try { + //[AUDIT ] CWWKF0012I: The server installed the following features: [jsp-2.2, productA:prodtest-1.0, timedexit-1.0, servlet-3.0]. + Assert.assertTrue("No indication that the product extension feature productA:prodtest-1.0 was installed", + isProductExtensionInstalled(serverConsoleOutput, "productA:prodtest-1.0")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for the product extension feature was installed message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + try { + // Check that the server logs contain the CWWKE0108I message + String messageToFind = "CWWKE0108I"; + boolean messageFound = false; + Log.info(c, CURRENT_METHOD_NAME, "SCANNING: " + outputDir + "/" + serverName + "/logs/message.log"); + File logFile = new File(outputDir + "/" + serverName + "/logs/messages.log"); + Scanner logScanner = new Scanner(logFile); + while (logScanner.hasNextLine() && messageFound == false) { + String line = logScanner.nextLine(); + Log.info(c, CURRENT_METHOD_NAME, line); + if (line.contains(messageToFind)) { + messageFound = true; + } + } + logScanner.close(); + Assert.assertTrue(messageFound); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for product extension was added message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + stopRunningServer(); + } catch (UnsupportedEncodingException ex) { + } finally { + System.setOut(originalSysOut); + } + } + + /** + * Determine if the input product extension exists in the input string. + * + * @param inputString string to search. + * @param productExtension product extension to search for. + * @return true if input product extension is found in the input string. + */ + private boolean isProductExtensionInstalled(String inputString, String productExtension) { + if ((productExtension == null) || (inputString == null)) { + return false; + } + int msgIndex = inputString.indexOf("CWWKF0012I: The server installed the following features:"); + if (msgIndex == -1) { + return false; + } + + String msgString = inputString.substring(msgIndex); + int leftBracketIndex = msgString.indexOf("["); + int rightBracketIndex = msgString.indexOf("]"); + if ((leftBracketIndex == -1) || + (rightBracketIndex == -1) || + (rightBracketIndex < leftBracketIndex)) { + return false; + } + + String features = msgString.substring(leftBracketIndex, rightBracketIndex); + Log.info(c, "isProductExtensionInstalled", features); + if (features.indexOf(productExtension) == -1) { + return false; + } + return true; + } + + public void testAddProductExtensionMultiple() { + PrintStream originalSysOut = System.out; + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + System.setOut(new PrintStream(baos, true, "UTF-8")); + coldStartServer(); + verifyServerEvent("\"STARTING\" ServerEvent should have fired", startingEventOccurred); + verifyServerEvent("\"STARTED\" ServerEvent should have fired", startedEventOccurred); + + String serverConsoleOutput = new String(baos.toByteArray(), "UTF-8"); + Log.info(c, "testAddProductExtensionMultiple", "consoleOutput = " + serverConsoleOutput); + try { + Assert.assertTrue("No indication that application started", serverConsoleOutput.contains("CWWKZ0001I: Application simpleApp started")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for app started message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + // [AUDIT ] CWWKF0012I: The server installed the following features: [jsp-2.2, productA:prodtest-1.0, productB:prodtestb-1.0, timedexit-1.0, servlet-3.0]. + try { + Assert.assertTrue("No indication that the product extension feature productA:prodtest-1.0 was installed", + isProductExtensionInstalled(serverConsoleOutput, "productA:prodtest-1.0")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for the product extension feature was installed message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + try { + Assert.assertTrue("No indication that the product extension feature productB:prodtestb-1.0 was installed", + isProductExtensionInstalled(serverConsoleOutput, "productB:prodtestb-1.0")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for the product extension feature was installed message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + try { + // Check that the server logs contain the CWWKE0108I message + String messageToFind = "CWWKE0108I"; + boolean messageFound = false; + Log.info(c, CURRENT_METHOD_NAME, "SCANNING: " + outputDir + "/" + serverName + "/logs/message.log"); + File logFile = new File(outputDir + "/" + serverName + "/logs/messages.log"); + Scanner logScanner = new Scanner(logFile); + while (logScanner.hasNextLine() && messageFound == false) { + String line = logScanner.nextLine(); + Log.info(c, CURRENT_METHOD_NAME, line); + if (line.contains(messageToFind)) { + messageFound = true; + } + } + logScanner.close(); + Assert.assertTrue(messageFound); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for product extension was added message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + stopRunningServer(); + } catch (UnsupportedEncodingException ex) { + } finally { + System.setOut(originalSysOut); + } + } + + public void testStartingAStartedServer() { + warmStartServer(); + + verifyServerEvent("\"STARTING\" ServerEvent should have fired", startingEventOccurred); + verifyServerEvent("\"STARTED\" ServerEvent should have fired", startedEventOccurred); + + // Start the started server + Future startFuture2 = server.start(); + try { + result = startFuture2.get(); + dumpResult("Starting a started server", result); + Assert.assertFalse("Starting a started server should not be successful", result.successful()); + Assert.assertEquals("Should have a redundant operation returned", ReturnCode.REDUNDANT_ACTION_STATUS.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(true); // server should be started + stopRunningServer(); + } + + public void testStoppingAStartedServer() { + warmStartServer(); + verifyServerEvent("\"STARTING\" ServerEvent should have fired", startingEventOccurred); + verifyServerEvent("\"STARTED\" ServerEvent should have fired", startedEventOccurred); + stopRunningServer(); + } + + public void testBadArgument() { + Future startFuture = server.start(new String[] { "--nOnSeNsE" }); + + try { + // check for failed event: should fire w/o requiring interaction w/ future.get + verifyServerEvent("\"FAILED\" ServerEvent should have fired", failedEventOccurred); + + result = startFuture.get(); + dumpResult("Starting a server", result); + Assert.assertFalse("Result of start attempt with bad args should fail", result.successful()); + Assert.assertEquals("Should have an BAD_ARGUMENT return code", ReturnCode.BAD_ARGUMENT.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(false); // server should not be started + } + + public void testLaunchException() { + Future startFuture = server.start("--create"); // server already created in init(), double create should fail + + try { + result = startFuture.get(); + dumpResult("Starting an embedded server with \"--create\", which is a bad thing to do", result); + Assert.assertFalse("Result of LaunchException should be failure", result.successful()); + Assert.assertEquals("Should have a BAD_ARGUMENT return code", ReturnCode.BAD_ARGUMENT.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(false); // server should not be started + } + + public void testLocationException() { + + String bogusName = "bOgUsSeRvErNaMe"; + server = sb.setName(bogusName).setOutputDir(new File(outputDir)).setUserDir(new File(userDir)).setServerEventListener(this).build(); + + (new File(outputDir + "/" + bogusName, "server.xml")).delete(); // delete the server from the hfs, so start() throws a LocationException + + Future startFuture = server.start(); + + try { + // check for failed event: should fire w/o requiring interaction w/ future.get + verifyServerEvent("\"FAILED\" ServerEvent should have fired", failedEventOccurred); + + result = startFuture.get(); + dumpResult("Starting a server with a bogus name", result); + Assert.assertFalse("Result of LocationException should be failure", result.successful()); + Assert.assertEquals("Should have a LOCATION_EXCEPTION return code", ReturnCode.LOCATION_EXCEPTION.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(false); // server should not be started + } + + public void testServerUnknownStatus() { + //TODO: This is not called by the test framework + // because I don't know how to guarantee an InterruptedException + // without jMock, which seems pointless in a FAT scenario like this + + Future startFuture = server.start(new String[] { "--clean" }); + + try { + result = startFuture.get(); + dumpResult("Force an InterruptException while starting a server", result); + Assert.assertFalse("Result of InterruptedException should be failure", result.successful()); + Assert.assertEquals("Should have a SERVER_UNKNOWN_STATUS return code", ReturnCode.SERVER_UNKNOWN_STATUS.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(true); // server should be started + + } + + public void testErrorServerStart() { + //TODO: This is not called by the test framework + // because I don't know how to force waitForStarted() to return false + // without jMock, which seems pointless in a FAT scenario like this + + } + + public List getFailures() { + return failures; + } + + private void verifyServerEvent(String msg, CountDownLatch event) { + boolean pass = false; + + try { + event.await(5, TimeUnit.SECONDS); + pass = true; + } catch (InterruptedException e) { + pass = false; + } + + try { + Assert.assertTrue(msg, pass); + } catch (AssertionFailedError e) { + failures.add(new AssertionFailedError(e.toString())); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + } + + private void warmStartServer() { + Future startFuture = server.start(); + + try { + result = startFuture.get(); + dumpResult("Starting a server", result); + Assert.assertTrue("Result of start attempt should be successful", result.successful()); + Assert.assertEquals("Should have an OK return code", ReturnCode.OK.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(true); // server should be started + } + + private void coldStartServer() { + Future startFuture = server.start(new String[] { "--clean" }); + + try { + result = startFuture.get(); + dumpResult("Starting a server", result); + Assert.assertTrue("Result of first start attempt should be successful", result.successful()); + Assert.assertEquals("Should have an OK return code", ReturnCode.OK.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(true); // server should be started + } + + private void stopRunningServer() { + Future stopFuture = server.stop(); + try { + result = stopFuture.get(); + dumpResult("Stopping a started server", result); + Assert.assertTrue("Stopping a running server should be successful", result.successful()); + Assert.assertEquals("Should have an OK return code", ReturnCode.OK.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Stop operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Stop operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(false); // server should be stopped + + verifyServerEvent("\"STOPPED\" ServerEvent should have fired", stoppedEventOccurred); + } + + private void checkServerRunning(boolean expectRunning) { + try { + if (expectRunning) { + Assert.assertTrue("Server should be running", server.isRunning()); + } else { + Assert.assertFalse("Server should not be running", server.isRunning()); + } + } catch (AssertionFailedError e) { + failures.add(e); + } + } + + private void dumpResult(String msg, Result result) { + Log.info(c, "dumpResult", msg + " -- Result: success=" + result.successful() + ", rc=" + result.getReturnCode() + ", ex=" + result.getException()); + } + + @Override + public void serverEvent(ServerEvent serverEvent) { + String event = serverEvent.toString(); + Log.info(c, "serverEvent", "NEW SERVER EVENT FIRED: " + event); + + switch (serverEvent.getType()) { + case STARTING: + startingEventOccurred.countDown(); + break; + case STARTED: + startedEventOccurred.countDown(); + break; + case STOPPED: + stoppedEventOccurred.countDown(); + break; + case FAILED: + failedEventOccurred.countDown(); + break; + default: + break; + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerTest.java new file mode 100755 index 000000000000..2f5089bda936 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerTest.java @@ -0,0 +1,265 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.wsspi.kernel.embeddable; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.channels.FileChannel; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import junit.framework.AssertionFailedError; + +public class EmbeddedServerTest { + + static final Class c = EmbeddedServerTest.class; + + static LibertyServer ls = null; + static Object driver = null; + + static File wsServerBundle = null; + static File testServerClasses = null; + + static Class driverClazz = null; + + public String testName; + + static String serverName = "com.ibm.wsspi.kernel.embeddable.fat"; + public static File outputAutoFVTDirectory; + + @Rule + public TestRule testInvoker = new TestRule() { + @Override + public Statement apply(final Statement stmt, final Description desc) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + try { + testName = desc.getMethodName(); + embeddedServerTestHelper(testName); + stmt.evaluate(); + } finally { + testName = null; + } + } + }; + } + }; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + final String METHOD_NAME = "setUpBeforeClass"; + + // Save this off for the tearDown method to manually copy logs from /NonDefaultUser + // folder to /autoFVT/output/servers/ folder. + outputAutoFVTDirectory = new File("output/servers", serverName); + Log.info(c, METHOD_NAME, "outputAutoFVTDirectory: " + outputAutoFVTDirectory.getAbsolutePath()); + + // Find the necessary bundles in our install image + ls = LibertyServerFactory.getLibertyServer("com.ibm.wsspi.kernel.embeddable.fat"); + + testServerClasses = new File("build/classes"); + + wsServerBundle = new File(ls.getInstallRoot() + "/bin/tools/ws-server.jar"); + + // PI20344: Use non default directories. + String userDir = ls.getUserDir() + "/../NonDefaultUser"; // originally ls.getUserDir() + String outputDir = userDir + "/servers"; // originally ls.getServerRoot(); + + // PI20344: Additional setup needed when using non default directories. + // Copy the server directory to my output directory + // Also need the test.properties file + File destDir = new File(outputDir, serverName); + File srcDir = new File(ls.getServerRoot()); + destDir.mkdirs(); + copyDirectory(srcDir, destDir); + + File dest_TestPorts = new File(destDir, "/../testports.properties"); + File src_TestPorts = new File(srcDir, "/../testports.properties"); + copyFile(src_TestPorts, dest_TestPorts); + // END PI20344 + + Log.info(c, METHOD_NAME, "wsServerBundle: " + wsServerBundle.getAbsolutePath()); + Log.info(c, METHOD_NAME, "testServerClasses: " + testServerClasses.getAbsolutePath()); + + URLClassLoader classloader = new URLClassLoader(new URL[] { wsServerBundle.toURI().toURL(), + testServerClasses.toURI().toURL() }) { + // Borrowed from the bvt tests + @Override + protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + Class result = null; + + if (name == null || name.length() == 0) + return null; + + result = findLoadedClass(name); + + if (result == null && name != null) { + try { + // Try to load the class from the child classpath first... + result = findClass(name); + } catch (ClassNotFoundException cnfe) { + result = super.loadClass(name, resolve); + } + } + + return result; + } + }; + + driverClazz = classloader.loadClass("com.ibm.wsspi.kernel.embeddable.EmbeddedServerDriver"); + Constructor dCTOR = driverClazz.getConstructor(String.class, String.class, String.class); + driver = dCTOR.newInstance(serverName, userDir, outputDir); + } + + @AfterClass + public static void tearDown() throws Throwable { + final String METHOD_NAME = "tearDown"; + + // Manually copying server logs since they are in a non-default location + // and build script copy does not pick them up. + outputAutoFVTDirectory.mkdirs(); + Log.info(c, METHOD_NAME, "Copying directory from " + + ls.getUserDir() + "/../NonDefaultUser" + " to " + + outputAutoFVTDirectory.getAbsolutePath()); + + File srcDir = new File(ls.getUserDir() + "/../NonDefaultUser"); + copyDirectory(srcDir, outputAutoFVTDirectory.getAbsoluteFile()); + } + + @Test + public void testStoppingAStoppedServer() throws Throwable {} + + @Test + public void testStartingAStoppedServer() throws Throwable {} + + @Test + public void testStartingAStartedServer() throws Throwable {} + + @Test + public void testStoppingAStartedServer() throws Throwable {} + + @Test + public void testBadArgument() throws Throwable {} + + @Test + public void testLaunchException() throws Throwable {} + + //@Test + //public void testLocationException() throws Throwable {} + + private static void embeddedServerTestHelper(final String REMOTE_METHOD_NAME) throws Throwable { + final String METHOD_NAME = "testEmbeddedServer"; + Log.info(c, METHOD_NAME, "Preparing to run: " + REMOTE_METHOD_NAME); + + Method testMethod = driverClazz.getDeclaredMethod(REMOTE_METHOD_NAME); + + Method initMethod = driverClazz.getDeclaredMethod("init", new Class[] { String.class }); + + Method tearDownMethod = driverClazz.getDeclaredMethod("tearDown"); + + Method getFailuresMethod = driverClazz.getDeclaredMethod("getFailures"); + + try { + + initMethod.invoke(driver, new Object[] { REMOTE_METHOD_NAME }); + testMethod.invoke(driver); + tearDownMethod.invoke(driver); + + List failures = (List) getFailuresMethod.invoke(driver); + for (AssertionFailedError fail : failures) + Log.info(driverClazz, REMOTE_METHOD_NAME, fail.getMessage()); + + if (!failures.isEmpty()) + //add string buffer here to show failures in detail + assertTrue("Failures found " + failures, false); + } catch (InvocationTargetException t) { + throw t.getCause(); + } + } + + private static void copyFile(File fromFile, File toFile) throws IOException { + // Open the source file + FileInputStream fis = new FileInputStream(fromFile); + try { + // Open the destination file + File destDir = toFile.getParentFile(); + if (!destDir.exists() && !destDir.mkdirs()) { + throw new IOException("Failed to create path: " + destDir.getAbsolutePath()); + } + + System.out.println("Copying file from: " + fromFile.getAbsolutePath()); + System.out.println("Copying file to: " + toFile.getAbsolutePath()); + + FileOutputStream fos = new FileOutputStream(toFile); + + // Perform the transfer using nio channels; this is simpler, and usually + // faster, than copying the file a chunk at a time + try { + FileChannel inChan = fis.getChannel(); + FileChannel outChan = fos.getChannel(); + inChan.transferTo(0, inChan.size(), outChan); + } finally { + fos.close(); + } + } finally { + fis.close(); + } + } + + public static void copyDirectory(File source, File target) throws IOException { + if (source.isDirectory()) { + if (!target.exists()) { + target.mkdir(); + } + + String[] children = source.list(); + for (int i = 0; i < children.length; i++) { + copyDirectory(new File(source, children[i]), + new File(target, children[i])); + } + } else { + InputStream in = new FileInputStream(source); + OutputStream out = new FileOutputStream(target); + + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + in.close(); + out.close(); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/applications/SharedLooseEAR.ear.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/applications/SharedLooseEAR.ear.xml new file mode 100755 index 000000000000..cc417f09a575 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/applications/SharedLooseEAR.ear.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.20130101.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.20130101.jar new file mode 100755 index 000000000000..ea1069f0f196 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.20130101.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.jar new file mode 100755 index 000000000000..ed70dc5c5770 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.20130101.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.20130101.jar new file mode 100755 index 000000000000..20306fa9e7c6 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.20130101.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.jar new file mode 100755 index 000000000000..8decf44057c4 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.20130101.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.20130101.jar new file mode 100755 index 000000000000..b1cc8684eff1 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.20130101.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.jar new file mode 100755 index 000000000000..ec2429663d3d Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.20130101.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.20130101.jar new file mode 100755 index 000000000000..21e8d5ec4ed7 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.20130101.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.jar new file mode 100755 index 000000000000..189cbd8f06c5 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.0.jar new file mode 100755 index 000000000000..7969a2058508 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201202020001-APAR0001.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201202020001-APAR0001.jar new file mode 100755 index 000000000000..b6281ee58425 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201202020001-APAR0001.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201203030001-APAR0002.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201203030001-APAR0002.jar new file mode 100755 index 000000000000..06f522ad2cf3 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201203030001-APAR0002.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201204040001-TestAPAR0001.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201204040001-TestAPAR0001.jar new file mode 100755 index 000000000000..4d11853da925 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201204040001-TestAPAR0001.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.jar new file mode 100755 index 000000000000..a06da8765a3d Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.100.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.100.jar new file mode 100755 index 000000000000..b4bebbab4198 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.100.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.201201010001-APAR0001.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.201201010001-APAR0001.jar new file mode 100755 index 000000000000..c19e1e1bcb9b Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.201201010001-APAR0001.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.jar new file mode 100755 index 000000000000..c532b85b7843 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.99.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.99.jar new file mode 100755 index 000000000000..0895ca97ce1b Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.99.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/jvm.options b/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/jvm.options new file mode 100755 index 000000000000..112fc720a057 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/jvm.options @@ -0,0 +1 @@ +-Xfuture \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/server.xml new file mode 100755 index 000000000000..b644e5a23d55 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/server.xml @@ -0,0 +1,11 @@ + + + + + + webProfile-6.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/interimFixesServer.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/files/interimFixesServer.xml new file mode 100755 index 000000000000..12fde62f6aa9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/interimFixesServer.xml @@ -0,0 +1,12 @@ + + + + + + jsp-2.2 + provisioningInterimFixesTest-1.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/marker b/dev/com.ibm.ws.kernel.boot_fat/publish/files/marker new file mode 100755 index 000000000000..74fd67bb1d0f --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/marker @@ -0,0 +1 @@ +A marker file to put in the workarea in the fingerprint clean tests. \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixTest-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixTest-1.0.mf new file mode 100755 index 000000000000..ebf1245cd209 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1.0 +Subsystem-SymbolicName: provisioningInterimFixTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ProvisioningInterimFixesTestBundle4; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixesTest-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixesTest-1.0.mf new file mode 100755 index 000000000000..ecf49f7ebd6f --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixesTest-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1.0 +Subsystem-SymbolicName: provisioningInterimFixesTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ProvisioningInterimFixesTestBundle1; version="[1,1.0.100)", + ProvisioningInterimFixesTestBundle2; version="[1,1.0.100)", + ProvisioningInterimFixesTestBundle3; version="[1,1.0.100)", + ProvisioningInterimFixesTestBundle4; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningTest-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningTest-1.0.mf new file mode 100755 index 000000000000..9f6781da6bc9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: provisioningTest-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ProvisioningTestBundle; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/service.fingerprint b/dev/com.ibm.ws.kernel.boot_fat/publish/files/service.fingerprint new file mode 100755 index 000000000000..1fc7a99648a7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/service.fingerprint @@ -0,0 +1 @@ +A test fingerprint file for mocking the service.fingerprint - in response to APAR 117401 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/singleInterimFixServer.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/files/singleInterimFixServer.xml new file mode 100755 index 000000000000..3139c91691e1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/singleInterimFixServer.xml @@ -0,0 +1,12 @@ + + + + + + jsp-2.2 + provisioningInterimFixTest-1.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestAbsolute.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestAbsolute.properties new file mode 100755 index 000000000000..bc4bf180ed41 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestAbsolute.properties @@ -0,0 +1 @@ +com.ibm.websphere.productInstall= \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestRelative.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestRelative.properties new file mode 100755 index 000000000000..2f12f1443237 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestRelative.properties @@ -0,0 +1 @@ +com.ibm.websphere.productInstall=wlpExt (&+) diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/clients/template2/client.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/clients/template2/client.xml new file mode 100755 index 000000000000..a07161e7ddec --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/clients/template2/client.xml @@ -0,0 +1,7 @@ + + + + javaeeClient-7.0 + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/servers/templateTest/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/servers/templateTest/server.xml new file mode 100755 index 000000000000..4f3c32e2ec97 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/servers/templateTest/server.xml @@ -0,0 +1,14 @@ + + + + + jsp-2.2 + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/earContent/META-INF/application.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/earContent/META-INF/application.xml new file mode 100755 index 000000000000..3c8c2abda264 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/earContent/META-INF/application.xml @@ -0,0 +1,16 @@ + + + TestMyEAR + + + TestWeb1.war + TestMyWeb1 + + + + + TestWeb0.war + TestMyWeb0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testUtil/classes/META-INF/MANIFEST.MF b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testUtil/classes/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..254272e1c074 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testUtil/classes/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/META-INF/MANIFEST.MF b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..59499bce4a2b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/index.jsp b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/index.jsp new file mode 100755 index 000000000000..7c276b94a389 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/index.jsp @@ -0,0 +1,12 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + +Welcome + + + Hi, this is web0. + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/META-INF/MANIFEST.MF b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..59499bce4a2b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/index.jsp b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/index.jsp new file mode 100755 index 000000000000..7c276b94a389 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/index.jsp @@ -0,0 +1,12 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + +Welcome + + + Hi, this is web0. + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/utils/classes/META-INF/MANIFEST.MF b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/utils/classes/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..254272e1c074 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/utils/classes/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/bootstrap.properties new file mode 100644 index 000000000000..4f1ae5a2e104 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/dropins/snoop.war b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/dropins/snoop.war new file mode 100644 index 000000000000..eff33454efa1 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/dropins/snoop.war differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/server.xml new file mode 100644 index 000000000000..1d8a79716f1d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/server.xml @@ -0,0 +1,12 @@ + + + + jsp-2.2 + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/Apps Loose Web.war.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/Apps Loose Web.war.xml new file mode 100755 index 000000000000..5c1bcb1587ea --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/Apps Loose Web.war.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-InvalidRelPaths.war.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-InvalidRelPaths.war.xml new file mode 100755 index 000000000000..41d0c37d0964 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-InvalidRelPaths.war.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-RelPaths.war.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-RelPaths.war.xml new file mode 100755 index 000000000000..dee07e12b8f3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-RelPaths.war.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-Signed.war.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-Signed.war.xml new file mode 100755 index 000000000000..bcbd83212b82 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-Signed.war.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + arbitrary text between tags should not cause package command to fail + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb.war.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb.war.xml new file mode 100755 index 000000000000..5c1bcb1587ea --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb.war.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/bootstrap.properties new file mode 100755 index 000000000000..8de793643eaa --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/bootstrap.properties @@ -0,0 +1,5 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:bootstrap=all=enabled +com.ibm.ws.logging.trace.max.files=30 + +# com.ibm.ws.kernel.boot.env.bvt needs testports.properties for HTTP +#bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/dropins/DropinsLooseWeb.ear.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/dropins/DropinsLooseWeb.ear.xml new file mode 100755 index 000000000000..4522aedfe5a2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/dropins/DropinsLooseWeb.ear.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/server.xml new file mode 100755 index 000000000000..8b22ca755eb3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/server.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/.gitignore b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/bootstrap.properties new file mode 100644 index 000000000000..6fe952051a32 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/bootstrap.properties @@ -0,0 +1,5 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:bootstrap=all=enabled +com.ibm.ws.logging.trace.max.files=1 +com.ibm.ws.logging.console.log.level=INFO + +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/server.xml new file mode 100644 index 000000000000..98604eaa3fec --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/server.xml @@ -0,0 +1,9 @@ + + + + + ejbLite-3.2 + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/.gitignore b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/.gitignore new file mode 100644 index 000000000000..f3f483d82c07 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/.gitignore @@ -0,0 +1 @@ +/dropins diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/bootstrap.properties new file mode 100755 index 000000000000..831b15d60ef4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/bootstrap.properties @@ -0,0 +1,2 @@ +command.port=-1 +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/server.xml new file mode 100755 index 000000000000..94fb81cd1555 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/server.xml @@ -0,0 +1,6 @@ + + + servlet-3.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.enabled.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.enabled.fat/server.xml new file mode 100755 index 000000000000..dd543055eaf3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.enabled.fat/server.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/bootstrap.properties new file mode 100755 index 000000000000..fe859a24711d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/server.xml new file mode 100755 index 000000000000..a0f06d9e4b91 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/server.xml @@ -0,0 +1,11 @@ + + + + + + + httpservice-2.2 + fileinstall-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.pause.resume.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.pause.resume.fat/server.xml new file mode 100755 index 000000000000..dd543055eaf3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.pause.resume.fat/server.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.serverstart.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.serverstart.fat/server.xml new file mode 100755 index 000000000000..dd543055eaf3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.serverstart.fat/server.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties new file mode 100755 index 000000000000..14294e579437 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties @@ -0,0 +1,5 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:bootstrap=all=enabled +com.ibm.ws.logging.trace.max.files=30 +com.ibm.ws.logging.console.log.level=INFO + +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties.hpel b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties.hpel new file mode 100755 index 000000000000..c5ee4367a125 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties.hpel @@ -0,0 +1,7 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:bootstrap=all=enabled +com.ibm.ws.logging.trace.max.files=30 +com.ibm.ws.logging.console.log.level=INFO + +websphere.log.provider=binaryLogging-1.0 + +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/server.xml new file mode 100755 index 000000000000..8c7a1920c7f4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/server.xml @@ -0,0 +1,4 @@ + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/bootstrap.properties new file mode 100755 index 000000000000..308b99268d49 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.console.log.level=OFF +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/server.xml new file mode 100755 index 000000000000..4163d65d3624 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/server.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/server.xml new file mode 100755 index 000000000000..7b298238aa64 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/server.xml @@ -0,0 +1,9 @@ + + + + + + jsp-2.2 + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/server.xml new file mode 100755 index 000000000000..13f01736f3d8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/server.xml @@ -0,0 +1,12 @@ + + + + + + jsp-2.2 + provisioningTest-1.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/.gitignore b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/.gitignore new file mode 100644 index 000000000000..f3f483d82c07 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/.gitignore @@ -0,0 +1 @@ +/dropins diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/bootstrap.properties new file mode 100755 index 000000000000..7ff78ec74f84 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:bootstrap=all=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/server.xml new file mode 100755 index 000000000000..0d3471bf0d8f --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/server.xml @@ -0,0 +1,7 @@ + + + servlet-3.0 + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/bootstrap.properties new file mode 100755 index 000000000000..2e3faa500d3d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/dropins/simpleApp.war/index.jsp b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/dropins/simpleApp.war/index.jsp new file mode 100755 index 000000000000..bdb6c10537ea --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/dropins/simpleApp.war/index.jsp @@ -0,0 +1,3 @@ + +
Hi, my name is <%=request.getParameter("name")%>
+ \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar new file mode 100755 index 000000000000..85a6fa4f6adf Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/features/prodtest-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/features/prodtest-1.0.mf new file mode 100755 index 000000000000..21b5ef9153be --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/features/prodtest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/server.xml new file mode 100755 index 000000000000..e1ebec9e8809 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/server.xml @@ -0,0 +1,12 @@ + + + + + + jsp-2.2 + productA:prodtest-1.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/bootstrap.properties new file mode 100755 index 000000000000..2e3faa500d3d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/dropins/simpleApp.war/index.jsp b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/dropins/simpleApp.war/index.jsp new file mode 100755 index 000000000000..bdb6c10537ea --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/dropins/simpleApp.war/index.jsp @@ -0,0 +1,3 @@ + +
Hi, my name is <%=request.getParameter("name")%>
+ \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar new file mode 100755 index 000000000000..85a6fa4f6adf Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/features/prodtest-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/features/prodtest-1.0.mf new file mode 100755 index 000000000000..21b5ef9153be --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/features/prodtest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/com.ibm.ws.prodtest.internal_1.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/com.ibm.ws.prodtest.internal_1.0.jar new file mode 100755 index 000000000000..85a6fa4f6adf Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/com.ibm.ws.prodtest.internal_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/features/prodtestb-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/features/prodtestb-1.0.mf new file mode 100755 index 000000000000..38d76226d879 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/features/prodtestb-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtestb-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/server.xml new file mode 100755 index 000000000000..fe1e35f2d5e8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/server.xml @@ -0,0 +1,13 @@ + + + + + + jsp-2.2 + productA:prodtest-1.0 + productB:prodtestb-1.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/bootstrap.properties new file mode 100755 index 000000000000..2e3faa500d3d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/dropins/simpleApp.war/index.jsp b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/dropins/simpleApp.war/index.jsp new file mode 100755 index 000000000000..bdb6c10537ea --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/dropins/simpleApp.war/index.jsp @@ -0,0 +1,3 @@ + +
Hi, my name is <%=request.getParameter("name")%>
+ \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/server.xml new file mode 100755 index 000000000000..72b547c216c2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/server.xml @@ -0,0 +1,11 @@ + + + + + + jsp-2.2 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/bootstrap.properties new file mode 100755 index 000000000000..fe859a24711d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/server.xml new file mode 100755 index 000000000000..8b22ca755eb3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/server.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/test-applications/checkJvmAppClasspath/src/com/ibm/ws/kernel/boot/app/classpath/CheckJvmAppClasspathPackagesBean.java b/dev/com.ibm.ws.kernel.boot_fat/test-applications/checkJvmAppClasspath/src/com/ibm/ws/kernel/boot/app/classpath/CheckJvmAppClasspathPackagesBean.java new file mode 100644 index 000000000000..8c81c5d791ae --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/test-applications/checkJvmAppClasspath/src/com/ibm/ws/kernel/boot/app/classpath/CheckJvmAppClasspathPackagesBean.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.app.classpath; + +import java.lang.reflect.Method; + +import javax.annotation.PostConstruct; +import javax.ejb.LocalBean; +import javax.ejb.Singleton; +import javax.ejb.Startup; + +@Startup +@Singleton +@LocalBean +public class CheckJvmAppClasspathPackagesBean { + + private static ClassLoader JVM_APP_LOADER = ClassLoader.getSystemClassLoader(); + + @PostConstruct + public void printJvmAppClasspathPackages() { + Method m; + try { + m = ClassLoader.class.getDeclaredMethod("getPackages"); + m.setAccessible(true); + Package[] pkgs = (Package[]) m.invoke(JVM_APP_LOADER); + for (Package p : pkgs) { + System.out.println("AppLoader can load: " + p.getName()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/.gitignore b/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/.gitignore new file mode 100644 index 000000000000..e47e1b33a748 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/.gitignore @@ -0,0 +1 @@ +/resources diff --git a/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/src/com/ibm/ws/kernel/boot/fat/ShutdownTestServlet.java b/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/src/com/ibm/ws/kernel/boot/fat/ShutdownTestServlet.java new file mode 100755 index 000000000000..85a528281412 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/src/com/ibm/ws/kernel/boot/fat/ShutdownTestServlet.java @@ -0,0 +1,46 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.fat; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet("/*") +@SuppressWarnings("serial") +public class ShutdownTestServlet extends HttpServlet { + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + final String exitMethodName = request.getParameter("exit"); + response.getWriter().println("exit=" + exitMethodName); + + // WebContainer "helpfully" blocks app stop until all servlets have + // finished their requests. That only makes the FAT take longer, so use + // a secondary thread. + new Thread() { + @Override + public void run() { + if ("Runtime.exit".equals(exitMethodName)) { + System.out.println(this + ": calling Runtime.exit"); + Runtime.getRuntime().exit(0); + } else { + System.out.println(this + ": calling Shutdown.exit"); + System.exit(0); + } + } + }.start(); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/.classpath b/dev/com.ibm.ws.kernel.boot_test/.classpath new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_test/.classpath.gradle b/dev/com.ibm.ws.kernel.boot_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_test/.gitignore b/dev/com.ibm.ws.kernel.boot_test/.gitignore new file mode 100644 index 000000000000..9fb7b834a975 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.gitignore @@ -0,0 +1,5 @@ +*.log* +/TestBundleDeactivate.txt +/coverage.ec +/lib +/reports diff --git a/dev/com.ibm.ws.kernel.boot_test/.project b/dev/com.ibm.ws.kernel.boot_test/.project new file mode 100755 index 000000000000..fd207f3e333e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.boot_test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..845c3083c7df --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..fadbc117581b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=true +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.boot_test/bnd.bnd b/dev/com.ibm.ws.kernel.boot_test/bnd.bnd new file mode 100755 index 000000000000..5b9fdb808598 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/bnd.bnd @@ -0,0 +1,21 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.kernel.boot;version=latest diff --git a/dev/com.ibm.ws.kernel.boot_test/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.boot_test/bnd.bnd.gradle new file mode 100755 index 000000000000..5b9fdb808598 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/bnd.bnd.gradle @@ -0,0 +1,21 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.kernel.boot;version=latest diff --git a/dev/com.ibm.ws.kernel.boot_test/build-unittest.xml b/dev/com.ibm.ws.kernel.boot_test/build-unittest.xml new file mode 100755 index 000000000000..86cb5c63ace0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/build-unittest.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + Project classpath: ${pcp} + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.security.utility_test/build.nogradle b/dev/com.ibm.ws.kernel.boot_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.security.utility_test/build.nogradle rename to dev/com.ibm.ws.kernel.boot_test/build.gradle diff --git a/dev/com.ibm.ws.kernel.boot_test/delivery.sets b/dev/com.ibm.ws.kernel.boot_test/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.boot_test/launch.bnd b/dev/com.ibm.ws.kernel.boot_test/launch.bnd new file mode 100755 index 000000000000..36e984b875c3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/launch.bnd @@ -0,0 +1,9 @@ +-nouses=true +bVersion=1.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + +Bundle-Name: WebSphere kernel bootstrap launcher +Bundle-SymbolicName: launch +Bundle-Version: ${bVersion} +WebSphere-DefaultKernel: test-kernel-1.0 +WebSphere-DefaultLogProvider: test-logging-1.0 \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_bvt/build.nogradle b/dev/com.ibm.ws.kernel.boot_test/resources/Factory.empty old mode 100644 new mode 100755 similarity index 100% rename from dev/com.ibm.ws.threading_bvt/build.nogradle rename to dev/com.ibm.ws.kernel.boot_test/resources/Factory.empty diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/packages.list b/dev/com.ibm.ws.kernel.boot_test/resources/packages.list new file mode 100755 index 000000000000..73141766e793 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/packages.list @@ -0,0 +1 @@ +not.right.property.name=value \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/bootstrap.properties new file mode 100755 index 000000000000..a9e014513632 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/bootstrap.properties @@ -0,0 +1,15 @@ +# port for the OSGi console +osgi.console=5678 + +# +# OSGi caching +# Equinox will cache information about a running server to speed up +# class resolution when the server is restarted. Alpine and Equinox +# will take steps to ensure that this data is refreshed if bundles in +# the lib directory are updated, but if you are getting a lot of +# messages about missing bundle constraints, and you know the bundle +# in question is well formed, starting with a clean slate may fix +# things up. Uncomment the following ("osgi.clean=true") to force +# equinox to clear cached information before installing or starting +# any bundles. +# osgi.clean=true diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/server.cfg b/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/server.cfg new file mode 100755 index 000000000000..6ffbd599b681 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/server.cfg @@ -0,0 +1,21 @@ +############################################## +# Default Alpine Configuration +# +# Format: +# group:key value +# or +# group{ +# #a series of +# key value +# } +# where can be: =, -=, +=, >=, or <= +# value can be: +# - String +# - String Array: values enclosed by [] and delimited by , +# - Map of Strings: set of "key=value" value pairs enclosed by {} and delimited by , +# See "Config Parser and Config File Format" document for more details. +############################################## + +com.ibm.ws.kernel.feature:featuresets+=[webcontainer, http, ssl] + +Applications:scanning.enabled=true diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.6.0.properties b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.6.0.properties new file mode 100755 index 000000000000..055dbd0f1b8f --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.6.0.properties @@ -0,0 +1,3 @@ +# An empty list for testing + +org.osgi.framework.system.packages=1.6.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.7.0.properties b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.7.0.properties new file mode 100755 index 000000000000..e0d682403dac --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.7.0.properties @@ -0,0 +1,3 @@ +# An empty list for testing + +org.osgi.framework.system.packages=1.7.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.8.0.properties b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.8.0.properties new file mode 100755 index 000000000000..73fc4869b66c --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.8.0.properties @@ -0,0 +1,3 @@ +# An empty list for testing + +org.osgi.framework.system.packages=1.8.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/simple.bnd b/dev/com.ibm.ws.kernel.boot_test/simple.bnd new file mode 100755 index 000000000000..7f4d4db1b7df --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/simple.bnd @@ -0,0 +1,13 @@ +-nouses=true +-resourceonly=true +bVersion=1.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} + +#include the real property file resources +Include-Resource: \ + @${unittest.kernel.boot.jar.name}!/OSGI-OPT/websphere/*.properties diff --git a/dev/com.ibm.ws.kernel.boot_test/simple2.bnd b/dev/com.ibm.ws.kernel.boot_test/simple2.bnd new file mode 100755 index 000000000000..96bf0d4a1a91 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/simple2.bnd @@ -0,0 +1,21 @@ +-nouses=true +-resourceonly=true +bVersion=2.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} +WebSphere-DefaultKernel: test-kernel-2.0 + +# For each exported package, create (in that package) a package-info.java +# file, and place an @version javadoc tag in package-level javadoc. +# Append ";provide:=true" if this bundle also provides an implementation +# for the exported API. +Export-Package: com.ibm.ws.kernel.launch.service;provide:=true + +#Include dummy resources for system-packages +Include-Resource: \ + OSGI-OPT/websphere=resources diff --git a/dev/com.ibm.ws.kernel.boot_test/simple3.bnd b/dev/com.ibm.ws.kernel.boot_test/simple3.bnd new file mode 100755 index 000000000000..93cf8514f67d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/simple3.bnd @@ -0,0 +1,13 @@ +-nouses=true +-resourceonly=true +bVersion=3.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} +WebSphere-DefaultKernel: test-kernel-2.0 + +## It is important that the pacakges.list file does not actually exist in the generated bundle.. +# because this is testing missing system packages so we don't include them here! diff --git a/dev/com.ibm.ws.kernel.boot_test/simple4.bnd b/dev/com.ibm.ws.kernel.boot_test/simple4.bnd new file mode 100755 index 000000000000..d182b3af5e7c --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/simple4.bnd @@ -0,0 +1,13 @@ +-nouses=true +-resourceonly=true +bVersion=4.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} +WebSphere-DefaultKernel: test-kernel-2.0 + +#mock up a 1.6.0 package list from the package.list with a bad property +Include-Resource: OSGI-OPT/websphere/system-packages_1.6.0.properties=resources/packages.list diff --git a/dev/com.ibm.ws.kernel.boot_test/simple5.bnd b/dev/com.ibm.ws.kernel.boot_test/simple5.bnd new file mode 100755 index 000000000000..905065903966 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/simple5.bnd @@ -0,0 +1,13 @@ +-nouses=true +-resourceonly=true +bVersion=5.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} + +#Include dummy resources for system-packages +Include-Resource: \ + OSGI-OPT/websphere=resources \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/BootstrapConfigTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/BootstrapConfigTest.java new file mode 100755 index 000000000000..50c96f777eed --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/BootstrapConfigTest.java @@ -0,0 +1,782 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * Change activity: + * + * Issue Date Name Description + * ----------- ----------- --------- ------------------------------------ + * Initial version + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.Field; +import java.security.PrivilegedExceptionAction; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.xml.parsers.DocumentBuilderFactory; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assume; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import test.common.SharedOutputManager; +import test.shared.Constants; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.internal.BootstrapConstants; +import com.ibm.ws.kernel.boot.internal.BootstrapConstants.VerifyServer; + +/** + * + */ +public class BootstrapConfigTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + static final File defaultServer = new File(Constants.TEST_TMP_ROOT, "defaultServer"); + + @Rule + public TestName testName = new TestName(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() { + TestUtils.cleanTempFiles(); + } + + @AfterClass + public static void tearDownAfterClass() { + TestUtils.cleanTempFiles(); + } + + Map initProps = new HashMap(); + BootstrapConfig bc = new TestBootstrapConfig(initProps); + + @Before + public void setUp() { + Constants.TEST_TMP_ROOT_FILE.mkdirs(); + + // Create server/workarea directories... + defaultServer.mkdirs(); + } + + @After + public void tearDown() throws Exception { + initProps.clear(); + TestUtils.cleanTempFiles(); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#mergeProperties(java.util.Map, java.net.URL, java.lang.String)} . + */ + @Test + public void testMergeProperties() { + + try { + File f1 = new File(Constants.TEST_PLATFORM_DIR + "include.properties"); + + // Test system property value override: compare with testProcessIncludes, + // which just looks for original value un-influenced by system properties + System.setProperty("override", "systemProperty"); + bc.mergeProperties(initProps, null, f1.toURI().toString()); + assertEquals("System property value should win", "systemProperty", bc.get("override")); + assertEquals("Peer file should be found", "found", bc.get("peer")); + assertEquals("Relative file should be found", "found", bc.get("relative")); + } finally { + System.clearProperty("override"); + } + } + + @Test + public void testMergePropertiesBadURL() { + Map map = new HashMap(); + + try { + bc.mergeProperties(map, null, "unknown:junk"); + fail("Expected location exception was not thrown"); + } catch (LocationException e) { + System.out.println(BootstrapConstants.messages.getString("error.badLocation")); + System.out.println(e.getTranslatedMessage()); + + // unable to resolve locations + assertTrue(outputMgr.checkForStandardOut("CWWKE0004E")); + // malformed URI for bootstrap properties + assertTrue(outputMgr.checkForStandardOut("CWWKE0008E")); + } + } + + @Test + public void testMergePropertiesBadFile() { + Map map = new HashMap(); + + try { + bc.mergeProperties(map, null, new File(Constants.TEST_PLATFORM_DIR + "notexist").toURI().toString()); + } catch (LocationException ex) { + assertTrue(ex.getTranslatedMessage().contains("CWWKE0014E")); + } + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#addMissingProperties(java.util.Properties, java.util.Map)} . + */ + @Test + public void testAddMissingProperties() { + final String key1 = "existingKey", value1 = "existingValue", key2 = "newKey", value2 = "newValue", value3 = "replaceValue"; + + initProps.put(key1, value1); + + Properties source = new Properties(); + // add replacement value; should be ignored + source.setProperty(key1, value3); + source.setProperty(key2, value2); + + bc.addMissingProperties(source, initProps); + + assertEquals("Original value should be preserved", value1, initProps.get(key1)); + assertEquals("New key should be set", value2, initProps.get(key2)); + + // Should not blow up w/ null/empty source or target + bc.addMissingProperties(null, initProps); + source.clear(); + bc.addMissingProperties(source, initProps); + bc.addMissingProperties(source, null); + + // Should not blow up w/ zero-length key + source.setProperty("", "blah"); + bc.addMissingProperties(source, initProps); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#processIncludes(java.util.Map, java.net.URL, java.lang.String)} . Most valid paths are tested via + * mergeProperties + */ + @Test + public void testProcessIncludes() { + bc.processIncludes(initProps, null, null); + + File f1 = new File(Constants.TEST_PLATFORM_DIR + "include.properties"); + String fname = f1.toURI().toString(); + bc.processIncludes(initProps, null, fname + " "); + // Compare with testMergeProperties + assertEquals("Original value should be present", "original", bc.get("override")); + assertEquals("Peer file should be found", "found", bc.get("peer")); + assertEquals("Relative file should be found", "found", bc.get("relative")); + + bc.processIncludes(initProps, null, fname + " ,\t" + fname); + } + + /** + * Expect an IllegalArgumentException when null is passed to configure Test + * method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#configure(java.util.Map)}. + */ + @Test(expected = IllegalArgumentException.class) + public void testConfigureNull() { + TestBootstrapConfig bc = new TestBootstrapConfig(); + + // configure(map) + bc.configure(null); + } + + /** + * Expect a LocationException when an unresolvable file is used as install dir + * + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#configure(java.util.Map)}. + * + * @throws IOException + */ + @Test(expected = com.ibm.ws.kernel.boot.LocationException.class) + public void testConfigureBadLocation() throws IOException { + String fName = "InstallDirAsFile"; + File file = new File(Constants.TEST_TMP_ROOT, fName); + file.createNewFile(); + file.deleteOnExit(); + + TestBootstrapConfig bc = new TestBootstrapConfig(); + bc.findLocations(testName.getMethodName(), file.getAbsolutePath(), null, null, null); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#configure(java.util.Map)}. + */ + @Test + public void testFindLocations() throws Exception { + File test1 = new File(Constants.TEST_TMP_ROOT, "test1"); + + try { + + bc = new TestBootstrapConfig(); + bc.findLocations(null, null, null, null, null); + + bc.printLocations(false); // print locations: no formatting + assertTrue("Bootstrap lib dir should be a directory (not a jar)", bc.bootstrapLib.isDirectory()); + + checkDirs("A", bc); + assertEquals("A: Default server name", BootstrapConstants.DEFAULT_SERVER_NAME, bc.getProcessName()); + assertEquals("A: installRoot should be parent of bootstrap lib", bc.installRoot, bc.bootstrapLib.getParentFile()); + assertEquals("A: userRoot should be child of installRoot", bc.installRoot, bc.userRoot.getParentFile()); + assertEquals("A: processesRoot should be a child of the userRoot", bc.userRoot, bc.processesRoot.getParentFile()); + assertEquals("A: configDir should be a child of the processesRoot", bc.processesRoot, bc.configDir.getParentFile()); + assertSame("A: outputRoot should be same as processesRoot", bc.processesRoot, bc.outputRoot); + assertSame("A: outputDir should be same as configDir", bc.configDir, bc.outputDir); + + bc = new TestBootstrapConfig(); + bc.findLocations(testName.getMethodName(), test1.getAbsolutePath(), null, null, null); + + checkDirs("B", bc); + assertEquals("B: userRoot should match userDir parameter", test1.getCanonicalFile(), bc.userRoot.getCanonicalFile()); + assertEquals("B: processesRoot should be a child of the userRoot", bc.userRoot, bc.processesRoot.getParentFile()); + assertEquals("B: configDir should be a child of the processesRoot", bc.processesRoot, bc.configDir.getParentFile()); + assertEquals("B: getServerFile(null) should return configDir", bc.configDir, bc.getConfigFile(null)); + + assertSame("B: outputRoot should be same as processesRoot", bc.processesRoot, bc.outputRoot); + assertSame("B: outputDir should be same as configDir", bc.configDir, bc.outputDir); + assertEquals("B: getServerOutputFile(null) should return outputDir", bc.outputDir, bc.getOutputFile(null)); + + // Now test for the output dir split: we now have two trees... (one shorter + // than the other.. ) + bc = new TestBootstrapConfig(); + bc.findLocations(testName.getMethodName(), null, test1.getAbsolutePath(), null, null); + + checkDirs("C", bc); + assertEquals("C: userRoot should be child of installRoot", bc.installRoot, bc.userRoot.getParentFile()); + assertEquals("C: processesRoot should be a child of the userRoot", bc.userRoot, bc.processesRoot.getParentFile()); + assertEquals("C: configDir should be a child of the processesRoot", bc.processesRoot, bc.configDir.getParentFile()); + assertEquals("C: getServerFile(null) should return configDir", bc.configDir, bc.getConfigFile(null)); + + assertEquals("C: outputRoot should match outputDir parameter", test1.getCanonicalFile(), bc.outputRoot.getCanonicalFile()); + assertEquals("C: outputDir should be a child of the outputRoot", bc.outputRoot, bc.outputDir.getParentFile()); + assertEquals("C: getServerOutputFile(null) should return outputDir", bc.outputDir, bc.getOutputFile(null)); + + assertEquals("C: getLogDiretory() should be a child of outputDir", bc.getOutputFile("logs"), bc.getLogDirectory()); + + // Now test for a separate log directory + bc = new TestBootstrapConfig(); + bc.findLocations(testName.getMethodName(), null, null, test1.getAbsolutePath(), null); + + checkDirs("D", bc); + assertEquals("D: userRoot should be child of installRoot", bc.installRoot, bc.userRoot.getParentFile()); + assertEquals("D: processesRoot should be a child of the userRoot", bc.userRoot, bc.processesRoot.getParentFile()); + assertEquals("D: configDir should be a child of the processesRoot", bc.processesRoot, bc.configDir.getParentFile()); + assertEquals("D: getServerFile(null) should return configDir", bc.configDir, bc.getConfigFile(null)); + + assertSame("D: outputRoot should be same as processesRoot", bc.processesRoot, bc.outputRoot); + assertSame("D: outputDir should be same as configDir", bc.configDir, bc.outputDir); + assertEquals("D: getServerOutputFile(null) should return outputDir", bc.outputDir, bc.getOutputFile(null)); + + assertEquals("D: getLogDiretory() should match logDir parameter", test1.getCanonicalFile(), bc.getLogDirectory().getCanonicalFile()); + + initProps.clear(); + + // Make sure system properties are ignored + System.setProperty(BootstrapConstants.LOC_PROPERTY_INSTANCE_DIR, test1.getAbsolutePath()); + bc = new TestBootstrapConfig(); + // configure(map, userDir, outputDir, logDir) + bc.findLocations(testName.getMethodName(), null, null, null, null); + + // This set should be identical to the conditions used in A (i.e. the defaults, + // as null is passed in as a parameters) + checkDirs("E", bc); + assertEquals("E: userRoot should be child of installRoot", bc.installRoot, bc.userRoot.getParentFile()); + assertEquals("E: processesRoot should be a child of the userRoot", bc.userRoot, bc.processesRoot.getParentFile()); + assertEquals("E: configDir should be a child of the processesRoot", bc.processesRoot, bc.configDir.getParentFile()); + assertSame("E: outputRoot should be same as processesRoot", bc.processesRoot, bc.outputRoot); + assertSame("E: outputDir should be same as configDir", bc.configDir, bc.outputDir); + + } finally { + TestUtils.cleanTempFiles(test1); + System.clearProperty(BootstrapConstants.LOC_PROPERTY_INSTANCE_DIR); + System.clearProperty(BootstrapConstants.LOC_PROPERTY_INSTALL_DIR); + } + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#setSystemProperties()}. + */ + @Test + public void testSetSystemProperty() { + final String key1 = "existingKey", value1 = "existingValue", key2 = "newKey", value2 = "newValue", nonExistentKey = "nonExistentKey"; + + String javaSecurityProp = "websphere.java.security"; + + bc.setSystemProperties(); + assertNull("System property test value did not return null as expected.", System.getProperty(key1)); + assertNull("System property test value did not return null as expected.", System.getProperty(key2)); + assertNull("Non existent system property did not return null as expected.", System.getProperty(nonExistentKey)); + assertNull("Websphere Java security property did not return null as expected.", System.getProperty(javaSecurityProp)); + + initProps.put(key1, value1); + initProps.put(key2, value2); + bc.setSystemProperties(); + assertEquals("System property test value did not equal expected value.", value1, System.getProperty(key1)); + assertEquals("System property test value did not equal expected value.", value2, System.getProperty(key2)); + assertNull("Non existent system property did not return null as expected.", System.getProperty(nonExistentKey)); + assertNull("System property " + javaSecurityProp + " did not return null as expected.", System.getProperty(javaSecurityProp)); + + initProps.put(javaSecurityProp, "true"); + bc.setSystemProperties(); + assertEquals("System property test value did not equal expected value.", value1, System.getProperty(key1)); + assertEquals("System property test value did not equal expected value.", value2, System.getProperty(key2)); + assertNull("Non existent system property did not return null as expected.", System.getProperty(nonExistentKey)); + assertNull("System property " + javaSecurityProp + " did not return null as expected.", System.getProperty(javaSecurityProp)); + } + + /** + * Prepare a server directory and BootstrapConfig for verification. + */ + private BootstrapConfig prepareServer(String serverName) { + File usrDir = new File(Constants.TEST_TMP_ROOT); + File serverDir = new File(usrDir, "servers" + File.separatorChar + serverName); + TestUtils.cleanTempFiles(serverDir); + bc = new BootstrapConfig(); + bc.findLocations(serverName, Constants.TEST_TMP_ROOT, null, null, null); + return bc; + } + + private static final String[] SERVER_NAMES = new String[] { "defaultServer", "newServer" }; + + private BootstrapConfig prepareDefaultServer() { + return prepareServer("defaultServer"); + } + + private BootstrapConfig prepareNewServer() { + return prepareServer("newServer"); + } + + /** + * The type of templates that can be used when creating a server. + */ + private enum ServerTemplateType { + /** Liberty templates (wlp/templates/servers/defaultServer/) */ + LIBERTY, + /** --template=test (files created by {@link #runTemplateTest}) */ + TEST, + /** Kernel template (boot JAR, used when no other templates found) */ + KERNEL, + } + + /** + * Prepare bootstrap statics to allow templates to be found, and then run + * the specified action. + */ + private void withMockTemplatesDirectory(ServerTemplateType templateType, PrivilegedExceptionAction action) throws Exception { + File installDir; + switch (templateType) { + case TEST: + installDir = new File(Constants.TEST_TMP_ROOT_FILE, "install"); + break; + case LIBERTY: + installDir = new File(Constants.BOOTSTRAP_PUBLISH_DIR); + break; + default: + throw new IllegalArgumentException(String.valueOf(templateType)); + } + + TestUtils.setKernelUtilsBootstrapLibDir(new File(installDir, "lib")); + try { + if (templateType == ServerTemplateType.TEST) { + File templateDir = new File(installDir, "templates/servers/test"); + assertTrue("created " + templateDir, templateDir.mkdirs()); + PrintWriter pw = new PrintWriter(new File(templateDir, "server.xml"), "UTF-8"); + pw.println(""); + pw.close(); + } + + action.run(); + } finally { + TestUtils.setKernelUtilsBootstrapLibDir(null); + } + } + + /** + * Analyze server.xml to determine which server template was used. + */ + private ServerTemplateType getServerTemplateType(File serverConfig) throws Exception { + Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new FileInputStream(serverConfig)); + Element element = doc.getDocumentElement(); + assertEquals("server", element.getNodeName()); + + if ("test".equals(element.getAttribute("description"))) { + // A test server.xml create by runTemplateTest above. + return ServerTemplateType.TEST; + } + + if (element.getElementsByTagName("featureManager").getLength() > 0) { + // /com.ibm.ws.kernel.boot/publish/servers/defaultServer/server.xml + // aka wlp/templates/servers/defaultServer/server.xml. + return ServerTemplateType.LIBERTY; + } + + // Otherwise, assume it was the "kernel default" server.xml, which + // (currently?) has no features enabled. + // /com.ibm.ws.kernel.boot/resources/OSGI-OPT/websphere/server/server.xml + // aka wlp/lib/com.ibm.ws.kernel_*.jar!/OSGI-OPT/websphere/server/server.xml + return ServerTemplateType.KERNEL; + } + + /** + * VerifyServer.EXISTS with a missing server = SERVER_NOT_EXIST_STATUS + */ + @Test + public void testVerifyServerExistsError() { + for (String serverName : SERVER_NAMES) { + try { + prepareServer(serverName).verifyProcess(VerifyServer.EXISTS, null); + } catch (LaunchException e) { + assertEquals(ReturnCode.SERVER_NOT_EXIST_STATUS, e.getReturnCode()); + } + } + } + + /** + * VerifyServer.EXISTS after creating should succeed. + */ + @Test + public void testVerifyServerExists() throws Exception { + for (String serverName : SERVER_NAMES) { + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, null); + bc.verifyProcess(VerifyServer.EXISTS, null); + } + } + + /** + * VerifyServer.CREATE should use the default kernel template when creating. + */ + @Test + public void testVerifyServerCreate() throws Exception { + for (String serverName : SERVER_NAMES) { + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, null); + assertEquals(ServerTemplateType.KERNEL, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + } + + /** + * VerifyServer.CREATE should use wlp/templates if present when creating. + */ + @Test + public void testVerifyServerCreateKernelTemplate() throws Exception { + withMockTemplatesDirectory(ServerTemplateType.LIBERTY, new PrivilegedExceptionAction() { + @Override + public Void run() throws Exception { + for (String serverName : SERVER_NAMES) { + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, null); + assertEquals(ServerTemplateType.LIBERTY, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + return null; + } + }); + } + + /** + * VerifyServer.CREATE with invalid --template = LAUNCH_EXCEPTION + error.fileNotFound. + */ + @Test + public void testVerifyServerCreateWithInvalidTemplate() throws Exception { + try { + String[] args = new String[] { "--template=invalid" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + prepareDefaultServer().verifyProcess(VerifyServer.CREATE, new LaunchArguments(cmdArgs, null)); + } catch (LaunchException e) { + assertEquals(ReturnCode.LAUNCH_EXCEPTION, e.getReturnCode()); + assertTrue(e.getTranslatedMessage(), e.getTranslatedMessage().startsWith("CWWKE0054E:")); + } + } + + /** + * VerifyServer.CREATE with --template should use that template. + */ + @Test + public void testVerifyServerCreateWithTemplate() throws Exception { + withMockTemplatesDirectory(ServerTemplateType.TEST, new PrivilegedExceptionAction() { + @Override + public Void run() throws Exception { + for (String serverName : SERVER_NAMES) { + String[] args = new String[] { "--template=test" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, new LaunchArguments(cmdArgs, null)); + assertEquals(ServerTemplateType.TEST, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + return null; + } + }); + } + + /** + * VerifyServer.CREATE after creating a server = REDUNDANT_ACTION_STATUS. + */ + @Test + public void testVerifyServerCreateAlreadyExists() { + for (String serverName : SERVER_NAMES) { + try { + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, null); + bc.verifyProcess(VerifyServer.CREATE, null); + } catch (LaunchException e) { + assertEquals(ReturnCode.REDUNDANT_ACTION_STATUS, e.getReturnCode()); + } + } + } + + /** + * VerifyServer.CREATE_DEFAULT should use the default kernel template when + * creating defaultServer. + */ + @Test + public void testVerifyServerCreateDefaultKernelTemplate() throws Exception { + prepareDefaultServer().verifyProcess(VerifyServer.CREATE_DEFAULT, null); + assertEquals(ServerTemplateType.KERNEL, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + + /** + * VerifyServer.CREATE_DEFAULT should use wlp/templates if present when + * creating defaultServer. + */ + @Test + public void testVerifyServerCreateDefaultLibertyTemplate() throws Exception { + withMockTemplatesDirectory(ServerTemplateType.LIBERTY, new PrivilegedExceptionAction() { + @Override + public Void run() throws Exception { + prepareDefaultServer().verifyProcess(VerifyServer.CREATE_DEFAULT, null); + assertEquals(ServerTemplateType.LIBERTY, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + return null; + } + }); + } + + /** + * VerifyServer.CREATE_DEFAULT should ignore --template when creating + * defaultServer. + */ + @Test + public void testVerifyServerCreateDefaultWithTemplate() throws Exception { + // This will fail if CREATE_DEFAULT erroneously checks --template. + String[] args = new String[] { "--template=invalid" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + prepareDefaultServer().verifyProcess(VerifyServer.CREATE_DEFAULT, new LaunchArguments(cmdArgs, null)); + assertEquals(ServerTemplateType.KERNEL, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + + /** + * VerifyServer.CREATE_DEFAULT should ignore --template when creating + * defaultServer, even if an empty directory already exists. + */ + @Test + public void testVerifyServerCreateDefaultForEmptyDirWithTemplate() throws Exception { + assertTrue("created server directory", prepareDefaultServer().getConfigFile(null).mkdirs()); + // This will fail if CREATE_DEFAULT erroneously checks --template. + String[] args = new String[] { "--template=invalid" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + bc.verifyProcess(VerifyServer.CREATE_DEFAULT, new LaunchArguments(cmdArgs, null)); + assertEquals(ServerTemplateType.KERNEL, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + + /** + * VerifyServer.CREATE_DEFAULT is like EXISTS for non-defaultServer: + * non-existent server = SERVER_NOT_EXIST_STATUS + */ + @Test + public void testVerifyServerCreateDefaultError() { + try { + prepareNewServer().verifyProcess(VerifyServer.CREATE_DEFAULT, null); + } catch (LaunchException e) { + assertEquals(ReturnCode.SERVER_NOT_EXIST_STATUS, e.getReturnCode()); + } + } + + /** + * VerifyServer.CREATE_DEFAULT is a no-op for an existing server. + */ + @Test + public void testVerifyServerCreateDefaultAlreadyExists() { + for (String serverName : SERVER_NAMES) { + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, null); + bc.verifyProcess(VerifyServer.CREATE_DEFAULT, null); + } + } + + /** + * VerifyServer.SKIP (or null) is a no-op regardless of whether or not + * the server exists. + */ + @Test + public void testVerifyServerSkip() throws Exception { + for (String serverName : SERVER_NAMES) { + prepareServer(serverName).verifyProcess(null, null); + bc.verifyProcess(VerifyServer.SKIP, null); + + // Create the server and try again. + bc.verifyProcess(VerifyServer.CREATE, null); + bc.verifyProcess(null, null); + bc.verifyProcess(VerifyServer.SKIP, null); + } + } + + @Test + public void testNewServer() throws Exception { + File commonFile = new File(Constants.TEST_TMP_ROOT); + File newServerDir = new File(commonFile, "servers/newServer"); + + try { + TestUtils.cleanTempFiles(newServerDir); + + // Find the new server (includes mapping to canonical name, etc.) + bc = new BootstrapConfig(); + bc.findLocations("newServer", Constants.TEST_TMP_ROOT, null, null, null); + System.out.println(newServerDir.toURI().toString()); + + // Invoke configure with property indicating that the server should be created + bc.verifyProcess(VerifyServer.CREATE, null); + + assertTrue("I: new server should have been created", newServerDir.exists() && newServerDir.isDirectory()); + assertEquals("I: intended server should be created", newServerDir.getCanonicalFile(), bc.configDir.getCanonicalFile()); + + File sFile = new File(bc.configDir, "server.xml"); + assertTrue("I: new server should have server.xml file created", sFile.exists() && sFile.isFile()); + } finally { + TestUtils.cleanTempFiles(newServerDir.getParentFile()); // servers dir + } + } + + @Test + public void testServerNameCaseSensitivity() { + + File serversDir = new File(Constants.TEST_TMP_ROOT_FILE, "servers"); + File newServerDir = new File(serversDir, "newServer"); + File newserverDir = new File(serversDir, "newserver"); + + try { + TestUtils.cleanTempFiles(newServerDir); + TestUtils.cleanTempFiles(newserverDir); + + // Create a server named "newServer" + + // find locations first + bc = new BootstrapConfig(); + bc.findLocations("newServer", Constants.TEST_TMP_ROOT, null, null, null); + + // configure / create the server + initProps.clear(); + bc.verifyProcess(VerifyServer.CREATE, null); + + // This test cannot proceed unless the file system is case-insensitive. + Assume.assumeTrue(newserverDir.exists()); + + // Configure a server named "newserver". + bc = new BootstrapConfig(); + bc.findLocations("newserver", Constants.TEST_TMP_ROOT, null, null, null); + bc.verifyProcess(VerifyServer.CREATE_DEFAULT, null); + + initProps.clear(); + bc.configure(initProps); + + // Verify that the server is named "newServer". + assertEquals("newServer", bc.getProcessName()); + assertEquals("newServer", bc.getConfigFile(null).getName()); + assertEquals("newServer", bc.getOutputFile(null).getName()); + + // Verify that no framework property contains "newserver" since + // these are all set as system properties. + for (Map.Entry entry : bc.getFrameworkProperties().entrySet()) { + assertFalse("framework property " + entry.getKey() + '=' + entry.getValue(), + entry.getValue().contains("newserver")); + } + } finally { + TestUtils.cleanTempFiles(serversDir); + } + } + + @Test + public void testSetServerName() { + bc.setProcessName("abcdefghijklmnopqrstuvwxyz"); + bc.setProcessName("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + bc.setProcessName("12345567890"); + bc.setProcessName("_-.+"); + bc.setProcessName("+-._"); + } + + @Test(expected = LocationException.class) + public void testSetServerDirBad1() { + bc.setProcessName("bad!"); + } + + @Test(expected = LocationException.class) + public void testSetServerDirBad2() { + bc.setProcessName("bad "); + } + + @Test(expected = LocationException.class) + public void testSetServerDirBad3() { + bc.setProcessName("bad\b"); + } + + @Test(expected = LocationException.class) + public void testSetServerDirBad4() { + bc.setProcessName(".bad"); + } + + @Test(expected = LocationException.class) + public void testSetServerDirBad5() { + bc.setProcessName("-bad"); + } + + public void checkDirs(String m, BootstrapConfig bc) throws IllegalArgumentException, IllegalAccessException { + // make sure all dirs are set.. use reflection so that we catch if we + // missed + // one.. + Field fields[] = BootstrapConfig.class.getDeclaredFields(); + for (Field f : fields) { + if (f.getType().equals(File.class)) { + f.setAccessible(true); + String name = f.getName(); + File file = (File) f.get(bc); + assertNotNull(m + ": File location should be set for " + name, file); + System.out.printf("%18s %s\n", name, file.getAbsolutePath()); + } + } + + // sanity check the calculated directories + assertEquals(bc.outputDir, bc.workarea.getParentFile()); + } + + protected class TestBootstrapConfig extends BootstrapConfig { + TestBootstrapConfig() {} + + TestBootstrapConfig(Map initProps) { + super.initProps = initProps; + } + + @Override + protected void verifyProcess(VerifyServer verify, LaunchArguments args) throws LaunchException {} + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LaunchArgumentsTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LaunchArgumentsTest.java new file mode 100755 index 000000000000..6aa4e292713a --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LaunchArgumentsTest.java @@ -0,0 +1,318 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.internal.BootstrapConstants; +import com.ibm.ws.kernel.boot.internal.BootstrapConstants.VerifyServer; + +/** + * + */ +public class LaunchArgumentsTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() { + TestUtils.cleanTempFiles(); + } + + @AfterClass + public static void tearDownAfterClass() { + TestUtils.cleanTempFiles(); + } + + @Test + public void testProcessBatchFileArgs() { + Launcher launcher = new Launcher(); + assertEquals(Arrays.asList(), + launcher.processBatchFileArgs(makeList())); + assertEquals(Arrays.asList("defaultServer"), + launcher.processBatchFileArgs(makeList("defaultServer"))); + assertEquals(Arrays.asList("--batch-file"), + launcher.processBatchFileArgs(makeList("--batch-file"))); + assertEquals(Arrays.asList("--batch-file=--stop"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop"))); + + assertEquals(Arrays.asList("defaultServer"), + launcher.processBatchFileArgs(makeList("--batch-file", "run"))); + assertEquals(Arrays.asList("defaultServer"), + launcher.processBatchFileArgs(makeList("--batch-file", "run", "defaultServer"))); + assertEquals(Arrays.asList("myServer"), + launcher.processBatchFileArgs(makeList("--batch-file", "run", "myServer"))); + assertEquals(Arrays.asList("defaultServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file", "run", "--option"))); + assertEquals(Arrays.asList("defaultServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file", "run", "defaultServer", "--option"))); + assertEquals(Arrays.asList("myServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file", "run", "myServer", "--option"))); + + assertEquals(Arrays.asList("--stop"), + launcher.processBatchFileArgs(makeList("--stop"))); + assertEquals(Arrays.asList("--stop", "defaultServer"), + launcher.processBatchFileArgs(makeList("--stop", "defaultServer"))); + assertEquals(Arrays.asList("--stop", "myServer"), + launcher.processBatchFileArgs(makeList("--stop", "myServer"))); + assertEquals(Arrays.asList("--stop", "--option"), + launcher.processBatchFileArgs(makeList("--stop", "--option"))); + assertEquals(Arrays.asList("--stop", "defaultServer", "--option"), + launcher.processBatchFileArgs(makeList("--stop", "defaultServer", "--option"))); + assertEquals(Arrays.asList("--stop", "myServer", "--option"), + launcher.processBatchFileArgs(makeList("--stop", "myServer", "--option"))); + + assertEquals(Arrays.asList("--stop", "defaultServer"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop"))); + assertEquals(Arrays.asList("--stop", "defaultServer"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop", "defaultServer"))); + assertEquals(Arrays.asList("--stop", "myServer"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop", "myServer"))); + assertEquals(Arrays.asList("--stop", "defaultServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop", "--option"))); + assertEquals(Arrays.asList("--stop", "defaultServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop", "defaultServer", "--option"))); + assertEquals(Arrays.asList("--stop", "myServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop", "myServer", "--option"))); + } + + /** + * Make sure the command line --clean will override the system property + * value for clean + */ + @Test + public void testParameterClean() { + String[] args = new String[] { "--clean" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + + System.setProperty(BootstrapConstants.INITPROP_OSGI_CLEAN, "none"); + + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("InitProps should contain the value to enable a clean start", + BootstrapConstants.OSGI_CLEAN_VALUE, initProps.get(BootstrapConstants.INITPROP_OSGI_CLEAN)); + assertNull("The system property value should be removed, as overridden by command line", + System.getProperty(BootstrapConstants.OSGI_CLEAN_VALUE)); + assertEquals("VerifyServer should be CREATE_DEFAULT for default start action", + VerifyServer.CREATE_DEFAULT, rc.getVerifyServer()); + } + + /** + * Make sure the command line --autoAcceptSigner will override the system property + * value for SSL auto-accept-signer-certificate. + */ + @Test + public void testParameterAutoAcceptSigner() { + String[] args = new String[] { "--autoAcceptSigner" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + + System.setProperty(BootstrapConstants.AUTO_ACCEPT_SIGNER, "false"); + + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps, true); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("InitProps should contain the value to enable a clean start", + "true", initProps.get(BootstrapConstants.AUTO_ACCEPT_SIGNER)); + assertEquals("VerifyServer should be CREATE_DEFAULT for default start action", + VerifyServer.CREATE_DEFAULT, rc.getVerifyServer()); + } + + @Test + public void testParameterEmpty() { + String[] args = new String[] {}; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be CREATE_DEFAULT for default start action", + VerifyServer.CREATE_DEFAULT, rc.getVerifyServer()); + + assertEquals("We should be ok!", ReturnCode.OK, rc); + } + + /** + */ + @Test + public void testParameterCreate() { + String[] args = new String[] { "--create" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be CREATE for create action", + VerifyServer.CREATE, rc.getVerifyServer()); + assertEquals("We should be set for a create operation", ReturnCode.CREATE_ACTION, rc); + } + + /** + */ + @Test + public void testParameterStop() { + String[] args = new String[] { "--stop" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be EXISTS for stop action", + VerifyServer.EXISTS, rc.getVerifyServer()); + + assertSame("Stop command should return stop action return code", ReturnCode.STOP_ACTION, rc); + } + + /** + */ + @Test + public void testParameterStatus() { + String[] args = new String[] { "--status" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be EXISTS for status action", + VerifyServer.EXISTS, rc.getVerifyServer()); + + assertSame("status command should return status action return code", ReturnCode.STATUS_ACTION, rc); + } + + /** + */ + @Test + public void testParameterStatusStart() { + String[] args = new String[] { "--status:start" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be SKIP for status:start action", + VerifyServer.SKIP, rc.getVerifyServer()); + + assertSame("status:start command should return start status action return code", ReturnCode.START_STATUS_ACTION, rc); + } + + /** + */ + @Test + public void testParameterServerName() { + String[] args = new String[] { "name1", "name2" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + + assertSame("status should be ok after double name", ReturnCode.OK, launchArgs.getRc()); + assertTrue("should see a warning about second name", outputMgr.checkForStandardOut("CWWKE0027W")); + } + + @Test + public void testParameterVersion() { + String[] args = new String[] { "--version" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be SKIP for version action", + VerifyServer.SKIP, rc.getVerifyServer()); + + assertEquals("ReturnCode should select version action", ReturnCode.VERSION_ACTION, rc); + } + + @Test + public void testParameterHelp() { + String[] args = new String[] { "--help" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be SKIP for help action", + VerifyServer.SKIP, rc.getVerifyServer()); + + assertEquals("ReturnCode should select help action", ReturnCode.HELP_ACTION, rc); + } + + @Test + public void testParameterHelpArgs() { + String[] args = new String[] { "--script=bin/server", "--help" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + + assertEquals("ReturnCode should select help action", ReturnCode.HELP_ACTION, launchArgs.getRc()); + assertEquals("original argument should be present as an option", "--help", launchArgs.getOption("arg")); + assertEquals("script should be set as an option", "bin/server", launchArgs.getOption("script")); + + args = new String[] { "--help:usage" }; + cmdArgs = new ArrayList(Arrays.asList(args)); + launchArgs = new LaunchArguments(cmdArgs, initProps); + + assertEquals("ReturnCode should select help action", ReturnCode.HELP_ACTION, launchArgs.getRc()); + assertEquals("original argument should be present as an option", "--help:usage", launchArgs.getOption("arg")); + assertNull("script should not be set as an option", launchArgs.getOption("script")); + } + + /** + */ + @Test + public void testParameterUnknownBad() { + String args[] = new String[] { "--garbage" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + + assertSame("status should be BAD_ARGUMENT after garbage argument", ReturnCode.BAD_ARGUMENT, launchArgs.getRc()); + assertTrue("should see a error about bad argument", outputMgr.checkForStandardOut("CWWKE0013E")); + } + + @Test + public void testParameterUnknownSingleDash() { + String args[] = new String[] { "-garbage" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + + assertSame("status should be BAD_ARGUMENT after garbage argument", ReturnCode.BAD_ARGUMENT, launchArgs.getRc()); + assertTrue("should see a error about bad argument", outputMgr.checkForStandardOut("CWWKE0013E")); + } + + private List makeList(String... args) { + return new ArrayList(Arrays.asList(args)); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LauncherTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LauncherTest.java new file mode 100755 index 000000000000..20ec2b8c602e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LauncherTest.java @@ -0,0 +1,205 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2009, 2013 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.PrintStream; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import com.ibm.ws.kernel.boot.internal.BootstrapConstants; +import com.ibm.ws.kernel.boot.internal.FileUtils; + +import test.common.SharedOutputManager; +import test.shared.Constants; +import test.shared.TestUtils; + +public class LauncherTest { + static final File defaultServer = new File(Constants.TEST_TMP_ROOT, "usr/servers/defaultServer"); + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() { + TestUtils.cleanTempFiles(); + } + + @AfterClass + public static void tearDownAfterClass() { + TestUtils.cleanTempFiles(); + } + + TestLauncher tlauncher = new TestLauncher(); + BootstrapConfig config = new BootstrapConfig(); + + // Grab streams set by SharedOutputManager + PrintStream outputMgrOut; + PrintStream outputMgrErr; + + @Before + public void setUp() { + outputMgr.resetStreams(); + Set keys = System.getProperties().stringPropertyNames(); + for (String key : keys) { + // Restrict the system properties we pick up and pass to the + // framework for launch + if (key.contains("osgi") || key.contains("was") || key.contains("equinox")) + System.clearProperty(key); + } + + outputMgrOut = System.out; + outputMgrErr = System.err; + + // Create server/workarea directories... + defaultServer.mkdir(); + } + + @After + public void tearDown() { + tlauncher.fakeEnv.clear(); + FileUtils.recursiveClean(defaultServer); + } + + @Test + public void testHardCodedMainClass() throws Exception { + File bootJar = TestUtils.findBuiltKernelBundle(); + URLClassLoader loader = new URLClassLoader(new URL[] { bootJar.toURI().toURL() }, null); + // Our main class is not API/SPI, but we do hard code it in several + // places, so we use this test to ensure they're all updated. + // - /com.ibm.ws.kernel.boot/build.xml + // - wlp/bin/tools/ws-server.jar!/META-INF/MANIFEST.MF Main-Class + // - wlp/lib/ws-launch.jar!/META-INF/MANIFEST.MF Main-Class + // - /com.ibm.zos.native/server_launcher.c + // - CMVC NATV/ws/code/os400.native/src/script/qwlpstrsvr.cpp + loader.loadClass("com.ibm.ws.kernel.boot.cmdline.EnvCheck"); + } + + @Test + public void testParameterVersion() throws Exception { + String[] args = new String[] { "--version" }; + + // This needs to crack open a manifest for a jar, so feed it a jar... + TestUtils.setKernelUtilsBootstrapJar(TestUtils.findBuiltKernelBundle()); + TestUtils.setKernelUtilsBootstrapLibDir(Constants.TEST_DIST_DIR_FILE); + TestUtils.setUtilsInstallDir(Constants.TEST_DATA_FILE); + + try { + int rc = tlauncher.createPlatform(args); + assertEquals(ReturnCode.OK.val, rc); + assertTrue(outputMgr.checkForStandardOut("WebSphere Application Server")); // config-root + // message + } finally { + TestUtils.setKernelUtilsBootstrapJar(null); + TestUtils.setKernelUtilsBootstrapLibDir(null); + TestUtils.setUtilsInstallDir(null); + } + } + + @Test + public void testParameterHelp() { + String[] args = new String[] { "--help" }; + + int rc = tlauncher.createPlatform(args); + assertEquals(ReturnCode.OK.val, rc); + assertTrue("ws-server.jar should be displayed for java -jar help", outputMgr.checkForStandardOut("ws-server.jar")); + + // More detailed testing of help is done in LauncherVerificationTest BVT + // because script vs. not-script is determined by an env variable.. + } + + /** + */ + @Test + public void testParameterUnknownBad() { + String args[] = new String[] { "--garbage" }; + + int rc = tlauncher.createPlatform(args); + assertTrue(outputMgr.checkForStandardOut("CWWKE0013E")); + assertEquals(ReturnCode.BAD_ARGUMENT.val, rc); + } + + /** + * When launched with --version, we still read the initial configuration + * and environment variables: use that to verify that we *are* reading + * the environment variables so we don't have to deal with launchPlatform. + */ + @Test + public void testFindLocationsEnv() { + final String m = "testFindLocationsEnv"; + + try { + File log_dir = TestUtils.createTempDirectory("log_dir"); + File x_log_dir = TestUtils.createTempDirectory("x_log_dir"); + BootstrapConfig bootProps = new BootstrapConfig(); + + // add a fake environment variable for the private/calculated temp dir X_LOG_DIR + tlauncher.fakeEnv.put(BootstrapConstants.ENV_X_LOG_DIR, x_log_dir.getCanonicalPath()); + + tlauncher.findLocations(bootProps, "defaultServer"); + assertEquals("The logDirectory value should be value of X_LOG_DIR", + x_log_dir.getCanonicalPath(), + bootProps.getLogDirectory().getCanonicalPath()); + + // add a fake environment variable for the LOG_DIR. This value should be ignored because X_LOG_DIR exists. + tlauncher.fakeEnv.put(BootstrapConstants.ENV_LOG_DIR, log_dir.getCanonicalPath()); + tlauncher.findLocations(bootProps, "defaultServer"); + assertEquals("The logDirectory value should be value of X_LOG_DIR", + x_log_dir.getCanonicalPath(), + bootProps.getLogDirectory().getCanonicalPath()); + + // clear out the value of X_LOG_DIR. Now the logDirectory should use LOG_DIR + tlauncher.fakeEnv.remove(BootstrapConstants.ENV_X_LOG_DIR); + tlauncher.findLocations(bootProps, "defaultServer"); + assertEquals("The logDirectory value should be value of LOG_DIR", + log_dir.getCanonicalPath(), + bootProps.getLogDirectory().getCanonicalPath()); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + TestUtils.cleanTempFiles(); + } + } + + /** + * Simple extension of the launcher for toggling of the behavior of some + * protected/internal methods in order to control code coverage in the + * parent. + */ + class TestLauncher extends Launcher { + int exceptionType = 0; + boolean superGetDefs = false; + int fakeJar = 0; + + final Map fakeEnv = new HashMap(); + + @Override + protected String getEnv(String key) { + return fakeEnv.get(key); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/SharedBootstrapConfig.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/SharedBootstrapConfig.java new file mode 100755 index 000000000000..1d506cdd7f21 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/SharedBootstrapConfig.java @@ -0,0 +1,72 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import com.ibm.ws.kernel.boot.internal.FileUtils; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +public class SharedBootstrapConfig extends BootstrapConfig { + + public static SharedBootstrapConfig createSharedConfig(SharedOutputManager outputMgr) { + try { + return new SharedBootstrapConfig(); + } catch (IOException e) { + outputMgr.failWithThrowable("createSharedConfig", e); + // unreachable: make compiler happy + throw new RuntimeException(e); + } + } + + public static SharedBootstrapConfig createSharedConfig(SharedOutputManager outputMgr, String serverName) { + try { + return new SharedBootstrapConfig(serverName); + } catch (IOException e) { + outputMgr.failWithThrowable("createSharedConfig", e); + // unreachable: make compiler happy + throw new RuntimeException(e); + } + } + + private SharedBootstrapConfig(String serverName) throws IOException { + this.processName = serverName; + + File root = TestUtils.createTempDirectory(serverName); + if (root == null || !root.exists()) + throw new IllegalArgumentException("root directory does not exist"); + + final String rootDirStr = root.getAbsolutePath(); + + HashMap map = new HashMap(); + + this.findLocations(serverName, rootDirStr, null, null, null); + this.configure(map); + } + + private SharedBootstrapConfig() throws IOException { + this("defaultServer"); + } + + public void setInitProps(Map initProps) { + this.initProps = initProps; + } + + public void cleanServerDir() { + FileUtils.recursiveClean(getConfigFile(null)); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/BootstrapManifestTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/BootstrapManifestTest.java new file mode 100755 index 000000000000..bce5e3c9d856 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/BootstrapManifestTest.java @@ -0,0 +1,291 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FilenameFilter; +import java.util.HashMap; +import java.util.Map; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; +import test.shared.Constants; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.BootstrapConfig; +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; + +/** + * + */ +public class BootstrapManifestTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestName testName = new TestName(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + TestUtils.cleanTempFiles(); + TestUtils.setKernelUtilsBootstrapJar(null); // make sure jar is clear + } + + @AfterClass + public static void tearDownAfterClass() { + TestUtils.cleanTempFiles(); + } + + @After + public void tearDown() throws Exception { + // reset the bootstrap jar... + TestUtils.setKernelUtilsBootstrapJar(null); // make sure jar is clear + } + + @Test + public void testGetDefaults() throws Exception { + BootstrapConfig config = new BootstrapConfig(); + + setBootstrapJar(0); // use a real built jar + BootstrapManifest m = new BootstrapManifest(); + assertNotNull("Bundle version should be set for the kernel.boot jar/bundle", m.getBundleVersion()); + assertEquals("Kernel definition should be set to the name of the default", "kernelCore-1.0", m.getKernelDefinition(config)); + assertEquals("Log provider definition should be set to the name of the default", "defaultLogging-1.0", m.getLogProviderDefinition(config)); + } + + @Test + public void testMissingKernelDefinition() throws Exception { + BootstrapConfig config = new BootstrapConfig(); + + setBootstrapJar(1); // use a jar with a missing kernel definition + BootstrapManifest m = new BootstrapManifest(); + assertNull("No value should have been found for kernel version", m.getKernelDefinition(config)); // this will throw + assertNull("No value should have been found for log provider", m.getLogProviderDefinition(config)); + } + + @Test + public void testMissingAttributesWithProperties() throws Exception { + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + + setBootstrapJar(1); // use a jar with a missing kernel definition and log provider + + String kernelDef = "kernel_1.x"; + String operatingSystemExtensionsDef = "extension_1.x"; + String logProviderDef = "logging_1.x"; + + Map initProps = new HashMap(); + initProps.put(BootstrapManifest.BOOTPROP_KERNEL, kernelDef); + initProps.put(BootstrapManifest.BOOTPROP_OS_EXTENSIONS, operatingSystemExtensionsDef); + initProps.put(BootstrapManifest.BOOTPROP_LOG_PROVIDER, logProviderDef); + config.setInitProps(initProps); + + BootstrapManifest m = new BootstrapManifest(); + assertEquals("Property was set: Kernel definition should equal provided property value", + kernelDef, m.getKernelDefinition(config)); + assertEquals("Property was set: OS extensions definition should equal provided property value", + operatingSystemExtensionsDef, m.getOSExtensionDefinition(config)); + assertEquals("Property was set: Log provider definition should equal provided property value", + logProviderDef, m.getLogProviderDefinition(config)); + } + + @Test(expected = com.ibm.ws.kernel.boot.LaunchException.class) + public void testMissingSystemPackagesList() throws Exception { + BootstrapConfig config = new BootstrapConfig(); + + // WebSphere-SystemPackages in MANIFEST.MF, points to file not present in bundle/jar + setBootstrapJar(3); + BootstrapManifest m = new BootstrapManifest(); + m.prepSystemPackages(config); + } + + @Test + public void testSystemPackages() throws Exception { + Map initProps = new HashMap(); + + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + config.setInitProps(initProps); + + setBootstrapJar(1); // use a jar with system packages + BootstrapManifest m = new BootstrapManifest(); + m.prepSystemPackages(config); + //the system packages are obtained from a java.version file name + assertNull(initProps.get(BootstrapConstants.INITPROP_OSGI_EXTRA_PACKAGE)); + assertNotNull(initProps.get(BootstrapConstants.INITPROP_OSGI_SYSTEM_PACKAGES)); + } + + @Test + public void testSystemPackagesExtraFromExportPackage() throws Exception { + Map initProps = new HashMap(); + + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + config.setInitProps(initProps); + + // Export-Package in MANIFEST.MF + setBootstrapJar(2); + BootstrapManifest m = new BootstrapManifest(); + m.prepSystemPackages(config); + assertNotNull(initProps.get(BootstrapConstants.INITPROP_OSGI_EXTRA_PACKAGE)); + //system-packages are not null because we included mocked up properties files + assertNotNull(initProps.get(BootstrapConstants.INITPROP_OSGI_SYSTEM_PACKAGES)); + } + + @Test + public void testSystemPackagesJavaVersion() throws Exception { + Map initProps = new HashMap(); + + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + config.setInitProps(initProps); + + setBootstrapJar(5); // use a jar with fake system packages that have version numbers + BootstrapManifest m = new BootstrapManifest(); + m.prepSystemPackages(config); + String sysPkgs = initProps.get(BootstrapConstants.INITPROP_OSGI_SYSTEM_PACKAGES); + + String javaVersion = System.getProperty("java.version"); + // strip off the update modifier + int index = javaVersion.indexOf('_'); + index = (index == -1) ? javaVersion.indexOf('-') : index; + javaVersion = (index == -1) ? javaVersion : javaVersion.substring(0, index); + //validate the system packages obtained match the running java.version file name + assertTrue("The system packages being used do not match the running java.version: " + + javaVersion + + " . This is normal if you are running the test on a version of Java that we support for running the server, but do not fully support. If we are intending to fully support a new Java version then new files are required in /com.ibm.ws.kernel.boot/resources/OSGI-OPT/websphere/system-packages_*.properties for production and /com.ibm.ws.kernel.boot_test/resources/system-packages_*.properties for test.", + sysPkgs.contains(javaVersion)); + + String versionsToCheck = null; + if (javaVersion.equals("1.6.0")) { + versionsToCheck = "1.6.0"; + } else if (javaVersion.equals("1.7.0")) { + versionsToCheck = "1.7.0,1.6.0"; + } else if (javaVersion.equals("1.8.0")) { + versionsToCheck = "1.8.0,1.7.0,1.6.0"; + } else { + fail("The running java version: " + javaVersion + " is newer than we have properties files for, system-packages udpates are required"); + } + + //validate that merging works and we have the older versions too + assertEquals("The system-packages_*.properties files were not merged for multiple java versions.", versionsToCheck, + sysPkgs); + } + + @Test + public void testSystemPackagesFileWrongProperty() throws Exception { + Map initProps = new HashMap(); + + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + config.setInitProps(initProps); + + setBootstrapJar(4); + BootstrapManifest m = new BootstrapManifest(); + m.prepSystemPackages(config); + assertNull(initProps.get(BootstrapConstants.INITPROP_OSGI_EXTRA_PACKAGE)); + assertNull(initProps.get(BootstrapConstants.INITPROP_OSGI_SYSTEM_PACKAGES)); + } + + @Test + public void testGetNormalizedOperatingSystemName() throws Exception { + Map names = new HashMap(); + names.put("AIX", "aix"); + names.put("Digital Unix", "digitalunix"); + names.put("FreeBSD", "freebsd"); + names.put("HP UX", "hpux"); + names.put("Irix", "irix"); + names.put("Linux", "linux"); + names.put("Mac OS", "macos"); + names.put("Mac OS X", "macosx"); + names.put("MPE/iX", "mpeix"); + names.put("Netware 4.11", "netware411"); + names.put("OS/2", "os2"); + names.put("OS/390", "os390"); + names.put("Solaris", "solaris"); + names.put("Windows 2000", "windows2000"); + names.put("Windows 7", "windows7"); + names.put("Windows 8", "windows8"); + names.put("Windows 95", "windows95"); + names.put("Windows 98", "windows98"); + names.put("Windows NT", "windowsnt"); + names.put("Windows NT (unknown)", "windowsntunknown"); + names.put("Windows Server 2012", "windowsserver2012"); + names.put("Windows Vista", "windowsvista"); + names.put("Windows XP", "windowsxp"); + names.put("z/OS", "zos"); + + for (String osName : names.keySet()) { + assertEquals(names.get(osName), BootstrapManifest.getNormalizedOperatingSystemName(osName)); + } + } + + protected static void setBootstrapJar(int jarTestCase) throws Exception { + File root = new File(Constants.TEST_DIST_DIR); + final String filterExpr; + + switch (jarTestCase) { + default: + case 0: + filterExpr = "com.ibm.ws.kernel.boot.*\\.jar"; + root = new File(Constants.BOOTSTRAP_LIB_DIR); + break; + case 1: + // Manifest does not contain default kernel definition / log provider + filterExpr = "simple_1\\.0\\.jar"; + break; + case 2: // Fake jar with manifest that does not contain + // framework/kernel + // definitions + filterExpr = "simple_2\\.0\\.jar"; + break; + case 3: + // Manifest references a system package list that doesn't exist + filterExpr = "simple_3\\.0\\.jar"; + break; + case 4: + // the system packages file exists, but contains + // invalid properties + filterExpr = "simple_4\\.0\\.jar"; + break; + case 5: + // the system packages file exists, but contains + // invalid properties + filterExpr = "simple_5\\.0\\.jar"; + break; + } + + File fileList[] = root.listFiles(new FilenameFilter() + { + @Override + public boolean accept(File dir, String name) + { + return name.matches(filterExpr); + } + }); + + if (fileList == null || fileList.length < 1) + throw new RuntimeException("Unable to find " + filterExpr + " in " + root.getName()); + + TestUtils.setKernelUtilsBootstrapJar(fileList[0]); // set for the test case + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FileUtilsTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FileUtilsTest.java new file mode 100755 index 000000000000..066da6d25bb1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FileUtilsTest.java @@ -0,0 +1,260 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; +import test.shared.Constants; +import test.shared.TestUtils; + +public class FileUtilsTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestName testName = new TestName(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() { + TestUtils.cleanTempFiles(); + } + + @AfterClass + public static void tearDownAfterClass() { + TestUtils.cleanTempFiles(); + } + + @Test + public void testNormalizePathDrive() { + Assume.assumeTrue(File.separatorChar == '\\'); + Assert.assertEquals("", FileUtils.normalizePathDrive("")); + Assert.assertEquals("c", FileUtils.normalizePathDrive("c")); + Assert.assertEquals("C", FileUtils.normalizePathDrive("C")); + Assert.assertEquals("C:", FileUtils.normalizePathDrive("c:")); + Assert.assertEquals("C:", FileUtils.normalizePathDrive("C:")); + Assert.assertEquals("C:\\", FileUtils.normalizePathDrive("c:\\")); + Assert.assertEquals("C:\\", FileUtils.normalizePathDrive("C:\\")); + } + + @Test + public void testGetFile() throws MalformedURLException { + final String m = "testGetFile"; + + URL url; + File result; + String expected; + + try { + // The following strings were printed out from getBootstrapJar + // during debugging... Need to make sure all end up legible... + // (i.e. these strings construct equivalent URLs to what is returned + // from Utils.class.getProtectionDomain().getCodeSource().getLocation()) + + // UNC path with a space. + // The URL for a UNC path is file:////server/path, but the + // deprecated File.toURL() as used by java -jar/-cp incorrectly + // returns file://server/path/, which has an invalid authority + // component. + url = new URL("file://HOST/with%20space/lib/com.ibm.alpine_1.0.jar"); + expected = "//HOST/with space/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // UNC path without a space. + // The URL for a UNC path is file:////server/path, but the + // deprecated File.toURL() as used by java -jar/-cp incorrectly + // returns file://server/path/, which has an invalid authority + // component. + url = new URL("file://HOST/nospace/lib/com.ibm.alpine_1.0.jar"); + expected = "//HOST/nospace/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // Windows path with space + url = new URL("file:/C:/with%20space/lib/com.ibm.alpine_1.0.jar"); + expected = "/C:/with space/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // Windows path without space + url = new URL("file:/C:/nospace/lib/com.ibm.alpine_1.0.jar"); + expected = "/C:/nospace/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // Windows path with a literal + + url = new URL("file:/C:/with+plus/lib/com.ibm.alpine_1.0.jar"); + expected = "/C:/with+plus/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // *nix path with space + url = new URL("file:/with%20space/lib/com.ibm.alpine_1.0.jar"); + expected = "/with space/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // *nix path without space + url = new URL("file:/nospace/lib/com.ibm.alpine_1.0.jar"); + expected = "/nospace/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // *nix path with a literal + + url = new URL("file:/with+plus/lib/com.ibm.alpine_1.0.jar"); + expected = "/with+plus/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + outputMgr.restoreStreams(); + } + } + + private void testResult(URL url, String expected, File resultFile) { + File expectedFile = new File(expected); + + System.out.println("--- URL: " + url.toString()); + System.out.println(" expected:\t" + expectedFile); + System.out.println(" result:\t" + resultFile); + + assertEquals(url.toString() + " not converted to path as expected ", expectedFile, resultFile); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.internal.KernelUtils.Utils#recursiveClean(java.io.File)} . + * + * @throws IOException + */ + @Test + public void testRecursiveClean() throws IOException { + + // These shouldn't blow up + FileUtils.recursiveClean(null); + FileUtils.recursiveClean(new File("notexist")); + + // Test recursive clean + File file1, dir2, file3, dir4, file5; + String prefix = "FileTestTmp"; + + file1 = TestUtils.createTempFile(prefix, ".tmp"); + file1.deleteOnExit(); + + dir2 = new File(file1.getParentFile(), prefix); + dir2.mkdirs(); + dir2.deleteOnExit(); + + file3 = TestUtils.createTempFile(prefix, ".tmp", dir2); + + dir4 = new File(dir2, prefix); + dir4.mkdirs(); + dir4.deleteOnExit(); + + file5 = TestUtils.createTempFile(prefix, ".tmp", dir4); + + assertTrue(file1.exists()); + assertTrue(dir2.exists()); + assertTrue(file3.exists()); + assertTrue(file3.getParent().equals(dir2.getPath())); + assertTrue(dir4.exists()); + assertTrue(file5.exists()); + assertTrue(file5.getParent().equals(dir4.getPath())); + + FileUtils.recursiveClean(file1); + assertFalse("File1 should not exist (deleted)", file1.exists()); + assertTrue("Dir2 should exist (untouched)", dir2.exists()); + assertTrue("File3 should exist (untouched)", file3.exists()); + assertTrue("Dir4 should exist (untouched)", dir4.exists()); + assertTrue("File5 should exist (untouched)", file5.exists()); + + FileUtils.recursiveClean(dir2); + assertFalse("Dir2 should not exist (deleted)", dir2.exists()); + assertFalse("File3 should not exist(deleted recursively)", file3.exists()); + assertFalse("Dir4 should exist (deleted)", dir4.exists()); + assertFalse("File5 should exist (deleted)", file5.exists()); + } + + /** + * Test that recursiveClean doesn't blow up with an NPE when a directory can't be read + * + * @throws IOException + */ + @Test + public void testRecursiveCleanNoReadPerms() throws IOException { + File file1, dir2 = null; + try { + // These shouldn't blow up + FileUtils.recursiveClean(null); + FileUtils.recursiveClean(new File("notexist")); + + // Test recursive clean + + String prefix = "FileTestTmp"; + + dir2 = new File(Constants.TEST_TMP_ROOT_FILE, prefix); + dir2.mkdirs(); + dir2.deleteOnExit(); + if (!dir2.setReadable(false)) { + // Platform doesn't support setting readable to false, just return + return; + } + if ("root".equals(System.getProperty("user.name"))) { + // The super-user can't set a file not readable to itself, so just return + return; + } + + file1 = TestUtils.createTempFile(prefix, ".tmp", dir2); + file1.deleteOnExit(); + + assertTrue(file1.exists()); + assertTrue(dir2.exists()); + + boolean cleaned = FileUtils.recursiveClean(dir2); + assertFalse("recursiveClean should report failure", cleaned); + assertTrue("Dir2 should exist (not deleted)", dir2.exists()); + assertTrue("File1 should exist (not deleted)", file1.exists()); + + assertTrue(dir2.setReadable(true)); + assertTrue(dir2.setWritable(true)); + cleaned = FileUtils.recursiveClean(dir2); + assertTrue("recursiveClean should succeed", cleaned); + assertFalse("Dir2 should not exist (deleted)", dir2.exists()); + assertFalse("File1 should not exist (deleted)", file1.exists()); + } finally { + if (dir2 != null) { + dir2.setReadable(true); + dir2.setWritable(true); + } + } + + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FrameworkManagerTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FrameworkManagerTest.java new file mode 100755 index 000000000000..5142481538b9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FrameworkManagerTest.java @@ -0,0 +1,280 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import java.io.File; +import java.lang.reflect.Field; +import java.util.Collections; +import java.util.HashMap; +import java.util.concurrent.CountDownLatch; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.launch.Framework; + +import com.ibm.ws.kernel.boot.BootstrapConfig; +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; +import com.ibm.ws.kernel.boot.cmdline.Utils; +import com.ibm.ws.kernel.launch.internal.FrameworkManager; +import com.ibm.ws.kernel.launch.service.FrameworkReady; + +import junit.framework.Assert; +import test.common.SharedOutputManager; + +public class FrameworkManagerTest { + @Rule + public final TimeoutRule rule = new TimeoutRule(); + + @Rule + public final SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + private final Mockery mockery = new Mockery(); + Framework framework = mockery.mock(Framework.class); + BundleContext systemBundleContext = mockery.mock(BundleContext.class); + + boolean frameworkStarted; + boolean frameworkStopped; + private Thread launchFrameworkThread; + private Throwable launchFrameworkThrowable; + private File installDirBefore; + + @Before + public void before() throws Exception { + mockery.checking(new Expectations() { + { + allowing(framework).getBundleContext(); + will(returnValue(systemBundleContext)); + allowing(framework).getState(); + will(returnValue(Bundle.ACTIVE)); + + } + }); + + Field f = Utils.class.getDeclaredField("installDir"); + f.setAccessible(true); + installDirBefore = (File) f.get(null); + f.set(null, new File("unittest", "test data")); + } + + @After + public void after() throws Exception { + Field f = Utils.class.getDeclaredField("installDir"); + f.setAccessible(true); + f.set(null, installDirBefore); + + // Previous these tests were using @RunWith(JMock) to check expectations. I switched to asserting + // expectations here because the TimeoutRule will not be called when using @RunWith(JMock) + mockery.assertIsSatisfied(); + } + + private void setupFrameworkReadyServices() throws Exception { + mockery.checking(new Expectations() { + { + allowing(systemBundleContext).getServiceReferences(FrameworkReady.class, null); + will(returnValue(Collections.emptyList())); + } + }); + } + + private void launchFramework(FrameworkManager fm) { + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + config.setInitProps(new HashMap()); + fm.launchFramework(config, null); + } + + private void startLaunchFrameworkThread(final FrameworkManager fm) { + launchFrameworkThread = new Thread() { + @Override + public void run() { + try { + launchFramework(fm); + } catch (Throwable t) { + launchFrameworkThrowable = t; + } + } + }; + launchFrameworkThread.start(); + } + + private void joinLaunchFrameworkThread() throws InterruptedException { + launchFrameworkThread.join(); + if (launchFrameworkThrowable != null) { + throw new RuntimeException(launchFrameworkThrowable); + } + } + + @Test + public void testLaunchAndShutdown() throws Throwable { + setupFrameworkReadyServices(); + TestFrameworkManager fm = new TestFrameworkManager(); + + startLaunchFrameworkThread(fm); + fm.waitForReady(); + Assert.assertTrue(frameworkStarted); + + fm.shutdownFramework(); + fm.waitForShutdown(); + Assert.assertTrue(frameworkStopped); + + joinLaunchFrameworkThread(); + } + + @Test + public void testFrameworkReadyService() throws Exception { + mockery.checking(new Expectations() { + { + ServiceReference reference = mockery.mock(ServiceReference.class); + allowing(systemBundleContext).getServiceReferences(with(FrameworkReady.class), with((String) null)); + will(returnValue(Collections.singletonList(reference))); + + FrameworkReady frameworkReady = mockery.mock(FrameworkReady.class); + allowing(systemBundleContext).getService(reference); + will(returnValue(frameworkReady)); + + one(frameworkReady).waitForFrameworkReady(); + } + }); + + TestFrameworkManager fm = new TestFrameworkManager(); + + startLaunchFrameworkThread(fm); + Assert.assertTrue(fm.waitForReady()); + + fm.shutdownFramework(); + fm.waitForShutdown(); + + joinLaunchFrameworkThread(); + } + + @Test + public void testStartFrameworkException() throws Throwable { + TestFrameworkManager fm = new TestFrameworkManager() { + @Override + protected Framework startFramework(BootstrapConfig config) { + throw new TestException(); + } + }; + + try { + launchFramework(fm); + Assert.fail("expected TestException"); + } catch (TestException e) { + } + + Assert.assertFalse(fm.waitForReady()); + Assert.assertFalse(frameworkStarted); + + fm.waitForShutdown(); + Assert.assertFalse(frameworkStopped); + } + + @Test + public void testInnerLaunchFrameworkException() throws Throwable { + setupFrameworkReadyServices(); + + TestFrameworkManager fm = new TestFrameworkManager() { + @Override + protected void innerLaunchFramework(boolean isClient) { + throw new TestException(); + } + }; + + try { + launchFramework(fm); + Assert.fail("expected TestException"); + } catch (TestException e) { + } + + Assert.assertFalse(fm.waitForReady()); + Assert.assertTrue(frameworkStarted); + + fm.waitForShutdown(); + Assert.assertTrue(frameworkStopped); + } + + // Timing out here rather than in the ant script so that we can generate a core using TimeoutRule when + // this hangs. Five minutes is probably excessive, but it's still less than the ant timeout. + // This is here to debug Java Defect 126649 -- once we get a core from that, we can remove this. + @Test(timeout = 300000) + public void testShutdownHook() throws Throwable { + setupFrameworkReadyServices(); + TestFrameworkManager fm = new TestFrameworkManager(); + + startLaunchFrameworkThread(fm); + Assert.assertTrue(fm.waitForReady()); + Assert.assertTrue(frameworkStarted); + + fm.runShutdownHook(); + + fm.waitForShutdown(); + Assert.assertTrue(frameworkStopped); + + joinLaunchFrameworkThread(); + } + + @SuppressWarnings("serial") + private static class TestException extends RuntimeException {} + + private class TestFrameworkManager extends FrameworkManager { + private final CountDownLatch frameworkStoppedLatch = new CountDownLatch(1); + + void runShutdownHook() { + shutdownHook.run(); + } + + @Override + protected Framework startFramework(BootstrapConfig config) throws BundleException { + frameworkStarted = true; + return FrameworkManagerTest.this.framework; + } + + @Override + protected void stopFramework() { + frameworkStopped = true; + frameworkStoppedLatch.countDown(); + } + + @Override + protected void waitForFrameworkStop() { + try { + frameworkStoppedLatch.await(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + + @Override + protected void innerLaunchFramework(boolean isClient) {} + + @Override + protected void startServerCommandListener() {} + + @Override + public boolean waitForReady() throws InterruptedException { + boolean result = super.waitForReady(); + + if (result) { + Assert.assertNotNull(framework); + } + + return result; + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/KernelResolverTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/KernelResolverTest.java new file mode 100755 index 000000000000..9b39491155b8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/KernelResolverTest.java @@ -0,0 +1,168 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import java.io.File; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; +import test.shared.DumpTimerRule; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.LaunchException; +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; + +/** + * + */ +public class KernelResolverTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestName testName = new TestName(); + + @Rule + public TestRule outputRule = outputMgr; + + @Rule + public TestRule dumpTimerRule = new DumpTimerRule(30000, new File("build/unittest")); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + TestUtils.cleanTempFiles(); + TestUtils.setKernelUtilsBootstrapLibDir(new File("unittest/test data/lbr/lib")); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + TestUtils.cleanTempFiles(); + TestUtils.setKernelUtilsBootstrapLibDir(null); + } + + // Shared configuration places the instance directory in the build dir + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr, "kernelResolver"); + File installDir = config.getInstallRoot(); + + @Test + public void testKernelResolverNoIncludesNoExtensions() throws Exception { + + // Read kernelCore and defaultLogging-- null os extensions + // This should be happy/healthy, and should not throw + KernelResolver resolver = new KernelResolver(installDir, null, "kernelCore-1.0", "defaultLogging-1.0", null); + + final List urlList = new ArrayList(4); + + // Add OSGi framework, log provider, and/or os extension "boot.jar" elements + resolver.addBootJars(urlList); + System.out.println(urlList); + + Assert.assertEquals("Should have two jars in the jar list by default", 2, urlList.size()); + Assert.assertTrue("Should have resolved x.y; version=\"[1.0.0,1.0.100)\"; type=\"boot.jar\" to x.y_1.0.jar", listContains(urlList, "x.y_1.0.jar")); + Assert.assertTrue("Should have resolved a.b; version=\"[1,1.0.100)\"; type=\"boot.jar\" to a.b_1.0.1.v2.jar", listContains(urlList, "a.b_1.0.1.v2.jar")); + Assert.assertEquals("Should have read the log provider from defaultLogging-1.0.jar", "com.ibm.ws.logging.internal.impl.LogProviderImpl", resolver.getLogProvider()); + + // There should be a warning issued about ignoring iFix jar a.b_1.0.2.v1.jar + Assert.assertTrue("Should have a warning message about skipping an iFix jar", outputMgr.checkForStandardOut("CWWKE0060W.*a.b_1.0.2.v1.jar")); + } + + @Test + public void testKernelResolverIncludesNoExtensions() throws Exception { + + // Read kernelCore and defaultLogging-- null os extensions + // This should be happy/healthy, and should not throw + KernelResolver resolver = new KernelResolver(installDir, null, "kernelCore-1.0", "binaryLogging-1.0", null); + + final List urlList = new ArrayList(4); + + resolver.addBootJars(urlList); + System.out.println(urlList); + + // Conditions are mostly the same: the binaryLogging mf includes defaultLogging mf, but the log provider class is different + Assert.assertEquals("Should have two jars in the jar list by default", 2, urlList.size()); + Assert.assertTrue("Should have resolved x.y; version=\"[1.0.0,1.0.100)\"; type=\"boot.jar\" to x.y_1.0.jar", listContains(urlList, "x.y_1.0.jar")); + Assert.assertTrue("Should have resolved a.b; version=\"[1,1.0.100)\"; type=\"boot.jar\" to a.b_1.0.1.v2.jar", listContains(urlList, "a.b_1.0.1.v2.jar")); + Assert.assertEquals("Should have read the log provider from defaultLogging-1.0.mf", "com.ibm.ws.logging.internal.hpel.HpelLogProviderImpl", resolver.getLogProvider()); + } + + @Test + public void testKernelResolverExtensions() { + + // Read kernelCore and defaultLogging-- null os extensions + // This should be happy/healthy, and should not throw + KernelResolver resolver = new KernelResolver(installDir, null, "kernelCore-1.0", "emptyLogging-1.0", "extension-1.0"); + + final List urlList = new ArrayList(4); + + resolver.addBootJars(urlList); + System.out.println(urlList); + + // Conditions are mostly the same: emptyLogging has no boot.jars, but extension-1.0 does + Assert.assertEquals("Should have two jars in the jar list by default", 2, urlList.size()); + Assert.assertTrue("Should have resolved x.y; version=\"[1.0.0,1.0.100)\"; type=\"boot.jar\" to x.y_1.0.jar", listContains(urlList, "x.y_1.0.jar")); + Assert.assertTrue("Should have resolved a.b; version=\"[1,1.0.100)\"; type=\"boot.jar\" to a.b_1.0.1.v2.jar", listContains(urlList, "a.b_1.0.1.v2.jar")); + Assert.assertEquals("Should have read the log provider from emptyLogging-1.0.mf", "dummy.LogProvider", resolver.getLogProvider()); + } + + @Test(expected = LaunchException.class) + public void testKernelResolverNullKernel() { + + // Throw: null kernel definition + new KernelResolver(installDir, null, null, null, null); + } + + @Test(expected = LaunchException.class) + public void testKernelResolverMissingKernel() { + + // Throw: null missing kernel definition + new KernelResolver(installDir, null, "bogus-1.0", null, null); + } + + @Test(expected = LaunchException.class) + public void testKernelResolverNullLogProvider() { + + // Throw: null log provider definition + new KernelResolver(installDir, null, "kernelCore-1.0", null, null); + } + + @Test(expected = LaunchException.class) + public void testKernelResolverMissingLogProvider() { + + // Throw: missing log provider definition + new KernelResolver(installDir, null, "kernelCore-1.0", "bogus-1.0", null); + } + + @Test(expected = LaunchException.class) + public void testKernelResolverMissingBundle() { + + // Throw: we couldn't find one of the specified jars + new KernelResolver(installDir, null, "kernelCore-1.0", "missingJar-1.0", null); + } + + boolean listContains(List urlList, String filename) { + for (URL url : urlList) { + if (url.toString().contains(filename)) + return true; + } + return false; + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerLockTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerLockTest.java new file mode 100755 index 000000000000..1c818db48acb --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerLockTest.java @@ -0,0 +1,263 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; + +import java.io.File; +import java.io.FileOutputStream; +import java.nio.channels.FileChannel; +import java.nio.channels.FileLock; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.LaunchException; +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; +import com.ibm.ws.kernel.boot.cmdline.Utils; + +/** + * + */ +public class ServerLockTest { + static SharedOutputManager outputMgr; + static SharedBootstrapConfig config; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + File f = TestUtils.createTempFile("ResourceUtilsTest", "tmp"); + f.delete(); + f.mkdir(); + + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + + // Bootstrap configuration/locations + config = SharedBootstrapConfig.createSharedConfig(outputMgr); + + outputMgr.captureStreams(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + outputMgr.restoreStreams(); + TestUtils.cleanTempFiles(); + } + + @Before + public void setUp() { + TestUtils.cleanTempFiles(); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.internal.KernelUtils#checkServerLock(java.io.File, java.lang.String)} . + * Additional testing of deleting the lock file at server shutdown + */ + @Test + public void testCheckServerLock() { + final String m = "testCheckServerLock"; + + try { + File sLockFile = config.getWorkareaFile(BootstrapConstants.S_LOCK_FILE); + assertTrue("Parent dirs should exist", sLockFile.getParentFile().exists() || sLockFile.getParentFile().mkdirs()); + + ServerLock serverLock = ServerLock.createServerLock(config); + try { + // get lock for testServer1 + serverLock.obtainServerLock(); + assertTrue("Lock file exists after call to obtain", sLockFile.exists()); + } finally { + serverLock.releaseServerLock(); + sLockFile.delete(); + } + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + if (config != null) { + // This method skips/preserves .sLock files + FileUtils.recursiveClean(config.getWorkareaFile(null)); + } + } + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.internal.KernelUtils#checkServerLock(java.io.File, java.lang.String)} . + * Test permissions surrounding get/obtain server lock + */ + @Test + public void testCheckServerLockPermissions() { + final String m = "testCheckServerLockPermissions"; + + try { + File tmpServerDir = config.getConfigFile(null); + File workArea = config.getWorkareaFile(null); + + // Test a write-only server directory + //we use an assume instead of an assert here because the test has no + //meaning and should be ignored if it could not set the directory to + //be unwritable (e.g. on Windows) + assumeTrue(tmpServerDir.setWritable(false, false)); + try { + // only test behavior with read-only directory if we could make the dir read-only: bug 48667 + if (tmpServerDir.canWrite() == false) { + assertFalse("tmpServerDir() should be false after setWritable(false)", tmpServerDir.canWrite()); + ServerLock.createServerLock(config); + throw new Exception("Missed expected launch exception with unwritable server directory"); + } + } catch (LaunchException le) { + // Expected exception + String translatedMsg = le.getTranslatedMessage(); + assertNotNull("Exception should contain translated message", translatedMsg); + assertTrue("Exception should contain console message CWWKE0044E", translatedMsg.contains("CWWKE0044E")); + assertFalse("Server workarea should not have been created", workArea.isDirectory()); + } finally { + tmpServerDir.setWritable(true, false); + } + + assertTrue("couldn't create workarea", workArea.mkdirs()); + + // Make allocated workarea read-only + assertTrue("must be able to make server workarea unwritable", workArea.setWritable(false, false)); + try { + // only test behavior with read-only directory if we could make the dir read-only: bug 48667 + if (workArea.canWrite() == false) { + assertFalse("workArea.canWrite() should be false after setWritable(false)", workArea.canWrite()); + ServerLock.createServerLock(config); + throw new Exception("Missed expected launch exception with read-only workarea"); + } + } catch (LaunchException le) { + // Expected exception + String translatedMsg = le.getTranslatedMessage(); + assertNotNull("Exception should contain translated message", translatedMsg); + assertTrue("Exception should contain console message CWWKE0044E", translatedMsg.contains("CWWKE0044E")); + } finally { + workArea.setWritable(true, false); + } + + // Allocate lock file, make it read-only + File lockFile = new File(workArea, BootstrapConstants.S_LOCK_FILE); + lockFile.createNewFile(); + assertTrue("must be able to make lockfile unwritable", lockFile.setWritable(false, false)); + try { + // only test behavior with read-only directory if we could make the dir read-only: bug 48667 + if (workArea.canWrite() == false) { + assertFalse("lockFile.canWrite() should be false after setWritable(false)", lockFile.canWrite()); + ServerLock.createServerLock(config); + throw new Exception("Missed expected launch exception with unwritable lock file"); + } + } catch (LaunchException le) { + // Expected exception + String translatedMsg = le.getTranslatedMessage(); + assertNotNull("Exception should contain translated message", translatedMsg); + assertTrue("Exception should contain console message CWWKE0044E", translatedMsg.contains("CWWKE0044E")); + } finally { + lockFile.setWritable(true, false); + } + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + if (config != null) { + FileUtils.recursiveClean(config.getWorkareaFile(null)); + } + } + } + + @Test + public void testCheckServerLockAlreadyLocked() { + final String m = "testCheckServerLockAlreadyLocked"; + + try { + File workArea = config.getWorkareaFile(null); + assertTrue("Parent dirs should exist", workArea.isDirectory() || workArea.mkdirs()); + + ServerLock serverLock = null; + File lockFile = null; + FileOutputStream fos = null; + FileChannel fc = null; + FileLock lock = null; + + try { + serverLock = ServerLock.createServerLock(config); + lockFile = new File(workArea, BootstrapConstants.S_LOCK_FILE); + fos = new FileOutputStream(lockFile); + fc = fos.getChannel(); + lock = fc.lock(); + + // Try to obtain with lock already held. + serverLock.obtainServerLock(); + throw new Exception("Missed expected launch exception: lock already held"); + } catch (LaunchException le) { + // Expected exception + String translatedMsg = le.getTranslatedMessage(); + assertNotNull("Exception should contain translated message", translatedMsg); + assertTrue("Exception should contain console message CWWKE0029E", translatedMsg.contains("CWWKE0029E")); + } finally { + if (lock != null) { + lock.release(); + lockFile.delete(); + } + if (!Utils.tryToClose(fc)) { + Utils.tryToClose(fos); + } + } + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + if (config != null) + FileUtils.recursiveClean(config.getWorkareaFile(null)); + } + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.internal.FileUtils#recursiveClean(java.io.File)} . + * Additional testing of not deleting the lock file. + */ + @Test + public void testRecursiveCleanWithLock() { + final String m = "testRecursiveCleanWithLock"; + + try { + ServerLock.createServerLock(config); + File workarea = config.getWorkareaFile(null); + assertTrue("Parent dirs should exist", workarea.isDirectory() || workarea.mkdirs()); + + File sLockFile = config.getWorkareaFile(BootstrapConstants.S_LOCK_FILE); + File nonLockFile = config.getWorkareaFile("notLock.file"); + + assertTrue(".sLock file should exist pre-test", sLockFile.exists() || sLockFile.createNewFile()); + assertTrue("nonLockFile should exist pre-test", nonLockFile.exists() || nonLockFile.createNewFile()); + + FileUtils.recursiveClean(config.getConfigFile(null)); + + assertFalse("non-lock file should not exist (deleted)", nonLockFile.exists()); + assertTrue("lock file should exist (untouched)", sLockFile.exists()); + assertTrue("workarea directory should exist (untouched-- preserve in-use .sLock file)", workarea.exists()); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerRunningTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerRunningTest.java new file mode 100755 index 000000000000..eebe7919a946 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerRunningTest.java @@ -0,0 +1,131 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; + +/** + * + */ +public class ServerRunningTest { + static SharedOutputManager outputMgr; + static SharedBootstrapConfig config; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + File f = TestUtils.createTempFile("ResourceUtilsTest", "tmp"); + f.delete(); + boolean suc = f.mkdir(); + + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + + // Bootstrap configuration/locations + config = SharedBootstrapConfig.createSharedConfig(outputMgr); + + outputMgr.captureStreams(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + outputMgr.restoreStreams(); + TestUtils.cleanTempFiles(); + } + + /** + * Test to make sure .sRunning file is created and exists as server is running and that it isn't + * deleted as part of a cleaning of workarea. + */ + @Test + public void testServerRunning() { + + final String m = "testServerRunning"; + File sRunningFile = null; + + try { + // Must create parent workarea - server lock code ensures this exists + File serverWorkArea = config.getWorkareaFile(null); + if (!serverWorkArea.exists()) { + boolean suc = serverWorkArea.mkdirs(); + } + + ServerLock.createServerRunningMarkerFile(config); // Unit test runtime code + sRunningFile = config.getWorkareaFile(BootstrapConstants.SERVER_RUNNING_FILE); + assertTrue("Running marker file exists after call to obtain", sRunningFile.exists()); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + if (config != null) { + // This method skips/preserves .sRunning file + FileUtils.recursiveClean(config.getWorkareaFile(null)); + } + } + assertTrue("Running marke file exists after call to clean workspace", sRunningFile.exists()); + } + + /** + * Test to make sure workspace area is cleaned after a JVM ABEND + */ + @Test + public void testServerRunningAfterABEND() { + + final String m = "testServerRunningAfterABEND"; + File sRunningFile = null; + + try { + // Must create parent workarea - server lock code ensures this exists + File serverWorkArea = config.getWorkareaFile(null); + if (!serverWorkArea.exists()) { + boolean suc = serverWorkArea.mkdirs(); + } + + sRunningFile = config.getWorkareaFile(BootstrapConstants.SERVER_RUNNING_FILE); + sRunningFile.delete(); // Make sure sRunning file isn't there. + + ServerLock.createServerRunningMarkerFile(config); // Unit test runtime code + boolean cleanStart = config.checkCleanStart(); + assertFalse("Clean start should not be requested", cleanStart); + + ServerLock.createServerRunningMarkerFile(config); // 2nd call - file will exist, appears as ABEND + cleanStart = config.checkCleanStart(); + assertTrue("Clean start should be requested", cleanStart); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + if (config != null) { + // This method skips/preserves .sRunning file + FileUtils.recursiveClean(config.getWorkareaFile(null)); + } + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/TimeoutRule.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/TimeoutRule.java new file mode 100755 index 000000000000..cfabbac3cb32 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/TimeoutRule.java @@ -0,0 +1,89 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import java.lang.management.ManagementFactory; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +/** + * + */ +public class TimeoutRule implements TestRule { + + /* + * (non-Javadoc) + * + * @see org.junit.rules.TestRule#apply(org.junit.runners.model.Statement, org.junit.runner.Description) + */ + @Override + public Statement apply(final Statement base, final Description arg1) { + return new CoreOnTimeoutStatement(base); + } + + public class CoreOnTimeoutStatement extends Statement { + + private final Statement base; + + /** + * @param base + */ + public CoreOnTimeoutStatement(Statement base) { + this.base = base; + } + + /* + * (non-Javadoc) + * + * @see org.junit.runners.model.Statement#evaluate() + */ + @Override + public void evaluate() throws Throwable { + try { + base.evaluate(); + } catch (Throwable ex) { + // Make sure this is a timeout + if (ex.getMessage() != null && ex.getMessage().startsWith("test timed out")) { + // Run gcore to generate a core dump on platforms where it's available + String osName = System.getProperty("os.name"); + if (osName.startsWith("Linux") || osName.startsWith("Solaris") || osName.startsWith("Sun")) { + int pid = getProcessPid(); + + Process p = Runtime.getRuntime().exec("gcore " + pid); + p.waitFor(); + } + } + + throw ex; + } + + } + + /** + * Get the process PID using the RuntimeMXBean. There are no real guarantees about the format, + * so this could easily break some day. + */ + private int getProcessPid() throws Exception { + String pidStr = ManagementFactory.getRuntimeMXBean().getName(); + + if (pidStr.contains("@")) { + return Integer.parseInt(pidStr.split("@")[0]); + } else { + return -1; + } + + } + + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/DumpProcessorTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/DumpProcessorTest.java new file mode 100755 index 000000000000..0474de7d9a4d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/DumpProcessorTest.java @@ -0,0 +1,109 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.commands; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertTrue; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import test.common.SharedOutputManager; +import test.shared.Constants; + +import com.ibm.ws.kernel.boot.BootstrapConfig; +import com.ibm.ws.kernel.boot.ReturnCode; + +/** + * + */ +@Ignore +public class DumpProcessorTest { + + private static SharedOutputManager outputMgr; + + private final Mockery mockery = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // capture system output + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + outputMgr.restoreStreams(); + } + + @Test + public void testUnableToFindJavaDumps() throws Exception { + final String serverName = "server-testUnableToFindJavaDumps"; + final File tempServerDir = new File(new File(Constants.TEST_TMP_ROOT_FILE, "servers"), serverName); + final BootstrapConfig mockBootConfig = mockery.mock(BootstrapConfig.class); + + // Methods called on BootstratpConfig from DumpProcessor execute method. + mockery.checking(new Expectations() { + { + allowing(mockBootConfig).getUserRoot(); + will(returnValue(Constants.TEST_TMP_ROOT_FILE)); + + allowing(mockBootConfig).getOutputFile(null); + will(returnValue(tempServerDir)); + } + }); + + File dumpFile = new File(Constants.TEST_TMP_ROOT_FILE, "dump.testUnableToFindJavaDumps.zip").getAbsoluteFile(); + + assertTrue("Precondition Failed - unable to create temp server directory", tempServerDir.mkdirs()); + + dumpFile.createNewFile(); + + // create paths to heap and system dumps that do not exist + List javaDumps = new ArrayList(); + javaDumps.add(new File(Constants.TEST_TMP_ROOT, "NON_EXISTENT_HEAP_DUMP.phd").getAbsolutePath()); + javaDumps.add(new File(Constants.TEST_TMP_ROOT, "NON_EXISTENT_SYSTEM_DUMP.dmp").getAbsolutePath()); + + try { + DumpProcessor dumpProcessor = new DumpProcessor(serverName, dumpFile, mockBootConfig, javaDumps); + assertEquals(ReturnCode.OK, dumpProcessor.execute()); + + // verify that the user is alerted to missing java dump files: + assertTrue("Did not find expected error message for missing heap dump file", outputMgr.checkForStandardOut("CWWKE0009E.*NON_EXISTENT_HEAP_DUMP.phd")); + assertTrue("Did not find expected error message for missing system dump file", outputMgr.checkForStandardOut("CWWKE0009E.*NON_EXISTENT_SYSTEM_DUMP.dmp")); + } finally { + if (dumpFile.exists()) { + dumpFile.delete(); + } + if (tempServerDir.exists()) { + tempServerDir.delete(); + } + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/FolderStructureGeneratorTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/FolderStructureGeneratorTest.java new file mode 100755 index 000000000000..ee8244b435eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/FolderStructureGeneratorTest.java @@ -0,0 +1,59 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.commands; + +import java.io.File; +import java.util.Formatter; +import java.util.regex.Pattern; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; + +public class FolderStructureGeneratorTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + private static final File dataDir = new File("unittest/test data/dump"); + + @Rule + public TestRule outputRule = outputMgr; + + @Test + public void testMD5() { + String md5 = new ServerDumpPackager.FolderStructureGenerator().md5(new File(dataDir, "/md5-1.txt")); + Assert.assertEquals("a62c519aaabfce3f6d02bfc983f26098", md5); + } + + @Test + public void testPrintFileList() throws Exception { + StringBuilder builder = new StringBuilder(); + Formatter formatter = new Formatter(builder); + new ServerDumpPackager.FolderStructureGenerator().printFileList(dataDir, formatter, dataDir.getAbsolutePath().length() + 1); + String[] lines = builder.toString().split("\r?\n"); + String dateTime = "\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}"; + String sep = Pattern.quote(File.separator); + + int i = 0; + Assert.assertTrue(lines[i], lines[i].matches("d " + dateTime + " lib" + sep)); + i++; + Assert.assertTrue(lines[i], lines[i].matches("f 54 " + dateTime + " c327688b13b293d7d42c60d39e59f8a5 lib" + sep + "md5-2.txt")); + i++; + Assert.assertTrue(lines[i], lines[i].matches("f 46 " + dateTime + " a62c519aaabfce3f6d02bfc983f26098 md5-1.txt")); + i++; + Assert.assertTrue(lines[i], lines[i].matches("d " + dateTime + " usr" + sep)); + i++; + // Files beneath usr should not be printed. + Assert.assertEquals(i, lines.length); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/PackageProcessorTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/PackageProcessorTest.java new file mode 100755 index 000000000000..debfb02e46b1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/PackageProcessorTest.java @@ -0,0 +1,133 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.commands; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.jar.Attributes; +import java.util.jar.Manifest; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.Before; +import org.junit.Test; + +import test.shared.Constants; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.BootstrapConfig; +import com.ibm.ws.kernel.boot.internal.BootstrapConstants; + +/** + * + */ +public class PackageProcessorTest { + + /** + * Mock environment. + */ + protected static Mockery mockery; + + /** + * Create the mockery environment. Called before each test to setup a new + * mockery environment for each test, which helps isolate Expectation sets + * and makes it easier to read error log output when Expectations fail. + */ + @Before + public void before() { + mockery = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + } + + /** + * @return A manifest file to use for testing. + */ + private File createTestManifestFile() throws IOException { + File maniFile = TestUtils.createTempFile("PackageProcessorTest.MANIFEST", ".mf"); + maniFile.deleteOnExit(); + + Manifest mf = new Manifest(); + Attributes atts = mf.getMainAttributes(); + + atts.putValue("Manifest-Version", "1.0"); + atts.putValue("Archive-Content-Type", "install"); + atts.putValue("Archive-Root", "wlp/"); + atts.putValue("Bnd-LastModified", "1389725452656"); + atts.putValue("Bundle-Copyright", "The Program materials contained in this file are IBM c" + + "opyright materials. WLP Copyright International Business Machines Corp." + + " 1999, 2013 All Rights Reserved * Licensed Materials - Property of IBM " + + "US Government Users Restricted Rights - Use, duplication or disclosure " + + "restricted by GSA ADP Schedule Contract with IBM Corp."); + atts.putValue("Bundle-Vendor", "IBM"); + atts.putValue("Created-By", "1.6.0 (IBM Corporation)"); + atts.putValue("Extract-Installer", "true"); + atts.putValue("Import-Package", "javax.xml.parsers,org.w3c.dom,org.xml.sax"); + atts.putValue("License-Agreement", "wlp/lafiles/LA"); + atts.putValue("License-Information", "wlp/lafiles/LI"); + atts.putValue("Main-Class", "wlp.lib.extract.SelfExtract"); + + mf.write(new FileOutputStream(maniFile)); + + return maniFile; + } + + /** + * + */ + @Test + public void testBuildManifestForIncludeEqualsUsr() throws Exception { + + final BootstrapConfig mockBootConfig = mockery.mock(BootstrapConfig.class); + + // Methods called on BootstratpConfig from PackageProcessor.CTOR. + mockery.checking(new Expectations() { + { + allowing(mockBootConfig).getUserRoot(); + will(returnValue(Constants.TEST_TMP_ROOT_FILE)); + + allowing(mockBootConfig).getConfigFile(null); + will(returnValue(Constants.TEST_TMP_ROOT_FILE)); + + allowing(mockBootConfig).get(BootstrapConstants.LOC_PROPERTY_SRVTMP_DIR); + will(returnValue(Constants.TEST_TMP_ROOT)); + + allowing(mockBootConfig).getProcessType(); + will(returnValue(BootstrapConstants.LOC_PROCESS_TYPE_SERVER)); + } + }); + + // Run the code under test. + File newManiFile = new PackageProcessor(null, null, mockBootConfig, null, null) + .buildManifestForIncludeEqualsUsr(createTestManifestFile()); + newManiFile.deleteOnExit(); + + // Verify content of new manifest file + Manifest mf = new Manifest(); + mf.read(new FileInputStream(newManiFile)); + + Attributes atts = mf.getMainAttributes(); + assertNull(atts.getValue("License-Information")); + assertNull(atts.getValue("License-Agreement")); + assertEquals("com.ibm.websphere.appserver", atts.getValue("Applies-To")); + assertEquals("false", atts.getValue("Extract-Installer")); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLauncherDelegate.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLauncherDelegate.java new file mode 100755 index 000000000000..5dc0ac9b68dc --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLauncherDelegate.java @@ -0,0 +1,22 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.framework; + +import com.ibm.ws.kernel.boot.BootstrapConfig; +import com.ibm.ws.kernel.launch.internal.LauncherDelegateImpl; + +public class BasicLauncherDelegate extends LauncherDelegateImpl { + public BasicLauncherDelegate(BootstrapConfig config) { + super(config); + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLogProvider.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLogProvider.java new file mode 100755 index 000000000000..68698c569051 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLogProvider.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.framework; + +import java.io.File; +import java.util.Map; + +import com.ibm.wsspi.logprovider.LogProvider; + +/** + * + */ +public class BasicLogProvider implements LogProvider { + @Override + public void configure(Map config, + File logLocation, + com.ibm.wsspi.logging.TextFileOutputStreamFactory factory) {} + + @Override + public void stop() {} +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/MBeanServerPipelineTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/MBeanServerPipelineTest.java new file mode 100755 index 000000000000..35389b732fe6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/MBeanServerPipelineTest.java @@ -0,0 +1,185 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.jmx.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import javax.management.MBeanServerFactory; + +import org.junit.Before; +import org.junit.Test; + +import com.ibm.ws.kernel.boot.jmx.service.MBeanServerForwarderDelegate; +import com.ibm.ws.kernel.boot.jmx.service.MBeanServerPipeline; + +/** + * + */ +public class MBeanServerPipelineTest { + + private static final String MBEAN_SERVER_BUILDER_PROPERTY = "javax.management.builder.initial"; + private static final String MBEAN_SERVER_BUILDER_CLASS = PlatformMBeanServerBuilder.class.getName(); + + public static final class MBeanServerPipelineHolder implements PlatformMBeanServerBuilderListener { + + private MBeanServerPipeline pipeline; + + @Override + public void platformMBeanServerCreated(MBeanServerPipeline pipeline) { + this.pipeline = pipeline; + } + + public MBeanServerPipeline getMBeanServerPipeline() { + return pipeline; + } + } + + public static class BasicFilter extends MBeanServerForwarderDelegate { + + private final int priority; + + public BasicFilter(int priority) { + this.priority = priority; + } + + @Override + public final int getPriority() { + return priority; + } + } + + public static class PriorityRecorder extends BasicFilter { + + private final List priorities; + + public PriorityRecorder(int priority, List priorities) { + super(priority); + this.priorities = priorities; + } + + @Override + public Integer getMBeanCount() { + priorities.add(getPriority()); + return super.getMBeanCount(); + } + } + + protected PlatformMBeanServer mBeanServer; + protected MBeanServerPipeline mBeanServerPipeline; + + @Before + public void setUp() throws Exception { + System.setProperty(MBEAN_SERVER_BUILDER_PROPERTY, MBEAN_SERVER_BUILDER_CLASS); + mBeanServer = (PlatformMBeanServer) MBeanServerFactory.newMBeanServer(); + MBeanServerPipelineHolder pipelineHolder = new MBeanServerPipelineHolder(); + mBeanServer.invokePlatformMBeanServerCreated(pipelineHolder); + mBeanServerPipeline = pipelineHolder.getMBeanServerPipeline(); + } + + @Test + public void testInsert() { + final BasicFilter f1 = new BasicFilter(5); + final BasicFilter f2 = new BasicFilter(-1); + + assertTrue("Excpected insert of BasicFilter(5) succeeded.", mBeanServerPipeline.insert(f1)); + assertFalse("Excpected insert of BasicFilter(5) failed.", mBeanServerPipeline.insert(f1)); + assertFalse("Excpected insert of BasicFilter(-1) failed.", mBeanServerPipeline.insert(f2)); + assertFalse("Excpected insert of null failed.", mBeanServerPipeline.insert(null)); + } + + @Test + public void testRemove() { + final BasicFilter f1 = new BasicFilter(42); + final BasicFilter f2 = new BasicFilter(8); + final BasicFilter f3 = new BasicFilter(13); + + assertFalse("Excpected remove of BasicFilter(42) failed.", mBeanServerPipeline.remove(f1)); + + mBeanServerPipeline.insert(f1); + mBeanServerPipeline.insert(f2); + mBeanServerPipeline.insert(f3); + + assertTrue("Excpected remove of BasicFilter(42) succeeded.", mBeanServerPipeline.remove(f1)); + assertTrue("Excpected remove of BasicFilter(8) succeeded.", mBeanServerPipeline.remove(f2)); + assertTrue("Excpected remove of BasicFilter(13) succeeded.", mBeanServerPipeline.remove(f3)); + assertFalse("Excpected remove of BasicFilter(42) failed.", mBeanServerPipeline.remove(f1)); + } + + @Test + public void testContains() { + final BasicFilter f1 = new BasicFilter(7); + final BasicFilter f2 = new BasicFilter(13); + final BasicFilter f3 = new BasicFilter(9); + final BasicFilter f4 = new BasicFilter(4); + + assertFalse("Excpected pipeline does not contain BasicFilter(7).", mBeanServerPipeline.contains(f1)); + assertFalse("Excpected pipeline does not contain null.", mBeanServerPipeline.contains(null)); + + mBeanServerPipeline.insert(f1); + mBeanServerPipeline.insert(f2); + mBeanServerPipeline.insert(f3); + + assertTrue("Excpected pipeline contains BasicFilter(7).", mBeanServerPipeline.contains(f1)); + assertTrue("Excpected pipeline contains BasicFilter(13).", mBeanServerPipeline.contains(f2)); + assertTrue("Excpected pipeline contains BasicFilter(9).", mBeanServerPipeline.contains(f3)); + assertFalse("Excpected pipeline does not contain BasicFilter(4).", mBeanServerPipeline.contains(f4)); + + mBeanServerPipeline.remove(f1); + mBeanServerPipeline.remove(f2); + mBeanServerPipeline.remove(f3); + + assertFalse("Excpected pipeline does not contain BasicFilter(7).", mBeanServerPipeline.contains(f1)); + assertFalse("Excpected pipeline does not contain BasicFilter(13).", mBeanServerPipeline.contains(f2)); + assertFalse("Excpected pipeline does not contain BasicFilter(9).", mBeanServerPipeline.contains(f3)); + } + + @Test + public void testPipelineOrder() { + final List priorities = new ArrayList(); + final PriorityRecorder f1 = new PriorityRecorder(7, priorities); + final PriorityRecorder f2 = new PriorityRecorder(13, priorities); + final PriorityRecorder f3 = new PriorityRecorder(9, priorities); + final PriorityRecorder f4 = new PriorityRecorder(4, priorities); + final PriorityRecorder f5 = new PriorityRecorder(15, priorities); + final PriorityRecorder f6 = new PriorityRecorder(6, priorities); + final PriorityRecorder f7 = new PriorityRecorder(12, priorities); + final PriorityRecorder f8 = new PriorityRecorder(8, priorities); + + final int mBeanCount1 = mBeanServer.getMBeanCount(); + + mBeanServerPipeline.insert(f1); + mBeanServerPipeline.insert(f2); + mBeanServerPipeline.insert(f3); + mBeanServerPipeline.insert(f4); + mBeanServerPipeline.insert(f5); + mBeanServerPipeline.insert(f6); + mBeanServerPipeline.insert(f7); + mBeanServerPipeline.insert(f8); + + final int mBeanCount2 = mBeanServer.getMBeanCount(); + assertEquals("Expected MBean counts to be equal.", mBeanCount1, mBeanCount2); + + final int length = priorities.size(); + assertEquals("Expected priorities.size() == 8.", 8, length); + + for (int i = 0; i < length - 1; ++i) { + int t0 = priorities.get(i); + int t1 = priorities.get(i + 1); + assertTrue("Expected '" + t0 + "' >= '" + t1 + "'.", t0 >= t1); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/PlatformMBeanServerDelegateTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/PlatformMBeanServerDelegateTest.java new file mode 100755 index 000000000000..9567278ecc23 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/PlatformMBeanServerDelegateTest.java @@ -0,0 +1,31 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.jmx.internal; + +import static org.junit.Assert.assertTrue; + +import javax.management.MBeanServerDelegate; + +import org.junit.Test; + +/** + * + */ +public class PlatformMBeanServerDelegateTest { + + @Test + public void testPlatformMBeanServerDelegateAttributes() throws Exception { + MBeanServerDelegate mBeanServerDelegate = new PlatformMBeanServerDelegate(); + assertTrue("Expected that server ID starts with WebSphere", + mBeanServerDelegate.getMBeanServerId().startsWith("WebSphere")); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/security/WLPDynamicPolicyTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/security/WLPDynamicPolicyTest.java new file mode 100755 index 000000000000..66c666bfa4b7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/security/WLPDynamicPolicyTest.java @@ -0,0 +1,163 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.security; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.net.URL; +import java.security.AllPermission; +import java.security.CodeSource; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Policy; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * + */ +public class WLPDynamicPolicyTest { + + private static URL testURL1; + private static URL testURL2; + private static URL unlistedURL; + private static List urls; + + private final Mockery mockery = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + private Policy policy; + private WLPDynamicPolicy dynamicPolicy; + private final Permission allPermission = new AllPermission(); + private PermissionsCombiner permissionsCombiner; + private PermissionCollection combinedPermissions; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + testURL1 = new URL("file:///testURL1"); + testURL2 = new URL("file:///testURL2"); + unlistedURL = new URL("file:///unlistedURL"); + urls = new ArrayList(); + urls.add(testURL1); + urls.add(testURL2); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Before + public void setUp() throws Exception { + policy = Policy.getPolicy(); + dynamicPolicy = new WLPDynamicPolicy(policy, urls); + permissionsCombiner = mockery.mock(PermissionsCombiner.class); + } + + @After + public void tearDown() throws Exception { + Policy.setPolicy(policy); + mockery.assertIsSatisfied(); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.internal.WLPDynamicPolicy#getPermissions(java.security.CodeSource)}. + */ + @Test + public void testGetPermissionsCodeSource_AllPermission() { + CodeSource codesource = new CodeSource(testURL1, (java.security.cert.Certificate[]) null); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertTrue("The AllPermission must be granted to the codesource.", pemissionCollection.implies(allPermission)); + } + + @Test + public void testGetPermissionsCodeSource_AllPermissionForDifferentCodeSource() { + CodeSource codesource = new CodeSource(testURL2, (java.security.cert.Certificate[]) null); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertTrue("The AllPermission must be granted to the codesource.", pemissionCollection.implies(allPermission)); + } + + @Test + public void testGetPermissionsCodeSource_AllPermissionForCodeSourceNotListedAndNoStaticPolicy() throws Exception { + dynamicPolicy = new WLPDynamicPolicy(null, urls); + CodeSource codesource = new CodeSource(unlistedURL, (java.security.cert.Certificate[]) null); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertTrue("The AllPermission must be granted to the codesource.", pemissionCollection.implies(allPermission)); + } + + @Test + public void testGetPermissionsCodeSource_StaticPermissionsForCodeSourceNotListed() throws Exception { + CodeSource codesource = new CodeSource(unlistedURL, (java.security.cert.Certificate[]) null); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + List staticPermissions = Collections.list(policy.getPermissions(codesource).elements()); + assertTrue("The static permissions must be granted to the codesource.", staticPermissions.equals(Collections.list(pemissionCollection.elements()))); + } + + @Test + public void testGetPermissionsCodeSource_StaticPermissionsForNullCodeSource() throws Exception { + dynamicPolicy.setPermissionsCombiner(permissionsCombiner); + CodeSource codesource = null; + + try { + List staticPermissions = Collections.list(policy.getPermissions(codesource).elements()); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertTrue("The static permissions must be granted to the codesource.", staticPermissions.equals(Collections.list(pemissionCollection.elements()))); + } catch (NullPointerException e) { + // Ignore NPE from policy.getPermissions(codesource) since Oracle's JDK does not support a null code source. + } + } + + @Test + public void testGetPermissionsCodeSource_StaticPermissionsForNullLocation() throws Exception { + dynamicPolicy.setPermissionsCombiner(permissionsCombiner); + CodeSource codesource = new CodeSource(null, (java.security.cert.Certificate[]) null); + List staticPermissions = Collections.list(policy.getPermissions(codesource).elements()); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertTrue("The static permissions must be granted to the codesource.", staticPermissions.equals(Collections.list(pemissionCollection.elements()))); + } + + @Test + public void testGetPermissionsCodeSource_CombinedPermissionsForCodeSourceNotListed() throws Exception { + dynamicPolicy.setPermissionsCombiner(permissionsCombiner); + + CodeSource codesource = new CodeSource(unlistedURL, (java.security.cert.Certificate[]) null); + createPermissionsCombinerExpectations(codesource); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertEquals("The combined permissions must be granted to the codesource.", combinedPermissions, pemissionCollection); + } + + private void createPermissionsCombinerExpectations(final CodeSource codesource) { + combinedPermissions = mockery.mock(PermissionCollection.class); + mockery.checking(new Expectations() { + { + one(permissionsCombiner).getCombinedPermissions(with(any(PermissionCollection.class)), with(codesource)); + will(returnValue(combinedPermissions)); + } + }); + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/classloader/JarFileClassLoaderTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/classloader/JarFileClassLoaderTest.java new file mode 100755 index 000000000000..5bd444a0b472 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/classloader/JarFileClassLoaderTest.java @@ -0,0 +1,217 @@ +package com.ibm.ws.kernel.internal.classloader; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.net.URLConnection; +import java.net.URLStreamHandler; +import java.util.Enumeration; +import java.util.Properties; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import test.common.SharedOutputManager; + +public class JarFileClassLoaderTest { + + static SharedOutputManager outputMgr; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + private JarFileClassLoader getFileURLClassLoader(boolean verify) throws Exception { + File badJar = new File("../com.ibm.ws.kernel.boot_test/unittest/test data/signed/bad.jar"); + assertTrue(badJar.exists()); + return new JarFileClassLoader(new URL[] { badJar.toURI().toURL() }, verify, null); + } + + @Test + public void testDirectoryClassPath() throws Exception { + File directory = new File("../com.ibm.ws.kernel.boot_test/unittest/test data/"); + assertTrue(directory.exists()); + JarFileClassLoader classloader = new JarFileClassLoader(new URL[] { directory.toURI().toURL() }, false, null); + assertNotNull(classloader.getResource("signed/bad.jar")); + } + + @Ignore + public void testFileURL() throws Exception { + JarFileClassLoader loader = null; + + loader = getFileURLClassLoader(true); + testClassLoaderVerify(loader); + + loader = getFileURLClassLoader(false); + testClassLoaderNoVerify(loader); + } + + private JarFileClassLoader getNonFileURLClassLoader(boolean verify) throws Exception { + final File badJar = new File("../com.ibm.ws.kernel.boot_test/unittest/test data/signed/bad.jar"); + assertTrue(badJar.exists()); + URLStreamHandler handler = (new URLStreamHandler() { + @Override + protected URLConnection openConnection(URL u) throws IOException { + return new URLConnection(u) { + @Override + public void connect() throws IOException {} + + @Override + public InputStream getInputStream() throws IOException { + return new FileInputStream(badJar); + } + }; + } + }); + URL url = new URL("foo", "", -1, badJar.getAbsolutePath(), handler); + return new JarFileClassLoader(new URL[] { url }, verify, null); + } + + @Ignore + public void testNonFileURL() throws Exception { + JarFileClassLoader loader = null; + + loader = getNonFileURLClassLoader(true); + System.out.println(loader); + System.out.println(loader.getURLs()); + testClassLoaderVerify(loader); + + loader = getNonFileURLClassLoader(false); + System.out.println(loader); + System.out.println(loader.getURLs()); + testClassLoaderNoVerify(loader); + } + + private void testClassLoaderNoVerify(JarFileClassLoader loader) throws Exception { + // test loadClass() + assertNotNull(loader.loadClass("org.eclipse.equinox.metatype.Extendable")); + + // test getResource() + URL resource = loader.getResource("org/eclipse/equinox/metatype/EquinoxMetaTypeService.class"); + assertNotNull(resource); + assertNotNull(resource.openStream()); + + // test getResources() + Enumeration resources = loader.getResources("org/eclipse/equinox/metatype/EquinoxMetaTypeInformation.class"); + assertNotNull(resources); + assertTrue(resources.hasMoreElements()); + assertNotNull(resources.nextElement().openStream()); + } + + private void testClassLoaderVerify(JarFileClassLoader loader) throws Exception { + // test loadClass() + try { + loader.loadClass("org.eclipse.equinox.metatype.Extendable"); + fail("Did not throw SecurityException"); + } catch (SecurityException e) { + // we expect SecurityException + } + + // test getResource() + URL resource = loader.getResource("org/eclipse/equinox/metatype/EquinoxMetaTypeService.class"); + assertNotNull(resource); + try { + resource.openStream(); + fail("Did not throw SecurityException"); + } catch (SecurityException e) { + // we expect SecurityException + } + + // test getResources() + Enumeration resources = loader.getResources("org/eclipse/equinox/metatype/EquinoxMetaTypeInformation.class"); + assertNotNull(resources); + assertTrue(resources.hasMoreElements()); + try { + resources.nextElement().openStream(); + fail("Did not throw SecurityException"); + } catch (SecurityException e) { + // we expect SecurityException + } + } + + private ClassLoader getResourceTestURLClassLoader(boolean urlLoader) throws MalformedURLException { + File parentJar = new File("../com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources1.jar"); + assertTrue("No parent jar: " + parentJar, parentJar.exists()); + File childJar = new File("../com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources2.jar"); + assertTrue("No child jar: " + childJar, childJar.exists()); + URLClassLoader parent = new URLClassLoader(new URL[] { parentJar.toURI().toURL() }); + URL[] childUrls = new URL[] { childJar.toURI().toURL() }; + if (urlLoader) { + return new BootstrapChildFirstURLClassloader(childUrls, parent); + } else { + return new BootstrapChildFirstJarClassloader(childUrls, parent); + } + } + + @Test + public void testChildFirstGetResource() throws MalformedURLException { + doTestChildFirstGetResource(getResourceTestURLClassLoader(true)); + doTestChildFirstGetResource(getResourceTestURLClassLoader(false)); + } + + public void doTestChildFirstGetResource(ClassLoader loader) { + URL bootResource = loader.getResource("com/ibm/ws/kernel/boot/test.properties"); + assertNotNull("no boot resource found.", bootResource); + URL testResource = loader.getResource("resources/test.properties"); + assertNotNull("no test resource found.", testResource); + assertResource(bootResource, "1"); + assertResource(testResource, "2"); + } + + private void assertResource(URL resource, String expected) { + Properties props = new Properties(); + try { + props.load(resource.openStream()); + } catch (IOException e) { + fail("Failed to load resource: " + e.toString()); + } + assertEquals("Wrong resource test value", expected, props.getProperty("test")); + } + + @Test + public void testChildFirstGetResources() throws MalformedURLException { + doTestChildFirstGetResources(getResourceTestURLClassLoader(true)); + doTestChildFirstGetResources(getResourceTestURLClassLoader(false)); + } + + public void doTestChildFirstGetResources(ClassLoader loader) { + try { + Enumeration bootResources = loader.getResources("com/ibm/ws/kernel/boot/test.properties"); + assertNotNull("no boot resource found.", bootResources); + Enumeration testResources = loader.getResources("resources/test.properties"); + assertNotNull("no test resource found.", testResources); + assertResources(bootResources, "1", "2"); + assertResources(testResources, "2", "1"); + } catch (IOException e) { + fail("Failed to get resources: " + e.toString()); + } + } + + private void assertResources(Enumeration testResources, String... expected) { + for (String expectedValue : expected) { + assertResource(testResources.nextElement(), expectedValue); + } + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/reference/Handler.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/reference/Handler.java new file mode 100755 index 000000000000..e4ecccdc5939 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/reference/Handler.java @@ -0,0 +1,39 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.internal.reference; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; + +/** + * + */ +public class Handler extends URLStreamHandler { + + /** {@inheritDoc} */ + @Override + protected URLConnection openConnection(URL arg0) throws IOException { + return new URLConnection(arg0) { + @Override + public void connect() throws IOException {} + + @Override + public InputStream getInputStream() { + return null; + } + }; + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkConfigurationTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkConfigurationTest.java new file mode 100755 index 000000000000..687ca5589524 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkConfigurationTest.java @@ -0,0 +1,40 @@ +package com.ibm.ws.kernel.launch.internal; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedOutputManager; + +public class FrameworkConfigurationTest { + + static SharedOutputManager outputMgr; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + @After + public void tearDown() throws Exception { + // Clear the output generated after each method invocation, this keeps + // things sane + outputMgr.resetStreams(); + } + + @Test + public void testStub() { + // There are no longer and tests in this suite! + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkManagerTimeTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkManagerTimeTest.java new file mode 100755 index 000000000000..f294374215b2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkManagerTimeTest.java @@ -0,0 +1,276 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.launch.internal; + +import java.text.DecimalFormatSymbols; +import java.util.Locale; + +import junit.framework.Assert; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedOutputManager; + +/** + * + */ +public class FrameworkManagerTimeTest { + static SharedOutputManager outputMgr; + static Locale saveLocale; + static FrameworkManager frameworkManager; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + saveLocale = Locale.getDefault(); + frameworkManager = new FrameworkManager(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + Locale.setDefault(saveLocale); + + } + + @Test + public void testgetElapsedTimeAsStringFromFrameworkManager_English() { + @SuppressWarnings("unused") + final String m = "testgetElapsedTimeAsStringFromFrameworkManager_English"; + String loc = "en"; //example: "pl" or "en" + DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(new Locale(loc)); + String days = " days, "; + String hours = " hours, "; + String min = " minutes, "; + String sec = " seconds"; + String decSep = decimalFormatSymbols.getDecimalSeparator() + ""; //Decimal Separator in English is '.' + String grpSep = decimalFormatSymbols.getGroupingSeparator() + ""; //Grouping Separator in English is ',' + + testgetElapsedTimeAsStringFromFrameworkManager(loc, days, hours, min, sec, decSep, grpSep); + + } + + @Test + public void testgetElapsedTimeAsStringFromFrameworkManager_Polish() { + @SuppressWarnings("unused") + final String m = "testgetElapsedTimeAsStringFromFrameworkManager_Polish"; + String loc = "pl"; //example: "pl" or "en" + DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(new Locale(loc)); + String days = " days, "; // dn. + String hours = " hours, ";// godz. + String min = " minutes, ";// min. + String sec = " seconds";// sek. + String decSep = decimalFormatSymbols.getDecimalSeparator() + ""; //Decimal Separator in Polish is ',' + String grpSep = decimalFormatSymbols.getGroupingSeparator() + ""; //Grouping Separator + + testgetElapsedTimeAsStringFromFrameworkManager(loc, days, hours, min, sec, decSep, grpSep); + + } + + private void testgetElapsedTimeAsStringFromFrameworkManager(String locale, String days, String hours, String min, String sec, String decSep, String grpSep) { + @SuppressWarnings("unused") + final String m = "testgetElapsedTimeAsStringFromFrameworkManager"; + Locale.setDefault(new Locale(locale)); //example: "pl" or "en" + long elapsedTimeVerify; + String[] processedTime = new String[48]; + String[] expectedResults = new String[48]; + + //Testing the first branch of the 'if' statement + //First Group- testing the mixed units + elapsedTimeVerify = 2007208124L;//The milliseconds of 23 days, 5 hours, 33 minutes, 28.124 seconds + expectedResults[0] = "23" + days + "5" + hours + "33" + min + "28" + decSep + "124" + sec; + processedTime[0] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 1989208124L;//The milliseconds of 23 days, 33 minutes, 28.124 seconds + expectedResults[1] = "23" + days + "33" + min + "28" + decSep + "124" + sec; + processedTime[1] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 2005228124L;//The milliseconds of 23 days, 5 hours, 28.124 seconds + expectedResults[2] = "23" + days + "5" + hours + "28" + decSep + "124" + sec; + processedTime[2] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 1987228124L;//The milliseconds of 23 days, 28.124 seconds + expectedResults[3] = "23" + days + "28" + decSep + "124" + sec; + processedTime[3] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 20008124L; //The milliseconds of 5 hours, 33 minutes, 28.124 seconds + expectedResults[4] = "5" + hours + "33" + min + "28" + decSep + "124" + sec; + processedTime[4] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 18028124L; //The milliseconds of 5 hours, 28.124 seconds + expectedResults[5] = "5" + hours + "28" + decSep + "124" + sec; + processedTime[5] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 2008124L; //The milliseconds of 33 minutes, 28.124 seconds + expectedResults[6] = "33" + min + "28" + decSep + "124" + sec; + processedTime[6] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 28124L; //The milliseconds of 28.124 seconds + expectedResults[7] = "28" + decSep + "124" + sec; + processedTime[7] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 28120L; //The milliseconds of 28.12 seconds + expectedResults[8] = "28" + decSep + "12" + sec; + processedTime[8] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 28100L; //The milliseconds of 28.1 seconds + expectedResults[9] = "28" + decSep + "1" + sec; + processedTime[9] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 28000L; //The milliseconds of 28 seconds + expectedResults[10] = "28" + sec; + processedTime[10] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 2000L; //The milliseconds of 2 seconds + expectedResults[11] = "2" + sec; + processedTime[11] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 200L; //The milliseconds of 0.2 seconds + expectedResults[12] = "0" + decSep + "2" + sec; + processedTime[12] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 20L; //The milliseconds of 0.02 seconds + expectedResults[13] = "0" + decSep + "02" + sec; + processedTime[13] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 2L; //The milliseconds of 0.002 seconds + expectedResults[14] = "0" + decSep + "002" + sec; + processedTime[14] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 1009L; //The milliseconds of 1.009 seconds + expectedResults[15] = "1" + decSep + "009" + sec; + processedTime[15] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + + //Second Group - testing with zero seconds + elapsedTimeVerify = 0L; //The milliseconds of 0 seconds + expectedResults[16] = "0" + sec; + processedTime[16] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 60000L; //The milliseconds of 1 minutes, 0 seconds + expectedResults[17] = "1" + min + "0" + sec; + processedTime[17] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 1987200000L;//The milliseconds of 23 days, 0 seconds + expectedResults[18] = "23" + days + "0" + sec; + processedTime[18] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 18000000L; //The milliseconds of 5 hours, 0 seconds + expectedResults[19] = "5" + hours + "0" + sec; + processedTime[19] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 1980000L; //The milliseconds of 33 minutes, 0 seconds + expectedResults[20] = "33" + min + "0" + sec; + processedTime[20] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + + //Third Group - testing with maximum value of Long + elapsedTimeVerify = Long.MAX_VALUE; //The milliseconds of 106,751,991,167 days, 7 hours, 12 minutes 55.635 seconds + //(Seconds rounded from 55.634688) However due in difference in calculation accuracy when the Remainder '%' is used on Long, the + // Value will be 55.807 + //Long.MAX_VALUE = 9223372036854775807 + expectedResults[21] = "106" + grpSep + "751" + grpSep + "991" + grpSep + "167" + days + "7" + hours + "12" + min + "55" + decSep + "807" + sec; + processedTime[21] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + + //Third Group - Negative testing + elapsedTimeVerify = -1L; // No Time in negative value - Currently return 0 seconds + expectedResults[22] = "0" + sec; + processedTime[22] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = Long.MIN_VALUE; // No Time in negative value - Currently return 0 seconds + // Long.MIN_VALUE = -9223372036854775808 + expectedResults[23] = "0" + sec; + processedTime[23] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + + //Testing the second branch of the 'if' statement, the 'else' + //First Group + elapsedTimeVerify = 1009L; //The milliseconds of 1.009 seconds + expectedResults[24] = "1" + decSep + "009" + sec; + processedTime[24] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 0L; //The milliseconds of 0 seconds + expectedResults[25] = "0" + sec; + processedTime[25] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2L; //The milliseconds of 0.002 seconds + expectedResults[26] = "0" + decSep + "002" + sec; + processedTime[26] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20L; //The milliseconds of 0.02 seconds + expectedResults[27] = "0" + decSep + "02" + sec; + processedTime[27] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200L; //The milliseconds of 0.2 seconds + expectedResults[28] = "0" + decSep + "2" + sec; + processedTime[28] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000L; //The milliseconds of 2 seconds + expectedResults[29] = "2" + sec; + processedTime[29] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20000L; //The milliseconds of 20 seconds + expectedResults[30] = "20" + sec; + processedTime[30] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200000L; //The milliseconds of 200 seconds + expectedResults[31] = "200" + sec; + processedTime[31] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000000L; //The milliseconds of 2,000 seconds + expectedResults[32] = "2" + grpSep + "000" + sec; + processedTime[32] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20000000L; //The milliseconds of 20,000 seconds + expectedResults[33] = "20" + grpSep + "000" + sec; + processedTime[33] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200000000L; //The milliseconds of 200,000 seconds + expectedResults[34] = "200" + grpSep + "000" + sec; + processedTime[34] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000000000L; //The milliseconds of 2,000,000 seconds + expectedResults[35] = "2" + grpSep + "000" + grpSep + "000" + sec; + processedTime[35] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20000000000L; //The milliseconds of 20,000,000 seconds + expectedResults[36] = "20" + grpSep + "000" + grpSep + "000" + sec; + processedTime[36] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200000000000L; //The milliseconds of 200,000,000 seconds + expectedResults[37] = "200" + grpSep + "000" + grpSep + "000" + sec; + processedTime[37] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000000000000L; //The milliseconds of 2,000,000,000 seconds + expectedResults[38] = "2" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[38] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20000000000000L; //The milliseconds of 20,000,000,000 seconds + expectedResults[39] = "20" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[39] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200000000000000L; //The milliseconds of 200,000,000,000 seconds + expectedResults[40] = "200" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[40] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000000000000000L; //The milliseconds of 2,000,000,000,000 seconds + expectedResults[41] = "2" + grpSep + "000" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[41] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20000000000000000L; //The milliseconds of 20,000,000,000,000 seconds + expectedResults[42] = "20" + grpSep + "000" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[42] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200000000000000000L; //The milliseconds of 200,000,000,000,000 seconds + expectedResults[43] = "200" + grpSep + "000" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[43] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000000000000000000L; //The milliseconds of 2,000,000,000,000,000 seconds + expectedResults[44] = "2" + grpSep + "000" + grpSep + "000" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[44] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + //Second Group - testing with maximum value of Long + elapsedTimeVerify = Long.MAX_VALUE; //The milliseconds of 9,223,372,036,854,775.807 seconds + // Long.MAX_VALUE = 9223372036854775807 + // The double will convert these seconds to 9,223,372,036,854,776 seconds + expectedResults[45] = "9" + grpSep + "223" + grpSep + "372" + grpSep + "036" + grpSep + "854" + grpSep + "776" + sec; + processedTime[45] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + //Third Group - Negative testing + elapsedTimeVerify = -1L; // No Time in negative value - Currently return 0 seconds + expectedResults[46] = "0" + sec; + processedTime[46] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = Long.MIN_VALUE; // No Time in negative value - Currently return 0 seconds + // Long.MIN_VALUE = -9223372036854775808 + expectedResults[47] = "0" + sec; + processedTime[47] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + + // Assisting the results + String whiteSpacePattern = "\\s"; + //int i = 47; + for (int i = 0; i < expectedResults.length; i++) { + boolean result = expectedResults[i].replaceAll(whiteSpacePattern, ""). + equalsIgnoreCase(processedTime[i].replaceAll(whiteSpacePattern, "")); + String errMsg = "Elapsed Time is not formated correctly for the " + Locale.getDefault() + " language.\n" + + "The expected result at test # [" + i + "] is: " + expectedResults[i] + "\n" + + "The actual result is: " + processedTime[i]; + Assert.assertEquals(errMsg, true, result); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/LibertyProcessImplTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/LibertyProcessImplTest.java new file mode 100755 index 000000000000..60f26726b8ed --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/LibertyProcessImplTest.java @@ -0,0 +1,84 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.launch.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.ArrayList; +import java.util.Arrays; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedOutputManager; + +/** + * + */ +public class LibertyProcessImplTest { + static SharedOutputManager outputMgr; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + /** + * Test method for {@link com.ibm.ws.kernel.launch.internal.LibertyProcessImpl#getArgs()} . + */ + @Test + public void testGetArgs() { + final String m = "testGetArgs"; + + LibertyProcessImpl cmi; + String[] list; + + try { + cmi = new LibertyProcessImpl(null, null); + list = cmi.getArgs(); + assertNotNull(list); + assertEquals(0, list.length); + + cmi = new LibertyProcessImpl(new ArrayList(), null); + list = cmi.getArgs(); + assertNotNull(list); + assertEquals(0, list.length); + + final String dummy = "dummy"; + + cmi = new LibertyProcessImpl(Arrays.asList(new String[] { dummy }), null); + list = cmi.getArgs(); + assertNotNull(list); + assertEquals(1, list.length); + assertEquals(dummy, list[0]); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManagerTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManagerTest.java new file mode 100755 index 000000000000..7de936619d63 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManagerTest.java @@ -0,0 +1,159 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.launch.internal; + +import static com.ibm.ws.kernel.launch.internal.NoRethrowSecurityManager.lineSep; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.FilePermission; +import java.security.AllPermission; +import java.security.CodeSource; +import java.security.Permission; +import java.security.Permissions; +import java.security.ProtectionDomain; +import java.security.SecureClassLoader; +import java.util.Enumeration; + +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Unit test for {@link NoRethrowSecurityManager} class. + */ +public class NoRethrowSecurityManagerTest { + + private static final Mockery mock = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + + private static final Permission PERMISSION1 = new FilePermission("<>", "read"); + private static final Permission PERMISSION2 = new AllPermission(); + + private static final CodeSource CODE_SOURCE2 = mock.mock(CodeSource.class, "source with no URL"); + + private static final Permissions PERMISSIONS = new Permissions(); + + private final ClassLoader CLASS_LOADER = ClassLoader.getSystemClassLoader(); + private final Class[] CLASS_ARRAY = { String.class, NoRethrowSecurityManager.class, + SecureClassLoader.class, org.osgi.service.permissionadmin.PermissionInfo.class }; + + private final String CS_STR_NULL_CODE_SOURCE = "null code source"; + private final String CS_STR_NULL_URL = "null code URL"; + + private final String PERMISSION_STR1 = "ClassLoader: Primordial Classloader" + lineSep + + " Permissions granted to CodeSource null" + lineSep + + " {" + lineSep + + " }"; + private String PERMISSION_STR2 = "ClassLoader: " + CLASS_LOADER.getClass().getName() + lineSep + + " Permissions granted to CodeSource " + CODE_SOURCE2 + lineSep + + " {" + lineSep + + " ;" + lineSep + + " ;" + lineSep + + " }"; + + @BeforeClass + public static void setup() { + PERMISSIONS.add(PERMISSION1); + PERMISSIONS.add(PERMISSION2); + } + + @Test + public void checkPermissionTest() { + NoRethrowSecurityManager secManager = new NoRethrowSecurityManager(); + try { + secManager.checkPermission(PERMISSION1); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + @Test + public void handleSecurityExceptionTest() { + NoRethrowSecurityManager secManager = new NoRethrowSecurityManager(); + try { + secManager.checkPermission(PERMISSION2); + } catch (SecurityException e) { + fail(e.getMessage()); + } + } + + @Test + public void getCodeSorce() { + NoRethrowSecurityManager secManager = new NoRethrowSecurityManager(); + String csLocation = getClass().getProtectionDomain().getCodeSource().getLocation().toString(); + + ProtectionDomain protectionDomain = new ProtectionDomain(null, null); + String csstr = secManager.getCodeSource(protectionDomain); + assertTrue("The result code source string is incorrect, expected '" + CS_STR_NULL_CODE_SOURCE + + "' and got '" + csstr + "'.", CS_STR_NULL_CODE_SOURCE.equals(csstr)); + + protectionDomain = new ProtectionDomain(CODE_SOURCE2, null); + csstr = secManager.getCodeSource(protectionDomain); + assertTrue("The result code source string is incorrect, expected '" + CS_STR_NULL_URL + + "' and got '" + csstr + "'.", CS_STR_NULL_URL.equals(csstr)); + + protectionDomain = getClass().getProtectionDomain(); + csstr = secManager.getCodeSource(protectionDomain); + assertTrue("The result code source string is incorrect, expected '" + csLocation + + "' and got '" + csstr + "'.", csLocation.equals(csstr)); + } + + @Test + public void permissionToStringTest() { + NoRethrowSecurityManager secManager = new NoRethrowSecurityManager(); + String result = secManager.permissionToString(null, null, null); + assertTrue("The result string is incorrect, should be: \n" + PERMISSION_STR1 + + "\n and got : " + result, PERMISSION_STR1.equals(result)); + + configPermissionsString(); + result = secManager.permissionToString(CODE_SOURCE2, CLASS_LOADER, PERMISSIONS); + assertTrue("The result string is incorrect, should be: \n" + PERMISSION_STR2 + + "\n and got :" + result, PERMISSION_STR2.equals(result)); + } + + @Test + public void isOffendingClassTest() { + NoRethrowSecurityManager secManager = new NoRethrowSecurityManager(); + ProtectionDomain domain = getClass().getProtectionDomain(); + boolean result; + + result = secManager.isOffendingClass(CLASS_ARRAY, 0, domain, PERMISSION1); + assertFalse("The class " + CLASS_ARRAY[0] + " should not be offending class.", result); + + result = secManager.isOffendingClass(CLASS_ARRAY, 1, domain, PERMISSION1); + assertFalse("The class " + CLASS_ARRAY[1] + " should not be offending class.", result); + + result = secManager.isOffendingClass(CLASS_ARRAY, 2, domain, PERMISSION1); + assertFalse("The class " + CLASS_ARRAY[2] + " should not be offending class.", result); + + result = secManager.isOffendingClass(CLASS_ARRAY, 3, domain, PERMISSION1); + assertTrue("The class " + CLASS_ARRAY[3] + " should be offending class.", result); + + } + + private void configPermissionsString() { + Enumeration elements = PERMISSIONS.elements(); + int cont = 1; + while (elements.hasMoreElements()) { + Permission p = elements.nextElement(); + PERMISSION_STR2 = PERMISSION_STR2.replaceFirst("", p.toString()); + cont++; + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/ProvisionerTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/ProvisionerTest.java new file mode 100755 index 000000000000..8211c4d7697f --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/ProvisionerTest.java @@ -0,0 +1,527 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.launch.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JMock; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; +import org.osgi.framework.Constants; +import org.osgi.framework.startlevel.BundleStartLevel; +import org.osgi.framework.startlevel.FrameworkStartLevel; +import org.osgi.framework.wiring.BundleRevision; + +import com.ibm.ws.kernel.boot.LaunchException; +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; +import com.ibm.ws.kernel.boot.internal.KernelResolver; +import com.ibm.ws.kernel.boot.internal.KernelStartLevel; +import com.ibm.ws.kernel.launch.internal.Provisioner.InvalidBundleContextException; +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +@RunWith(JMock.class) +public class ProvisionerTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + static SharedBootstrapConfig config; + + @Rule + public TestName testName = new TestName(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + TestUtils.cleanTempFiles(); + TestUtils.setKernelUtilsBootstrapLibDir(new File("unittest/test data/lbr/lib")); + TestUtils.setUtilsInstallDir(new File("unittest/test data/lbr")); + + config = SharedBootstrapConfig.createSharedConfig(outputMgr); + BundleRepositoryRegistry.initializeDefaults(null, true); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + TestUtils.cleanTempFiles(); + TestUtils.setKernelUtilsBootstrapLibDir(null); + } + + /** Trivial interface that groups Bundle & BundleStartLevel so mock can push through the adapt method */ + interface TestBundleStartLevel extends Bundle, BundleStartLevel {} + + /** Trivial interface that groups Bundle & BundleRevision so mock can push through the adapt method */ + interface TestBundleRevision extends Bundle, BundleRevision {} + + /** Trivial interface that groups Bundle & FrameworkStartLevel so mock can push through the adapt method */ + interface TestFrameworkStartLevel extends Bundle, FrameworkStartLevel {} + + Mockery context = new Mockery(); + + final Bundle mockBundle = context.mock(Bundle.class); + final BundleContext mockBundleContext = context.mock(BundleContext.class); + final TestBundleRevision mockBundleRevision = context.mock(TestBundleRevision.class); + final TestBundleStartLevel mockBundleStartLevel = context.mock(TestBundleStartLevel.class); + final TestFrameworkStartLevel mockFrameworkStartLevel = context.mock(TestFrameworkStartLevel.class); + + final ProvisionerImpl provisioner = new ProvisionerImpl(); + + @Before + public void setUp() throws Exception { + System.setProperty("java.protocol.handler.pkgs", "com.ibm.ws.kernel.internal"); + context.checking(new Expectations() { + { + atLeast(1).of(mockBundleContext).getBundle(Constants.SYSTEM_BUNDLE_LOCATION); + will(returnValue(mockFrameworkStartLevel)); + + one(mockFrameworkStartLevel).adapt(FrameworkStartLevel.class); + will(returnValue(mockFrameworkStartLevel)); + + one(mockFrameworkStartLevel).setInitialBundleStartLevel(KernelStartLevel.ACTIVE.getLevel()); + } + }); + } + + @Test + public void testInstallNonexistentBundle() throws Exception { + + BundleInstallStatus iStatus; + + // B -- non-existent bundle + + KernelResolver resolver = new KernelResolver(config.getInstallRoot(), null, "kernelCoreMissing-1.0", "defaultLogging-1.0", null); + config.setKernelResolver(resolver); + + provisioner.getServices(mockBundleContext); + iStatus = provisioner.installBundles(config); + + String listMissingBundles = iStatus.listMissingBundles(); + + assertTrue("B: Bundles notexist should be missing: " + listMissingBundles, iStatus.bundlesMissing()); + assertNotNull("B: listMissingBundles should not return null: " + listMissingBundles, listMissingBundles); + assertTrue("B: List of missing bundles should include p.q: " + listMissingBundles, listMissingBundles.contains("p.q")); + } + + @Test + public void testInstallBundle() throws Exception { + final String m = "testInstallBundle"; + + BundleInstallStatus iStatus; + + context.checking(new Expectations() { + { + one(mockBundleContext).installBundle(with(any(String.class)), with(any(InputStream.class))); + will(returnValue(mockBundle)); + + one(mockBundle).adapt(BundleStartLevel.class); + will(returnValue(mockBundleStartLevel)); + + one(mockBundle).adapt(BundleRevision.class); + will(returnValue(mockBundleRevision)); + + one(mockBundleRevision).getTypes(); + will(returnValue(0)); + + one(mockBundleStartLevel).getStartLevel(); + will(returnValue(1)); + + one(mockBundleStartLevel).setStartLevel(KernelStartLevel.BOOTSTRAP.getLevel()); + } + }); + + KernelResolver resolver = new KernelResolver(config.getInstallRoot(), null, "kernelCore-1.0", "emptyLogging-1.0", null); + config.setKernelResolver(resolver); + + provisioner.getServices(mockBundleContext); + iStatus = provisioner.installBundles(config); + + if (iStatus.bundlesMissing()) + System.out.println(iStatus.listMissingBundles()); + + assertFalse(m + " C: There should be no missing bundles", iStatus.bundlesMissing()); + assertNull(m + " C: The list of missing bundles should be null", iStatus.listMissingBundles()); + + recordExceptions(iStatus); // print any unexpected exceptions for + // debug + + assertFalse(m + " C: There should not be an install exception", iStatus.installExceptions()); + assertNull(m + " C: There should not be an exception to trace", iStatus.traceInstallExceptions()); + + if (iStatus.bundlesToStart()) + System.out.println(iStatus.getBundlesToStart()); + + assertTrue(m + " C: Bundles were installed", iStatus.bundlesToStart()); + assertTrue(m + " C: The list of bundles should contain the installed bundle", iStatus.getBundlesToStart().contains(mockBundle)); + } + + @Test + public void testInstallExistingBundle() throws Exception { + final String m = "testInstallExistingBundle"; + + BundleInstallStatus iStatus; + + KernelResolver resolver = new KernelResolver(config.getInstallRoot(), null, "kernelCore-1.0", "kernelCore-1.0", null); + config.setKernelResolver(resolver); + + File simple_1 = new File("unittest/test data/lbr/lib", "x.y_1.0.jar"); + final String locationString = "reference:" + simple_1.toURI().toURL().toString(); + + context.checking(new Expectations() { + { + one(mockBundleContext).installBundle("kernel@" + locationString, null); + will(returnValue(mockBundle)); + + one(mockBundle).adapt(BundleRevision.class); + will(returnValue(mockBundleRevision)); + + one(mockBundleRevision).getTypes(); + will(returnValue(0)); + + one(mockBundle).adapt(BundleStartLevel.class); + will(returnValue(mockBundleStartLevel)); + + one(mockBundleStartLevel).getStartLevel(); + will(returnValue(1)); + + one(mockBundleStartLevel).setStartLevel(KernelStartLevel.BOOTSTRAP.getLevel()); + } + }); + + provisioner.getServices(mockBundleContext); + iStatus = provisioner.installBundles(config); + + if (iStatus.bundlesMissing()) + System.out.println(iStatus.listMissingBundles()); + + assertFalse(m + " C: There should be no missing bundles", iStatus.bundlesMissing()); + assertNull(m + " C: The list of missing bundles should be null", iStatus.listMissingBundles()); + + recordExceptions(iStatus); // print any unexpected exceptions for + // debug + + assertFalse(m + " C: There should not be an install exception", iStatus.installExceptions()); + assertNull(m + " C: There should not be an exception to trace", iStatus.traceInstallExceptions()); + + if (iStatus.bundlesToStart()) + System.out.println(iStatus.getBundlesToStart()); + + assertTrue(m + " C: Bundles were installed", iStatus.bundlesToStart()); + assertTrue(m + " C: The list of bundles should contain the installed bundle", iStatus.getBundlesToStart().contains(mockBundle)); + } + + @Test + public void testInstallBundleException() throws Exception { + + BundleInstallStatus iStatus; + + // D -- existing bundle with EXCEPTION on install; + // one call to installBundle (that will throw exception) + // no calls to getHeaders + + final BundleException testEx = new BundleException("Expected exception installing bundle"); + + KernelResolver resolver = new KernelResolver(config.getInstallRoot(), null, "kernelCore-1.0", "emptyLogging-1.0", null); + config.setKernelResolver(resolver); + + context.checking(new Expectations() { + { + one(mockBundleContext).installBundle(with(any(String.class)), with(any(InputStream.class))); + will(throwException(testEx)); + + never(mockBundle).adapt(BundleRevision.class); + never(mockBundleRevision).getTypes(); + + never(mockBundle).adapt(BundleStartLevel.class); + never(mockBundleStartLevel).getStartLevel(); + never(mockBundleStartLevel).setStartLevel(with(any(int.class))); + } + }); + + provisioner.getServices(mockBundleContext); + iStatus = provisioner.installBundles(config); + + assertFalse("D: There should be no bundles installed", iStatus.bundlesToStart()); + assertTrue("D: There should be an install exception", iStatus.installExceptions()); + assertNotNull("D: There should be exceptions to trace", iStatus.traceInstallExceptions()); + + Map badness = iStatus.getInstallExceptions(); + System.out.println(badness); + + assertTrue("D: There should be an exception associated with bad bundle", badness.keySet().contains("x.y;version=\"[1.0.0,1.0.100)\"")); + assertEquals("D: The exception in the map should match the one thrown", badness.get("x.y;version=\"[1.0.0,1.0.100)\""), testEx); + } + + @Test + public void testInstallFragment() throws Exception { + + BundleInstallStatus iStatus; + + KernelResolver resolver = new KernelResolver(config.getInstallRoot(), null, "kernelCore-1.0", "emptyLogging-1.0", null); + config.setKernelResolver(resolver); + + // E -- existing FRAGMENT bundle; + // should not be added to list of "installed" bundles + context.checking(new Expectations() { + { + one(mockBundleContext).installBundle(with(any(String.class)), with(any(InputStream.class))); + will(returnValue(mockBundle)); + + one(mockBundle).adapt(BundleRevision.class); + will(returnValue(mockBundleRevision)); + + one(mockBundleRevision).getTypes(); + will(returnValue(BundleRevision.TYPE_FRAGMENT)); + + never(mockBundle).adapt(BundleStartLevel.class); + never(mockBundleStartLevel).getStartLevel(); + never(mockBundleStartLevel).setStartLevel(with(any(int.class))); + } + }); + + provisioner.getServices(mockBundleContext); + iStatus = provisioner.installBundles(config); + + assertFalse("E: The fragment bundle should not be in the list of installed bundles", iStatus.bundlesToStart()); + } + + @Test + public void testStartNullList() { + provisioner.getServices(mockBundleContext); + + // A -- null properties, empty array + + provisioner.startBundles(null); + provisioner.startBundles(new ArrayList()); + } + + @Test + public void testStartBundle() throws Exception { + BundleStartStatus sStatus; + provisioner.getServices(mockBundleContext); + + // B -- mock bundle; + // one call to b.start, bundle already started + + List bList = new ArrayList(); + bList.add(mockBundle); + + context.checking(new Expectations() { + { + one(mockBundle).getState(); + will(returnValue(org.osgi.framework.Bundle.RESOLVED)); + + one(mockBundle).start(with(any(int.class))); + } + }); + + sStatus = provisioner.startBundles(bList); + + assertFalse(sStatus.startExceptions()); + assertNull(sStatus.traceStartExceptions()); + + // C -- Felix path + context.checking(new Expectations() { + { + one(mockFrameworkStartLevel).adapt(FrameworkStartLevel.class); + will(returnValue(mockFrameworkStartLevel)); + + one(mockFrameworkStartLevel).setInitialBundleStartLevel(KernelStartLevel.ACTIVE.getLevel()); + + one(mockBundle).getState(); + will(returnValue(org.osgi.framework.Bundle.RESOLVED)); + + one(mockBundle).start(with(any(int.class))); + } + }); + + provisioner.getServices(mockBundleContext); + + sStatus = provisioner.startBundles(bList); + } + + @Test + public void testStartStartedBundle() throws Exception { + BundleStartStatus sStatus; + provisioner.getServices(mockBundleContext); + + // C -- mock bundle; + // one call to b.start, works fine + + List bList = new ArrayList(); + bList.add(mockBundle); + + context.checking(new Expectations() { + { + one(mockBundle).getState(); + will(returnValue(org.osgi.framework.Bundle.STARTING)); + + never(mockBundle).start(with(any(int.class))); + } + }); + + sStatus = provisioner.startBundles(bList); + + assertFalse(sStatus.startExceptions()); + assertNull(sStatus.traceStartExceptions()); + } + + @Test + public void testStartBundleException() throws Exception { + BundleStartStatus sStatus; + provisioner.getServices(mockBundleContext); + + // D -- existing bundle with EXCEPTION; + // one call to b.start, throws bundle exception + + final BundleException testEx = new BundleException("Expected exception starting bundle"); + + context.checking(new Expectations() { + { + one(mockBundle).getState(); + will(returnValue(org.osgi.framework.Bundle.RESOLVED)); + + one(mockBundle).start(with(any(int.class))); + will(throwException(testEx)); + + one(mockBundle).getSymbolicName(); + will(returnValue("mockBundle")); + } + }); + + List bList = new ArrayList(); + bList.add(mockBundle); + + sStatus = provisioner.startBundles(bList); + + assertTrue(sStatus.startExceptions()); + assertNotNull(sStatus.traceStartExceptions()); + + Map badness = sStatus.getStartExceptions(); + assertTrue(badness.keySet().contains(mockBundle)); + assertEquals(badness.get(mockBundle), testEx); + } + + @Test(expected = LaunchException.class) + public void testInstallStatusInstallException() { + final String m = "testInstallStatusInstallException"; + try { + final BundleInstallStatus iStatus = new BundleInstallStatus(); + iStatus.addInstallException("bundleName", new Throwable("pretend error")); + + provisioner.getServices(mockBundleContext); + provisioner.checkInstallStatus(iStatus); + } catch (LaunchException b) { + if (!b.getMessage().contains("installing")) + outputMgr.failWithThrowable(m, new AssertionError("exception message does not contain message about exceptions while installing bundles")); + + throw b; // expected + } + } + + @Test(expected = LaunchException.class) + public void testInstallStatusMissingBundles() { + final String m = "testInstallStatusMissingBundles"; + try { + final BundleInstallStatus iStatus = new BundleInstallStatus(); + iStatus.addMissingBundle("missing"); + + provisioner.getServices(mockBundleContext); + provisioner.checkInstallStatus(iStatus); + } catch (LaunchException b) { + if (!b.getMessage().contains("Missing")) + outputMgr.failWithThrowable(m, new AssertionError("exception message does not contain message about missing bundles")); + + throw b; // expected + } + } + + @Test(expected = LaunchException.class) + public void testInstallStatusNoBundles() { + final String m = "testInstallStatusNoBundles"; + + try { + final BundleInstallStatus iStatus = new BundleInstallStatus(); + + // no bundles to start.. + provisioner.getServices(mockBundleContext); + provisioner.checkInstallStatus(iStatus); + } catch (LaunchException b) { + if (!b.getMessage().contains("No required bundles")) + outputMgr.failWithThrowable(m, new AssertionError("exception message does not contain message about no bundles to start")); + + throw b; // expected + } + } + + @Test(expected = LaunchException.class) + public void testCheckStartStatusStartException() throws InvalidBundleContextException { + + context.checking(new Expectations() { + { + oneOf(mockBundle).getLocation(); + will(returnValue("bundle location")); + } + }); + + BundleStartStatus startStatus = new BundleStartStatus(); + startStatus.addStartException(mockBundle, new BundleException("fake exception")); + + provisioner.getServices(mockBundleContext); + provisioner.checkStartStatus(startStatus); + } + + @Test(expected = InvalidBundleContextException.class) + public void testCheckStartStatusInvalidContext() throws InvalidBundleContextException { + BundleStartStatus startStatus = new BundleStartStatus(); + startStatus.markContextInvalid(); + + provisioner.getServices(mockBundleContext); + provisioner.checkStartStatus(startStatus); + } + + protected void recordExceptions(BundleInstallStatus iStatus) { + + if (iStatus.installExceptions()) { + Map exceptions = iStatus.getInstallExceptions(); + for (String key : exceptions.keySet()) { + Throwable t = exceptions.get(key); + System.out.println("+UNEXPECTED EXCEPTION for " + key); + System.out.println("ex: " + t.getMessage()); + t.printStackTrace(System.out); + } + } + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/LocalBundleRepositoryTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/LocalBundleRepositoryTest.java new file mode 100755 index 000000000000..8934454e7d6e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/LocalBundleRepositoryTest.java @@ -0,0 +1,146 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.provisioining; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.osgi.framework.VersionRange; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.provisioning.ContentBasedLocalBundleRepository; + +/** + * + */ +public class LocalBundleRepositoryTest { + private final SharedOutputManager outputMgr = SharedOutputManager.getInstance().trace("*=all"); + @Rule + public final TestRule outputRule = outputMgr; + + private static File cacheDir; + + @BeforeClass + public static void setupCache() throws IOException { + cacheDir = TestUtils.createTempDirectory("cache.data"); + } + + /** + * This method checks that if the location attribute identifies an exact file we use that rather than applying the iFix selection rules. + */ + @Test + public void testFullySpecifiedLocation() { + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/lbr"), cacheDir, true); + File f = lbr.selectBundle("lib/a.b_1.0.jar", "a.b", new VersionRange("0.0.0")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "a.b_1.0.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + lbr.dispose(); + } + + /** + * This method tests that if we don't have iFixes, or fix pack updates to a bundle we install the correct bundle. This + * is very low level belts and braces. If we don't do this right all BVTs are going to fail. + */ + @Test + public void testSelectSingleMatch() { + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/lbr"), cacheDir, true); + File f = lbr.selectBundle("", "x.y", new VersionRange("[1.0.0,1.0.100)")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "x.y_1.0.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + lbr.dispose(); + } + + /** + * This is the key iFix install routine. It is testing that when we have multiple iFixes for a fix pack we select the most + * recent one. It also checks that we ignore iFixes for fixpack jars that have not been installed. So this is really important. + */ + @Test + public void testSelectMultiMatch() { + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/lbr"), cacheDir, true); + File f = lbr.selectBundle("", "a.b", new VersionRange("[1.0.0,1.0.100)")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "a.b_1.0.1.v2.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + assertTrue("The ifix warning message (CWWKE0060W) was not output", outputMgr.checkForMessages("CWWKE0060W")); + assertTrue("The ifix warning message did not identify the iFix a.b_1.0.2.v1.jar", outputMgr.checkForMessages("a.b_1.0.2.v1.jar")); + assertTrue("The ifix warning message did not identify the base a.b_1.0.2.v1.jar", outputMgr.checkForMessages("a.b_1.0.2.jar")); + lbr.dispose(); + } + + /** + * This test ensures that if you have different bundles with the same symbolic name but different versions, and the bundle versions don't have + * qualifiers i.e. they are not ifix/apar bundles, that the bundle with the highest version is selected. + */ + @Test + public void testMultipleVersionedBundlesWithNoQualifiers() { + // We specifically don't want the cache because we are using a different bundle repository. If we use the cache this goes boom. + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/nonIFixLBR"), null, true); + File f = lbr.selectBundle("", "a.b", new VersionRange("[1.0.0,1.0.100)")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "a.b_1.0.1.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + lbr.dispose(); + } + + /** + * This method checks that we can select jars from two locations. We should pick the most recent from both locations. In + * the test the base jar 1.0.2 is in dev and the iFixes are in lib. We should pick up the iFixes and ignore the ones in + * dev. + */ + @Test + public void testMultipleLocations() { + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/lbr"), cacheDir, true); + File f = lbr.selectBundle("dev/,lib/", "a.b", new VersionRange("[1.0.0,1.0.100)")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "a.b_1.0.2.v1.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + f = lbr.selectBundle("dev/", "a.b", new VersionRange("[1.0.0,1.0.100)")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "bad.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + lbr.dispose(); + } + + /** + * This method checks that we can select and return jars that don't match the naming convetion, but where the content + * correctly identifies the jar. In this case we select dev and lib and select bundles up to 1.0.2, excluding iFixes. + * The jar is called bad.jar, but the SymbolicName is a.b and version is 1.0.2. + */ + @Test + public void testBadlyNamedJar() { + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/lbr"), cacheDir, true); + File f = lbr.selectBundle("dev/,lib/", "a.b", new VersionRange("[1.0.0,1.0.2]")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "bad.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + lbr.dispose(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/ServiceFingerprintTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/ServiceFingerprintTest.java new file mode 100755 index 000000000000..cb97c3a89029 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/ServiceFingerprintTest.java @@ -0,0 +1,152 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.provisioining; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.Properties; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; + +import com.ibm.ws.kernel.boot.internal.FileUtils; +import com.ibm.ws.kernel.provisioning.ServiceFingerprint; + +/** + * + */ +public class ServiceFingerprintTest { + private static File workArea = new File("build/service.print/workarea/"); + private static File installDir = new File("../build.image/wlp"); + @Rule + public TestRule sharedOutputRuleThingy = SharedOutputManager.getInstance(); + + @Before + public void setup() { + new File(workArea, "platform").mkdirs(); + ServiceFingerprint.hasServiceBeenApplied(installDir, workArea); + ServiceFingerprint.putInstallDir(null, installDir); + } + + /** + * Add a single file to the ServiceFingerprint. Then check to see if service has been applied. Since the file has not + * changed it should not have changed. + */ + @Test + public void checkServiceDetectionWithNoChanges() { + ServiceFingerprint.put(new File("resources/packages.list")); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + } + + /** + * Add two files to the ServiceFingerprint. One doesn't change. One is deleted. Then check to see if service has been applied. + * Since a file is deleted it should return true for the final call to hasServiceBeenApplied. + */ + @Test + public void checkServiceDetectionWithFileDelete() throws IOException { + ServiceFingerprint.put(new File("resources/packages.list")); + File tmp = File.createTempFile("test", ".txt"); + PrintStream out = new PrintStream(tmp); + out.println("some data"); + out.close(); + ServiceFingerprint.put(tmp); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + tmp.delete(); + assertTrue("We should have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + } + + /** + * Add two files to the ServiceFingerprint. One doesn't change. One doesn't exist when it is initially added. The + * file is then created before checking to see if service has been applied. + * Since a file is added it should return true for the final call to hasServiceBeenApplied. + */ + @Test + public void checkServiceDetectionWithFileCreation() throws IOException { + ServiceFingerprint.put(new File("resources/packages.list")); + File tmp = File.createTempFile("test", ".txt"); + tmp.delete(); + ServiceFingerprint.put(tmp); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + PrintStream out = new PrintStream(tmp); + out.println("some data"); + out.close(); + assertTrue("We should have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + tmp.delete(); + } + + /** + * Add two files to the ServiceFingerprint. One doesn't change. One does. Then check to see if service has been applied. + * Since a file has changed it should return true for the final call to hasServiceBeenApplied. + */ + @Test + public void checkServiceDetectionWithFileChange() throws IOException { + ServiceFingerprint.put(new File("resources/packages.list")); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + File tmp = File.createTempFile("test", ".txt"); + tmp.delete(); + PrintStream out = new PrintStream(tmp); + out.println("some data"); + out.close(); + ServiceFingerprint.put(tmp); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + out = new PrintStream(tmp); + out.println("some totally new data"); + out.close(); + assertTrue("We should have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + tmp.delete(); + } + + /** + * Add two files to the ServiceFingerprint. One doesn't change. One is deleted. Then check to see if service has been applied. + * Since a file is deleted it should return true for the final call to hasServiceBeenApplied. + */ + @Test + public void checkServiceDetectionWithFileDeleteAndClear() throws IOException { + File tmpInstall = File.createTempFile("wlp", null); + tmpInstall.delete(); + File tmpVersions = new File(tmpInstall, "lib/versions/"); + tmpVersions.mkdirs(); + File tmpServiceFingerprint = new File(tmpVersions, "service.fingerprint"); + PrintStream out = new PrintStream(tmpServiceFingerprint); + out.println("some data"); + out.close(); + ServiceFingerprint.putInstallDir(null, tmpInstall); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(tmpInstall, workArea)); + // rename the install area + File renameTmpInstall = new File(tmpInstall.getParentFile(), tmpInstall.getName() + "2"); + tmpInstall.renameTo(renameTmpInstall); + assertTrue("We should have detected a file change", ServiceFingerprint.hasServiceBeenApplied(tmpInstall, workArea)); + ServiceFingerprint.clear(); + ServiceFingerprint.putInstallDir(null, renameTmpInstall); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(renameTmpInstall, workArea)); + FileUtils.recursiveClean(renameTmpInstall); + } + + @After + public void cleanup() throws FileNotFoundException, IOException { + Properties props = new Properties(); + props.store(new FileOutputStream(new File(workArea, "platform/service.fingerprint")), null); + ServiceFingerprint.hasServiceBeenApplied(installDir, workArea); + new File("build/service.print/workarea/platform/service.fingerprint").delete(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/Constants.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/Constants.java new file mode 100755 index 000000000000..46022b1432bd --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/Constants.java @@ -0,0 +1,52 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * Change activity: + * + * Issue Date Name Description + * ----------- ----------- --------- ------------------------------------ + * Initial version + */ +package test.shared; + +import java.io.File; + +/** + * + */ +public class Constants { + /** + * Test data directory: note the space! always test paths with spaces. + * Dratted windows. + */ + public static final String TEST_DATA_DIR = "../com.ibm.ws.kernel.boot_test/build/unittest/test data/"; + + public static final File TEST_DATA_FILE = new File(TEST_DATA_DIR); + + /** Test dist dir: where our generated sample jars live */ + public static final String TEST_DIST_DIR = "../com.ibm.ws.kernel.boot_test/build/unittest/test data/lib/"; + + /** Test dist dir: where our generated sample jars live */ + public static final File TEST_DIST_DIR_FILE = new File(TEST_DIST_DIR); + + public static final String TEST_PLATFORM_DIR = "../com.ibm.ws.kernel.boot_test/build/unittest/test data/lib/platform/"; + + public static final String TEST_TMP_ROOT = "../com.ibm.ws.kernel.boot_test/build/tmp/"; + + public static final File TEST_TMP_ROOT_FILE = new File(TEST_TMP_ROOT); + + /** The dist dir containing the real jar file for the bootstrap */ + public static final String BOOTSTRAP_LIB_DIR = "../com.ibm.ws.kernel.boot/build/lib/"; + + public static final String BOOTSTRAP_PUBLISH_DIR = "../com.ibm.ws.kernel.boot/publish/"; + + public static final String MOCK_FRAMEWORK_LAUNCH = "MOCK_FRAMEWORK_LAUNCH"; +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/DumpTimerRule.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/DumpTimerRule.java new file mode 100755 index 000000000000..1c6b04e6fcb3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/DumpTimerRule.java @@ -0,0 +1,91 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.shared; + +import java.io.File; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.kernel.boot.internal.commands.JavaDumpAction; +import com.ibm.ws.kernel.boot.internal.commands.JavaDumper; + +/** + * + */ +public class DumpTimerRule implements TestRule { + + private static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); + + private final long timeoutMillis; + private final File outputDir; + private volatile boolean complete; + + public DumpTimerRule(long timeoutMillis, File outputDir) { + this.timeoutMillis = timeoutMillis; + this.outputDir = outputDir; + } + + /* + * (non-Javadoc) + * + * @see org.junit.rules.TestRule#apply(org.junit.runners.model.Statement, org.junit.runner.Description) + */ + @Override + public Statement apply(Statement statement, Description arg1) { + return new DumpTimerStatement(statement); + } + + private class DumpTimerStatement extends Statement { + private final Statement statement; + + private DumpTimerStatement(Statement statement) { + this.statement = statement; + } + + /* + * (non-Javadoc) + * + * @see org.junit.runners.model.Statement#evaluate() + */ + @Override + public void evaluate() throws Throwable { + DumpThreads dumper = new DumpThreads(); + ScheduledFuture future = scheduler.schedule(dumper, timeoutMillis, TimeUnit.MILLISECONDS); + try { + statement.evaluate(); + } finally { + complete = true; + future.cancel(false); + } + + } + + } + + private class DumpThreads implements Runnable { + + @Override + public void run() { + if (!complete) { + JavaDumper.getInstance().dump(JavaDumpAction.THREAD, outputDir); + } + + } + + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/TestUtils.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/TestUtils.java new file mode 100755 index 000000000000..05012f324c8d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/TestUtils.java @@ -0,0 +1,141 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.shared; + +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.concurrent.atomic.AtomicInteger; + +import com.ibm.ws.kernel.boot.cmdline.Utils; +import com.ibm.ws.kernel.boot.internal.KernelUtils; + +/** + * + */ +public class TestUtils { + private static AtomicInteger count = new AtomicInteger(0); + static Field bootJarField = null; + static Field bootLibDirField = null; + static Field utilsInstallDirField = null; + + public static File findBuiltKernelBundle() { + File root = new File(Constants.BOOTSTRAP_LIB_DIR); + + File fileList[] = root.listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.matches("com.ibm.ws.kernel.boot.*\\.jar"); + } + }); + + if (fileList == null || fileList.length < 1) + throw new RuntimeException("Unable to find com.ibm.ws.kernel.boot.*\\.jar in " + root.getAbsolutePath()); + + return fileList[0]; + } + + public static void setKernelUtilsBootstrapJar(File bootstrapJar) throws Exception { + if (bootJarField == null) { + bootJarField = KernelUtils.class.getDeclaredField("launchHome"); + bootJarField.setAccessible(true); + } + bootJarField.set(null, bootstrapJar); + } + + public static void setKernelUtilsBootstrapLibDir(File bootLibDir) throws Exception { + if (bootLibDirField == null) { + bootLibDirField = KernelUtils.class.getDeclaredField("libDir"); + bootLibDirField.setAccessible(true); + } + bootLibDirField.set(null, bootLibDir); + } + + public static void setUtilsInstallDir(File installDir) throws Exception { + if (utilsInstallDirField == null) { + utilsInstallDirField = Utils.class.getDeclaredField("installDir"); + utilsInstallDirField.setAccessible(true); + } + utilsInstallDirField.set(null, installDir); + } + + public static File createTempFile(String name, String suffix) throws IOException { + if (!Constants.TEST_TMP_ROOT_FILE.isDirectory()) { + Constants.TEST_TMP_ROOT_FILE.mkdirs(); + } + return File.createTempFile(name, suffix, Constants.TEST_TMP_ROOT_FILE); + } + + public static File createTempFile(String name, String suffix, File dir) throws IOException { + return File.createTempFile(name, suffix, dir); + } + + public static File createTempDirectory(String name) throws IOException { + File f = new File(Constants.TEST_TMP_ROOT_FILE, name + count.incrementAndGet()); + + if (!f.exists() && !f.mkdirs()) { + System.out.println("alex: file creation failed for: " + f.getAbsolutePath()); + throw new IOException("Unable to create temporary directory"); + } + return f; + } + + public static void cleanTempFiles(File dir) { + recursiveClean(dir); + } + + public static void cleanTempFiles() { + recursiveClean(Constants.TEST_TMP_ROOT_FILE); + } + + private static boolean recursiveClean(final File fileToRemove) { + if (fileToRemove == null) + return true; + + if (!fileToRemove.exists()) + return true; + + boolean success = true; + + if (fileToRemove.isDirectory()) { + File[] files = fileToRemove.listFiles(); + for (File file : files) { + if (file.isDirectory()) { + success |= recursiveClean(file); + } else { + success |= file.delete(); + } + } + files = fileToRemove.listFiles(); + if (files.length == 0) + success |= fileToRemove.delete(); + } else { + success |= fileToRemove.delete(); + } + return success; + } + + public static Method getMethod(Class subjectClass, String methodName, Class... parameterClasses) throws NoSuchMethodException { + try { + return subjectClass.getDeclaredMethod(methodName, parameterClasses); + } catch (NoSuchMethodException e) { + Class superClass = subjectClass.getSuperclass(); + if (superClass != null) { + return getMethod(superClass, methodName, parameterClasses); + } else { + throw new NoSuchMethodException(); + } + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/lib/md5-2.txt b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/lib/md5-2.txt new file mode 100755 index 000000000000..91dbf2724c8a --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/lib/md5-2.txt @@ -0,0 +1 @@ +Another file for testing MD5. Do not change contents. \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/md5-1.txt b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/md5-1.txt new file mode 100755 index 000000000000..31a2ac49f4ee --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/md5-1.txt @@ -0,0 +1 @@ +File for testing MD5. Do not change contents. \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/usr/ignored.txt b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/usr/ignored.txt new file mode 100755 index 000000000000..c891e9054e0c --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/usr/ignored.txt @@ -0,0 +1 @@ +This file should be ignored by the file list generator. \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/a.b_1.0.2.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/a.b_1.0.2.mf new file mode 100755 index 000000000000..177bf28b64ac --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/a.b_1.0.2.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.2 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/bad.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/bad.jar new file mode 100755 index 000000000000..e72d9cdc23cd Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/bad.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.jar new file mode 100755 index 000000000000..a8ad3ab74ddc Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.mf new file mode 100755 index 000000000000..d1e287c057b5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.jar new file mode 100755 index 000000000000..7a7d36cad520 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.mf new file mode 100755 index 000000000000..04cf5ce5103e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.1 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.jar new file mode 100755 index 000000000000..98bbadc01fc2 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.mf new file mode 100755 index 000000000000..a9d0a16987b2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.mf @@ -0,0 +1,4 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.1.v1 +IBM-Interim-Fixes: PQ1234 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.jar new file mode 100755 index 000000000000..5b1f20a19feb Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.mf new file mode 100755 index 000000000000..98eddeddcfcb --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.mf @@ -0,0 +1,4 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.1.v2 +IBM-Test-Fixes: PK1234 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.jar new file mode 100755 index 000000000000..a9cbe3740937 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.mf new file mode 100755 index 000000000000..7d909d5851c2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.100 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.jar new file mode 100755 index 000000000000..246c26cc3666 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.mf new file mode 100755 index 000000000000..6c3ffc629a3d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.mf @@ -0,0 +1,4 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.2.v1 +IBM-Test-Fixes: PK1234 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.jar new file mode 100755 index 000000000000..56b4c60a3192 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.mf new file mode 100755 index 000000000000..b8f69510b0b4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b; singleton:=true +Bundle-Version: 1.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/dummy.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/dummy.jar new file mode 100755 index 000000000000..3fbb1489bcde Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/dummy.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/binaryLogging-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/binaryLogging-1.0.mf new file mode 100755 index 000000000000..242af6b39e95 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/binaryLogging-1.0.mf @@ -0,0 +1,15 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: binaryLogging-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.binary.logging-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +WebSphere-LogProvider: com.ibm.ws.logging.internal.hpel.HpelLogProviderImpl + +## +## This relies on defaultLogging. We include a location hint to +## assist with bootstrapping. This is not generally applicable (don't copy). +## +Subsystem-Content: com.ibm.websphere.appserver.logging-1.0; location:="lib/platform/defaultLogging-1.0.mf"; type="osgi.subsystem.feature", + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/defaultLogging-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/defaultLogging-1.0.mf new file mode 100755 index 000000000000..f6f835186b72 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/defaultLogging-1.0.mf @@ -0,0 +1,12 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: defaultLogging-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.logging-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +WebSphere-LogProvider: com.ibm.ws.logging.internal.impl.LogProviderImpl + +Subsystem-Content: a.b; version="[1,1.0.100)"; type="boot.jar", + a.b; version="[1,1.0.100)" + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/emptyLogging-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/emptyLogging-1.0.mf new file mode 100755 index 000000000000..4a524e0d0b3c --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/emptyLogging-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: emptyLogging-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.logging-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +WebSphere-LogProvider: dummy.LogProvider + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/extension-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/extension-1.0.mf new file mode 100755 index 000000000000..de2a12fb7694 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/extension-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: com.ibm.websphere.appserver.logging-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +Subsystem-Content: a.b; version="[1,1.0.100)"; type="boot.jar", + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernel-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernel-1.0.mf new file mode 100755 index 000000000000..fb9341772a5f --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernel-1.0.mf @@ -0,0 +1,64 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: com.ibm.websphere.appserver.kernel-1.0; visibility:=private +Subsystem-Version: 1.0.0 +Subsystem-Content: README.TXT; location:="README.TXT"; type="file", + Copyright.txt; location:="Copyright.txt"; type="file", + isadc; location:="bin/isadc"; type="file", + isadc.bat; location:="bin/isadc.bat"; type="file", + productInfo; location:="bin/productInfo"; type="file", + productInfo.bat; location:="bin/productInfo.bat"; type="file", + securityUtility; location:="bin/securityUtility"; type="file", + securityUtility.bat; location:="bin/securityUtility.bat"; type="file", + featureManager; location:="bin/featureManager"; type="file", + featureManager.bat; location:="bin/featureManager.bat"; type="file", + server; location:="bin/server"; type="file", + server.bat; location:="bin/server.bat"; type="file", + ws-featurelist.jar; location:="bin/tools/ws-featurelist.jar"; type="file", + ws-featureManager.jar; location:="bin/tools/ws-featureManager.jar"; type="file", + ws-isadc.jar; location:="bin/tools/ws-isadc.jar"; type="file", + ws-productutil.jar; location:="bin/tools/ws-productutil.jar"; type="file", + ws-schemagen.jar; location:="bin/tools/ws-schemagen.jar"; type="file", + ws-securityutil.jar; location:="bin/tools/ws-securityutil.jar"; type="file", + cachespec.dtd; location:="dev/api/ibm/schema/cachespec.dtd"; type="file", + ibm-application-bnd_1_0.xsd; location:="dev/api/ibm/schema/ibm-application-bnd_1_0.xsd"; type="file", + ibm-application-bnd_1_1.xsd; location:="dev/api/ibm/schema/ibm-application-bnd_1_1.xsd"; type="file", + ibm-application-ext_1_0.xsd; location:="dev/api/ibm/schema/ibm-application-ext_1_0.xsd"; type="file", + ibm-application-ext_1_1.xsd; location:="dev/api/ibm/schema/ibm-application-ext_1_1.xsd"; type="file", + ibm-common-bnd_1_0.xsd; location:="dev/api/ibm/schema/ibm-common-bnd_1_0.xsd"; type="file", + ibm-common-bnd_1_1.xsd; location:="dev/api/ibm/schema/ibm-common-bnd_1_1.xsd"; type="file", + ibm-common-ext_1_0.xsd; location:="dev/api/ibm/schema/ibm-common-ext_1_0.xsd"; type="file", + ibm-common-ext_1_1.xsd; location:="dev/api/ibm/schema/ibm-common-ext_1_1.xsd"; type="file", + ibm-ejb-jar-bnd_1_0.xsd; location:="dev/api/ibm/schema/ibm-ejb-jar-bnd_1_0.xsd"; type="file", + ibm-ejb-jar-bnd_1_1.xsd; location:="dev/api/ibm/schema/ibm-ejb-jar-bnd_1_1.xsd"; type="file", + ibm-ejb-jar-ext_1_0.xsd; location:="dev/api/ibm/schema/ibm-ejb-jar-ext_1_0.xsd"; type="file", + ibm-ejb-jar-ext_1_1.xsd; location:="dev/api/ibm/schema/ibm-ejb-jar-ext_1_1.xsd"; type="file", + ibm-managed-bean-bnd_1_0.xsd; location:="dev/api/ibm/schema/ibm-managed-bean-bnd_1_0.xsd"; type="file", + ibm-web-bnd_1_0.xsd; location:="dev/api/ibm/schema/ibm-web-bnd_1_0.xsd"; type="file", + ibm-web-bnd_1_1.xsd; location:="dev/api/ibm/schema/ibm-web-bnd_1_1.xsd"; type="file", + ibm-web-ext_1_0.xsd; location:="dev/api/ibm/schema/ibm-web-ext_1_0.xsd"; type="file", + ibm-web-ext_1_1.xsd; location:="dev/api/ibm/schema/ibm-web-ext_1_1.xsd"; type="file", + com.ibm.websphere.appserver.spi.kernel.filemonitor; location:="dev/spi/ibm/com.ibm.websphere.appserver.spi.kernel.filemonitor_1.0.0.jar"; type="jar", + com.ibm.websphere.appserver.spi.kernel.service; location:="dev/spi/ibm/com.ibm.websphere.appserver.spi.kernel.service_1.0.0.jar"; type="jar", + com.ibm.websphere.appserver.spi.kernel.metatype; location:="dev/spi/ibm/com.ibm.websphere.appserver.spi.kernel.metatype_1.0.0.jar"; type="jar", + com.ibm.websphere.appserver.spi.logging; location:="dev/spi/ibm/com.ibm.websphere.appserver.spi.logging_1.1.0.jar"; type="jar", + com.ibm.websphere.appserver.spi.kernel.filemonitor_1.0-javadoc.zip; location:="dev/spi/ibm/javadoc/com.ibm.websphere.appserver.spi.kernel.filemonitor_1.0-javadoc.zip"; type="file", + com.ibm.websphere.appserver.spi.kernel.metatype_1.0-javadoc.zip; location:="dev/spi/ibm/javadoc/com.ibm.websphere.appserver.spi.kernel.metatype_1.0-javadoc.zip"; type="file", + com.ibm.websphere.appserver.spi.kernel.service_1.0-javadoc.zip; location:="dev/spi/ibm/javadoc/com.ibm.websphere.appserver.spi.kernel.service_1.0-javadoc.zip"; type="file", + com.ibm.websphere.appserver.spi.logging_1.1-javadoc.zip; location:="dev/spi/ibm/javadoc/com.ibm.websphere.appserver.spi.logging_1.1-javadoc.zip"; type="file", + com.ibm.websphere.appserver.spi.threading_1.0.0.jar; location:="dev/spi/ibm/com.ibm.websphere.appserver.spi.threading_1.0.0.jar"; type="jar", + com.ibm.websphere.appserver.spi.threading_1.0-javadoc.zip; location:="dev/spi/ibm/javadoc/com.ibm.websphere.appserver.spi.threading_1.0-javadoc.zip"; type="file", + osgi.core; location:="dev/spi/spec/com.ibm.wsspi.org.osgi.core.5.0.0_1.0.0.jar"; type="jar", + wlp-anttasks.jar; location:="dev/tools/ant/wlp-anttasks.jar"; type="file", + bootstrap-agent.jar; location:="lib/bootstrap-agent.jar"; type="file", + ws-launch.jar; location:="lib/ws-launch.jar"; type="file", + com.ibm.ws.org.apache.commons.lang.2.4_1.0.0.jar; location:="lib/com.ibm.ws.org.apache.commons.lang.2.4_1.0.0.jar"; type="jar", + com.ibm.rls.og_1.0.jar; location:="lib/com.ibm.rls.og_1.0.jar"; type="jar", + com.ibm.ws.anno.servlet_1.0.1.jar; location:="lib/com.ibm.ws.anno.servlet_1.0.1.jar"; type="jar", + com.ibm.ws.managedobject_1.0.jar; location:="lib/com.ibm.ws.managedobject_1.0.jar"; type="jar", + com.ibm.ws.product.utility_1.0.2.jar; location:="lib/com.ibm.ws.product.utility_1.0.2.jar"; type="jar", + com.ibm.ws.security.utility_1.0.3.jar; location:="lib/com.ibm.ws.security.utility_1.0.3.jar"; type="jar", + com.ibm.ws.timedoperations_1.0.jar; location:="lib/com.ibm.ws.timedoperations_1.0.jar"; type="jar", + internal-isadc.bat; location:="lib/tools/internal-isadc.bat";type="file", + .isadc; location:="lib/tools/.isadc";type="file" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCore-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCore-1.0.mf new file mode 100755 index 000000000000..e5fe928b8454 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCore-1.0.mf @@ -0,0 +1,13 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: kernelCore-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.kernelCore-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +WebSphere-LogProvider: dummy.LogProvider + +Subsystem-Content: com.ibm.websphere.appserver.kernel-1.0; type="osgi.subsystem.feature", + x.y; version="[1.0.0,1.0.100)"; type="boot.jar", + x.y; version="[1.0.0,1.0.100)"; start-phase:=BOOTSTRAP, + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCoreMissing-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCoreMissing-1.0.mf new file mode 100755 index 000000000000..bc67f16575f9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCoreMissing-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: com.ibm.websphere.appserver.kernelCore-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +Subsystem-Content: com.ibm.websphere.appserver.kernel-1.0; type="osgi.subsystem.feature", + x.y; version="[1.0.0,1.0.100)"; type="boot.jar", + p.q; version="[1.0.0,1.0.100)", + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/missingJar-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/missingJar-1.0.mf new file mode 100755 index 000000000000..5ddf4899c710 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/missingJar-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: emptyLogging-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.logging-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +Subsystem-Content: com.ibm.websphere.appserver.kernel-1.0; type="osgi.subsystem.feature", + p.q; version="[1.0.0,1.0.100)"; type="boot.jar" + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/rebuildjars.bat b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/rebuildjars.bat new file mode 100755 index 000000000000..290d4f763505 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/rebuildjars.bat @@ -0,0 +1,15 @@ +set JAR=c:\java60\bin\jar + +for /r %%i in (*.jar) do ( + if exist %%~ni.mf ( + echo "%%~ni" + mkdir "%%~ni" + cd %%~ni + %JAR% xvf "%%i" + cd .. + del "%%i" + %JAR% cvmf "%%~ni.mf" "%%i" -C "%%~ni" . + del /s/q "%%~ni" + rmdir /s/q "%%~ni" + ) + ) \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.jar new file mode 100755 index 000000000000..155f46165f99 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.mf new file mode 100755 index 000000000000..f430599b2d7d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: x.y +Bundle-Version: 1.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/include.properties b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/include.properties new file mode 100755 index 000000000000..2b550e2ae727 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/include.properties @@ -0,0 +1,3 @@ +bootstrap.include=peer.properties, ../platform/relative.properties +dummy=true +override=original \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/peer.properties b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/peer.properties new file mode 100755 index 000000000000..f1d7c4837a10 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/peer.properties @@ -0,0 +1,2 @@ +override=peer +peer=found \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/relative.properties b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/relative.properties new file mode 100755 index 000000000000..82d0ad91bcd6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/relative.properties @@ -0,0 +1,2 @@ +override=relative +relative=found \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/testDefNoEquals.map b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/testDefNoEquals.map new file mode 100755 index 000000000000..38467bdd9ade --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/testDefNoEquals.map @@ -0,0 +1,2 @@ +Alpine-ListVersion=a +TestStringNoValue \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..825482e73eb0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,7 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=$LIBERTY_VERSION$ +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition=BASE_ILAN +com.ibm.websphere.productLicenseType=ILAN diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.0.jar new file mode 100755 index 000000000000..09cf269ca3a8 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.1.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.1.jar new file mode 100755 index 000000000000..94f8985caa1a Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.100.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.100.jar new file mode 100755 index 000000000000..35bf68176aa5 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.100.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.jar new file mode 100755 index 000000000000..dc6ee8852999 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/x.y_1.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/x.y_1.0.jar new file mode 100755 index 000000000000..51d7da73ab6a Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/x.y_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources1.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources1.jar new file mode 100755 index 000000000000..be7b833e8d22 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources2.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources2.jar new file mode 100755 index 000000000000..31d30e11c4f8 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources2.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/signed/bad.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/signed/bad.jar new file mode 100755 index 000000000000..6dcf2c836172 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/signed/bad.jar differ diff --git a/dev/com.ibm.ws.kernel.cmdline_test/.classpath b/dev/com.ibm.ws.kernel.cmdline_test/.classpath index 42684bba7cea..bd880329225d 100755 --- a/dev/com.ibm.ws.kernel.cmdline_test/.classpath +++ b/dev/com.ibm.ws.kernel.cmdline_test/.classpath @@ -1,8 +1,7 @@ - - - - - + + + + diff --git a/dev/com.ibm.ws.kernel.cmdline_test/.classpath.gradle b/dev/com.ibm.ws.kernel.cmdline_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.kernel.cmdline_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.cmdline_test/.project b/dev/com.ibm.ws.kernel.cmdline_test/.project index eb5c130b7d8f..4f554ed23c6c 100755 --- a/dev/com.ibm.ws.kernel.cmdline_test/.project +++ b/dev/com.ibm.ws.kernel.cmdline_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.kernel.cmdline_test/bnd.bnd b/dev/com.ibm.ws.kernel.cmdline_test/bnd.bnd new file mode 100755 index 000000000000..f37a202410bd --- /dev/null +++ b/dev/com.ibm.ws.kernel.cmdline_test/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.kernel.cmdline;version=latest diff --git a/dev/com.ibm.ws.kernel.cmdline_test/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.cmdline_test/bnd.bnd.gradle new file mode 100755 index 000000000000..f37a202410bd --- /dev/null +++ b/dev/com.ibm.ws.kernel.cmdline_test/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.kernel.cmdline;version=latest diff --git a/dev/com.ibm.ws.threading_test/build.nogradle b/dev/com.ibm.ws.kernel.cmdline_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.threading_test/build.nogradle rename to dev/com.ibm.ws.kernel.cmdline_test/build.gradle diff --git a/dev/com.ibm.ws.kernel.feature/bnd.bnd b/dev/com.ibm.ws.kernel.feature/bnd.bnd index 3f1f7943ce8c..890b52b19577 100755 --- a/dev/com.ibm.ws.kernel.feature/bnd.bnd +++ b/dev/com.ibm.ws.kernel.feature/bnd.bnd @@ -11,7 +11,7 @@ Export-Package: \ com.ibm.wsspi.kernel.feature;provide:=true Import-Package: \ - !com.sun.tools.attach,${defaultPackageImport} + !com.sun.tools.attach, !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * # NOTE: ODDNESS. we're including wlp.lib.extract as a package. The contents of # that package are provided by wlp.lib.extract project! Dependency-wise, it's better to diff --git a/dev/com.ibm.ws.kernel.feature_bvt/.classpath b/dev/com.ibm.ws.kernel.feature_bvt/.classpath index ead81e3409c3..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.kernel.feature_bvt/.classpath +++ b/dev/com.ibm.ws.kernel.feature_bvt/.classpath @@ -1,16 +1,7 @@ - - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.kernel.feature_bvt/.classpath.gradle b/dev/com.ibm.ws.kernel.feature_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_bvt/.project b/dev/com.ibm.ws.kernel.feature_bvt/.project index 50fee205278e..9fa21e274c70 100755 --- a/dev/com.ibm.ws.kernel.feature_bvt/.project +++ b/dev/com.ibm.ws.kernel.feature_bvt/.project @@ -11,13 +11,13 @@ - com.ibm.ws.rasplugin.RASValidationBuilder + bndtools.core.bndbuilder org.eclipse.jdt.core.javanature - com.ibm.ws.rasplugin.RASValidationNature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.kernel.feature_bvt/bnd.bnd b/dev/com.ibm.ws.kernel.feature_bvt/bnd.bnd new file mode 100755 index 000000000000..66357bda84e2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_bvt/bnd.bnd @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +instrument.disabled: true + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.kernel.feature_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.feature_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..66357bda84e2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_bvt/bnd.bnd.gradle @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +instrument.disabled: true + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.zos.command.processing_test/build.nogradle b/dev/com.ibm.ws.kernel.feature_bvt/build.gradle similarity index 100% rename from dev/com.ibm.ws.zos.command.processing_test/build.nogradle rename to dev/com.ibm.ws.kernel.feature_bvt/build.gradle diff --git a/dev/com.ibm.ws.kernel.feature_fat/.classpath b/dev/com.ibm.ws.kernel.feature_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/.classpath.gradle b/dev/com.ibm.ws.kernel.feature_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/.gitignore b/dev/com.ibm.ws.kernel.feature_fat/.gitignore new file mode 100644 index 000000000000..57b341172a1b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/generated/ diff --git a/dev/com.ibm.ws.kernel.feature_fat/.project b/dev/com.ibm.ws.kernel.feature_fat/.project new file mode 100755 index 000000000000..6e531391609f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.feature_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.feature_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.feature_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.feature_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..845c3083c7df --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.feature_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.feature_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..fadbc117581b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=true +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.feature_fat/bnd.bnd b/dev/com.ibm.ws.kernel.feature_fat/bnd.bnd new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.kernel.feature_fat/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.feature_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.kernel.feature_fat/build-test.xml b/dev/com.ibm.ws.kernel.feature_fat/build-test.xml new file mode 100755 index 000000000000..7a7d2d0aabdc --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/build-test.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.zos.core_test/build.nogradle b/dev/com.ibm.ws.kernel.feature_fat/build.gradle similarity index 100% rename from dev/com.ibm.ws.zos.core_test/build.nogradle rename to dev/com.ibm.ws.kernel.feature_fat/build.gradle diff --git a/dev/com.ibm.ws.kernel.feature_fat/delivery.sets b/dev/com.ibm.ws.kernel.feature_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/AutoFeaturesTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/AutoFeaturesTest.java new file mode 100755 index 000000000000..f6a8feb9c63a --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/AutoFeaturesTest.java @@ -0,0 +1,2073 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.ExpectedFFDC; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +@Mode(TestMode.FULL) +public class AutoFeaturesTest { + + private static final Class c = AutoFeaturesTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.autofeature"); + private static final Logger logger = Logger.getLogger(AutoFeaturesTest.class.getName()); + private static final String FEATURE_PROVISIONER_CONTEXT_ROOT = "/feature/provisioner"; + + private static final String USR_FEATURE_A_MF = "ufeatureA-1.0.mf"; + private static final String USR_FEATURE_B_MF = "ufeatureB-1.0.mf"; + private static final String USR_FEATURE_C_MF = "ufeatureC-1.0.mf"; + private static final String USR_FEATURE_D_MF = "ufeatureD-1.0.mf"; + + private static final String USR_FEATURE_H_MF = "ufeatureH-1.0.mf"; + private static final String USR_FEATURE_I_MF = "ufeatureI-1.0.mf"; + + private static final String USR_AUTO_FEATURE_E_MF = "ufeatureE-1.0.mf"; + private static final String USR_AUTO_FEATURE_F_MF = "ufeatureF-1.0.mf"; + private static final String USR_AUTO_FEATURE_G_MF = "ufeatureG-1.0.mf"; + private static final String USR_AUTO_FEATURE_J_MF = "ufeatureJ-1.0.mf"; + private static final String USR_AUTO_FEATURE_L_MF = "ufeatureL-1.0.mf"; + private static final String USR_AUTO_FEATURE_M_MF = "ufeatureM-1.0.mf"; + private static final String USR_AUTO_FEATURE_N_MF = "ufeatureN-1.0.mf"; + + private static final String[] userFeatures = { USR_FEATURE_A_MF, USR_FEATURE_B_MF, USR_FEATURE_C_MF, USR_FEATURE_D_MF, + USR_FEATURE_H_MF, USR_FEATURE_I_MF, USR_AUTO_FEATURE_E_MF, + USR_AUTO_FEATURE_F_MF, USR_AUTO_FEATURE_G_MF, USR_AUTO_FEATURE_J_MF, + USR_AUTO_FEATURE_L_MF, USR_AUTO_FEATURE_M_MF, USR_AUTO_FEATURE_N_MF }; + private static final String USR_FEATURE_PATH = "usr/extension/lib/features/"; + private static final String USR_BUNDLE_PATH = "usr/extension/lib/"; + + private static final String PRODUCT_FEATURE_A_MF = "pfeatureA-1.0.mf"; + private static final String PRODUCT_FEATURE_B_MF = "pfeatureB-1.0.mf"; + private static final String PRODUCT_FEATURE_C_MF = "pfeatureC-1.0.mf"; + private static final String PRODUCT_FEATURE_D_MF = "pfeatureD-1.0.mf"; + + private static final String PRODUCT_FEATURE_H_MF = "pfeatureH-1.0.mf"; + private static final String PRODUCT_FEATURE_I_MF = "pfeatureI-1.0.mf"; + + private static final String PRODUCT_AUTO_FEATURE_E_MF = "pfeatureE-1.0.mf"; + private static final String PRODUCT_AUTO_FEATURE_F_MF = "pfeatureF-1.0.mf"; + private static final String PRODUCT_AUTO_FEATURE_G_MF = "pfeatureG-1.0.mf"; + private static final String PRODUCT_AUTO_FEATURE_J_MF = "pfeatureJ-1.0.mf"; + private static final String PRODUCT_AUTO_FEATURE_L_MF = "pfeatureL-1.0.mf"; + private static final String PRODUCT_AUTO_FEATURE_M_MF = "pfeatureM-1.0.mf"; + private static final String PRODUCT_AUTO_FEATURE_N_MF = "pfeatureN-1.0.mf"; + + private static final String[] productFeatures = { PRODUCT_FEATURE_A_MF, PRODUCT_FEATURE_B_MF, PRODUCT_FEATURE_C_MF, PRODUCT_FEATURE_D_MF, + PRODUCT_FEATURE_H_MF, PRODUCT_FEATURE_I_MF, PRODUCT_AUTO_FEATURE_E_MF, + PRODUCT_AUTO_FEATURE_F_MF, PRODUCT_AUTO_FEATURE_G_MF, PRODUCT_AUTO_FEATURE_J_MF, + PRODUCT_AUTO_FEATURE_L_MF, PRODUCT_AUTO_FEATURE_M_MF, PRODUCT_AUTO_FEATURE_N_MF }; + private static final String PRODUCT_EXTENSIONS_PATH = "etc/extensions/"; + private static final String PRODUCT_PATH = "productAuto"; + private static final String PRODUCT_FEATURE_PATH = PRODUCT_PATH + "/lib/features/"; + private static final String PRODUCT_BUNDLE_PATH = PRODUCT_PATH + "/lib/"; + private static final String PRODUCT_FEATURE_PROPERTIES_FILE = "productAuto.properties"; + + private static final String PRODUCT2_PATH = "product2Auto"; + private static final String PRODUCT2_FEATURE_PATH = PRODUCT2_PATH + "/lib/features/"; + private static final String PRODUCT2_BUNDLE_PATH = PRODUCT2_PATH + "/lib/"; + private static final String PRODUCT2_FEATURE_PROPERTIES_FILE = "product2Auto.properties"; + + private static final String PRODUCT2_FEATURE_A_MF = "p2featureA-1.0.mf"; + private static final String PRODUCT2_FEATURE_B_MF = "p2featureB-1.0.mf"; + private static final String PRODUCT2_FEATURE_D_MF = "p2featureD-1.0.mf"; + + private static final String PRODUCT2_AUTO_FEATURE_E_MF = "p2featureE-1.0.mf"; + private static final String PRODUCT2_AUTO_FEATURE_G_MF = "p2featureG-1.0.mf"; + private static final String[] product2Features = { PRODUCT2_FEATURE_A_MF, PRODUCT2_FEATURE_B_MF, PRODUCT2_FEATURE_D_MF, + PRODUCT2_AUTO_FEATURE_E_MF, PRODUCT2_AUTO_FEATURE_G_MF }; + + private static final String FEATURE_A_MF = "featureA-1.0.mf"; + private static final String FEATURE_B_MF = "featureB-1.0.mf"; + private static final String FEATURE_C_MF = "featureC-1.0.mf"; + private static final String FEATURE_D_MF = "featureD-1.0.mf"; + + private static final String FEATURE_H_MF = "featureH-1.0.mf"; + private static final String FEATURE_I_MF = "featureI-1.0.mf"; + + private static final String AUTO_FEATURE_E_MF = "featureE-1.0.mf"; + private static final String AUTO_FEATURE_F_MF = "featureF-1.0.mf"; + private static final String AUTO_FEATURE_G_MF = "featureG-1.0.mf"; + + private static final String AUTO_FEATURE_J_MF = "featureJ-1.0.mf"; + + private static final String AUTO_FEATURE_INVALID_HEADER_MF = "invalid_header_feature.mf"; + + private static final String FEATURE_X_MF = "featureXx-1.0.mf"; + private static final String FEATURE_Y_MF = "featureYy-1.0.mf"; + private static final String FEATURE_Z_MF = "featureZz-1.0.mf"; + + private static final String[] features = { FEATURE_A_MF, FEATURE_B_MF, FEATURE_C_MF, FEATURE_D_MF, FEATURE_H_MF, FEATURE_I_MF, + AUTO_FEATURE_E_MF, AUTO_FEATURE_F_MF, AUTO_FEATURE_G_MF, AUTO_FEATURE_J_MF, FEATURE_X_MF, FEATURE_Y_MF, FEATURE_Z_MF }; + + private static final String installFeatureMsgPrefix = "CWWKF0012I: The server installed the following features: \\["; + private static final String uninstallFeatureMsgPrefix = "CWWKF0013I: The server removed the following features: \\["; + private static final String invalidHeaderMsgPrefix = "CWWKF0016I: The filter .*? in the invalid_header_feature feature manifest header is incorrect:"; + + // the number of server cycles to perform before counting any + private static final int PRESTART_IGNORES = 5; + private static final int SAMPLE_SIZE = 25; + + private static final String FEATURE_PATH = "lib/features/"; + private static final String TEST_FEATURE = "skeletonTestFeature"; + private static final String TEST_FEATURE_VERSION = "-1.0.mf"; + private static final String TEST_MF = TEST_FEATURE + TEST_FEATURE_VERSION; + + private static final String CACHE_DIRECTORY = "workarea/platform/"; + private static final String FEATURE_CACHE = CACHE_DIRECTORY + "feature.cache"; + private static final String FEATURE_BUNDLE_CACHE = CACHE_DIRECTORY + "feature.bundles.cache"; + + /** + * Copy the necessary features and bundles to the liberty server directories + * + * @throws Exception + */ + @Mode(TestMode.LITE) + @BeforeClass + public static void setup() throws Exception { + final String METHOD_NAME = "classSetUp"; + + Log.entering(c, METHOD_NAME); + + for (String feature : features) { + Log.info(c, METHOD_NAME, "Copying " + feature + " to " + FEATURE_PATH + "."); + server.copyFileToLibertyInstallRoot(FEATURE_PATH, feature); + } + + for (int i = 1; i < 8; i++) { + Log.info(c, METHOD_NAME, "Copying bundle" + i + "_1.0.0.jar to lib."); + server.copyFileToLibertyInstallRoot("lib", "bundle" + i + "_1.0.0.jar"); + Log.info(c, METHOD_NAME, "Copying ubundle" + i + "_1.0.0.jar to " + USR_BUNDLE_PATH); + server.copyFileToLibertyInstallRoot(USR_BUNDLE_PATH, "ubundle" + i + "_1.0.0.jar"); + Log.info(c, METHOD_NAME, "Copying pbundle" + i + "_1.0.0.jar to " + PRODUCT_BUNDLE_PATH); + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, "pbundle" + i + "_1.0.0.jar"); + Log.info(c, METHOD_NAME, "Copying pbundle" + i + "_1.0.0.jar to " + PRODUCT2_BUNDLE_PATH); + server.copyFileToLibertyInstallRoot(PRODUCT2_BUNDLE_PATH, "p2bundle" + i + "_1.0.0.jar"); + } + + Log.info(c, METHOD_NAME, "Copying bundlex_1.0.0.jar to lib."); + server.copyFileToLibertyInstallRoot("lib", "bundlex_1.0.0.jar"); + Log.info(c, METHOD_NAME, "Copying bundley_1.0.0.jar to lib."); + server.copyFileToLibertyInstallRoot("lib", "bundley_1.0.0.jar"); + Log.info(c, METHOD_NAME, "Copying bundlez_1.0.0.jar to lib."); + server.copyFileToLibertyInstallRoot("lib", "bundlez_1.0.0.jar"); + + for (String feature : userFeatures) { + Log.info(c, METHOD_NAME, "Copying " + feature + " to " + USR_FEATURE_PATH + "."); + server.copyFileToLibertyInstallRoot(USR_FEATURE_PATH, feature); + } + + for (String feature : productFeatures) { + Log.info(c, METHOD_NAME, "Copying " + feature + " to " + PRODUCT_FEATURE_PATH + "."); + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, feature); + } + + for (String feature : product2Features) { + Log.info(c, METHOD_NAME, "Copying " + feature + " to " + PRODUCT2_FEATURE_PATH + "."); + server.copyFileToLibertyInstallRoot(PRODUCT2_FEATURE_PATH, feature); + } + + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT2_FEATURE_PROPERTIES_FILE); + + deleteSkeletons(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This method removes all the testing artifacts from the server directories. + * + * @throws Exception + */ + @Mode(TestMode.LITE) + @AfterClass + public static void cleanup() throws Exception { + final String METHOD_NAME = "classTearDown"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) + server.stopServer(); + + for (String feature : features) { + Log.info(c, METHOD_NAME, FEATURE_PATH + feature + " will be deleted."); + server.deleteFileFromLibertyInstallRoot("lib/features/" + feature); + } + + // Clean up the invalid header. Leaving this in the features dir will cause tests to fail. + server.deleteFileFromLibertyInstallRoot(FEATURE_PATH + AUTO_FEATURE_INVALID_HEADER_MF); + + for (int i = 1; i < 8; i++) { + server.deleteFileFromLibertyInstallRoot("lib/bundle" + i + "_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot(USR_BUNDLE_PATH + "ubundle" + i + "_1.0.0.jar"); + } + server.deleteFileFromLibertyInstallRoot("lib/bundlex_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/bundley_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/bundlez_1.0.0.jar"); + + // Remove the refreshFeatures servlet. + server.deleteFileFromLibertyInstallRoot("lib/test.feature.provisioner_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot(FEATURE_PATH + "test.featureprovisioner_1.0.mf"); + + for (String feature : userFeatures) { + Log.info(c, METHOD_NAME, USR_FEATURE_PATH + feature + " will be deleted."); + server.deleteFileFromLibertyInstallRoot(USR_FEATURE_PATH + feature); + } + + server.deleteDirectoryFromLibertyInstallRoot(PRODUCT_PATH); + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE); + server.deleteDirectoryFromLibertyInstallRoot(PRODUCT2_PATH); + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT2_FEATURE_PROPERTIES_FILE); + + deleteSkeletons(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This method removes the skeleton features that are created as part of the performance test. + * + * @throws Exception + */ + @Mode(TestMode.LITE) + private static void deleteSkeletons() throws Exception { + if (server.fileExistsInLibertyInstallRoot(FEATURE_PATH)) { + for (String oldAutoFeature : server.listLibertyInstallRoot(FEATURE_PATH, TEST_FEATURE)) { + server.deleteFileFromLibertyInstallRoot(FEATURE_PATH + oldAutoFeature); + } + } + } + + @Rule + public TestName testName = new TestName(); + + @Mode(TestMode.LITE) + @After + public void stopServer() throws Exception { + if (server.isStarted()) + server.stopServer(); + } + + /** + * TestDescription: + * This test ensures that auto features are automatically installed when their capability features are installed. The test ensures + * that this happens successfully during server start. + * + * The feature structure is as follows: + * + * featureA, featureB, featureC and featureD are all normal features. + * + * featureE is an auto feature that depends on features A and B. + * featureF is an auto feature that depends on features B and C. + * featureG is an auto feature that depends on auto feature E and normal feature D. + * + * @throws Exception + */ + @Mode(TestMode.LITE) + @Test + public void testAutoFeaturesInstallDuringServerStartup() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Now move the server xml with the all features available + server.setServerConfigurationFile("server_all_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // When the features are installed during a server start we don't get messages issued to the logs about which features are + // installed, so we need to look in the feature.cache file to ensure the correct features have been installed. + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertNotNull("There is no installed features property in the feature.cache file", + installedFeatures); + + assertTrue("featureA-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureA-1.0")); + assertTrue("featureB-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureB-1.0")); + assertTrue("featureC-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureC-1.0")); + assertTrue("featureD-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureD-1.0")); + assertTrue("featureE-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureE-1.0")); + assertTrue("featureF-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureF-1.0")); + assertTrue("featureG-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureG-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertTrue("bundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle5/[1.0.0,2.0.0)")); + assertTrue("bundle6/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle6/[1.0.0,2.0.0)")); + assertTrue("bundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle7/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that auto features are automatically installed when their capability features are installed. The test + * ensures that this happens during server update. + * + * The feature structure is as follows: + * + * featureA, featureB, featureC and featureD are all normal features. + * + * featureE is an auto feature that depends on features A and B. + * featureF is an auto feature that depends on features B and C. + * featureG is an auto feature that depends on auto feature E and normal feature D. + * + * @throws Exception + */ + @Mode(TestMode.LITE) + @Test + public void testAutoFeaturesInstallDuringServerUpdate() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // Now move the server xml with the first set of features available + TestUtils.makeConfigUpdateSetMark(server, "server_initial_features.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not installed and should have been: " + output, output.contains("featureA-1.0")); + assertTrue("featureB-1.0 was not installed and should have been: " + output, output.contains("featureB-1.0")); + assertTrue("featureD-1.0 was not installed and should have been: " + output, output.contains("featureD-1.0")); + assertTrue("featureE-1.0 was not installed and should have been: " + output, output.contains("featureE-1.0")); + assertTrue("featureG-1.0 was not installed and should have been: " + output, output.contains("featureG-1.0")); + + // Ensure that an auto feature that doesn't have a type of osgi.subsystem.feature isn't provisioned. + assertFalse("invalidSubsystemTypeFeature-1.0 was installed and should not have been: " + output, output.contains("invalidSubsystemTypeFeature-1.0")); + + // Now check that we have only the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertFalse("bundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertTrue("bundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle5/[1.0.0,2.0.0)")); + assertFalse("bundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle6/[1.0.0,2.0.0)")); + assertTrue("bundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle7/[1.0.0,2.0.0)")); + + // Now add a new feature which should trigger an auto install as well. + TestUtils.makeConfigUpdateSetMark(server, "server_add_featureC.xml"); + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix + ".*featureC.*"); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " for feature C and F in the logs.", output); + + assertTrue("featureC-1.0 was not installed and should have been: " + output, output.contains("featureC-1.0")); + assertTrue("featureF-1.0 was not installed and should have been: " + output, output.contains("featureF-1.0")); + + // Now check that bundles of the features have also been installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertTrue("bundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle5/[1.0.0,2.0.0)")); + assertTrue("bundle6/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle6/[1.0.0,2.0.0)")); + assertTrue("bundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle7/[1.0.0,2.0.0)")); + + // Finally check that removing a feature will also uninstall some auto features. + TestUtils.makeConfigUpdateSetMark(server, "server_remove_featureA.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not uninstalled and should have been: " + output, output.contains("featureA-1.0")); + assertTrue("featureE-1.0 was not uninstalled and should have been: " + output, output.contains("featureE-1.0")); + assertTrue("featureG-1.0 was not uninstalled and should have been: " + output, output.contains("featureG-1.0")); + + // Now check that bundles of the features we've installed have been added. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundle1/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertFalse("bundle5/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle5/[1.0.0,2.0.0)")); + assertTrue("bundle6/[1.0.0,2.0.0) was not installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle6/[1.0.0,2.0.0)")); + assertFalse("bundle7/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle7/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that you are able to use "OR" filters, so that an auto feature will be auto provisioned if one feature or another + * feature, or both features are configured. The test uses the feature update method to check things have been provisioned correctly. + * + * The feature structure is as follows: + * + * featureH and featureI are all normal features. + * + * featureJ is an auto feature that depends on feature H or feature I. + * + * @throws Exception + */ + @Test + public void testCapabilityHeaderRequiringOneFeatureOrAnotherFeature() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // Now move the server xml with the first features available + TestUtils.makeConfigUpdateSetMark(server, "server_add_featureH.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureH-1.0 was not installed and should have been: " + output, output.contains("featureH-1.0")); + assertTrue("featureJ-1.0 was not installed and should have been: " + output, output.contains("featureJ-1.0")); + + // Now check that we have the correct bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertFalse("bundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + + // Now move the server xml with the second feature available + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + assertTrue("featureH-1.0 was not uninstalled and should have been: " + output, output.contains("featureH-1.0")); + assertTrue("featureJ-1.0 was not uninstalled and should have been: " + output, output.contains("featureJ-1.0")); + + // Now check that we have uninstalled the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertFalse("bundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertFalse("bundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + + server.stopServer(); + server.startServer(testName.getMethodName() + "-2.log"); // clean start + + TestUtils.makeConfigUpdateSetMark(server, "server_add_featureI.xml"); + // Get the install feature message for the initial set up of updated features + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + "in the logs.", output); + + assertTrue("featureI-1.0 was not installed and should have been: " + output, output.contains("featureI-1.0")); + assertTrue("featureJ-1.0 was not installed and should have been: " + output, output.contains("featureJ-1.0")); + + // Now check that we have the correct bundles installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + + // Now move the server xml with the second feature available + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + assertTrue("featureI-1.0 was not uninstalled and should have been: " + output, output.contains("featureI-1.0")); + assertTrue("featureJ-1.0 was not uninstalled and should have been: " + output, output.contains("featureJ-1.0")); + + // Now check that we have uninstalled the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertFalse("bundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertFalse("bundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + + server.stopServer(); + server.startServer(testName.getMethodName() + "-3.log"); // clean start + + TestUtils.makeConfigUpdateSetMark(server, "server_add_featureH_and_featureI.xml"); + // Get the install feature message for the initial set up of updated features + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + "in the logs.", output); + + assertTrue("featureH-1.0 was not installed and should have been: " + output, output.contains("featureH-1.0")); + assertTrue("featureI-1.0 was not installed and should have been: " + output, output.contains("featureI-1.0")); + assertTrue("featureJ-1.0 was not installed and should have been: " + output, output.contains("featureJ-1.0")); + + // Now check that we have installed all of the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + + //Now clear down the server and try just configuring the other feature. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureH-1.0 was not uninstalled and should have been: " + output, output.contains("featureH-1.0")); + assertTrue("featureI-1.0 was not uninstalled and should have been: " + output, output.contains("featureI-1.0")); + assertTrue("featureJ-1.0 was not uninstalled and should have been: " + output, output.contains("featureJ-1.0")); + + // Now check that we have the uninstalled the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertFalse("bundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertFalse("bundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that auto features are added to the feature directory between a server stop and start, will get provisioned + * if they are satisfied, even if the configured features aren't changed between server starts. + * + * The feature structure is as follows: + * + * featureA, featureB + * + * featureE is an auto feature that depends on features A and B. + * featureG is an auto feature that depends on auto feature E and normal feature D. + * + * @throws Exception + */ + @Test + public void testNewAutoFeaturesInstallAfterRestart() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Remove auto features, E, F and G + server.deleteFileFromLibertyInstallRoot("lib/features/" + AUTO_FEATURE_E_MF); + server.deleteFileFromLibertyInstallRoot("lib/features/" + AUTO_FEATURE_F_MF); + server.deleteFileFromLibertyInstallRoot("lib/features/" + AUTO_FEATURE_G_MF); + + // Now move the server xml with the all features available + server.setServerConfigurationFile("server_all_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // When the features are installed during a server start we don't get messages issued to the logs about which features are + // installed, so we need to look in the feature.cache file to ensure the correct features have been installed. + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertNotNull("There is no installed features property in the feature.cache file", + installedFeatures); + + assertTrue("featureA-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureA-1.0")); + assertTrue("featureB-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureB-1.0")); + assertTrue("featureC-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureC-1.0")); + assertTrue("featureD-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureD-1.0")); + assertFalse("featureE-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("featureE-1.0")); + assertFalse("featureF-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("featureF-1.0")); + assertFalse("featureG-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("featureG-1.0")); + + // Now check that we have only the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertFalse("bundle5/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle5/[1.0.0,2.0.0)")); + assertFalse("bundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle6/[1.0.0,2.0.0)")); + assertFalse("bundle7/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle7/[1.0.0,2.0.0)")); + + if (server.isStarted()) + server.stopServer(); + + // Now add auto features, E, F and G + server.copyFileToLibertyInstallRoot(FEATURE_PATH, AUTO_FEATURE_E_MF); + server.copyFileToLibertyInstallRoot(FEATURE_PATH, AUTO_FEATURE_F_MF); + server.copyFileToLibertyInstallRoot(FEATURE_PATH, AUTO_FEATURE_G_MF); + // restart the server + server.startServer(testName.getMethodName() + "-2.log"); // clean start + + // When the features are installed during a server start we don't get messages issued to the logs about which features are + // installed, so we need to look in the feature.cache file to ensure the correct features have been installed. + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertNotNull("There is no installed features property in the feature.cache file", + installedFeatures); + + // feature names are stored in the cache as lower case. + assertTrue("featureA-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureA-1.0")); + assertTrue("featureB-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureB-1.0")); + assertTrue("featureC-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureC-1.0")); + assertTrue("featureD-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureD-1.0")); + assertTrue("featureE-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureE-1.0")); + assertTrue("featureF-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureF-1.0")); + assertTrue("featureG-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureG-1.0")); + + // Now check that bundles of the features are all installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertTrue("bundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle5/[1.0.0,2.0.0)")); + assertTrue("bundle6/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle6/[1.0.0,2.0.0)")); + assertTrue("bundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle7/[1.0.0,2.0.0)")); + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that auto user features are automatically installed when their capability features are installed. + * The test ensures that this happens successfully during server start. + * + * The feature structure is as follows: + * + * ufeatureA, ufeatureB, ufeatureC and ufeatureD are all normal user features. + * + * ufeatureE is an auto user feature that depends on normal user features A and B. + * ufeatureF is an auto user feature that depends on normal user features B and C. + * ufeatureG is an auto user feature that depends on auto user feature E and normal user feature D. + * + * @throws Exception + */ + @Test + public void testUsrAutoFeaturesInstallDuringServerStartup() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Now move the server xml with the all features available + server.setServerConfigurationFile("server_usr_all_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // When the features are installed during a server start we don't get messages issued to the logs about which features are + // installed, so we need to look in the feature.cache file to ensure the correct features have been installed. + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertNotNull("There is no installed features property in the feature.cache file", + installedFeatures); + + assertTrue("ufeatureA-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureA-1.0")); + assertTrue("ufeatureB-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureB-1.0")); + assertTrue("ufeatureC-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureC-1.0")); + assertTrue("ufeatureD-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureD-1.0")); + assertTrue("ufeatureE-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureE-1.0")); + assertTrue("ufeatureF-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureF-1.0")); + assertTrue("ufeatureG-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureG-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("usr|ubundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle4/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle5/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle6/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle6/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle7/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that auto user features are automatically installed when their capability user features are installed. + * The test ensures that this happens during server update. + * + * The feature structure is as follows: + * + * ufeatureA, ufeatureB, ufeatureC and ufeatureD are all normal user features. + * + * ufeatureE is an auto user feature that depends on normal user features A and B. + * ufeatureF is an auto user feature that depends on normal user features B and C. + * ufeatureG is an auto user feature that depends on auto user feature E and normal user feature D. + * + * @throws Exception + */ + @Test + public void testUsrAutoFeaturesInstallDuringServerUpdate() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // Now move the server xml with the first set of features available + TestUtils.makeConfigUpdateSetMark(server, "server_initial_usr_features.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("ufeatureA-1.0 was not installed and should have been: " + output, output.contains("ufeatureA-1.0")); + assertTrue("ufeatureB-1.0 was not installed and should have been: " + output, output.contains("ufeatureB-1.0")); + assertTrue("ufeatureD-1.0 was not installed and should have been: " + output, output.contains("ufeatureD-1.0")); + assertTrue("ufeatureE-1.0 was not installed and should have been: " + output, output.contains("ufeatureE-1.0")); + assertTrue("ufeatureG-1.0 was not installed and should have been: " + output, output.contains("ufeatureG-1.0")); + + // Ensure that an auto feature that doesn't have a type of osgi.subsystem.feature isn't provisioned. + assertFalse("invalidSubsystemTypeFeature-1.0 was installed and should not have been: " + output, output.contains("invalidSubsystemTypeFeature-1.0")); + + // Now check that we have only the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("usr|ubundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle4/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle5/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle6/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle7/[1.0.0,2.0.0)")); + + // Now add a new feature which should trigger an auto install as well. + TestUtils.makeConfigUpdateSetMark(server, "server_add_usr_featureC.xml"); + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix + ".*ufeatureC.*"); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " for user feature C and F in the logs.", output); + + assertTrue("ufeatureC-1.0 was not installed and should have been: " + output, output.contains("ufeatureC-1.0")); + assertTrue("ufeatureF-1.0 was not installed and should have been: " + output, output.contains("ufeatureF-1.0")); + + // Now check that bundles of the features have also been installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("usr|ubundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle4/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle5/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle6/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle6/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle7/[1.0.0,2.0.0)")); + + // Finally check that removing a feature will also uninstall some auto features. + TestUtils.makeConfigUpdateSetMark(server, "server_remove_usr_featureA.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("ufeatureA-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureA-1.0")); + assertTrue("ufeatureE-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureE-1.0")); + assertTrue("ufeatureG-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureG-1.0")); + + // Now check that bundles of the features we've installed have been added. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("usr|ubundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle3/[1.0.0,2.0.0) was not installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle4/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle5/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle5/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle6/[1.0.0,2.0.0) was not installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("usr|ubundle6/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle7/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle7/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that auto user features are automatically installed when their capability features are installed. + * The capability features are a combination of user and non user features. + * The test ensures that this happens during server update. + * + * The feature structure is as follows: + * + * featureA, featureB, featureC and featureD are all normal non user features. + * + * ufeatureL is an auto user feature that depends on normal non user features A and B. + * ufeatureM is an auto user feature that depends on normal non user features B and C. + * ufeatureN is an auto user feature that depends on auto user feature L and normal non user feature D. + * + * @throws Exception + */ + @Test + public void testUsrAutoFeaturesDependsUserAndNonUserFeatures() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // Now move the server xml with the first set of features available + TestUtils.makeConfigUpdateSetMark(server, "server_initial_features.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not installed and should have been: " + output, output.contains("featureA-1.0")); + assertTrue("featureB-1.0 was not installed and should have been: " + output, output.contains("featureB-1.0")); + assertTrue("featureD-1.0 was not installed and should have been: " + output, output.contains("featureD-1.0")); + assertTrue("ufeatureL-1.0 was not installed and should have been: " + output, output.contains("ufeatureL-1.0")); + assertTrue("ufeatureN-1.0 was not installed and should have been: " + output, output.contains("ufeatureN-1.0")); + + // Ensure that an auto feature that doesn't have a type of osgi.subsystem.feature isn't provisioned. + assertFalse("invalidSubsystemTypeFeature-1.0 was installed and should not have been: " + output, output.contains("invalidSubsystemTypeFeature-1.0")); + + // Now check that we have only the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertFalse("bundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle5/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle6/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle7/[1.0.0,2.0.0)")); + + // Now add a new feature which should trigger an auto install as well. + TestUtils.makeConfigUpdateSetMark(server, "server_add_featureC.xml"); + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix + ".*featureC.*"); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " for feature C and user feature M in the logs.", output); + + assertTrue("featureC-1.0 was not installed and should have been: " + output, output.contains("featureC-1.0")); + assertTrue("ufeatureM-1.0 was not installed and should have been: " + output, output.contains("ufeatureM-1.0")); + + // Now check that bundles of the features have also been installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle5/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle6/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle6/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle7/[1.0.0,2.0.0)")); + + // Finally check that removing a feature will also uninstall some auto features. + TestUtils.makeConfigUpdateSetMark(server, "server_remove_featureA.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not uninstalled and should have been: " + output, output.contains("featureA-1.0")); + assertTrue("ufeatureL-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureL-1.0")); + assertTrue("ufeatureN-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureN-1.0")); + + // Now check that bundles of the features we've installed have been added. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundle1/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle5/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle5/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle6/[1.0.0,2.0.0) was not installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("usr|ubundle6/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle7/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle7/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that you are able to use "OR" filters, so that an auto user feature will be auto provisioned if one user feature or another + * user feature, or both user features are configured. The test uses the feature update method to check things have been provisioned correctly. + * + * The feature structure is as follows: + * + * ufeatureH and ufeatureI are all normal user features. + * + * ufeatureJ is an auto user feature that depends on user feature H or user feature I. + * + * @throws Exception + */ + @Test + public void testUsrCapabilityHeaderRequiringOneFeatureOrAnotherFeature() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // Now move the server xml with the first features available + TestUtils.makeConfigUpdateSetMark(server, "server_add_usr_featureH.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("ufeatureH-1.0 was not installed and should have been: " + output, output.contains("ufeatureH-1.0")); + assertTrue("ufeatureJ-1.0 was not installed and should have been: " + output, output.contains("ufeatureJ-1.0")); + + // Now check that we have the correct bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("usr|ubundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + + // Now move the server xml with the second feature available + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + assertTrue("ufeatureH-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureH-1.0")); + assertTrue("ufeatureJ-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureJ-1.0")); + + // Now check that we have uninstalled the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("usr|ubundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + + server.stopServer(); + server.startServer(testName.getMethodName() + "-2.log"); // clean start + + TestUtils.makeConfigUpdateSetMark(server, "server_add_usr_featureI.xml"); + // Get the install feature message for the initial set up of updated features + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + "in the logs.", output); + + assertTrue("ufeatureI-1.0 was not installed and should have been: " + output, output.contains("ufeatureI-1.0")); + assertTrue("ufeatureJ-1.0 was not installed and should have been: " + output, output.contains("ufeatureJ-1.0")); + + // Now check that we have the correct bundles installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("usr|ubundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + + // Now move the server xml with the second feature available + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + assertTrue("ufeatureI-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureI-1.0")); + assertTrue("ufeatureJ-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureJ-1.0")); + + // Now check that we have uninstalled the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("usr|ubundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + + server.stopServer(); + server.startServer(testName.getMethodName() + "-3.log"); // clean start + + TestUtils.makeConfigUpdateSetMark(server, "server_add_usr_featureH_and_featureI.xml"); + // Get the install feature message for the initial set up of updated features + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + "in the logs.", output); + + assertTrue("ufeatureH-1.0 was not installed and should have been: " + output, output.contains("ufeatureH-1.0")); + assertTrue("ufeatureI-1.0 was not installed and should have been: " + output, output.contains("ufeatureI-1.0")); + assertTrue("ufeatureJ-1.0 was not installed and should have been: " + output, output.contains("ufeatureJ-1.0")); + + // Now check that we have installed all of the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("usr|ubundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + + //Now clear down the server and try just configuring the other feature. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("ufeatureH-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureH-1.0")); + assertTrue("ufeatureI-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureI-1.0")); + assertTrue("ufeatureJ-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureJ-1.0")); + + // Now check that we have the uninstalled the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("usr|ubundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that auto user features are added to the feature directory between a server stop and start, will get provisioned + * if they are satisfied, even if the configured features aren't changed between server starts. + * + * The feature structure is as follows: + * + * ufeatureA, ufeatureB are normal user features + * + * ufeatureE is an auto user feature that depends on normal user features A and B. + * ufeatureG is an auto user feature that depends on auto user feature E and normal user feature D. + * + * @throws Exception + */ + @Test + public void testUsrNewAutoFeaturesInstallAfterRestart() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Remove user auto features, E, F and G + server.deleteFileFromLibertyInstallRoot(USR_FEATURE_PATH + USR_AUTO_FEATURE_E_MF); + server.deleteFileFromLibertyInstallRoot(USR_FEATURE_PATH + USR_AUTO_FEATURE_F_MF); + server.deleteFileFromLibertyInstallRoot(USR_FEATURE_PATH + USR_AUTO_FEATURE_G_MF); + + // Now move the server xml with the all features available + server.setServerConfigurationFile("server_usr_all_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // When the features are installed during a server start we don't get messages issued to the logs about which features are + // installed, so we need to look in the feature.cache file to ensure the correct features have been installed. + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertNotNull("There is no installed features property in the feature.cache file", + installedFeatures); + + // feature names are stored in the cache as lower case. + assertTrue("ufeatureA-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureA-1.0")); + assertTrue("ufeatureB-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureB-1.0")); + assertTrue("ufeatureC-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureC-1.0")); + assertTrue("ufeatureD-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureD-1.0")); + assertFalse("ufeatureE-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("ufeatureE-1.0")); + assertFalse("ufeatureF-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("ufeatureF-1.0")); + assertFalse("ufeatureG-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("ufeatureG-1.0")); + + // Now check that we have only the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("usr|ubundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle4/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle5/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle5/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle6/[1.0.0,2.0.0)")); + assertFalse("usr|ubundle7/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle7/[1.0.0,2.0.0)")); + + if (server.isStarted()) + server.stopServer(); + + // Now add user auto features, E, F and G + server.copyFileToLibertyInstallRoot(USR_FEATURE_PATH, USR_AUTO_FEATURE_E_MF); + server.copyFileToLibertyInstallRoot(USR_FEATURE_PATH, USR_AUTO_FEATURE_F_MF); + server.copyFileToLibertyInstallRoot(USR_FEATURE_PATH, USR_AUTO_FEATURE_G_MF); + // restart the server + server.startServer(testName.getMethodName() + "-2.log"); // clean start + + // When the features are installed during a server start we don't get messages issued to the logs about which features are + // installed, so we need to look in the feature.cache file to ensure the correct features have been installed. + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertNotNull("There is no installed features property in the feature.cache file", + installedFeatures); + + assertTrue("ufeatureA-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureA-1.0")); + assertTrue("ufeatureB-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureB-1.0")); + assertTrue("ufeatureC-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureC-1.0")); + assertTrue("ufeatureD-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureD-1.0")); + assertTrue("ufeatureE-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureE-1.0")); + assertTrue("ufeatureF-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureF-1.0")); + assertTrue("ufeatureG-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("ufeatureG-1.0")); + + // Now check that bundles of the features are all installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("usr|ubundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle2/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle3/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle4/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle5/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle6/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle6/[1.0.0,2.0.0)")); + assertTrue("usr|ubundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle7/[1.0.0,2.0.0)")); + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that auto product features are automatically installed when their capability features are installed. + * The test ensures that this happens successfully during server start. + * + * The feature structure is as follows: + * + * pfeatureA, pfeatureB, pfeatureC and pfeatureD are all normal product features. + * + * pfeatureE is an auto product feature that depends on normal product features A and B. + * pfeatureF is an auto product feature that depends on normal product features B and C. + * pfeatureG is an auto product feature that depends on auto product feature E and normal product feature D. + * + * @throws Exception + */ + @Test + public void testProductAutoFeaturesInstallDuringServerStartup() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Now move the server xml with the all features available + server.setServerConfigurationFile("server_product_all_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // When the features are installed during a server start we don't get messages issued to the logs about which features are + // installed, so we need to look in the feature.cache file to ensure the correct features have been installed. + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertNotNull("There is no installed features property in the feature.cache file", + installedFeatures); + + // feature names are stored in the cache as lower case. + assertTrue("pfeatureA-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureA-1.0")); + assertTrue("pfeatureB-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureB-1.0")); + assertTrue("pfeatureC-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureC-1.0")); + assertTrue("pfeatureD-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureD-1.0")); + assertTrue("pfeatureE-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureE-1.0")); + assertTrue("pfeatureF-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureF-1.0")); + assertTrue("pfeatureG-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureG-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("productAuto|pbundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle4/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle5/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle6/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle6/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle7/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that auto product features are automatically installed when their capability product features are installed. + * The test ensures that this happens during server update. + * + * The feature structure is as follows: + * + * pfeatureA, pfeatureB, pfeatureC and pfeatureD are all normal product features. + * + * pfeatureE is an auto product feature that depends on normal product features A and B. + * pfeatureF is an auto product feature that depends on normal product features B and C. + * pfeatureG is an auto product feature that depends on auto product feature E and normal product feature D. + * + * @throws Exception + */ + @Test + public void testProductAutoFeaturesInstallDuringServerUpdate() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // Now move the server xml with the first set of features available + TestUtils.makeConfigUpdateSetMark(server, "server_initial_product_features.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("pfeatureA-1.0 was not installed and should have been: " + output, output.contains("pfeatureA-1.0")); + assertTrue("pfeatureB-1.0 was not installed and should have been: " + output, output.contains("pfeatureB-1.0")); + assertTrue("pfeatureD-1.0 was not installed and should have been: " + output, output.contains("pfeatureD-1.0")); + assertTrue("pfeatureE-1.0 was not installed and should have been: " + output, output.contains("pfeatureE-1.0")); + assertTrue("pfeatureG-1.0 was not installed and should have been: " + output, output.contains("pfeatureG-1.0")); + + // Ensure that an auto feature that doesn't have a type of osgi.subsystem.feature isn't provisioned. + assertFalse("invalidSubsystemTypeFeature-1.0 was installed and should not have been: " + output, output.contains("invalidSubsystemTypeFeature-1.0")); + + // Now check that we have only the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("productAuto|pbundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle4/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle5/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle6/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle7/[1.0.0,2.0.0)")); + + // Now add a new feature which should trigger an auto install as well. + TestUtils.makeConfigUpdateSetMark(server, "server_add_product_featureC.xml"); + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix + ".*pfeatureC.*"); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " for product feature C and F in the logs.", output); + + assertTrue("pfeatureC-1.0 was not installed and should have been: " + output, output.contains("pfeatureC-1.0")); + assertTrue("pfeatureF-1.0 was not installed and should have been: " + output, output.contains("pfeatureF-1.0")); + + // Now check that bundles of the features have also been installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("productAuto|pbundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle4/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle5/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle6/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle6/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle7/[1.0.0,2.0.0)")); + + // Finally check that removing a feature will also uninstall some auto features. + TestUtils.makeConfigUpdateSetMark(server, "server_remove_product_featureA.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("pfeatureA-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureA-1.0")); + assertTrue("pfeatureE-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureE-1.0")); + assertTrue("pfeatureG-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureG-1.0")); + + // Now check that bundles of the features we've installed have been added. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("productAuto|pbundle1/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle3/[1.0.0,2.0.0) was not installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle4/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle5/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle5/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle6/[1.0.0,2.0.0) was not installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle6/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle7/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle7/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that when multiple product features are configured, the + * auto product features are automatically installed when their capability product features are installed. + * The test ensures that this happens during server update. + * + * The feature structure is as follows: + * + * pfeatureA, pfeatureB, and pfeatureD are all normal product features for product productAuto. + * p2featureA p2featureB and p2featureD are all normal product features for product product2Auto. + * + * pfeatureE is an auto product feature that depends on normal product features pfeatureA and pfeatureB. + * pfeatureG is an auto product feature that depends on auto product feature pfeatureE and normal product feature pfeatureD. + * p2featureE is an auto product feature that depends on normal product features p2featureA and p2featureB. + * p2featureG is an auto product feature that depends on auto product feature p2featureE and normal product feature p2featureD. + * + * @throws Exception + */ + @Test + public void testMultipleProductsWithAutoFeaturesInstallDuringServerUpdate() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // Now move the server xml with the first set of features available + TestUtils.makeConfigUpdateSetMark(server, "server_initial_product2_features.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("pfeatureA-1.0 was not installed and should have been: " + output, output.contains("pfeatureA-1.0")); + assertTrue("pfeatureB-1.0 was not installed and should have been: " + output, output.contains("pfeatureB-1.0")); + assertTrue("pfeatureD-1.0 was not installed and should have been: " + output, output.contains("pfeatureD-1.0")); + assertTrue("pfeatureE-1.0 was not installed and should have been: " + output, output.contains("pfeatureE-1.0")); + assertTrue("pfeatureG-1.0 was not installed and should have been: " + output, output.contains("pfeatureG-1.0")); + + assertTrue("p2featureA-1.0 was not installed and should have been: " + output, output.contains("p2featureA-1.0")); + assertTrue("p2featureB-1.0 was not installed and should have been: " + output, output.contains("p2featureB-1.0")); + assertTrue("p2featureD-1.0 was not installed and should have been: " + output, output.contains("p2featureD-1.0")); + assertTrue("p2featureE-1.0 was not installed and should have been: " + output, output.contains("p2featureE-1.0")); + assertTrue("p2featureG-1.0 was not installed and should have been: " + output, output.contains("p2featureG-1.0")); + + // Ensure that an auto feature that doesn't have a type of osgi.subsystem.feature isn't provisioned. + assertFalse("invalidSubsystemTypeFeature-1.0 was installed and should not have been: " + output, output.contains("invalidSubsystemTypeFeature-1.0")); + + // Now check that we have only the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("productAuto|pbundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle4/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle5/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle6/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle7/[1.0.0,2.0.0)")); + + assertTrue("product2Auto|p2bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle1/[1.0.0,2.0.0)")); + assertTrue("product2Auto|p2bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle2/[1.0.0,2.0.0)")); + assertFalse("product2Auto|p2bundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle3/[1.0.0,2.0.0)")); + assertTrue("product2Auto|p2bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle4/[1.0.0,2.0.0)")); + assertTrue("product2Auto|p2bundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle5/[1.0.0,2.0.0)")); + assertFalse("product2Auto|p2bundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle6/[1.0.0,2.0.0)")); + assertTrue("product2Auto|p2bundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle7/[1.0.0,2.0.0)")); + + // Finally check that removing a feature will also uninstall some auto features. + // Removing D should cause G to get unstalled as well + TestUtils.makeConfigUpdateSetMark(server, "server_remove_product2_featureD.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("p2featureD-1.0 was not uninstalled and should have been: " + output, output.contains("p2featureD-1.0")); + assertTrue("p2featureG-1.0 was not uninstalled and should have been: " + output, output.contains("p2featureG-1.0")); + + // Now check that bundles of the features we've installed have been added. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("productAuto|pbundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle4/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle5/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle6/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle7/[1.0.0,2.0.0)")); + + assertTrue("product2Auto|p2bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle1/[1.0.0,2.0.0)")); + assertTrue("product2Auto|p2bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle2/[1.0.0,2.0.0)")); + assertFalse("product2Auto|p2bundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle3/[1.0.0,2.0.0)")); + assertFalse("product2Auto|p2bundle4/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle4/[1.0.0,2.0.0)")); + assertTrue("product2Auto|p2bundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle5/[1.0.0,2.0.0)")); + assertFalse("product2Auto|p2bundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle6/[1.0.0,2.0.0)")); + assertFalse("product2Auto|p2bundle7/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("product2Auto|p2bundle7/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that auto product features are automatically installed when their capability features are installed. + * The capability features are a combination of product and non product features. + * The test ensures that this happens during server update. + * + * The feature structure is as follows: + * + * featureA, featureB, featureC and featureD are all normal non product features. + * + * pfeatureL is an auto product feature that depends on normal non product features A and B. + * pfeatureM is an auto product feature that depends on normal non product features B and C. + * pfeatureN is an auto product feature that depends on auto product feature L and normal non product feature D. + * + * @throws Exception + */ + @Test + public void testProductAutoFeaturesDependsUserAndNonUserFeatures() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // Now move the server xml with the first set of features available + TestUtils.makeConfigUpdateSetMark(server, "server_initial_features.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not installed and should have been: " + output, output.contains("featureA-1.0")); + assertTrue("featureB-1.0 was not installed and should have been: " + output, output.contains("featureB-1.0")); + assertTrue("featureD-1.0 was not installed and should have been: " + output, output.contains("featureD-1.0")); + assertTrue("pfeatureL-1.0 was not installed and should have been: " + output, output.contains("pfeatureL-1.0")); + assertTrue("pfeatureN-1.0 was not installed and should have been: " + output, output.contains("pfeatureN-1.0")); + + // Ensure that an auto feature that doesn't have a type of osgi.subsystem.feature isn't provisioned. + assertFalse("invalidSubsystemTypeFeature-1.0 was installed and should not have been: " + output, output.contains("invalidSubsystemTypeFeature-1.0")); + + // Now check that we have only the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertFalse("bundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle5/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle6/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle7/[1.0.0,2.0.0)")); + + // Now add a new feature which should trigger an auto install as well. + TestUtils.makeConfigUpdateSetMark(server, "server_add_featureC.xml"); + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix + ".*featureC.*"); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " for feature C and product feature M in the logs.", output); + + assertTrue("featureC-1.0 was not installed and should have been: " + output, output.contains("featureC-1.0")); + assertTrue("pfeatureM-1.0 was not installed and should have been: " + output, output.contains("pfeatureM-1.0")); + + // Now check that bundles of the features have also been installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle5/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle6/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle6/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle7/[1.0.0,2.0.0)")); + + // Finally check that removing a feature will also uninstall some auto features. + TestUtils.makeConfigUpdateSetMark(server, "server_remove_featureA.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not uninstalled and should have been: " + output, output.contains("featureA-1.0")); + assertTrue("pfeatureL-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureL-1.0")); + assertTrue("pfeatureN-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureN-1.0")); + + // Now check that bundles of the features we've installed have been added. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundle1/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + assertTrue("bundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle2/[1.0.0,2.0.0)")); + assertTrue("bundle3/[1.0.0,2.0.0) was not installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle3/[1.0.0,2.0.0)")); + assertTrue("bundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle4/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle5/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle5/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle6/[1.0.0,2.0.0) was not installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle6/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle7/[1.0.0,2.0.0) was installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle7/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that you are able to use "OR" filters, so that an auto product feature will be auto provisioned if one product feature or another + * product feature, or both product features are configured. The test uses the feature update method to check things have been provisioned correctly. + * + * The feature structure is as follows: + * + * pfeatureH and pfeatureI are all normal product features. + * + * pfeatureJ is an auto product feature that depends on product feature H or product feature I. + * + * @throws Exception + */ + @Test + public void testProductCapabilityHeaderRequiringOneFeatureOrAnotherFeature() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // Now move the server xml with the first features available + TestUtils.makeConfigUpdateSetMark(server, "server_add_product_featureH.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("pfeatureH-1.0 was not installed and should have been: " + output, output.contains("pfeatureH-1.0")); + assertTrue("pfeatureJ-1.0 was not installed and should have been: " + output, output.contains("pfeatureJ-1.0")); + + // Now check that we have the correct bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("pundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + + // Now move the server xml with the second feature available + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + assertTrue("pfeatureH-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureH-1.0")); + assertTrue("pfeatureJ-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureJ-1.0")); + + // Now check that we have uninstalled the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("productAuto|pbundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + + server.stopServer(); + // This is still a clean start + server.startServer(testName.getMethodName() + "-2.log"); + + TestUtils.makeConfigUpdateSetMark(server, "server_add_product_featureI.xml"); + // Get the install feature message for the initial set up of updated features + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + "in the logs.", output); + + assertTrue("pfeatureI-1.0 was not installed and should have been: " + output, output.contains("pfeatureI-1.0")); + assertTrue("pfeatureJ-1.0 was not installed and should have been: " + output, output.contains("pfeatureJ-1.0")); + + // Now check that we have the correct bundles installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("productAuto|pbundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + + // Now move the server xml with the second feature available + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + assertTrue("pfeatureI-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureI-1.0")); + assertTrue("pfeatureJ-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureJ-1.0")); + + // Now check that we have uninstalled the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("productAuto|pbundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + + server.stopServer(); + // This is still a clean start + server.startServer(testName.getMethodName() + "-3.log"); + + TestUtils.makeConfigUpdateSetMark(server, "server_add_product_featureH_and_featureI.xml"); + // Get the install feature message for the initial set up of updated features + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + "in the logs.", output); + + assertTrue("pfeatureH-1.0 was not installed and should have been: " + output, output.contains("pfeatureH-1.0")); + assertTrue("pfeatureI-1.0 was not installed and should have been: " + output, output.contains("pfeatureI-1.0")); + assertTrue("pfeatureJ-1.0 was not installed and should have been: " + output, output.contains("pfeatureJ-1.0")); + + // Now check that we have installed all of the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("productAuto|pbundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + + //Now clear down the server and try just configuring the other feature. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("pfeatureH-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureH-1.0")); + assertTrue("pfeatureI-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureI-1.0")); + assertTrue("pfeatureJ-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureJ-1.0")); + + // Now check that we have the uninstalled the bundles. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("productAuto|pbundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle2/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle3/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that auto product features are added to the feature directory between a server stop and start, will get provisioned + * if they are satisfied, even if the configured features aren't changed between server starts. + * + * The feature structure is as follows: + * + * pfeatureA, pfeatureB are normal product features + * + * pfeatureE is an auto product feature that depends on normal product features A and B. + * pfeatureG is an auto product feature that depends on auto product feature E and normal product feature D. + * + * @throws Exception + */ + @Test + public void testProductNewAutoFeaturesInstallAfterRestart() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Remove product auto features, E, F and G + server.deleteFileFromLibertyInstallRoot(PRODUCT_FEATURE_PATH + PRODUCT_AUTO_FEATURE_E_MF); + server.deleteFileFromLibertyInstallRoot(PRODUCT_FEATURE_PATH + PRODUCT_AUTO_FEATURE_F_MF); + server.deleteFileFromLibertyInstallRoot(PRODUCT_FEATURE_PATH + PRODUCT_AUTO_FEATURE_G_MF); + + // Now move the server xml with the all features available + server.setServerConfigurationFile("server_product_all_features.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // When the features are installed during a server start we don't get messages issued to the logs about which features are + // installed, so we need to look in the feature.cache file to ensure the correct features have been installed. + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertNotNull("There is no installed features property in the feature.cache file", + installedFeatures); + + // feature names are stored in the cache as lower case. + assertTrue("pfeatureA-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureA-1.0")); + assertTrue("pfeatureB-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureB-1.0")); + assertTrue("pfeatureC-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureC-1.0")); + assertTrue("pfeatureD-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureD-1.0")); + assertFalse("pfeatureE-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("pfeatureE-1.0")); + assertFalse("pfeatureF-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("pfeatureF-1.0")); + assertFalse("pfeatureG-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("pfeatureG-1.0")); + + // Now check that we have only the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("productAuto|pbundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle4/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle5/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle5/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle6/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle6/[1.0.0,2.0.0)")); + assertFalse("productAuto|pbundle7/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle7/[1.0.0,2.0.0)")); + + if (server.isStarted()) + server.stopServer(); + + // Now add product auto features, E, F and G + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_AUTO_FEATURE_E_MF); + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_AUTO_FEATURE_F_MF); + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_AUTO_FEATURE_G_MF); + // restart the server + server.startServer(testName.getMethodName() + "-2.log"); // clean start + + // When the features are installed during a server start we don't get messages issued to the logs about which features are + // installed, so we need to look in the feature.cache file to ensure the correct features have been installed. + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertNotNull("There is no installed features property in the feature.cache file", + installedFeatures); + + // feature names are stored in the cache as lower case. + assertTrue("pfeatureA-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureA-1.0")); + assertTrue("pfeatureB-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureB-1.0")); + assertTrue("pfeatureC-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureC-1.0")); + assertTrue("pfeatureD-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureD-1.0")); + assertTrue("pfeatureE-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureE-1.0")); + assertTrue("pfeatureF-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureF-1.0")); + assertTrue("pfeatureG-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("pfeatureG-1.0")); + + // Now check that bundles of the features are all installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("productAuto|pbundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle1/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle2/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle2/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle3/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle3/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle4/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle4/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle5/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle6/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle6/[1.0.0,2.0.0)")); + assertTrue("productAuto|pbundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("productAuto|pbundle7/[1.0.0,2.0.0)")); + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that an invalid filter in the capability header throws the expected exception. + * + * @throws Exception + */ + + @Test + @ExpectedFFDC({ "org.osgi.framework.InvalidSyntaxException" }) + public void testInvalidFilterInCapabilityHeader() throws Exception { + Log.entering(c, testName.getMethodName()); + + // Copy the invalid feature header to the server features dir and set the server xml to the invalid header feature xml file. + server.copyFileToLibertyInstallRoot(FEATURE_PATH, AUTO_FEATURE_INVALID_HEADER_MF); + server.setServerConfigurationFile("server_invalid_header.xml"); + server.startServer(testName.getMethodName() + ".log"); + + String output = server.waitForStringInLog(invalidHeaderMsgPrefix); + + server.deleteFileFromLibertyInstallRoot(FEATURE_PATH + AUTO_FEATURE_INVALID_HEADER_MF); + + assertNotNull("We haven't found the " + invalidHeaderMsgPrefix + " in the logs.", output); + + Log.exiting(c, testName.getMethodName()); + } + + @Test + @Ignore + public void testAutoFeatureScanTime() throws Exception { + Log.entering(c, testName.getMethodName()); + + //work out the initial performance + double[] initialStats = performStatsSeries(testName.getMethodName()); + + //now add some autoFeatures (say 10) + int someAutoFeatures = 10; + createAutoFeatures(someAutoFeatures); + //get the stats for 10 features + double[] someStats = performStatsSeries(testName.getMethodName() + "-some"); + + //now add a ridiculous number of autoFeatures (say 500) + int ridiculousAutoFeatures = 500; + createAutoFeatures(ridiculousAutoFeatures); + //get the stats for 500 features + double[] ridiculousStats = performStatsSeries(testName.getMethodName() + "-lots"); + + logger.info("Statistics (no auto feature files): mean= " + initialStats[0] + " sample standard deviation= " + initialStats[1]); + logger.info("Statistics (" + someAutoFeatures + " auto feature files): mean= " + someStats[0] + " sample standard deviation= " + someStats[1]); + logger.info("Statistics (" + ridiculousAutoFeatures + " auto feature files): mean= " + ridiculousStats[0] + " sample standard deviation= " + ridiculousStats[1]); + + double change1 = performanceDegradation(initialStats, someStats); + assertTrue("Performance was more than 1% worse (" + change1 + "% worse) when reading " + someAutoFeatures + " auto feature files", change1 <= 1d); + + double change2 = performanceDegradation(initialStats, ridiculousStats); + assertTrue("Performance was more than 1% worse (" + change2 + "% worse) when reading " + ridiculousAutoFeatures + " auto feature files", change2 <= 1d); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * TestDescription: + * This test ensures that auto product features that are added to the feature directory after a server start, will get provisioned + * if they are satisfied, even if the configured features aren't changed between server starts. + * + * The feature structure is as follows: + * + * featureA, featureB, featureC and feature D are normal features + * + * featureE is an auto feature that depends on normal features A and B. + * featureG is an auto feature that depends on auto feature E and normal feature D. + * + * @throws Exception + */ + + @Test + public void testAutoFeatureInstallFromFeatureManagerRefresh() throws Exception { + Log.entering(c, testName.getMethodName()); + + //Ensure autofeatures A, B, C and D are in the runtime. + server.copyFileToLibertyInstallRoot(FEATURE_PATH, FEATURE_A_MF); + server.copyFileToLibertyInstallRoot(FEATURE_PATH, FEATURE_B_MF); + server.copyFileToLibertyInstallRoot(FEATURE_PATH, FEATURE_C_MF); + server.copyFileToLibertyInstallRoot(FEATURE_PATH, FEATURE_D_MF); + // Remove auto features, E, F and G + server.deleteFileFromLibertyInstallRoot(FEATURE_PATH + AUTO_FEATURE_E_MF); + server.deleteFileFromLibertyInstallRoot(FEATURE_PATH + AUTO_FEATURE_F_MF); + server.deleteFileFromLibertyInstallRoot(FEATURE_PATH + AUTO_FEATURE_G_MF); + + // Copy the test feature bundle, and the test featureProvisioner manifest, + // which allows us to use a servlet to refresh the autofeatures. + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getInstallRoot() + "/lib", "publish/bundles/test.feature.provisioner_1.0.0.jar"); + server.copyFileToLibertyInstallRoot(FEATURE_PATH, "test.featureprovisioner-1.0.mf"); + + // Now move the server xml with the all features available + server.setServerConfigurationFile("server_refresh_autofeatures.xml"); + server.startServer(testName.getMethodName() + ".log"); + + // Wait for the Feature Refresh servlet to start. + String message = server.waitForStringInLog("CWWKT0016I.*http://.*/feature"); + + // When the features are installed during a server start we don't get messages issued to the logs about which features are + // installed, so we need to look in the feature.cache file to ensure the correct features have been installed. + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertNotNull("There is no installed features property in the feature.cache file", + installedFeatures); + + assertTrue("featureA-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureA-1.0")); + assertTrue("featureB-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureB-1.0")); + assertTrue("featureC-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureC-1.0")); + assertTrue("featureD-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureD-1.0")); + assertFalse("featureE-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("featureE-1.0")); + assertFalse("featureF-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("featureF-1.0")); + assertFalse("featureG-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("featureG-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + assertFalse("bundle5/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle5/[1.0.0,2.0.0)")); + assertFalse("bundle7/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle7/[1.0.0,2.0.0)")); + + // Add product auto feature E to the feature lib dir. + server.copyFileToLibertyInstallRoot(FEATURE_PATH, AUTO_FEATURE_E_MF); + + // Trigger the refresh of the auto features, and ensure we get the message saying feature E has been provisioned. + HttpUtils.findStringInUrl(server, FEATURE_PROVISIONER_CONTEXT_ROOT, "FeatureProvisioner: features refreshed."); + + // Because the refreshFeatures method is asynchronous, we need to wait for the completion message in the console logs. + server.setMarkToEndOfLog(); + server.waitForStringInLogUsingMark("CWWKF0008I"); + + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + + assertTrue("featureE-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureE-1.0")); + + // Now check that we have the expected bundles installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + assertTrue("bundle5/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle5/[1.0.0,2.0.0)")); + + // Add product auto feature G to the feature lib dir. + server.copyFileToLibertyInstallRoot(FEATURE_PATH, AUTO_FEATURE_G_MF); + + // Trigger the refresh of the auto features, and ensure we get the message saying feature G has been provisioned. + HttpUtils.findStringInUrl(server, FEATURE_PROVISIONER_CONTEXT_ROOT, "FeatureProvisioner: features refreshed."); + // Because the refreshFeatures method is asynchronous, we need to wait for the completion message in the console logs. + server.setMarkToEndOfLog(); + server.waitForStringInLogUsingMark("CWWKF0008I"); + + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertTrue("featureG-1.0 was not installed and should have been: " + installedFeatures, installedFeatures.contains("featureG-1.0")); + + // Now check that we have the expected bundles installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + assertTrue("bundle7/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle7/[1.0.0,2.0.0)")); + + // Remove Feature E and G manifests from the lib features dir, and refresh the auto features, and ensure that the + // both feature E and G have been removed. You have to Feature G as well as E, otherwise we get an exception because G + // is currently provisioned and the system recognises that it can't + server.deleteFileFromLibertyInstallRoot(FEATURE_PATH + AUTO_FEATURE_E_MF); + + HttpUtils.findStringInUrl(server, FEATURE_PROVISIONER_CONTEXT_ROOT, "FeatureProvisioner: features refreshed."); + // Because the refreshFeatures method is asynchronous, we need to wait for the completion message in the console logs. + server.setMarkToEndOfLog(); + server.waitForStringInLogUsingMark("CWWKF0008I"); + + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertFalse("featureE-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("featureE-1.0")); + assertFalse("featureG-1.0 was installed and should not have been: " + installedFeatures, installedFeatures.contains("featureG-1.0")); + + // Now check that we have the expected bundles installed. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + assertFalse("bundle5/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle5/[1.0.0,2.0.0)")); + assertFalse("bundle7/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle7/[1.0.0,2.0.0)")); + + // Add product auto feature E and F back to the feature lib dir for future tests. + server.copyFileToLibertyInstallRoot(FEATURE_PATH, AUTO_FEATURE_E_MF); + server.copyFileToLibertyInstallRoot(FEATURE_PATH, AUTO_FEATURE_F_MF); + + Log.exiting(c, testName.getMethodName()); + } + + /** + * Work out if the performance of stats2 was worse than stats1 + * + * @param stats1 + * @param stats2 + */ + private double performanceDegradation(double[] stats1, double[] stats2) { + double mean1 = stats1[0]; + double stddev1 = stats1[1]; + double mean2 = stats2[0]; + double stddev2 = stats2[1]; + + double meanDifference = mean2 - mean1; + + if (meanDifference > 0 && meanDifference > (stddev1 + stddev2)) { + //the performance was worse by more than one standard deviation overlap + return (meanDifference / mean1) * 100; + } else { + return 0d; + } + } + + private double[] performStatsSeries(String filePrefix) throws Exception { + //work out the initial performance + List results = serverCycles(SAMPLE_SIZE, filePrefix); + double[] stats = calculateStats(results); + + return stats; + } + + private double[] calculateStats(List results) { + Long sum = 0l; + Integer count = results.size(); + for (Long result : results) { + sum += result; + } + logger.info("Sum= " + sum); + double mean = sum.floatValue() / count.floatValue(); + + //std deviation (use the n-1 sample standard deviation) + double sumOfSquares = 0d; + for (Long result : results) { + sumOfSquares += Math.pow(result.floatValue() - mean, 2); + } + double stdDev = Math.sqrt(sumOfSquares / (count.floatValue() - 1f)); + return new double[] { mean, stdDev }; + } + + private List serverCycles(int count, String filePrefix) throws Exception { + List results = new ArrayList(count); + for (int i = 1; i <= PRESTART_IGNORES; i++) { + serverCycle(filePrefix + "-prestart", i); + } + for (int i = 1; i <= count; i++) { + results.add(serverCycle(filePrefix, i)); + } + return results; + } + + private long serverCycle(String filePrefix, int i) throws Exception { + server.setMarkToEndOfLog(server.getDefaultLogFile()); + server.startServer(filePrefix + "-" + i + ".log"); + long duration = getStartDurartion(); + logger.log(Level.INFO, "Start duration was: " + getStartDurartion() + "ms"); + server.stopServer(); + return duration; + } + + private long getStartDurartion() throws Exception { + String launchingMessage = server.waitForStringInLogUsingMark("CWWKE0001I"); + String launchedMessage = server.waitForStringInLogUsingMark("CWWKF0011I"); + long startTime = extractTimeFromMessage(launchingMessage); + long endTime = extractTimeFromMessage(launchedMessage); + //calculate the duration of start + return endTime - startTime; + } + + static final Pattern tsPattern = Pattern.compile("^\\[(.*)\\].*"); + static final DateFormat tsFormat = DateFormatProvider.getDateFormat(); + + //new SimpleDateFormat("dd/MM/yy HH:MM:ss:SSS zzz"); + + private long extractTimeFromMessage(String message) throws Exception { + Matcher m = tsPattern.matcher(message); + if (m.matches() && m.groupCount() > 0) { + logger.log(Level.INFO, m.group(1)); + return tsFormat.parse(m.group(1)).getTime(); + } else { + return 0; + } + } + + private void createAutoFeatures(int numberToCreate) throws Exception { + server.copyFileToLibertyInstallRoot(FEATURE_PATH, "skeletonTestFeature-1.0.mf"); + RemoteFile templateFile = server.getFileFromLibertyInstallRoot(FEATURE_PATH + TEST_MF); + RemoteFile autoFeatureRoot = server.getFileFromLibertyInstallRoot(FEATURE_PATH); + for (int i = 1; i < numberToCreate; i++) { + RemoteFile generatedAutoFile = new RemoteFile(autoFeatureRoot, TEST_FEATURE + i + TEST_FEATURE_VERSION); + templateFile.copyToDest(generatedAutoFile); + } + } + + /* + * This is really frustrating, but we can't use a Liberty call here, but we need to use the same + * date and time format as the logs in any particular locale, so have a nested copy of the + * DateFormatProvider, hopefully it won't get out of sync with the logging code very easily + * or to an extent that impacts its use in this test (which is to calculate time differences + * between log messages) + */ + + public static class DateFormatProvider { + + /** + * Return a format string that will produce a reasonable standard way for + * formatting time (but still using the current locale) + * + * @return The format string + */ + public static DateFormat getDateFormat() { + String pattern; + int patternLength; + int endOfSecsIndex; + // Retrieve a standard Java DateFormat object with desired format. + DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM); + if (formatter instanceof SimpleDateFormat) { + // Retrieve the pattern from the formatter, since we will need to + // modify it. + SimpleDateFormat sdFormatter = (SimpleDateFormat) formatter; + pattern = sdFormatter.toPattern(); + // Append milliseconds and timezone after seconds + patternLength = pattern.length(); + endOfSecsIndex = pattern.lastIndexOf('s') + 1; + String newPattern = pattern.substring(0, endOfSecsIndex) + ":SSS z"; + if (endOfSecsIndex < patternLength) + newPattern += pattern.substring(endOfSecsIndex, patternLength); + // 0-23 hour clock (get rid of any other clock formats and am/pm) + newPattern = newPattern.replace('h', 'H'); + newPattern = newPattern.replace('K', 'H'); + newPattern = newPattern.replace('k', 'H'); + newPattern = newPattern.replace('a', ' '); + newPattern = newPattern.trim(); + sdFormatter.applyPattern(newPattern); + formatter = sdFormatter; + } else { + formatter = new SimpleDateFormat("yy.MM.dd HH:mm:ss:SSS z"); + } + return formatter; + } + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FATSuite.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FATSuite.java new file mode 100755 index 000000000000..42ed0f58c660 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FATSuite.java @@ -0,0 +1,43 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ + // Disabled FeatureProcessTypeTest.class, + AutoFeaturesTest.class, + FeatureTest.class, + ProductFeatureTest.class, + UserFeatureTest.class, + SPIIsolationTest.class, + FeatureListToolTest.class, + FeatureManagerToolTest.class, + SimpleMinifiedServerTest.class, + MinifyIconsTest.class, + FeatureManagerIconsTest.class, + FeatureConflictUpgradeTest.class, + IgnoreAPITest.class, + SimpleFeatureUpdateTest.class, + SystemBundleOverrideTest.class, + FeatureAPITest.class, + FeatureAPIServiceTest.class +}) +/** + * Purpose: This suite collects and runs all known good test suites. + */ +public class FATSuite { + +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureAPIServiceTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureAPIServiceTest.java new file mode 100755 index 000000000000..105c8f72d240 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureAPIServiceTest.java @@ -0,0 +1,77 @@ +package com.ibm.ws.kernel.feature.fat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertNotNull; + +import java.io.FileNotFoundException; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class FeatureAPIServiceTest { + static final Class c = FeatureAPIServiceTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.api.service"); + + @Test + public void testAddServiceApi() throws Exception { + server.startServer(); + + assertNotNull("The application did not appear to have been installed.", server.waitForStringInLog("CWWKZ0001I.* test.service.consumer")); + assertNotNull("Failed to grant access to the ApiService.", server.waitForStringInLog("ApiService - SUCCESS", 5000)); + assertNotNull("Failed to deny access to the NotApiService.", server.waitForStringInLog("NotApiService - SUCCESS", 5000)); + } + + @BeforeClass + public static void installUserFeature() throws Exception { + server.installUserFeature("test.service.provider-1.0"); + server.installUserBundle("test.service.provider_1.0.0"); + try { + RemoteFile featureFile = server.getFileFromLibertyInstallRoot("/lib/features/test.service.provider-1.0.mf"); + if (featureFile.exists()) { + Log.info(c, "installUserFeature", "Found unexpected system feature: " + featureFile.toString()); + server.uninstallSystemFeature("test.service.provider-1.0"); + } + } catch (FileNotFoundException e) { + // ignore; expected + } + } + + @AfterClass + public static void uninstallUserFeature() throws Exception { + try { + RemoteFile featureFile = server.getFileFromLibertyInstallRoot("/lib/features/test.service.provider-1.0.mf"); + if (featureFile.exists()) { + Log.info(c, "uninstallUserFeature", "Found unexpected system feature: " + featureFile.toString()); + } + } catch (FileNotFoundException e) { + // ignore; expected + } + server.uninstallUserFeature("test.service.provider-1.0"); + server.uninstallUserBundle("test.service.provider_1.0.0"); + } + + @After + public void tearDown() throws Exception { + if (server != null && server.isStarted()) { + server.stopServer(); + } + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureAPITest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureAPITest.java new file mode 100755 index 000000000000..29dcd15d468e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureAPITest.java @@ -0,0 +1,113 @@ +package com.ibm.ws.kernel.feature.fat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.ProtocolException; +import java.net.URL; +import java.util.Arrays; +import java.util.Collections; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class FeatureAPITest { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.api"); + private final Class c = FeatureAPITest.class; + + @Test + public void testAddApi() throws Exception { + final String method = "testAddApi"; + server.startServer(); + + assertNotNull("The application did not appear to have been installed.", server.waitForStringInLog("CWWKZ0001I.* test.feature.api.client")); + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/test.feature.api.client/apiClient"); + Log.info(c, method, "Calling Application with URL=" + url.toString()); + HttpURLConnection con = getHttpConnection(url); + BufferedReader br = getConnectionStream(con); + String line = br.readLine(); + assertEquals("Wrong response from application", "FAILED", line); + + server.setMarkToEndOfLog(); + server.changeFeatures(Arrays.asList("servlet-3.0", "test.feature.api-1.0")); + server.waitForConfigUpdateInLogUsingMark(Collections. emptySet()); + + Log.info(c, method, "Calling Application with URL=" + url.toString()); + con = getHttpConnection(url); + br = getConnectionStream(con); + line = br.readLine(); + assertEquals("Wrong response from application", "ApiClientTest:SUCCESS", line); + } + + @BeforeClass + public static void installSystemFeature() throws Exception { + server.installSystemFeature("test.feature.api.internal-1.0"); + server.installSystemFeature("test.feature.api-1.0"); + server.installSystemBundle("test.feature.api_1.0.0"); + } + + @AfterClass + public static void uninstallSystemFeature() throws Exception { + server.uninstallSystemFeature("test.feature.api.internal-1.0"); + server.uninstallSystemFeature("test.feature.api-1.0"); + server.uninstallSystemBundle("test.feature.api_1.0.0"); + } + + @After + public void tearDown() throws Exception { + if (server != null && server.isStarted()) { + server.stopServer(); + } + } + + /** + * This method is used to get a connection stream from an HTTP connection. It + * gives the output from the webpage that it gets from the connection + * + * @param con The connection to the HTTP address + * @return The Output from the webpage + */ + private BufferedReader getConnectionStream(HttpURLConnection con) throws IOException { + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + return br; + } + + /** + * This method creates a connection to a webpage and then reutrns the connection + * + * @param url The Http Address to connect to + * @return The connection to the http address + */ + private HttpURLConnection getHttpConnection(URL url) throws IOException, ProtocolException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + return con; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureConflictUpgradeTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureConflictUpgradeTest.java new file mode 100755 index 000000000000..0495fa5b87f0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureConflictUpgradeTest.java @@ -0,0 +1,395 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.FileNotFoundException; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.ExpectedFFDC; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class FeatureConflictUpgradeTest { + private static final Class c = FeatureConflictUpgradeTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.featureConflict"); + + private static final String FEATURE_CAPABILITYA_1_0 = "capabilityA-1.0"; + private static final String FEATURE_CAPABILITYA_1_1 = "capabilityA-1.1"; + private static final String FEATURE_CAPABILITYA_2_0 = "capabilityA-2.0"; + + private static final String FEATURE_CAPABILITYB_1_0 = "capabilityB-1.0"; + private static final String FEATURE_CAPABILITYB_1_1 = "capabilityB-1.1"; + private static final String FEATURE_CAPABILITYB_2_0 = "capabilityB-2.0"; + + private static final String FEATURE_CAPABILITYC_1_0 = "capabilityC-1.0"; + private static final String FEATURE_CAPABILITYD_1_0 = "capabilityD-1.0"; + + private static final String FEATURE_COMBO_A10_B10_1_0 = "comboA10B10-1.0"; + + private static final String FEATURE_AUTO_A10_B10_1_0 = "auto-A10B10-1.0"; + private static final String FEATURE_AUTO_A11_B11_1_0 = "auto-A11B11-1.0"; + + private static final String FEATURE_CACHE = "workarea/platform/feature.cache"; + + @BeforeClass + public static void beforeClass() throws Exception { + Log.info(c, "beforeClass", "Installing features"); + server.installSystemFeature(FEATURE_CAPABILITYA_1_0); + server.installSystemFeature(FEATURE_CAPABILITYA_1_1); + server.installSystemFeature(FEATURE_CAPABILITYA_2_0); + server.installSystemFeature(FEATURE_CAPABILITYB_1_0); + server.installSystemFeature(FEATURE_CAPABILITYB_1_1); + server.installSystemFeature(FEATURE_CAPABILITYB_2_0); + server.installSystemFeature(FEATURE_CAPABILITYC_1_0); + server.installSystemFeature(FEATURE_CAPABILITYD_1_0); + server.installSystemFeature(FEATURE_COMBO_A10_B10_1_0); + server.installSystemFeature(FEATURE_AUTO_A10_B10_1_0); + server.installSystemFeature(FEATURE_AUTO_A11_B11_1_0); + + for (int i = 1; i < 8; i++) { + server.copyFileToLibertyInstallRoot("lib", "bundle" + i + "_1.0.0.jar"); + } + } + + @AfterClass + public static void afterClass() throws Exception { + Log.info(c, "afterClass", "Uninstalling features"); + server.uninstallSystemFeature(FEATURE_CAPABILITYA_1_0); + server.uninstallSystemFeature(FEATURE_CAPABILITYA_1_1); + server.uninstallSystemFeature(FEATURE_CAPABILITYA_2_0); + server.uninstallSystemFeature(FEATURE_CAPABILITYB_1_0); + server.uninstallSystemFeature(FEATURE_CAPABILITYB_1_1); + server.uninstallSystemFeature(FEATURE_CAPABILITYB_2_0); + server.uninstallSystemFeature(FEATURE_CAPABILITYC_1_0); + server.uninstallSystemFeature(FEATURE_CAPABILITYD_1_0); + server.uninstallSystemFeature(FEATURE_COMBO_A10_B10_1_0); + server.uninstallSystemFeature(FEATURE_AUTO_A10_B10_1_0); + server.uninstallSystemFeature(FEATURE_AUTO_A11_B11_1_0); + + for (int i = 1; i < 8; i++) { + server.deleteFileFromLibertyInstallRoot("lib/bundle" + i + "_1.0.0.jar"); + } + } + + @After + public void tearDown() throws Exception { + if (server.isStarted()) { + ProgramOutput po = server.stopServer(); + Log.info(c, "tearDown", "Stop server " + (po.getReturnCode() == 0 ? "succeeded" : "failed")); + } + try { + RemoteFile tmpBootstrapProps = server.getFileFromLibertyServerRoot("tmp.bootstrap.properties"); + if (tmpBootstrapProps.exists()) { + server.renameLibertyServerRootFile("bootstrap.properties", "override_tolerates_bootstrap.properties"); + server.renameLibertyServerRootFile("tmp.bootstrap.properties", "bootstrap.properties"); + } + } catch (FileNotFoundException e) { + // nothing + } + + } + + /** + * Tests that two versions of a singleton feature cause a failure if configured directly in server.xml + * + * @throws Exception + */ + @Test + @ExpectedFFDC("java.lang.IllegalArgumentException") + public void testTwoVersionsSameFeatureConfigured() throws Exception { + final String m = "testTwoVersionsSameFeature"; + Log.info(c, m, "starting test"); + + server.setServerConfigurationFile("server_a10a11.xml"); + server.startServer(m + ".log"); + + assertNotNull("No message indicating a conflict", server.waitForStringInLog("CWWKF0033E.*" + FEATURE_CAPABILITYA_1_0)); + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertFalse("Expected capabilityA-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_1)); + assertFalse("Expected capabilityA-1.0 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + + Log.info(c, m, "successful exit"); + } + + /** + * Tests that the latest version of a feature is loaded even when another feature depends on on older + * version of that feature. + * + * @throws Exception + */ + @Test + public void testFeatureOverridesComboFeature() throws Exception { + final String m = "testFeatureOverridesComboFeature"; + Log.info(c, m, "starting test"); + + server.setServerConfigurationFile("server_a10b11combo10.xml"); + server.startServer(m + ".log"); + + //assertNotNull("No message indicating that the lower version feature was not used", server.waitForStringInLog("CWWKF0031I.*" + FEATURE_CAPABILITYB_1_0)); + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertTrue("Expected capabilityA-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + assertTrue("Expected capabilityB-1.1 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_1)); + assertFalse("Expected capabilityB-1.0 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + + Log.info(c, m, "successful exit"); + } + + /** + * Tests that a feature update that adds a newer version of a feature (while a combo feature depends on a + * lower version of the same feature) results in the lower version of the feature getting removed, and the + * newer feature installed. + * + * @throws Exception + */ + @Test + public void testFeatureUpdateUpgradesExistingFeature() throws Exception { + final String m = "testFeatureUpdateUpgradesExistingFeature"; + Log.info(c, m, "starting test"); + + server.setServerConfigurationFile("server_a10combo10.xml"); + server.startServer(m + ".log"); + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + Log.info(c, m, "installedFeatures: " + installedFeatures); + assertTrue("Pre-condition: Expected capabilityA-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + assertTrue("Pre-condition: Expected capabilityB-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + assertFalse("Pre-condition: Expected capabilityA-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_1)); + assertFalse("Pre-condition: Expected capabilityB-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYB_1_1)); + + Log.info(c, m, "Feature update - adding:" + FEATURE_CAPABILITYB_1_1); + server.setServerConfigurationFile("server_a10b11combo10.xml"); + // assertNotNull("No message indicating that the lower version feature was not used", server.waitForStringInLog("CWWKF0031I.*" + FEATURE_CAPABILITYB_1_0)); + assertNotNull("Expected message indicating that feature update completed did not occur", server.waitForStringInLog("CWWKG0017I")); // feature update completed + assertNotNull("Expected message indicating that capabilityB-1.1 feature was installed did not occur", server.waitForStringInLog("CWWKF0012I.*capabilityB-1.1")); + assertNotNull("Expected message indicating that capabilityB-1.0 feature was uninstalled did not occur", server.waitForStringInLog("CWWKF0013I.*capabilityB-1.0")); + + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + Log.info(c, m, "installedFeatures: " + installedFeatures); + assertTrue("Expected capabilityA-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + assertTrue("Expected capabilityB-1.1 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_1)); + assertFalse("Expected capabilityA-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_1)); + assertFalse("Expected capabilityB-1.0 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + + Log.info(c, m, "successful exit"); + } + + /** + * Tests that a feature update that adds a newer version of a feature (while a combo feature depends on a + * lower version of the same feature) results in the lower version of the feature getting removed, and the + * newer feature installed. + * + * @throws Exception + */ + @Test + public void testFeatureUpdateDowngradesExistingFeature() throws Exception { + final String m = "testFeatureUpdateUpgradesExistingFeature"; + Log.info(c, m, "starting test"); + + server.setServerConfigurationFile("server_a10b11combo10.xml"); + server.startServer(m + ".log"); + + // assertNotNull("No message indicating that the lower version feature was not used", server.waitForStringInLog("CWWKF0031I.*" + FEATURE_CAPABILITYB_1_0)); + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + Log.info(c, m, "installedFeatures: " + installedFeatures); + assertTrue("Pre-condition: Expected capabilityA-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + assertTrue("Pre-condition: Expected capabilityB-1.1 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_1)); + assertFalse("Pre-condition: Expected capabilityA-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_1)); + assertFalse("Pre-condition: Expected capabilityB-1.0 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + + Log.info(c, m, "Feature update - adding:" + FEATURE_CAPABILITYB_1_1); + server.setServerConfigurationFile("server_a10combo10.xml"); + assertNotNull("Expected message indicating that feature update completed did not occur", server.waitForStringInLog("CWWKG0017I")); // feature update completed + assertNotNull("Expected message indicating that capabilityB-1.0 feature was installed did not occur", server.waitForStringInLog("CWWKF0012I.*capabilityB-1.0")); + assertNotNull("Expected message indicating that capabilityB-1.1 feature was uninstalled did not occur", server.waitForStringInLog("CWWKF0013I.*capabilityB-1.1")); + + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + Log.info(c, m, "installedFeatures: " + installedFeatures); + assertTrue("Expected capabilityA-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + assertTrue("Expected capabilityB-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + assertFalse("Expected capabilityA-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_1)); + assertFalse("Expected capabilityB-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYB_1_1)); + + Log.info(c, m, "successful exit"); + } + + /** + * Tests that auto features (features that are loaded automatically when other specified features + * are explicitly loaded) load correctly. Specifically, this test verifies that an auto feature + * that depends on capabilityA-1.0 and capabilityB-1.0 is loaded when those features are loaded. + * Then, when capabilityB is upgraded to 1.1, the auto feature should be unloaded. Then when + * capabilityA is also upgraded to 1.1, a new auto feature that depends on capabilityA-1.1 and + * capabilityB-1.1 should be loaded. + */ + @Test + public void testAutoFeaturesUpgradeAndDowngradeAppropriately() throws Exception { + final String m = "testAutoFeaturesUpgradeAndDowngradeAppropriately"; + Log.info(c, m, "starting test"); + + server.setServerConfigurationFile("server_a10combo10.xml"); + server.startServer(m + ".log"); + + // server.xml specifies capabilityA-1.0 and capabilityB-1.0, so + // we expect auto feature auto-A10B10 to be installed + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + Log.info(c, m, "installedFeatures: " + installedFeatures); + assertTrue("Pre-condition: Expected capabilityA-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + assertTrue("Pre-condition: Expected capabilityB-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + assertTrue("Pre-condition: Expected auto-A10B10-1.0 auto feature to be installed but was not", installedFeatures.contains(FEATURE_AUTO_A10_B10_1_0)); + assertFalse("Pre-condition: Expected capabilityA-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_1)); + assertFalse("Pre-condition: Expected capabilityB-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYB_1_1)); + assertFalse("Pre-condition: Expected auto-A11B11-1.0 auto feature not to be installed, but it was", installedFeatures.contains(FEATURE_AUTO_A11_B11_1_0)); + + Log.info(c, m, "Feature update - adding:" + FEATURE_CAPABILITYB_1_1); + server.setServerConfigurationFile("server_a10b11combo10.xml"); + //assertNotNull("No message indicating that the lower version feature was not used", server.waitForStringInLog("CWWKF0031I.*" + FEATURE_CAPABILITYB_1_0)); + assertNotNull("Expected message indicating that feature update completed did not occur", server.waitForStringInLog("CWWKG0017I")); // feature update completed + assertNotNull("Expected message indicating that capabilityB-1.1 feature was installed did not occur", server.waitForStringInLog("CWWKF0012I.*capabilityB-1.1")); + assertNotNull("Expected message indicating that capabilityB-1.0 feature was uninstalled did not occur", server.waitForStringInLog("CWWKF0013I.*capabilityB-1.0")); + + // Now server.xml specifies a variety of options that should include capabiltyA-1.0, + // capabilityB-1.0, and capabilityB-1.1 -- the server should not install capabilityB-1.0 + // since capabilityB-1.1 is the upgrade -- that means that auto feature auto-A10B10 should + // be uninstalled. + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + Log.info(c, m, "installedFeatures: " + installedFeatures); + assertTrue("Expected capabilityA-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + assertTrue("Expected capabilityB-1.1 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_1)); + assertFalse("Expected auto-A10B10-1.0 auto feature not to be installed but it was", installedFeatures.contains(FEATURE_AUTO_A10_B10_1_0)); + assertFalse("Expected capabilityA-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_1)); + assertFalse("Expected capabilityB-1.0 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + assertFalse("Expected auto-A11B11-1.0 auto feature not to be installed, but it was", installedFeatures.contains(FEATURE_AUTO_A11_B11_1_0)); + + // Test was failing on Sun so add a sleep because + // some filesystems need about a second for filesystem changes to be detected. + //Pause for 2 seconds + Thread.sleep(2000); + + Log.info(c, m, "Feature update - adding:" + FEATURE_CAPABILITYA_1_1); + server.setServerConfigurationFile("server_a11b11combo10.xml"); + //assertNotNull("No message indicating that the lower version feature was not used", server.waitForStringInLog("CWWKF0031I.*" + FEATURE_CAPABILITYA_1_0)); + assertNotNull("Expected message indicating that feature update completed did not occur", server.waitForStringInLog("CWWKG0017I")); // feature update completed + assertNotNull("Expected message indicating that capabilityA-1.1 feature was installed did not occur", server.waitForStringInLog("CWWKF0012I.*capabilityA-1.1")); + assertNotNull("Expected message indicating that capabilityA-1.0 feature was uninstalled did not occur", server.waitForStringInLog("CWWKF0013I.*capabilityA-1.0")); + + // No we've upgraded capabilityA-1.0 to 1.1- so we have A1.0, A1.1, B1.0, and B1.1 specified, and + // the server should remove A1.0 and B1.0 since the are upgraded by A1.1 and B1.1 respectively. + // This means that we should see auto feature, auto-A11B11 installed. + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + Log.info(c, m, "installedFeatures: " + installedFeatures); + assertTrue("Expected capabilityA-1.1 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYA_1_1)); + assertTrue("Expected capabilityB-1.1 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_1)); + assertTrue("Expected auto-A11B11-1.0 auto feature to be installed but was not", installedFeatures.contains(FEATURE_AUTO_A11_B11_1_0)); + assertFalse("Expected capabilityA-1.0 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + assertFalse("Expected capabilityB-1.0 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + assertFalse("Expected auto-A10B10-1.0 auto feature not to be installed, but it was", installedFeatures.contains(FEATURE_AUTO_A10_B10_1_0)); + + Log.info(c, m, "successful exit"); + } + + /** + * Tests that a conflict occurs if two different versions of the same feature are required but there is no toleration + * that allows for a common version to be selected. The removes the problem feature to ensure a solution can be found + * + * @throws Exception + */ + @Test + @ExpectedFFDC("java.lang.IllegalArgumentException") + public void testFeatureConflict() throws Exception { + final String m = "testFeatureConflict"; + Log.info(c, m, "starting test"); + + server.setServerConfigurationFile("server_d10a10b10combo10.xml"); + server.startServer(m + ".log"); + + assertNotNull("No message indicating a conflict", server.waitForStringInLog("CWWKF0033E.*" + FEATURE_CAPABILITYA_1_0)); + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertTrue("Expected comboA10B10-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_COMBO_A10_B10_1_0)); + assertTrue("Expected capabilityB-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + assertTrue("Expected capabilityC-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYC_1_0)); + assertTrue("Expected capabilityD-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYD_1_0)); + assertFalse("Expected capabilityA-1.0 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + assertFalse("Expected capabilityA-2.0 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_2_0)); + + Log.info(c, m, "Feature update - using only: " + FEATURE_COMBO_A10_B10_1_0); + server.setServerConfigurationFile("server_a10combo10.xml"); + assertNotNull("Expected message indicating that feature update completed did not occur", server.waitForStringInLog("CWWKG0017I")); // feature update completed + assertNotNull("Expected message indicating that capabilityA-1.0 feature was installed did not occur", server.waitForStringInLog("CWWKF0012I.*capabilityA-1.0")); + assertNotNull("Expected message indicating that capabilityC-1.0 feature was uninstalled did not occur", server.waitForStringInLog("CWWKF0013I.*capabilityC-1.0")); + assertNotNull("Expected message indicating that capabilityD-1.0 feature was uninstalled did not occur", server.waitForStringInLog("CWWKF0013I.*capabilityD-1.0")); + + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + Log.info(c, m, "installedFeatures: " + installedFeatures); + assertTrue("Expected capabilityA-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + assertTrue("Expected capabilityB-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + assertFalse("Expected capabilityA-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_1)); + assertFalse("Expected capabilityB-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYB_1_1)); + Log.info(c, m, "successful exit"); + } + + /** + * Tests that a conflict does not occur if two different versions of the same feature are required but tolerates is overridden by bootstrap.properties + * that allows for a common version to be selected. Then removes the problem feature to ensure a solution can be found again. + * + * @throws Exception + */ + @Test + public void testFeatureConflictOverrideTolerate() throws Exception { + final String m = "testFeatureConflicOverrideTolerate"; + Log.info(c, m, "starting test"); + + server.renameLibertyServerRootFile("bootstrap.properties", "tmp.bootstrap.properties"); + server.renameLibertyServerRootFile("override_tolerates_bootstrap.properties", "bootstrap.properties"); + server.setServerConfigurationFile("server_d10a10b10combo10.xml"); + server.startServer(m + ".log"); + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertTrue("Expected comboA10B10-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_COMBO_A10_B10_1_0)); + assertTrue("Expected capabilityA-2.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYA_2_0)); + assertTrue("Expected capabilityB-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + assertTrue("Expected capabilityC-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYC_1_0)); + assertTrue("Expected capabilityD-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYD_1_0)); + assertFalse("Expected capabilityA-1.0 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + + Log.info(c, m, "Feature update - using only: " + FEATURE_COMBO_A10_B10_1_0); + server.setServerConfigurationFile("server_a10combo10.xml"); + assertNotNull("Expected message indicating that feature update completed did not occur", server.waitForStringInLog("CWWKG0017I")); // feature update completed + assertNotNull("Expected message indicating that capabilityA-1.0 feature was installed did not occur", server.waitForStringInLog("CWWKF0012I.*capabilityA-1.0")); + assertNotNull("Expected message indicating that capabilityC-1.0 feature was uninstalled did not occur", server.waitForStringInLog("CWWKF0013I.*capabilityC-1.0")); + assertNotNull("Expected message indicating that capabilityD-1.0 feature was uninstalled did not occur", server.waitForStringInLog("CWWKF0013I.*capabilityD-1.0")); + + installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + Log.info(c, m, "installedFeatures: " + installedFeatures); + assertTrue("Expected capabilityA-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYA_1_0)); + assertTrue("Expected capabilityB-1.0 feature to be installed but was not", installedFeatures.contains(FEATURE_CAPABILITYB_1_0)); + assertFalse("Expected capabilityA-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYA_1_1)); + assertFalse("Expected capabilityB-1.1 feature not to be installed, but it was", installedFeatures.contains(FEATURE_CAPABILITYB_1_1)); + Log.info(c, m, "successful exit"); + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureListToolTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureListToolTest.java new file mode 100755 index 000000000000..c02a3c89da70 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureListToolTest.java @@ -0,0 +1,125 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class FeatureListToolTest extends FeatureToolTestCommon { + + @BeforeClass + public static void beforeClassSetup() throws Exception { + setupEnv(LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.tool")); + setupProductExtensions(SETUP_ALL_PROD_EXTS); + + } + + /** + * Tests that the featurelist's tool help displays the --productExtension option. + * + * @throws Exception + */ + @Test + public void testFeatureListToolProductExtensionParmHelpDisplay() throws Exception { + testFeatureToolProductExtensionParmHelpDisplay(javaExc, new String[] { "-jar", installRoot + "/bin/tools/ws-featurelist.jar", "--help" }, installRoot); + } + + /** + * Test ws-featurelist.jar with --productExtension=testproduct where the features folder for the product extension is empty. + * The request is expected to fail and issue message: CWWKG0078E. + * + * @throws Exception + */ + @Test + public void testFeatureListToolUsingProductWithNoFeatureMfs() throws Exception { + testFeatureToolUsingProductWithNoFeatureMfs(javaExc, + new String[] { "-jar", installRoot + "/bin/tools/ws-featurelist.jar", "--productExtension=testproduct", + installRoot + "/tool.output.dir/prodExtFeaturelistNoFeatures.xml" }, + installRoot, + "CWWKG0078E"); + } + + /** + * Test ws-featurelist.jar with a product extension name argument pointing to a product that does not exist: --productExtension=testproductbadName. + * The request is expected to fail and issue message: CWWKG0080E. + * + * @throws Exception + */ + @Test + public void testFeatureListToolUsingBadProductExtNameArgument() throws Exception { + testFeatureToolUsingBadProductExtNameArgument(javaExc, + new String[] { "-jar", installRoot + "/bin/tools/ws-featurelist.jar", + "--productExtension=testproductbadName", installRoot + "/tool.output.dir/prodExtFeaturelistBadNameArg.xml" }, + installRoot, + "CWWKG0080E"); + } + + /** + * Test ws-featurelist.jar with --productExtension=testproduct where the com.ibm.websphere.productInstall in the + * product extension's properties file points to "". + * The request is expected to fail and issue message: CWWKG0079E. + * + * @throws Exception + */ + @Test + public void testFeatureListToolUsingEmptyInstallLocationInProdExtPropsFile() throws Exception { + testFeatureToolUsingEmptyInstallLocationInProdExtPropsFile(javaExc, + new String[] { "-jar", installRoot + "/bin/tools/ws-featurelist.jar", + "--productExtension=testproduct", + installRoot + "/tool.output.dir/prodExtFeaturelistWithInvalidInstLocInPropsFile.xml" }, + installRoot, + "CWWKG0079E"); + } + + /** + * Test ws-featurelist.jar without the --productExtension argument. + * Only Core features expected in the output list. + * + * @throws Exception + */ + @Test + public void testFeatureListToolWithNoProdExtArgument() throws Exception { + testFeatureToolWithNoProdExtArgument(javaExc, + new String[] { "-jar", installRoot + "/bin/tools/ws-featurelist.jar", + installRoot + "/tool.output.dir/coreFeaturelist.xml" }, + installRoot); + } + + /** + * Test ws-featurelist.jar with --productExtension=usr argument. + * Only features in the default user product extension location are expected in the output list. + * + * @throws Exception + */ + @Test + public void testFeatureListToolWithUsrProdExtArgument() throws Exception { + testFeatureToolWithUsrProdExtArgument(javaExc, + new String[] { "-jar", installRoot + "/bin/tools/ws-featurelist.jar", + "--productExtension=usr", installRoot + "/tool.output.dir/usrFeaturelist.xml" }, + installRoot); + } + + /** + * Test ws-featurelist.jar with the --productExtension=testproduct argument. + * Only features in the default user product extension testproduct are expected in the output list. + * + * @throws Exception + */ + @Test + public void testFeatureListToolWithProdExtArgument() throws Exception { + testFeatureToolWithProdExtArgument(javaExc, new String[] { "-jar", installRoot + "/bin/tools/ws-featurelist.jar", + "--productExtension=testproduct", installRoot + "/tool.output.dir/prodExtFeaturelist.xml" }, + installRoot); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureManagerIconsTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureManagerIconsTest.java new file mode 100755 index 000000000000..92b704c18fc2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureManagerIconsTest.java @@ -0,0 +1,314 @@ +package com.ibm.ws.kernel.feature.fat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.ProtocolException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Tests that installing and uninstalling of features using the featureManager will honour the + * icons. + * + * This test uses the IconFeature class to represent the feature being tested. If any new features are + * needed for testing, please consult that class's Javadoc as setting up a new feature in the same way + * may make testing common items much easier. + */ +@Mode(TestMode.FULL) +public class FeatureManagerIconsTest { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.icons_test"); + private final Class c = FeatureManagerIconsTest.class; + + List iconFeaturesInstalled = new ArrayList(); + + /** + * Test that adding a feature where the Icon header is wrong is effectively ignored + * + * @throws Exception + */ + @Test + public void installEsaBadPath() throws Exception { + IconFeature badPath = new IconFeature("badPathTool-1.0"); + badPath.addUnexpectedIcon("OSGI-INF/toolicon.png"); + iconFeaturesInstalled.add(badPath); + runInstaller(badPath); + } + + /** + * Test that a feature with the Subsystem-Icon header specified without any files works + * + * @throws Exception + */ + @Test + public void installEsaWithEmptyHeader() throws Exception { + IconFeature emptyIconHeaderFeature = new IconFeature("emptyIconHeader-1.0"); + emptyIconHeaderFeature.addUnexpectedIcon("OSGI-INF/toolicon.png"); + iconFeaturesInstalled.add(emptyIconHeaderFeature); + runInstaller(emptyIconHeaderFeature); + } + + /** + * Test golden path, a single file referenced in the Subsystem-Icon header + * + * @throws Exception + */ + @Mode(TestMode.LITE) + @Test + public void installEsaGoldenPath() throws Exception { + IconFeature goldenPath = new IconFeature("goldenPathTool-1.0"); + goldenPath.addExpectedIcon("OSGI-INF/toolicon.png"); + iconFeaturesInstalled.add(goldenPath); + runInstaller(goldenPath); + } + + /** + * Test adding a directive onto the file path and ensuring the files are still detected correctly + * + * @throws Exception + */ + @Test + public void installEsaWithIconDirectives() throws Exception { + IconFeature iconDirectives = new IconFeature("iconDirectivesTool-1.0"); + iconDirectives.addExpectedIcon("OSGI-INF/toolicon64.png"); + iconDirectives.addExpectedIcon("OSGI-INF/toolicon10.png"); + iconFeaturesInstalled.add(iconDirectives); + runInstaller(iconDirectives); + } + + /** + * Test an ESA with multiple files specified in the header, but where not all the files exist in the ESA. + * + * @throws Exception + */ + @Test + public void installEsaWithSomeMissingIcons() throws Exception { + IconFeature someIconsMissing = new IconFeature("missingIconsTool-1.0"); + someIconsMissing.addUnexpectedIcon("OSGI-INF/missingtoolicon.png"); + someIconsMissing.addExpectedIcon("OSGI-INF/toolicon.png"); + iconFeaturesInstalled.add(someIconsMissing); + runInstaller(someIconsMissing); + } + + /** + * Test an ESA where the Subsystem-Icon header is not provided. Nothing should be installed. + * + * @throws Exception + */ + @Test + public void installEsaWithNoHeader() throws Exception { + IconFeature noHeaderFeature = new IconFeature("noHeaderTool-1.0"); + noHeaderFeature.addUnexpectedIcon("OSGI-INF/toolicon.png"); + iconFeaturesInstalled.add(noHeaderFeature); + runInstaller(noHeaderFeature); + } + + /** + * Test installing a user feature. This should work exactly the same as a product feature, although + * files should go under usr/extension + * + * @throws Exception + */ + @Test + public void installUserFeature() throws Exception { + IconFeature userFeature = new IconFeature("userIconFeature-1.0"); + userFeature.markAsUserFeature(); + userFeature.addExpectedIcon("OSGI-INF/usertool.png"); + userFeature.addUnexpectedIcon("OSGI-INF/unexpectedIcon.png"); + iconFeaturesInstalled.add(userFeature); + runInstaller(userFeature); + } + + /** + * Run the featureManager install command and verify that, as well as installing the feature correctly, + * the feature's wab is accessible and only the expected icons are laid down + * + * @param string + * @throws Exception + */ + private void runInstaller(IconFeature feature) throws Exception { + String method = "runInstaller"; + server.stopServer(); + String pathToEsa = feature.getAutoFVTLocation(); + server.copyFileToLibertyInstallRoot(pathToEsa); + String cmd = server.getInstallRoot() + "/bin/featureManager install " + feature.getEsaFile() + " --acceptLicense"; + ProgramOutput result = server.getMachine().execute(cmd); + Log.info(c, method, "Got response " + result.getReturnCode()); + if (result.getReturnCode() != 0) { + for (String stdOutLine : result.getStdout().split("\n")) { + Log.info(c, method, "Stdout: " + stdOutLine.trim()); + } + + for (String stdErrLine : result.getStderr().split("\n")) { + Log.info(c, method, "Stderr: " + stdErrLine.trim()); + } + } + + Assert.assertEquals("The " + feature.getShortName() + " feature should install correctly", 0, result.getReturnCode()); + List features = new ArrayList(); + features.add("wab-1.0"); + features.add(feature.getNamespacedShortName()); + server.changeFeatures(features); + server.startServer(); + server.waitForStringInLog("CWWKT0016I.*" + feature.getNamespacedShortName()); + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + feature.getURL()); + HttpURLConnection con = getHttpConnection(url); + BufferedReader br = getConnectionStream(con); + String line = br.readLine(); + //If there is output then the Application automatically installed correctly + + assertTrue("The output did not contain the automatically installed message", + line.contains(feature.getShortName())); + + for (String expectedIcon : feature.getExpectedIcons()) { + // Check that the files are laid down on the filesystem + // Not testing them deeply, as long as they are more than zero bytes + assertTrue("The icon at " + expectedIcon + " should exist", server.fileExistsInLibertyInstallRoot(expectedIcon)); + assertTrue("The icon " + expectedIcon + " should not be zero bytes", server.getFileFromLibertyInstallRoot(expectedIcon).length() > 0); + } + + for (String unexpectedIcon : feature.getUnexpectedIcons()) { + // Check that the file is not laid down on the filesystem + assertFalse("The icon at " + unexpectedIcon + " should not exist", server.fileExistsInLibertyInstallRoot(unexpectedIcon)); + } + + if (feature.getExpectedIcons().size() == 0) { + assertFalse("No icons were expected, so the icons folder should not exist", server.fileExistsInLibertyInstallRoot(feature.getIconFolder())); + } + + } + + /** + * Both before and after each test we should ensure that none of the features are installed. + * This should fail if we couldn't uninstall any features + * + * @throws Exception + */ + @Before + @After + public void tearDown() throws Exception { + Iterator iterator = iconFeaturesInstalled.iterator(); + List featuresThatDidNotUninstall = new ArrayList(); + while (iterator.hasNext()) { + IconFeature iconFeature = iterator.next(); + if (removeFeature(iconFeature)) { + iterator.remove(); + } else { + featuresThatDidNotUninstall.add(iconFeature.getShortName()); + } + } + + if (featuresThatDidNotUninstall.size() > 0) { + Assert.fail("No features should have been left installed, but the following features were " + featuresThatDidNotUninstall); + } + + } + + /** + * Remove all files that are part of the feature, with the intention being to clean up the image + * under test + * + * @param feature the feature to remove + * @return true if no files were left behind, false otherwise + * @throws Exception if anything goes wrong + */ + private boolean removeFeature(IconFeature feature) throws Exception { + boolean returnCode = true; + String method = "removeFeature"; + server.stopServer(); + server.deleteFileFromLibertyInstallRoot(feature.getEsaFile()); + + // What we should be doing is using featureManager uninstall here, but the fact that its not available in V8.5.5.2 means that's not a good plan. + server.deleteDirectoryFromLibertyInstallRoot(feature.getIconFolder()); + server.deleteFileFromLibertyInstallRoot(feature.getFeatureBundle()); + server.deleteFileFromLibertyInstallRoot(feature.getFeatureManifest()); +// TODO this code should be re-enabled and replace the lines above when the uninstall command on featureManager is re-enabled +// String cmd = server.getInstallRoot() + "/bin/featureManager uninstall " + feature.getShortName(); +// ProgramOutput result = server.getMachine().execute(cmd); +// Log.info(c, method, "(" + feature.getShortName() + ") Got response " + result.getReturnCode()); +// if (result.getReturnCode() != 0) { +// for (String stdOutLine : result.getStdout().split("\n")) { +// Log.info(c, method, "(" + feature.getShortName() + ") Stdout: " + stdOutLine.trim()); +// } +// +// for (String stdErrLine : result.getStderr().split("\n")) { +// Log.info(c, method, "(" + feature.getShortName() + ") Stderr: " + stdErrLine.trim()); +// } +// returnCode = false; +// } + + for (String expectedIcon : feature.getExpectedIcons()) { + // Check that the files that should have been laid down have gone + // Not testing them deeply, as long as they are more than zero bytes + if (server.fileExistsInLibertyInstallRoot(expectedIcon)) { + Log.info(c, method, "The icon at " + expectedIcon + " should not exist after an uninstall"); + returnCode = false; + } + } + if (server.fileExistsInLibertyInstallRoot(feature.getIconFolder())) { + Log.info(c, method, "The icon folder at " + feature.getIconFolder() + " should not exist after an uninstall"); + returnCode = false; + } + + return returnCode; + } + + /** + * This method is used to get a connection stream from an HTTP connection. It + * gives the output from the webpage that it gets from the connection + * + * @param con The connection to the HTTP address + * @return The Output from the webpage + */ + private BufferedReader getConnectionStream(HttpURLConnection con) throws IOException { + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + return br; + } + + /** + * This method creates a connection to a webpage and then reutrns the connection + * + * @param url The Http Address to connect to + * @return The connection to the http address + */ + private HttpURLConnection getHttpConnection(URL url) throws IOException, ProtocolException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + return con; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureManagerToolTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureManagerToolTest.java new file mode 100755 index 000000000000..5b3c0b6d93aa --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureManagerToolTest.java @@ -0,0 +1,2017 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Arrays; +import java.util.Collection; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.jar.JarInputStream; +import java.util.jar.Manifest; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipOutputStream; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.osgi.util.ManifestElement; +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Test; +import org.osgi.framework.BundleException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import com.ibm.websphere.simplicity.LocalFile; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.common.apiservices.LocalMachine; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.LibertyServerUtils; + +@Mode(TestMode.FULL) +public class FeatureManagerToolTest extends FeatureToolTestCommon { + /** */ + private static final String ZOS_EDITION = "zOS"; + /** */ + private static final String INSTALLATION_MANAGER = "InstallationManager"; + /** */ + private static final String PRODUCT_INSTALL_TYPE = "productInstallType"; + + private static final String PRODUCT_EDITION = "productEdition"; + + private static final String PRODUCT_VERSION = "productVersion"; + + /** */ + private static final String IBM_APPLIES_TO_HEADER = "IBM-AppliesTo"; + /** */ + private static final String SUBSYSTEM_MANIFEST_FILE = "OSGI-INF/SUBSYSTEM.MF"; + private static final int ReturnCode_OK = 0; + private static final int ReturnCode_BAD_ARGUMENT = 20; + + private static final Class c = FeatureManagerToolTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.user"); + + private static final String installFeatureMsgPrefix = "CWWKF0012I:"; + + private final Collection filesToTidy = new HashSet(); + + /** + * This method removes all the testing artifacts from the server directories. + * + * @throws Exception + */ + @After + public void cleanup() throws Exception { + final String METHOD_NAME = "cleanup"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) + server.stopServer(); + + server.deleteDirectoryFromLibertyInstallRoot("usr/extension/"); + server.deleteDirectoryFromLibertyInstallRoot("producttest"); + server.deleteDirectoryFromLibertyInstallRoot("etc/extensions"); + server.deleteDirectoryFromLibertyInstallRoot("tool.output.dir"); + + for (String filePath : filesToTidy) { + server.deleteFileFromLibertyInstallRoot(filePath); + } + filesToTidy.clear(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a user feature is installed when added to server.xml. + * + * @throws Exception + */ + @Mode(TestMode.LITE) + @Test + public void testFeatureInstall() throws Exception { + final String METHOD_NAME = "testFeatureInstall"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest"); + + Log.info(c, METHOD_NAME, po.getStdout()); + Log.info(c, METHOD_NAME, po.getStderr()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + // Start the server xml with a user feature available + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + TestUtils.makeConfigUpdateSetMark(server, "server_user_features.xml"); + + // Get the install feature message for the added user feature. + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("usertest user feature was not installed and should have been: " + output, output.contains("usertest")); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.mf")); + assertTrue("The usertest bundle should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a user feature is installed when added to server.xml. + * + * @throws Exception + */ + @Test + public void testFeatureInstallToProductExtension() throws Exception { + final String METHOD_NAME = "testFeatureInstall"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + + ProgramOutput po = server.installFeature("testproduct", "usertest"); + + Log.info(c, METHOD_NAME, po.getStdout()); + Log.info(c, METHOD_NAME, po.getStderr()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("producttest/lib/features/usertest.mf")); + assertTrue("The usertest bundle should exist.", server.fileExistsInLibertyInstallRoot("producttest/lib/usertest_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + @Test + public void testFeatureInstallFromURL() throws Exception { + final String METHOD_NAME = "testFeatureInstallFromURL"; + + Log.entering(c, METHOD_NAME); + + LibertyServer installServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.install"); + + try { + + installServer.addInstalledAppForValidation("feature"); + installServer.startServer(METHOD_NAME + ".log"); + + String url = "http://localhost:" + installServer.getHttpDefaultPort() + "/feature/usertest.esa"; + + ProgramOutput po = installServer.getMachine().execute(installServer.getInstallRoot() + "/bin/featureManager", new String[] { "install", "--to=usr", url }, + installServer.getInstallRoot()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + } finally { + if (installServer.isStarted()) + installServer.stopServer(); + + installServer.deleteDirectoryFromLibertyInstallRoot("usr/extension/"); + + Log.exiting(c, METHOD_NAME); + } + } + + /** + * TestDescription: + * This test ensures that you can't install a user feature if it already exists. + * + * @throws Exception + */ + @Test + public void testFeatureInstallTwice() throws Exception { + final String METHOD_NAME = "testFeatureInstallTwice"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest"); + + Log.info(c, METHOD_NAME, po.getStdout()); + Log.info(c, METHOD_NAME, po.getStderr()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + po = server.installFeature(null, "usertest"); + + String stdout = po.getStdout(); + Log.info(c, METHOD_NAME, stdout); + + assertTrue("The feature should not have been installed. " + stdout, stdout.contains("CWWKF1000I")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can't install a feature with a missing bundle. + * + * @throws Exception + */ + @Test + public void testFeatureInstallMissingBundle() throws Exception { + final String METHOD_NAME = "testFeatureInstallMissingBundle"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.missing.bundle"); + + String stdout = po.getStdout(); + Log.info(c, METHOD_NAME, stdout); + + assertTrue("The feature should not have been installed. stdout:\r\n" + stdout, stdout.contains("CWWKF1013E")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can't install a user feature if it has a file missing. + * + * @throws Exception + */ + @Test + public void testFeatureInstallMissingFile() throws Exception { + final String METHOD_NAME = "testFeatureInstallMissingFile"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.missing.file"); + + String stdout = po.getStdout(); + Log.info(c, METHOD_NAME, stdout); + + assertTrue("The feature should not have been installed. stdout:\r\n" + stdout, stdout.contains("CWWKF1012E")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can't install a user feature if it does not have a subsystem manifest. + * + * @throws Exception + */ + @Test + public void testFeatureInstallMissingSubsystemManifest() throws Exception { + final String METHOD_NAME = "testFeatureInstallMissingSubsystemManifest"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.no.subsystem.manifest"); + + String stdout = po.getStdout(); + Log.info(c, METHOD_NAME, stdout); + + assertTrue("The feature should not have been installed. stdout:\r\n" + stdout, stdout.contains("CWWKF1022E")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can install a user feature with static files. + * + * @throws Exception + */ + @Test + public void testFeatureInstallWithFile() throws Exception { + final String METHOD_NAME = "testFeatureInstallWithFile"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.file"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can install a user feature that relocates a jar from lib. + * + * @throws Exception + */ + @Test + public void testFeatureInstallWithAlternativeLocation() throws Exception { + final String METHOD_NAME = "testFeatureInstallWithAlternativeLocation"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.api"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + assertTrue("The english translations were not installed", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/l10n/usertest.with.api.properties")); + assertTrue("The french translations were not installed", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/l10n/usertest.with.api_fr.properties")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can install a user feature that has a dependency to another feature in the same install location + * + * @throws Exception + */ + @Test + public void testFeatureInstallWithDependency() throws Exception { + final String METHOD_NAME = "testFeatureInstallWithDependency"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.dependency", "usertest.dependency"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.mf")); + assertTrue("The usertest bundle should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest_1.0.0.jar")); + + assertTrue("The usertest dependency feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.dependency.mf")); + assertTrue("The usertest dependency bundle should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest.dependency_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can install a user feature that has a dependency to another feature in the same install location that has a duplicate bundle in both features. + * + * @throws Exception + */ + @Test + public void testFeatureInstallWithDependencyAndDuplicateBundle() throws Exception { + final String METHOD_NAME = "testFeatureInstallWithDependencyAndDuplicateBundle"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.dependency.duplicate.bundle", "usertest.dependency.duplicate.bundle"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + assertTrue("The usertest with dependency feature manifest should exist.", + server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.with.dependency.duplicate.bundle.mf")); + assertTrue("The usertest bundle should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest.duplicate_1.0.0.jar")); + assertTrue("The usertest readme file should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/docs/readme.txt")); + + assertTrue("The usertest dependency feature manifest should exist.", + server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.dependency.duplicate.bundle.mf")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can install a user feature that has a dependency to another feature in the same install location from a URL + * + * @throws Exception + */ + @Test + public void testFeatureInstallWithDependencyFromURL() throws Exception { + final String METHOD_NAME = "testFeatureInstallWithDependency"; + + Log.entering(c, METHOD_NAME); + + // Our dependencies will come from a Liberty server so grab this + LibertyServer esaProviderServer = null; + try { + esaProviderServer = LibertyServerFactory.getStartedLibertyServer("com.ibm.ws.kernel.feature.esa.provider"); + String url = "http://" + esaProviderServer.getHostname() + ":" + esaProviderServer.getHttpDefaultPort() + "/esas/usertest.with.dependency.esa"; + + ProgramOutput po = server.getMachine().execute(server.getInstallRoot() + "/bin/featureManager", new String[] { "install", "--to=usr", url }, server.getInstallRoot()); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.mf")); + assertTrue("The usertest bundle should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest_1.0.0.jar")); + + assertTrue("The usertest dependency feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.dependency.mf")); + assertTrue("The usertest dependency bundle should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest.dependency_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } finally { + if (esaProviderServer != null && esaProviderServer.isStarted()) { + esaProviderServer.stopServer(); + } + } + } + + /** + * TestDescription: + * This test ensures that you can't install a user feature that has a dependency to another feature that does not exist + * + * @throws Exception + */ + @Test + public void testFeatureInstallWithMissingDependency() throws Exception { + final String METHOD_NAME = "testFeatureInstallWithDependency"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.missing.dependency"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertTrue("The feature should not have been installed and should have reported a missing file. stdout:\r\n" + po.getStdout(), po.getStdout().contains("CWWKF1009E")); + assertTrue("The feature should not have been installed and should have reported a missing dependency. stdout:\r\n" + po.getStdout(), po.getStdout().contains("CWWKF1011E")); + + assertFalse("The usertest feature manifest should not exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.mf")); + assertFalse("The usertest bundle should not exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can install a user feature that has a dependency to another feature that does exist and a second feature that does not. When the install fails + * (which it should) everything should be rolled back. Sadly the dependencies are stored in a map so we can't guarantee that the missing dependency will be loaded second so + * this test will only intermittently work! + * + * @throws Exception + */ + @Test + public void testFeatureInstallRollbackWithMissingDependency() throws Exception { + final String METHOD_NAME = "testFeatureInstallWithDependency"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.multiple.dependencies", "usertest.dependency"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertTrue("The feature should not have been installed and should have reported a missing file. stdout:\r\n" + po.getStdout(), po.getStdout().contains("CWWKF1009E")); + assertTrue("The feature should not have been installed and should have reported a missing dependency. stdout:\r\n" + po.getStdout(), po.getStdout().contains("CWWKF1011E")); + + assertFalse("The usertest feature manifest should not exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.mf")); + assertFalse("The usertest bundle should not exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest_1.0.0.jar")); + + assertFalse("The usertest dependency feature manifest should not exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.dependency.mf")); + assertFalse("The usertest dependency bundle should not exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest.dependency_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a user feature that has the IBM-InstallTo and IBM-ShortName headers is installed and goes to the core. + * + * @throws Exception + */ + @Test + public void testIBMFeatureInstall() throws Exception { + final String METHOD_NAME = "testFeatureInstall"; + + Log.entering(c, METHOD_NAME); + + // This is adding files to core so can't just delete whole directories... record files added + filesToTidy.add("lib/features/usertest.install.to.core.mf"); + filesToTidy.add("lib/usertest_1.0.0.jar"); + + // Just in case the short name is used incorrectly + filesToTidy.add("lib/features/ut.mf"); + + ProgramOutput po = server.installFeature(null, "usertest.install.to.core"); + + Log.info(c, METHOD_NAME, po.getStdout()); + Log.info(c, METHOD_NAME, po.getStderr()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + // The feature file now uses the full symbolic name rather than the short name + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("lib/features/usertest.install.to.core.mf")); + assertTrue("The usertest bundle should exist.", server.fileExistsInLibertyInstallRoot("lib/usertest_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test is the same as testIBMFeatureInstall but passes the --to=usr option to ensures that a user feature that has the IBM-InstallTo and IBM-ShortName headers override + * the command line option. + * + * @throws Exception + */ + @Test + public void testIBMFeatureInstallWithToUser() throws Exception { + final String METHOD_NAME = "testFeatureInstall"; + + Log.entering(c, METHOD_NAME); + + // This is adding files to core so can't just delete whole directories... record files added + filesToTidy.add("lib/features/usertest.install.to.core.mf"); + filesToTidy.add("lib/usertest_1.0.0.jar"); + + // Just in case the short name is used incorrectly + filesToTidy.add("lib/features/ut.mf"); + + ProgramOutput po = server.installFeature("usr", "usertest.install.to.core"); + + Log.info(c, METHOD_NAME, po.getStdout()); + Log.info(c, METHOD_NAME, po.getStderr()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + // The feature file now uses the full symbolic name rather than the short name + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("lib/features/usertest.install.to.core.mf")); + assertTrue("The usertest bundle should exist.", server.fileExistsInLibertyInstallRoot("lib/usertest_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when there are two subsystem manifests with different case then an appropriate warning is issued. + * + * @throws Exception + */ + @Test + public void testTwoSubsystemManifests() throws Exception { + final String METHOD_NAME = "testFeatureInstall"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.two.manifests"); + + Log.info(c, METHOD_NAME, po.getStdout()); + Log.info(c, METHOD_NAME, po.getStderr()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + assertTrue("There should have been a warning message saying there were two manifests. stdout:\r\n" + po.getStdout(), po.getStdout().contains("CWWKF1023W")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can install a user feature that has a dependency to another feature that already exists + * + * @throws Exception + */ + @Test + public void testFeatureInstallWithDependencyToExisting() throws Exception { + final String METHOD_NAME = "testFeatureInstallWithDependency"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.depends.on.existing"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.depends.on.existing.mf")); + assertTrue("The usertest bundle should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can install features with cyclic dependencies + * + * @throws Exception + */ + @Test + public void testFeatureInstallWithCyclicDependency() throws Exception { + final String METHOD_NAME = "testFeatureInstallWithDependency"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.cyclic.1", "usertest.cyclic.2"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + assertTrue("The usertest.cyclic.1 feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.cyclic.1.mf")); + assertTrue("The usertest.cyclic.2 feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.cyclic.2.mf")); + assertTrue("The usertest.cyclic.1 bundle should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest.cyclic.1_1.0.0.jar")); + assertTrue("The usertest.cyclic.2 bundle should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest.cyclic.2_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This test makes sure that an IBM license is shown to the user when present + * + * @throws Exception + */ + @Mode(TestMode.LITE) + @Test + public void testSimpleIBMLicenseStatement() throws Exception { + final String METHOD_NAME = "testSimpleIBMLicenseStatement"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.ibm.license.same"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + // Just make sure the license text is printed, we don't do interactive install so this shows it was read + assertTrue("The license should have been printed in the output:\r\n" + po.getStdout(), po.getStdout().contains("MainLicense")); + + // Make sure the license is copied in as well + assertTrue("The english license file should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lafiles/usertest.with.ibm.license.same/lafiles/LA_en")); + assertTrue("The Taiwanese license information file should exist.", + server.fileExistsInLibertyInstallRoot("usr/extension/lafiles/usertest.with.ibm.license.same/lafiles/LI_zh_TW")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This test makes sure that where multiple ESAs are being installed all the IBM licenses are shown once and only once to the user when present + * + * @throws Exception + */ + @Test + public void testMultipleIBMLicenseStatement() throws Exception { + final String METHOD_NAME = "testMultipleIBMLicenseStatement"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.ibm.license", "usertest.with.ibm.license.same", "usertest.with.ibm.license.different"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + // Just make sure the license text is printed, we don't do interactive install so this shows it was read + assertTrue("The license should have been printed in the output once:\r\n" + po.getStdout(), po.getStdout().contains("MainLicense")); + assertTrue("The license should have been printed in the output once:\r\n" + po.getStdout(), + po.getStdout().indexOf("MainLicense") == po.getStdout().lastIndexOf("MainLicense")); + assertTrue("The second license should have been printed in the output:\r\n" + po.getStdout(), po.getStdout().contains("MainLicense")); + + /* + * Make sure the licenses are copied in as well. Make sure the licenses for both where it is the same is copied so the user can see the license for each without having to + * know the relationship between them + */ + assertTrue("The english license file should exist for the root ESA.", + server.fileExistsInLibertyInstallRoot("usr/extension/lafiles/usertest.with.ibm.license/lafiles/LA_en")); + assertTrue("The Taiwanese license information file should exist for the root ESA.", + server.fileExistsInLibertyInstallRoot("usr/extension/lafiles/usertest.with.ibm.license/lafiles/LI_zh_TW")); + + assertTrue("The english license file should exist for the dependent ESA with the same license.", + server.fileExistsInLibertyInstallRoot("usr/extension/lafiles/usertest.with.ibm.license.same/lafiles/LA_en")); + assertTrue("The Taiwanese license information file should exist for the dependent ESA with the same license.", + server.fileExistsInLibertyInstallRoot("usr/extension/lafiles/usertest.with.ibm.license.same/lafiles/LI_zh_TW")); + + assertTrue("The english license file should exist for the dependent ESA with a different license.", + server.fileExistsInLibertyInstallRoot("usr/extension/lafiles/usertest.with.ibm.license.different/lafiles/LA_en")); + assertTrue("The Taiwanese license information file should exist for the dependent ESA with a different license.", + server.fileExistsInLibertyInstallRoot("usr/extension/lafiles/usertest.with.ibm.license.different/lafiles/LI_zh_TW")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This test makes sure that where a license is already on disk then we don't ask the user to accept it again + * + * @throws Exception + */ + @Test + public void testAcceptedLicenseStatement() throws Exception { + final String METHOD_NAME = "testAcceptedLicenseStatement"; + + Log.entering(c, METHOD_NAME); + + // First install the version with the same license + ProgramOutput po = server.installFeature(null, "usertest.with.ibm.license.same"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + po = server.installFeature(null, "usertest.with.ibm.license", "usertest.with.ibm.license.different"); + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + // Make sure we were never asked for the main license + assertFalse("The license was already on disk so shouldn't need accepting again:\r\n" + po.getStdout(), po.getStdout().contains("MainLicense")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This test makes sure that third party licenses are shown to users + * + * @throws Exception + */ + @Test + public void testThirdPartyLicense() throws Exception { + final String METHOD_NAME = "testThirdPartyLicense"; + + Log.entering(c, METHOD_NAME); + + // First install the version with the same license + ProgramOutput po = server.installFeature(null, "usertest.third.party.license"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + // Make sure we were never asked for the main license + assertTrue("The license was not presented to the user:\r:\n", po.getStdout().contains("ThirdPartyLicense")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This test makes sure that the viewLicenseInfo option works + * + * @throws Exception + */ + @Test + public void testViewLicenseInfo() throws Exception { + final String METHOD_NAME = "testViewLicenseInfo"; + + Log.entering(c, METHOD_NAME); + + // First install the version with the same license + ProgramOutput po = server.installFeatureWithProgramArgs(null, "usertest.third.party.license", new String[] { "--viewLicenseInfo" }); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The viewLicense should have exited ok. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + // Make sure the license was printed + assertTrue("The license should have been presented to the user:\r:\n" + po.getStdout(), po.getStdout().contains("ThirdPartyLicense")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This test makes sure that the viewLicenseAgreement option works + * + * @throws Exception + */ + @Test + public void testViewLicenseAgreement() throws Exception { + final String METHOD_NAME = "testViewLicenseAgreement"; + + Log.entering(c, METHOD_NAME); + + // First install the version with the same license + ProgramOutput po = server.installFeatureWithProgramArgs(null, "usertest.third.party.license", new String[] { "--viewLicenseAgreement" }); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The viewLicense should have exited ok. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + // Make sure the license was printed + assertTrue("The license should have been presented to the user:\r:\n" + po.getStdout(), po.getStdout().contains("ThirdPartyLicense")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This test makes sure that the viewLicenseAgreement option works for dependencies + * + * @throws Exception + */ + @Test + public void testViewLicenseAgreementWithDependencies() throws Exception { + final String METHOD_NAME = "testViewLicenseAgreementWithDependencies"; + + Log.entering(c, METHOD_NAME); + + // First install the version with the same license + ProgramOutput po = server.installFeatureWithProgramArgs(null, "usertest.with.ibm.license", new String[] { "--viewLicenseAgreement" }, "usertest.with.ibm.license.same", + "usertest.with.ibm.license.different"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The viewLicense should have exited ok. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + // Make sure both licenses were printed + assertTrue("The first license should have been presented to the user:\r:\n" + po.getStdout(), po.getStdout().contains("MainLicense")); + assertTrue("The second license should have been presented to the user:\r:\n" + po.getStdout(), po.getStdout().contains("DifferentLicense")); + + // Make sure the main one was only shown once + assertTrue("The license should have been printed in the output once:\r\n" + po.getStdout(), + po.getStdout().indexOf("MainLicense") == po.getStdout().lastIndexOf("MainLicense")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that the featureList action generates a feature list. + * + * @throws Exception + */ + @Mode(TestMode.LITE) + @Test + public void testFeatureList() throws Exception { + final String METHOD_NAME = "testFeatureList"; + Log.entering(c, METHOD_NAME); + + setupEnv(server); + + ProgramOutput po = server.installFeature(null, "usertest.with.api"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + po = server.getMachine().execute(installRoot + "/bin/featureManager", + new String[] { "featureList", "--productExtension=usr", installRoot + "/tool.output.dir/featurelist.xml" }, + installRoot); + logInfo(po, "tool.output.dir/featurelist.xml"); + + RemoteFile rf = server.getFileFromLibertyInstallRoot("tool.output.dir/featurelist.xml"); + InputStream in = rf.openForReading(); + DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = builder.parse(in); + NodeList nl = doc.getElementsByTagName("feature"); + + boolean found = false; + boolean foundApiJar = false; + boolean foundDisplayName = false; + boolean foundDescription = false; + boolean foundCategory1 = false; + boolean foundCategory2 = false; + + for (int i = 0; i < nl.getLength(); i++) { + Element e = (Element) nl.item(i); + if ("usertest.with.api".equals(e.getAttribute("name"))) { + found = true; + NodeList nl2 = e.getChildNodes(); + for (int j = 0; j < nl2.getLength(); j++) { + if (nl2.item(j) instanceof Element) { + e = (Element) nl2.item(j); + if ("apiJar".equals(e.getNodeName())) { + foundApiJar = true; + assertEquals("The api jar name is incorrect", "usr/extension/dev/api/usertest_1.0.0.jar", e.getTextContent().trim()); + } else if ("displayName".equals(e.getNodeName())) { + foundDisplayName = true; + assertEquals("The feature name is incorrect", "Test feature name", e.getTextContent().trim()); + } else if ("description".equals(e.getNodeName())) { + foundDescription = true; + assertEquals("The feature description is incorrect", "Test feature description", e.getTextContent().trim()); + } else if ("category".equals(e.getNodeName())) { + String catName = e.getTextContent(); + if ("category1".equals(catName)) { + foundCategory1 = true; + } else if ("category2".equals(catName)) { + foundCategory2 = true; + } + } + } + } + } + } + + assertTrue("The user feature should be in the feature list", found); + assertTrue("The feature's api jar was not found", foundApiJar); + assertTrue("The feature's name was not found", foundDisplayName); + assertTrue("The feature's description was not found", foundDescription); + assertTrue("The feature's category (category1) was not found", foundCategory1); + assertTrue("The feature's category (category2) was not found", foundCategory2); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests that the featureManager featureList action help displays the --productExtension option. + * + * @throws Exception + */ + @Test + public void testFeatureMgrToolProductExtensionParmHelpDisplay() throws Exception { + setupEnv(server); + testFeatureToolProductExtensionParmHelpDisplay(installRoot + "/bin/featureManager", new String[] { "help", "featureList" }, installRoot); + } + + /** + * Test featureManger featureList with --productExtension=testproduct where the features folder for the product extension is empty. + * The request is expected to fail and issue message: CWWKF1019E. + * + * @throws Exception + */ + @Test + public void testFeatureMgrToolUsingProductWithNoFeatureMfs() throws Exception { + setupEnv(server); + setupProductExtensions(SETUP_PROD_EXT); + testFeatureToolUsingProductWithNoFeatureMfs(installRoot + "/bin/featureManager", + new String[] { "featureList", "--productExtension=testproduct", + installRoot + "/tool.output.dir/prodExtFeaturelistNoFeatures.xml" }, + installRoot, + "CWWKF1019E"); + } + + /** + * Test featureManger featureList with a product extension name argument pointing to a product that does not exist: --productExtension=testproductbadName. + * The request is expected to fail and issue message: CWWKF1021E. + * + * @throws Exception + */ + @Test + public void testFeatureMgrToolUsingBadProductExtNameArgument() throws Exception { + setupEnv(server); + setupProductExtensions(SETUP_PROD_EXT); + testFeatureToolUsingBadProductExtNameArgument(installRoot + "/bin/featureManager", + new String[] { "featureList", "--productExtension=testproductbadName", + installRoot + "/tool.output.dir/prodExtFeaturelistBadNameArg.xml" }, + installRoot, + "CWWKF1021E"); + } + + /** + * Test featureManger featureList with --productExtension=testproduct where the com.ibm.websphere.productInstall in the + * product extension's properties file points to "". + * The request is expected to fail and issue message: CWWKF1020E. + * + * @throws Exception + */ + @Test + public void testFeatureMgrToolUsingEmptyInstallLocationInProdExtPropsFile() throws Exception { + setupEnv(server); + setupProductExtensions(SETUP_PROD_EXT); + testFeatureToolUsingEmptyInstallLocationInProdExtPropsFile(installRoot + "/bin/featureManager", + new String[] { "featureList", "--productExtension=testproduct", + installRoot + "/tool.output.dir/prodExtFeaturelistWithInvalidInstLocInPropsFile.xml" }, + installRoot, + "CWWKF1020E"); + } + + /** + * Test featureManger featureList without the --productExtension argument. + * Only Core features expected in the output list. + * + * @throws Exception + */ + @Test + public void testFeatureMgrToolWithNoProdExtArgument() throws Exception { + setupEnv(server); + setupProductExtensions(SETUP_PROD_EXT); + testFeatureToolWithNoProdExtArgument(installRoot + "/bin/featureManager", + new String[] { "featureList", installRoot + "/tool.output.dir/coreFeaturelist.xml" }, + installRoot); + } + + /** + * Test featureManger featureList with the --productExtension=usr argument. + * Only features in the default user product extension location are expected in the output list. + * + * @throws Exception + */ + @Test + public void testFeatureMgrToolWithUsrProdExtArgument() throws Exception { + setupEnv(server); + setupProductExtensions(SETUP_USR_PROD_EXT); + testFeatureToolWithUsrProdExtArgument(installRoot + "/bin/featureManager", + new String[] { "featureList", "--productExtension=usr", installRoot + "/tool.output.dir/usrFeaturelist.xml" }, + installRoot); + } + + /** + * Test featureManger featureList with the --productExtension=testproduct argument. + * Only features in the default user product extension testproduct are expected in the output list. + * + * @throws Exception + */ + @Test + public void testFeatureMgrToolWithProdExtArgument() throws Exception { + setupEnv(server); + setupProductExtensions(SETUP_PROD_EXT); + testFeatureToolWithProdExtArgument(installRoot + "/bin/featureManager", + new String[] { "featureList", "--productExtension=testproduct", installRoot + "/tool.output.dir/prodExtFeaturelist.xml" }, + installRoot); + } + + /** + * This test makes sure that if the IBM-AppliesTo header is set to the current version then the install happens correctly + * + * @throws Exception + */ + @Test + public void testAppliesToCurrent() throws Exception { + final String METHOD_NAME = "testAppliesToCurrent"; + + // The "current" install will change over time (i.e. version number) + // so read in what is current rather than have it hard coded in a test file + RemoteFile propsFile = server.getFileFromLibertyInstallRoot("lib/versions/WebSphereApplicationServer.properties"); + File tempLocalPropsFile = File.createTempFile("WebSphereApplicationServer", ".properties"); + + try { + // Just in case the test goes wrong tidy on exit + tempLocalPropsFile.deleteOnExit(); + RemoteFile tempLocalPropsRemoteFile = new RemoteFile(LocalMachine.getLocalMachine(), tempLocalPropsFile.getAbsolutePath()); + propsFile.copyToDest(tempLocalPropsRemoteFile); + + Properties properties = new Properties(); + properties.load(new FileInputStream(tempLocalPropsFile)); + String appliesTo = getAppliesToForCurrent(properties); + Log.info(c, METHOD_NAME, "Adding this appliesTo to subsystem manifest: " + appliesTo); + addAppliesToToZip(new File("publish/features/usertest.applies.to.current.source.esa"), new File("publish/features/usertest.applies.to.current.esa"), appliesTo); + + ProgramOutput po = server.installFeature(null, "usertest.applies.to.current"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + Log.exiting(c, METHOD_NAME); + } finally { + tempLocalPropsFile.delete(); + } + } + + /** + * This will build up a valid applies to string for the current installation + * + * @param props The Websphere properties file for the current install + * @return + */ + private String getAppliesToForCurrent(Properties props) { + + String productId = props.getProperty("com.ibm.websphere.productId"); + StringBuilder appliesTo = new StringBuilder(productId); + String version = props.getProperty("com.ibm.websphere.productVersion"); + if (version != null && !version.isEmpty()) { + appliesTo.append("; productVersion=").append(version); + } + + String installType = props.getProperty("com.ibm.websphere.productInstallType"); + if (installType != null && !installType.isEmpty()) { + appliesTo.append("; productInstallType=").append(installType); + } + + String productEdition = props.getProperty("com.ibm.websphere.productEdition"); + if (productEdition != null && !productEdition.isEmpty()) { + appliesTo.append("; productEdition=").append(productEdition); + } + return appliesTo.toString(); + } + + /** + * Adds the supplied applies to header to the subsystem manifest from an input zip copying it to the output zip + * + * @param in + * @param out + * @param appliesTo The value of the applies to to set + * @throws IOException + */ + private void addAppliesToToZip(File in, File out, String appliesTo) throws IOException { + ZipFile inZip = new ZipFile(in); + Enumeration zipEntries = inZip.entries(); + FileOutputStream fos = new FileOutputStream(out); + ZipOutputStream outZipStream = new ZipOutputStream(fos); + byte[] bytes = new byte[1024]; + while (zipEntries.hasMoreElements()) { + ZipEntry nextEntry = zipEntries.nextElement(); + outZipStream.putNextEntry(new ZipEntry(nextEntry.getName())); + InputStream is = inZip.getInputStream(nextEntry); + int len; + while ((len = is.read(bytes)) != -1) { + outZipStream.write(bytes, 0, len); + } + + if (SUBSYSTEM_MANIFEST_FILE.equalsIgnoreCase(nextEntry.getName())) { + String appliesToHeader = "\nIBM-AppliesTo: " + appliesTo; + outZipStream.write(appliesToHeader.getBytes()); + } + + outZipStream.closeEntry(); + } + outZipStream.close(); + } + + /** + * This test makes sure that if the IBM-AppliesTo header is set to a different version then the install does not happen + * + * @throws Exception + */ + @Test + public void testAppliesToDifferent() throws Exception { + final String METHOD_NAME = "testAppliesToDifferent"; + ProgramOutput po = server.installFeature(null, "usertest.applies.to.different"); + + String stdout = po.getStdout(); + Log.info(c, METHOD_NAME, stdout); + + assertEquals("The feature should not have been installed. stdout:\r\n" + stdout, 29, po.getReturnCode()); + assertTrue("An error should have been printed. stdout:\r\n" + stdout, + stdout.contains("CWWKF1296E")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This test makes sure that if the IBM-Feature-Version header is set to an invalid version then the install does not happen + * + * @throws Exception + */ + @Test + public void testInvalidFeatureVersion() throws Exception { + final String METHOD_NAME = "testInvalidFeatureVersion"; + ProgramOutput po = server.installFeature(null, "usertest.invalid.feature.version"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertNotSame("The feature should not have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + assertTrue("An error should have been printed. stdout:\r\n" + po.getStdout(), + po.getStdout().contains("CWWKF0022E")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This tests that when an ESA is installed that adds a JAR that had been previously ifixed then it should print a warning. + */ + @Test + public void testIFixedJar() throws Exception { + final String METHOD_NAME = "testIFixedJar"; + Log.entering(c, METHOD_NAME); + + // First install the ifix + this.filesToTidy.add("lib/fixes/iFix1.xml"); + this.filesToTidy.add("lib/fixes/iFix1.lpmf"); + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getInstallRoot() + "/lib/fixes", "publish/features/iFix1.xml"); + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getInstallRoot() + "/lib/fixes", "publish/features/iFix1.lpmf"); + + // Now install the feature + filesToTidy.add("lib/features/usertest.mf"); + filesToTidy.add("lib/usertest_1.0.0.jar"); + ProgramOutput po = server.installFeature(CORE_PRODUCT_NAME, "usertest"); + + Log.info(c, METHOD_NAME, po.getStdout()); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + assertTrue("A message saying the iFix would need to be applied should have been printed:\r\n" + po.getStdout(), + po.getStdout().contains("iFix1")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Test for defect 97183: Make sure the message is correct for default params when a bundle already exists + */ + @Test + public void testExistingBundles() throws Exception { + final String METHOD_NAME = "testIFixedJar"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest"); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + // Now install the feature with a clashing JAR with no flags + po = server.installFeature(null, "usertest.same.bundle"); + assertEquals("The feature should not have been installed. stdout:\r\n" + po.getStdout(), 25, po.getReturnCode()); + assertTrue("A message saying the file exists should have been outputted:\r\n" + po.getStdout(), + po.getStdout().contains("CWWKF1015E")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Test for defect 97183: Make sure that if you are ignoring existing bundles then it works + */ + @Test + public void testExistingBundlesWithIgnore() throws Exception { + final String METHOD_NAME = "testIFixedJar"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest"); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + // Now install the feature with a clashing JAR with no flags + po = server.installFeatureWithProgramArgs(null, "usertest.same.bundle", new String[] { "--when-file-exists=ignore" }); + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout(), 0, po.getReturnCode()); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that you can't install a user feature if it has a file with no location directive. + * + * @throws Exception + */ + @Test + public void testFeatureInstallMissingFileLocation() throws Exception { + final String METHOD_NAME = "testFeatureInstallMissingFileLocation"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.file.missing.location"); + + String stdout = po.getStdout(); + Log.info(c, METHOD_NAME, stdout); + + assertTrue("The feature should not have been installed. stdout:\r\n" + stdout, stdout.contains("CWWKF1012E")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a bundle is copied to the location defined by a directory. + * + * @throws Exception + */ + @Test + public void testBundleWithDirLocation() throws Exception { + final String METHOD_NAME = "testBundleWithDirLocation"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.dir.location"); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.with.dir.location.mf")); + assertTrue("The usertest bundle should exist in the directory specified by location. stdout:\r\n" + po.getStdout(), + server.fileExistsInLibertyInstallRoot("usr/extension/dev/usertest_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a bundle is copied to the location defined by a file. + * + * @throws Exception + */ + @Test + public void testBundleWithFileLocation() throws Exception { + final String METHOD_NAME = "testBundleWithFileLocation"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.exact.location"); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.with.exact.location.mf")); + assertTrue("The usertest bundle should exist in the directory specified by location. stdout:\r\n" + po.getStdout(), + server.fileExistsInLibertyInstallRoot("usr/extension/dev/usertest_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that if there is a JAR entry that is missing the the build fails. + * + * @throws Exception + */ + @Test + public void testMissingJar() throws Exception { + final String METHOD_NAME = "testMissingJar"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.missing.jar"); + assertEquals("The feature should not have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 24, + po.getReturnCode()); + assertTrue("An error should of been printed:\r\n" + po.getStdout(), po.getStdout().contains("CWWKF1013E")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a JAR is copied to the location defined by a directory. + * + * @throws Exception + */ + @Test + public void testJarWithDirLocation() throws Exception { + final String METHOD_NAME = "testJarWithDirLocation"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.jar.with.dir.location"); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.jar.with.dir.location.mf")); + assertTrue("The usertest jar should exist in the directory specified by location. stdout:\r\n" + po.getStdout(), + server.fileExistsInLibertyInstallRoot("usr/extension/dev/usertest.jar.with.dir.location_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a JAR is copied to the location defined by a file. + * + * @throws Exception + */ + @Test + public void testJarWithFileLocation() throws Exception { + final String METHOD_NAME = "testJarWithFileLocation"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.jar.with.exact.location"); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.jar.with.exact.location.mf")); + assertTrue("The usertest jar should exist in the file specified by location. stdout:\r\n" + po.getStdout(), + server.fileExistsInLibertyInstallRoot("usr/extension/dev/foo/usertest.jar.with.exact.location_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a JAR is copied to the lib location when no location is defined. + * + * @throws Exception + */ + @Test + public void testJarWithNoLocation() throws Exception { + final String METHOD_NAME = "testJarWithNoLocation"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.jar.with.no.location"); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.jar.with.no.location.mf")); + assertTrue("The usertest jar should exist in the default lib directory.", + server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest.jar.with.no.location_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that if you have a type="JAR" and a type="file" both pointing to a bundle with the same symbolic name + * then both get installed correctly. + * + * @throws Exception + */ + @Test + public void testJarWithFileToSameJar() throws Exception { + final String METHOD_NAME = "testJarWithFileToSameJar"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.jar.and.file"); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist. stdout:\r\n" + po.getStdout(), + server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.jar.and.file.mf")); + assertTrue("The usertest jar should exist in the directory specified by location on the jar. stdout:\r\n" + po.getStdout(), + server.fileExistsInLibertyInstallRoot("usr/extension/dev/foo/usertest.jar.and.file_1.0.0.jar")); + assertTrue("The usertest jar should exist in the directory specified by location on the file. stdout:\r\n" + po.getStdout(), + server.fileExistsInLibertyInstallRoot("usr/extension/dev/bar/usertest.jar.and.file_1.0.0.jar")); + JarInputStream jarInputStream = new JarInputStream(server.getFileFromLibertyInstallRoot("usr/extension/dev/foo/usertest.jar.and.file_1.0.0.jar").openForReading()); + Manifest jarManifest = jarInputStream.getManifest(); + assertEquals("The wrong JAR was copied into the location for the type=\"jar\"", jarManifest.getMainAttributes().getValue("IBM-TEST-TYPE"), "jar"); + + JarInputStream fileInputStream = new JarInputStream(server.getFileFromLibertyInstallRoot("usr/extension/dev/bar/usertest.jar.and.file_1.0.0.jar").openForReading()); + Manifest fileManifest = fileInputStream.getManifest(); + assertEquals("The wrong JAR was copied into the location for the type=\"file\"", fileManifest.getMainAttributes().getValue("IBM-TEST-TYPE"), "file"); + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that if you have a type="file" entry pointing to a non OSGi JAR then it is handled correctly and doesn't + * crash the processing. + * + * @throws Exception + */ + @Test + public void testFileWithNonOsgiJar() throws Exception { + final String METHOD_NAME = "testFileWithNonOsgiJar"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.file.non.osgi.jar"); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.file.non.osgi.jar.mf")); + assertTrue("The usertest jar file should exist in the directory specified by location.", + server.fileExistsInLibertyInstallRoot("usr/extension/dev/usertest.file.non.osgi.jar_1.0.0.jar")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that if you have a single type="jar" entry pointing but two JARs in your ESA then the right one is copied in + * + * @throws Exception + */ + @Test + public void testMultipleJars() throws Exception { + final String METHOD_NAME = "testMultipleJars"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.multiple.jars"); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.multiple.jars.mf")); + assertTrue("The usertest jar should exist in the directory specified by location.", + server.fileExistsInLibertyInstallRoot("usr/extension/dev/foo/usertest.multiple.jars_1.0.0.jar")); + assertFalse("The usertest jar should not exist for the JAR that wasn't listed in the subsystem manifest.", + server.fileExistsInLibertyInstallRoot("usr/extension/dev/bar/usertest.multiple.jars_1.0.0.jar")); + + JarInputStream jarInputStream = new JarInputStream(server.getFileFromLibertyInstallRoot("usr/extension/dev/foo/usertest.multiple.jars_1.0.0.jar").openForReading()); + Manifest jarManifest = jarInputStream.getManifest(); + assertEquals("The wrong JAR was copied into the location for the type=\"jar\"", jarManifest.getMainAttributes().getValue("IBM-TEST-TYPE"), "jar"); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that if you have a checksum file in the ESA then it is copied across + * + * @throws Exception + */ + @Test + public void testChecksumInstalled() throws Exception { + final String METHOD_NAME = "testMultipleJars"; + + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.installFeature(null, "usertest.with.checksum"); + + assertEquals("The feature should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, po.getReturnCode()); + + assertTrue("The usertest feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.with.checksum.mf")); + assertTrue("The checksum file should exists.", + server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/checksums/usertest.with.checksum.cs")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Test Description: + * This test makes sure that the ESAs built for our features install using the feature manager. This will probably take a while... It works by minifying an empty server (so we + * don't have feature clashes) extracting it and then installing a built ESA into it before deleting the extracted minified install... as we have 79 core ESAs and 95 base ESAs + * at the time of writing that is a lot of I/O. The saving grace is that we only do it when we have built the image, otherwise it's a no-op. + * + * @throws Exception + */ + @Test + public void testBuiltEsasInstall() throws Exception { + final String METHOD_NAME = "testBuiltEsasInstall"; + + Log.entering(c, METHOD_NAME); + + // First test to see if we can run this test, only can do it if building image + LocalFile dheRepoFeaturesDir = new LocalFile(LibertyServerUtils.makeJavaCompatible("publish/features/dhe_repo")); + if (!dheRepoFeaturesDir.exists()) { + Log.info(c, METHOD_NAME, "No ESAs to test so exiting"); + return; + } + + // We can run, grab a minified server test utils to work with, always tear down so we'll do the rest in a try finally + MinifiedServerTestUtils minifyUtils = new MinifiedServerTestUtils(); + try { + LibertyServer unminifiedServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.miniest"); + minifyUtils.setup(c.getName(), "com.ibm.ws.kernel.feature.miniest", unminifiedServer); + + RemoteFile packagedServer = minifyUtils.minifyServer(); + if (packagedServer == null) { + // Must be on z/OS can't do the test + Log.info(c, METHOD_NAME, "Unable to create minified server so exiting"); + return; + } + + // Always set the install to DEVELOPERS, all liberty features including ND should install into a developers server + runTestRepositoryIndividually(dheRepoFeaturesDir, minifyUtils, unminifiedServer, packagedServer, "DEVELOPERS"); + } finally { + minifyUtils.tearDown(); + } + } + + @Test + public void testInstallExtendedAfterBuiltEsasInstall() throws Exception { + final String METHOD_NAME = "testInstallExtendedAfterBuiltEsasInstall"; + + Log.entering(c, METHOD_NAME); + + // First test to see if we can run this test, only can do it if building image + LocalFile dheRepoFeaturesDir = new LocalFile(LibertyServerUtils.makeJavaCompatible("publish/features/dhe_repo")); + if (!dheRepoFeaturesDir.exists()) { + Log.info(c, METHOD_NAME, "No ESAs to test so exiting"); + return; + } + + // We can run, grab a minified server test utils to work with, always tear down so we'll do the rest in a try finally + MinifiedServerTestUtils minifyUtils = new MinifiedServerTestUtils(); + try { + LibertyServer unminifiedServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.miniest"); + minifyUtils.setup(c.getName(), "com.ibm.ws.kernel.feature.miniest", unminifiedServer); + + RemoteFile packagedServer = minifyUtils.minifyServer(); + if (packagedServer == null) { + // Must be on z/OS can't do the test + Log.info(c, METHOD_NAME, "Unable to create minified server so exiting"); + return; + } + + // Always set the install to DEVELOPERS, all liberty features including ND should install into a developers server + runTestRepositoryTogetherWithExtended(dheRepoFeaturesDir, minifyUtils, unminifiedServer, packagedServer, "DEVELOPERS"); + } finally { + minifyUtils.tearDown(); + } + } + + /** + * This will take a local repository directory, copy it onto the remote machine and try to install each ESA into the miniest server zip. + * + * @param featuresRepoDir The local dir with the repository in + * @param minifyUtils The minify utils that contains all the information about the servers being used + * @param unminifiedServer The server pre-minify + * @param packagedServer The minified server zip + * @param repoEdition The edition to install into (will cause the properties file to be updated) + * @throws Exception + * @throws IOException + */ + public void runTestRepositoryIndividually(LocalFile featuresRepoDir, + MinifiedServerTestUtils minifyUtils, + LibertyServer unminifiedServer, + RemoteFile packagedServer, + String repoEdition) throws Exception, IOException { + final String METHOD_NAME = "runTestRepositoryIndividually"; + + RemoteFile remoteRepository = createRemoteRepository(unminifiedServer, featuresRepoDir, repoEdition); + + for (RemoteFile esa : remoteRepository.list(false)) { + // Create the miniest install + LibertyServer minifiedServer = minifyUtils.useMinifiedServer(packagedServer); + + // TODO after resolution of 119915, there shouldn't be a need to create lib/features in the tests + // When you create a miniest server as there aren't any feature xmls there is no features dir so make that now + // As with above can't use utils on liberty server to get a file that doesn't exist + RemoteFile featuresDir = LibertyFileManager.createRemoteFile(minifiedServer.getMachine(), minifiedServer.getInstallRoot() + "/lib/features"); + assertTrue("Should be able to create features dir " + featuresDir.getAbsolutePath() + " exists=" + featuresDir.exists(), featuresDir.mkdir()); + + // By default the version property file has no value for edition, however, we've created image so it will have + // iterated through all of the editions that need to be created so we don't know what state it'll be in. + // Make it set to the right edition + RemoteFile versionPropertiesFile = minifiedServer.getFileFromLibertyInstallRoot("lib/versions/WebSphereApplicationServer.properties"); + Properties versionProperties = new Properties(); + versionProperties.load(versionPropertiesFile.openForReading()); + versionProperties.put("com.ibm.websphere.productEdition", repoEdition); + versionProperties.store(versionPropertiesFile.openForWriting(false), null); + String libertyVersion = versionProperties.getProperty("com.ibm.websphere." + PRODUCT_VERSION); + + String esaName = esa.getName(); + + if (shouldInstallESA(repoEdition, libertyVersion, esa, esaName)) { + + Log.info(c, METHOD_NAME, "Installing ESA " + esaName + " into edition: " + repoEdition); + ProgramOutput po = minifiedServer.installFeature(esa); + + assertEquals("Installing ESA " + esa.getName() + " should of worked. Program output:\n" + po.getStdout() + "\nErr output:\n" + po.getStderr(), 0, + po.getReturnCode()); + assertFalse("There should not of been an error in the validation:\n " + po.getStdout(), po.getStdout().contains("ERROR")); + assertTrue("The validation should of completed successfully:\n " + po.getStdout(), po.getStdout().contains("Product validation completed successfully.")); + + // Also make sure that all of the checksum entries were copied + verifyChecksums(unminifiedServer, esaName); + } + minifyUtils.deletedNestedServer(); + } + } + + /** + * @param repoEdition + * @param METHOD_NAME + * @param esa + * @param esaName + * @throws IOException + * @throws BundleException + */ + private boolean shouldInstallESA(String repoEdition, String libertyVersion, RemoteFile esa, String esaName) throws IOException, BundleException { + String METHOD_NAME = "shouldInstallESA"; + + // Check the product install type and edition to make sure we should be installing the ESA + boolean installationManager = false; + boolean isZosOnly = false; + boolean versionMatch = false; + JarFile jarFile = new JarFile(esa.getAbsolutePath()); + + JarEntry entry = jarFile.getJarEntry(SUBSYSTEM_MANIFEST_FILE); + if (entry != null) { + Map headers = new HashMap(); + ManifestElement.parseBundleManifest(jarFile.getInputStream(entry), headers); + + String appliesTo = headers.get(IBM_APPLIES_TO_HEADER); + if (appliesTo != null) { + StringTokenizer tokenizer = new StringTokenizer(appliesTo, ";"); + while (tokenizer.hasMoreTokens()) { + String nextToken = tokenizer.nextToken(); + nextToken = nextToken.trim(); + if (nextToken.startsWith(PRODUCT_INSTALL_TYPE)) { + String installType = nextToken.substring(19); + Log.info(c, METHOD_NAME, "install type: " + installType); + if (installType != null && INSTALLATION_MANAGER.equalsIgnoreCase(installType)) + installationManager = true; + } else if (nextToken.startsWith(PRODUCT_EDITION)) { + if (nextToken.contains(ZOS_EDITION) && !nextToken.contains(repoEdition)) + isZosOnly = true; + } else if (nextToken.startsWith(PRODUCT_VERSION)) { + String installVersion = nextToken.substring(PRODUCT_VERSION.length() + 1); + Log.info(c, METHOD_NAME, "install version: " + installVersion); + if (installVersion != null && libertyVersion.equalsIgnoreCase(installVersion)) + versionMatch = true; + } + } + } + } + + jarFile.close(); + + if (installationManager) { + Log.info(c, METHOD_NAME, "ESA " + esaName + " applies only to InstallationManager installs. Not installing."); + + } else if (isZosOnly) { + Log.info(c, METHOD_NAME, "ESA " + esaName + " applies only to the zOS edition. Not installing."); + } + + return (!installationManager && !isZosOnly && versionMatch); + } + + public void runTestRepositoryTogetherWithExtended(LocalFile featuresRepoDir, + MinifiedServerTestUtils minifyUtils, + LibertyServer unminifiedServer, + RemoteFile packagedServer, + String repoEdition) throws Exception, IOException { + final String METHOD_NAME = "runTestRepositoryTogetherWithExtended"; + + RemoteFile remoteRepository = createRemoteRepository(unminifiedServer, featuresRepoDir, repoEdition); + + // Create the miniest install + LibertyServer minifiedServer = minifyUtils.useMinifiedServer(packagedServer); + + // TODO after resolution of 119915, there shouldn't be a need to create lib/features in the tests + // When you create a miniest server as there aren't any feature xmls there is no features dir so make that now + // As with above can't use utils on liberty server to get a file that doesn't exist + RemoteFile featuresDir = LibertyFileManager.createRemoteFile(minifiedServer.getMachine(), minifiedServer.getInstallRoot() + "/lib/features"); + assertTrue("Should be able to create features dir " + featuresDir.getAbsolutePath() + " exists=" + featuresDir.exists(), featuresDir.mkdir()); + + // By default the version property file has no value for edition, however, we've created image so it will have + // iterated through all of the editions that need to be created so we don't know what state it'll be in. + // Make it set to the right edition + RemoteFile versionPropertiesFile = minifiedServer.getFileFromLibertyInstallRoot("lib/versions/WebSphereApplicationServer.properties"); + Properties versionProperties = new Properties(); + versionProperties.load(versionPropertiesFile.openForReading()); + versionProperties.put("com.ibm.websphere.productEdition", repoEdition); + versionProperties.store(versionPropertiesFile.openForWriting(false), null); + String libertyVersion = versionProperties.getProperty("com.ibm.websphere." + PRODUCT_VERSION); + + for (RemoteFile esa : remoteRepository.list(false)) { + + String esaName = esa.getName(); + if (shouldInstallESA(repoEdition, libertyVersion, esa, esaName)) { + Log.info(c, METHOD_NAME, "Installing ESA " + esaName + " into edition: " + repoEdition); + ProgramOutput po = minifiedServer.installFeature(esa, new String[] { "--when-file-exists=ignore" }); + + if (po.getReturnCode() == 0) { + assertEquals("Installing ESA " + esa.getName() + " should of worked. Program output:\n" + po.getStdout() + "\nErr output:\n" + po.getStderr(), + 0, po.getReturnCode()); + assertFalse("There should not of been an error in the validation:\n " + po.getStdout(), + po.getStdout().contains("ERROR")); + assertTrue("The validation should of completed successfully:\n " + po.getStdout(), + po.getStdout().contains("Product validation completed successfully.")); + } else { + Log.info(c, METHOD_NAME, "Could not install ESA " + esaName + " into edition: " + + repoEdition + " Return code: " + po.getReturnCode() + " StdOut: " + po.getStdout()); + // Assert that possibly the esa was already installed + assertTrue("Since we didn't successfully install the esa, it should already exist.", + po.getStdout().contains("CWWKF1000I")); + } + + // Also make sure that all of the checksum entries were copied + verifyChecksums(unminifiedServer, esaName); + } else { + Log.info(c, METHOD_NAME, "ESA " + esaName + " is not applied to Liberty edition: " + repoEdition + " and version:" + libertyVersion); + minifyUtils.deletedNestedServer(); + return; + } + } + + // After we have installed every esa in the repository, try to install the extended + // jar on top of the miniest server with every feature installed as an esa. + boolean imageInstalled = minifiedServer.installExtendedImage(); + assertTrue("The extended image should have successfully installed after installing all esa's first.", + imageInstalled); + + // Finally, we are done with the test so we can delete the built up nested server + minifyUtils.deletedNestedServer(); + } + + private RemoteFile createRemoteRepository(LibertyServer unminifiedServer, + LocalFile featuresRepoDir, + String repoEdition) throws Exception { + final String METHOD_NAME = "createRemoteRepository"; + + // Make a mock repository on the unminified server as this isn't deleted after each install + // LibertyServer.getFileFromLibertyServerRoot goes through LibertyFileManager.getLibertyFile + // which throws a not found exception when it doesn't exist so can't use it + RemoteFile remoteRepository = LibertyFileManager.createRemoteFile(unminifiedServer.getMachine(), + unminifiedServer.getServerRoot() + "/" + repoEdition + ".repository"); + if (!remoteRepository.exists()) { + assertTrue("Should be able to create repository dir", remoteRepository.mkdir()); + } else { + Log.info(c, METHOD_NAME, "The remote repository at " + remoteRepository.getAbsolutePath() + " already exists."); + } + + for (RemoteFile esaSrc : featuresRepoDir.list(false)) { + RemoteFile esaDest = new RemoteFile(remoteRepository, esaSrc.getName()); + esaDest.copyFromSource(esaSrc); + } + + return remoteRepository; + } + + private void verifyChecksums(LibertyServer unminifiedServer, String esaName) throws Exception { + final String METHOD_NAME = "verifyChecksums"; + + // Also make sure that all of the checksum entries were copied + String checksumPath = "lib/features/checksums/" + esaName.substring(0, esaName.length() - 4) + ".cs"; + if (unminifiedServer.fileExistsInLibertyInstallRoot(checksumPath)) { + RemoteFile originalChechsumFile = unminifiedServer.getFileFromLibertyInstallRoot(checksumPath); + Properties originalChecksums = new Properties(); + originalChecksums.load(originalChechsumFile.openForReading()); + + RemoteFile newChecksumFile = unminifiedServer.getFileFromLibertyInstallRoot(checksumPath); + Properties newChecksums = new Properties(); + newChecksums.load(newChecksumFile.openForReading()); + + assertEquals("All of the original checksum entries should of been installed into the new runtime:\nOriginal:\n" + originalChecksums.toString() + + "\nnewChecksums:\n" + + newChecksums.toString(), originalChecksums.size(), newChecksums.size()); + } else { + // If there are no source CS file then there is nothing to test + Log.info(c, METHOD_NAME, "No checksum for path " + checksumPath + " so not testing"); + } + } + + private ProgramOutput runTool(String... args) throws Exception { + Log.info(c, "runTool", "running bin/featureManager with arguments: " + Arrays.asList(args)); + ProgramOutput po = server.getMachine().execute(server.getInstallRoot() + "/bin/featureManager", args, server.getInstallRoot()); + Log.info(c, "runTool", "Return Code: " + po.getReturnCode() + ". STDOUT: " + po.getStdout()); + return po; + } + + private File getClasspathOutputJar() { + return new File(server.getServerRoot() + "/classpath.jar"); + } + + private Manifest dumpManifest(File file) throws Exception { + JarFile jar = new JarFile(file); + try { + Manifest manifest = jar.getManifest(); + Assert.assertNotNull("expected manifest in " + file, manifest); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + manifest.write(out); + + String manifestContents = new String(out.toByteArray(), "UTF-8"); + Log.info(c, "dumpManifest", "META-INF/MANIFEST.MF contents of " + file, manifestContents); + return manifest; + } finally { + jar.close(); + } + } + + @SuppressWarnings("deprecation") + private URLClassLoader newURLClassLoader(File file) throws Exception { + // If there is no .close() method, then the output .jar will be locked, + // which will cause problems. + try { + URLClassLoader.class.getMethod("close"); + } catch (NoSuchMethodException e) { + Log.info(c, "newURLClassLoader", "Not running Java 7"); + Assume.assumeTrue(false); + } + + return new URLClassLoader(new URL[] { file.toURL() }, null); + } + + private void closeURLClassLoader(URLClassLoader cl) throws Exception { + URLClassLoader.class.getMethod("close").invoke(cl); + } + + private String getStderr(ProgramOutput po) { + // LocalMachine.execute oddly merges stderr into stdout. + return po.getStdout(); + } + + @Test + @Mode(TestMode.LITE) + public void testClasspathNoArgs() throws Exception { + ProgramOutput po = runTool(new String[] { "classpath" }); + assertEquals(ReturnCode_BAD_ARGUMENT, po.getReturnCode()); + assertTrue(getStderr(po).contains("CWWKF1001E:")); + } + + @Test + @Mode(TestMode.LITE) + public void testClasspathNoFeatures() throws Exception { + ProgramOutput po = runTool(new String[] { "classpath", getClasspathOutputJar().getAbsolutePath() }); + assertEquals(ReturnCode_BAD_ARGUMENT, po.getReturnCode()); + assertTrue(getStderr(po).contains("CWWKF1025E:")); + } + + @Test + @Mode(TestMode.LITE) + public void testClasspathEmptyFeatures() throws Exception { + ProgramOutput po = runTool(new String[] { "classpath", "--features=", getClasspathOutputJar().getAbsolutePath() }); + assertEquals(ReturnCode_BAD_ARGUMENT, po.getReturnCode()); + assertTrue(getStderr(po).contains("CWWKF1025E:")); + } + + @Test + @Mode(TestMode.LITE) + public void testClasspathInvalidFeature() throws Exception { + ProgramOutput po = runTool(new String[] { "classpath", "--features=invalidFeatureName", getClasspathOutputJar().getAbsolutePath() }); + assertEquals(ReturnCode_BAD_ARGUMENT, po.getReturnCode()); + assertTrue(getStderr(po).contains("CWWKF1026E:")); + } + + @Test + @Mode(TestMode.LITE) + public void testClasspathProtectedFeature() throws Exception { + ProgramOutput po = runTool(new String[] { "classpath", "--features=com.ibm.websphere.appserver.classloading-1.0", getClasspathOutputJar().getAbsolutePath() }); + assertEquals(ReturnCode_BAD_ARGUMENT, po.getReturnCode()); + assertTrue(getStderr(po).contains("CWWKF1027E:")); + } + + @Test + @Mode(TestMode.LITE) + public void testClasspathInvalidDrive() throws Exception { + Assume.assumeTrue(File.separatorChar == '\\'); + + String outputJarPath = getClasspathOutputJar().getAbsolutePath(); + boolean installOnCDrive = outputJarPath.substring(0, 1).equalsIgnoreCase("c"); + File badOutputJar = new File((installOnCDrive ? "D" : "C") + outputJarPath.substring(1)); + + ProgramOutput po = runTool(new String[] { "classpath", "--features=servlet-3.0", badOutputJar.getAbsolutePath() }); + assertEquals(ReturnCode_BAD_ARGUMENT, po.getReturnCode()); + assertTrue(getStderr(po).contains("CWWKF1028E:")); + } + + private static final String SERVLET_3_0_CLASS_NAME = "javax.servlet.ServletInputStream"; + private static final String EJBLITE_3_1_CLASS_NAME = "javax.ejb.Stateful"; + + private void assertLoadClass(ClassLoader cl, String className) throws Exception { + Class klass = cl.loadClass(className); + Log.info(c, "expectClass", "loaded class " + klass); + } + + private void assertNotLoadClass(ClassLoader cl, String className) throws Exception { + try { + Assert.assertNull("unexpected successful loadClass " + className, cl.loadClass(className)); + } catch (ClassNotFoundException e) { + Log.info(c, "checkClassAndMethod", "caught expected " + e); + } + } + + @Test + @Mode(TestMode.LITE) + public void testClasspathServlet30() throws Exception { + File output = getClasspathOutputJar(); + ProgramOutput po = runTool(new String[] { "classpath", "--features=servlet-3.0", output.getAbsolutePath() }); + dumpManifest(output); + + try { + URLClassLoader cl = newURLClassLoader(output); + try { + Assert.assertEquals("expected successful exit code", ReturnCode_OK, po.getReturnCode()); + assertLoadClass(cl, SERVLET_3_0_CLASS_NAME); + assertNotLoadClass(cl, EJBLITE_3_1_CLASS_NAME); + } finally { + closeURLClassLoader(cl); + } + } finally { + Assert.assertTrue(output.delete()); + } + } + + @Test + @Mode(TestMode.LITE) + public void testClasspathServlet30AndServlet31() throws Exception { + File output = getClasspathOutputJar(); + ProgramOutput po = runTool(new String[] { + "classpath", + "--features=appSecurity-2.0,appClientSupport-1.0,ssl-1.0,beanvalidation-1.1,cdi-1.2,concurrent-1.0,ejb-3.2,jacc-1.5,jaspic-1.1,javamail-1.5,jaxb-2.2,jaxrs-2.0,jaxws-2.2,batch-1.0,j2eeManagement-1.1,jca-1.7,jcaInboundSecurity-1.0,jdbc-4.1,jmsMdb-3.2,jpa-2.1,jsf-2.2,jsonp-1.0,el-3.0,jsp-2.3,localConnector-1.0,managedbeans-1.0,servlet-3.1,wasJmsClient-2.0,wasJmsServer-1.0,wasJmsSecurity-1.0,websocket-1.1", + output.getAbsolutePath() }); + Assert.assertEquals("expected successful exit code", ReturnCode_OK, po.getReturnCode()); + Manifest m = dumpManifest(output); + + String cp = m.getMainAttributes().getValue("Class-Path"); + + assertTrue("Class-Path should contain servlet 3.1 API jar: " + cp, cp.contains("com.ibm.websphere.javaee.servlet.3.1")); + assertFalse("Class-Path should not contain servlet 3.0 API jar: " + cp, cp.contains("com.ibm.websphere.javaee.servlet.3.0")); + + } + + @Test + @Mode(TestMode.LITE) + public void testClasspathEJBLite31() throws Exception { + File output = getClasspathOutputJar(); + ProgramOutput po = runTool(new String[] { "classpath", "--features=ejbLite-3.1", output.getAbsolutePath() }); + dumpManifest(output); + + try { + URLClassLoader cl = newURLClassLoader(output); + try { + Assert.assertEquals("expected successful exit code", ReturnCode_OK, po.getReturnCode()); + assertNotLoadClass(cl, SERVLET_3_0_CLASS_NAME); + assertLoadClass(cl, EJBLITE_3_1_CLASS_NAME); + } finally { + closeURLClassLoader(cl); + } + } finally { + Assert.assertTrue(output.delete()); + } + } + + @Test + @Mode(TestMode.LITE) + public void testClasspathServlet30AndEJBLite31() throws Exception { + File output = getClasspathOutputJar(); + ProgramOutput po = runTool(new String[] { "classpath", "--features=servlet-3.0,ejbLite-3.1", output.getAbsolutePath() }); + dumpManifest(output); + + try { + URLClassLoader cl = newURLClassLoader(output); + try { + Assert.assertEquals("expected successful exit code", ReturnCode_OK, po.getReturnCode()); + assertLoadClass(cl, SERVLET_3_0_CLASS_NAME); + assertLoadClass(cl, EJBLITE_3_1_CLASS_NAME); + } finally { + closeURLClassLoader(cl); + } + } finally { + Assert.assertTrue(output.delete()); + } + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureProcessTypeTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureProcessTypeTest.java new file mode 100755 index 000000000000..f0aa4c72e68b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureProcessTypeTest.java @@ -0,0 +1,118 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.FileNotFoundException; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.ExpectedFFDC; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class FeatureProcessTypeTest { + private static final Class c = FeatureProcessTypeTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.process.type"); + + private static final String SERVER_A_1_0 = "serverA-1.0"; + + private static final String CLIENT_B_1_0 = "clientB-1.0"; + + private static final String FEATURE_CACHE = "workarea/platform/feature.cache"; + + @BeforeClass + public static void beforeClass() throws Exception { + Log.info(c, "beforeClass", "Installing features"); + server.installSystemFeature(SERVER_A_1_0); + server.installSystemFeature(CLIENT_B_1_0); + + for (int i = 1; i < 8; i++) { + server.copyFileToLibertyInstallRoot("lib", "bundle" + i + "_1.0.0.jar"); + } + } + + @AfterClass + public static void afterClass() throws Exception { + Log.info(c, "afterClass", "Uninstalling features"); + server.uninstallSystemFeature(SERVER_A_1_0); + server.uninstallSystemFeature(CLIENT_B_1_0); + + for (int i = 1; i < 8; i++) { + server.deleteFileFromLibertyInstallRoot("lib/bundle" + i + "_1.0.0.jar"); + } + } + + @After + public void tearDown() throws Exception { + if (server.isStarted()) { + ProgramOutput po = server.stopServer(); + Log.info(c, "tearDown", "Stop server " + (po.getReturnCode() == 0 ? "succeeded" : "failed")); + } + try { + RemoteFile tmpBootstrapProps = server.getFileFromLibertyServerRoot("tmp.bootstrap.properties"); + if (tmpBootstrapProps.exists()) { + server.renameLibertyServerRootFile("bootstrap.properties", "override_tolerates_bootstrap.properties"); + server.renameLibertyServerRootFile("tmp.bootstrap.properties", "bootstrap.properties"); + } + } catch (FileNotFoundException e) { + // nothing + } + + } + + @Test + @ExpectedFFDC("java.lang.IllegalArgumentException") + public void testClientFeatureConfigured() throws Exception { + final String m = "testClientFeatureConfigured"; + Log.info(c, m, "starting test"); + + server.setServerConfigurationFile("server_client.xml"); + server.startServer(m + ".log"); + + assertNotNull("No message indicating a conflict", server.waitForStringInLog("CWWKF0034E.*" + CLIENT_B_1_0)); + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertFalse("Expected clientB-1.0 feature to not be installed, but it was: " + installedFeatures, installedFeatures.contains(CLIENT_B_1_0)); + + Log.info(c, m, "successful exit"); + } + + @Test + @ExpectedFFDC("java.lang.IllegalArgumentException") + public void testServerIncludeClientFeatureConfigured() throws Exception { + final String m = "testServerIncludeClientFeatureConfigured"; + Log.info(c, m, "starting test"); + + server.setServerConfigurationFile("server_serverclient.xml"); + server.startServer(m + ".log"); + + assertNotNull("No message indicating a conflict", server.waitForStringInLog("CWWKF0035E.*" + CLIENT_B_1_0)); + + String installedFeatures = TestUtils.getInstalledFeatures(server, FEATURE_CACHE); + assertTrue("Expected serverA-1.0 feature to be installed, but it was not: " + installedFeatures, installedFeatures.contains(SERVER_A_1_0)); + + Log.info(c, m, "successful exit"); + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureTest.java new file mode 100755 index 000000000000..0c08cbfb5609 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureTest.java @@ -0,0 +1,614 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.Properties; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.AllowedFFDC; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class FeatureTest { + + private static final Class c = FeatureTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature"); + //private static final Logger logger = Logger.getLogger(FeatureTest.class.getName()); + + private static final String FEATURE_V_MF = "featureVv-1.0.mf"; + private static final String FEATURE_X_MF = "featureXx-1.0.mf"; + private static final String FEATURE_Y_MF = "featureYy-1.0.mf"; + private static final String FEATURE_Z_MF = "featureZz-1.0.mf"; + + private static final String[] features = { FEATURE_V_MF, FEATURE_X_MF, FEATURE_Y_MF, FEATURE_Z_MF }; + + private static final String installFeatureMsgPrefix = "CWWKF0012I: The server installed the following features: \\["; + private static final String uninstallFeatureMsgPrefix = "CWWKF0013I: The server removed the following features: \\["; + private static final String notFoundFeatureMsgPrefix = "CWWKF0001E:"; + private static final String wrongProcessTypeMsgPrefix = "CWWKF0038E:"; + private static final String missingJavaDependency1 = "CWWKF0032E: The featureJavaEight-1.0 feature requires a minimum Java runtime environment version of JavaSE 1.888"; + private static final String missingJavaDependency2 = "CWWKF0032E: The featureJavaNine-1.0 feature requires a minimum Java runtime environment version of JavaSE 1.9"; + + private static final String FEATURE_PATH = "lib/features/"; + + private static final String CACHE_DIRECTORY = "workarea/platform/"; + private static final String FEATURE_BUNDLE_CACHE = CACHE_DIRECTORY + "feature.bundles.cache"; + + /** + * Copy the necessary features and bundles to the liberty server directories + * + * @throws Exception + */ + @BeforeClass + public static void setup() throws Exception { + final String METHOD_NAME = "classSetUp"; + + Log.entering(c, METHOD_NAME); + + for (String feature : features) { + Log.info(c, METHOD_NAME, "Copying " + feature + " to " + FEATURE_PATH + "."); + server.copyFileToLibertyInstallRoot(FEATURE_PATH, feature); + } + + Log.info(c, METHOD_NAME, "Copying bundlev_1.0.0.jar to lib."); + server.copyFileToLibertyInstallRoot("lib", "bundlev_1.0.0.jar"); + Log.info(c, METHOD_NAME, "Copying bundlex_1.0.0.jar to lib."); + server.copyFileToLibertyInstallRoot("lib", "bundlex_1.0.0.jar"); + Log.info(c, METHOD_NAME, "Copying bundley_1.0.0.jar to lib."); + server.copyFileToLibertyInstallRoot("lib", "bundley_1.0.0.jar"); + Log.info(c, METHOD_NAME, "Copying bundlez_1.0.0.jar to lib."); + server.copyFileToLibertyInstallRoot("lib", "bundlez_1.0.0.jar"); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This method removes all the testing artifacts from the server directories. + * + * @throws Exception + */ + @AfterClass + public static void cleanup() throws Exception { + final String METHOD_NAME = "classTearDown"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) + server.stopServer(); + + for (String feature : features) { + Log.info(c, METHOD_NAME, FEATURE_PATH + feature + " will be deleted."); + server.deleteFileFromLibertyInstallRoot("lib/features/" + feature); + } + server.deleteFileFromLibertyInstallRoot("lib/features/featureA-1.0.mf"); + server.deleteFileFromLibertyInstallRoot("lib/features/featureWw-1.0.mf"); + + server.deleteFileFromLibertyInstallRoot("lib/bundlev_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/bundlew_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/bundlex_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/bundley_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/bundlez_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/bundle1_1.0.0.jar"); + + server.deleteFileFromLibertyInstallRoot("lib/features/featureJavaEight-1.0.mf"); + server.deleteFileFromLibertyInstallRoot("lib/features/featureJavaNine-1.0.mf"); + server.deleteFileFromLibertyInstallRoot("lib/bundleJavaEight_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/bundleJavaNine_1.0.0.jar"); + + Log.exiting(c, METHOD_NAME); + } + + @After + public void stopServer() throws Exception { + if (server.isStarted()) + server.stopServer(); + } + + /** + * TestDescription: + * This test ensures that the name of the .mf file does not matter and that the features + * listed under Subsystem-Content are also installed. + * The test ensures that this happens during server update. + * + * The feature structure is as follows: + * + * featureX, featureY, featureZ are all normal features. + * + * featureX is defined in featureXx.mf by IBM-ShortName: featureX-1.0 + * featureY is defined in featureYy.mf by IBM-ShortName: featureY-1.0 + * featureZ is defined in featureZz.mf by IBM-ShortName: featureZ-1.0 + * + * featureX is a feature that has featureY listed under Subsystem-Content. + * featureY is a feature that has featureZ listed under Subsystem-Content. + * featureZ is a feature that has no other features listed under Subsystem-Content. + * + * @throws Exception + */ + @Test + public void testSubsystemContentFeaturesInstallDuringServerUpdate() throws Exception { + final String METHOD_NAME = "testSubsystemContentFeaturesInstallDuringServerUpdate"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with the first set of features available (also resets mark) + TestUtils.makeConfigUpdateSetMark(server, "server_add_featureX.xml"); + + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureX-1.0 was not installed and should have been: " + output, output.contains("featureX-1.0")); + assertTrue("featureY-1.0 was not installed and should have been: " + output, output.contains("featureY-1.0")); + assertTrue("featureZ-1.0 was not installed and should have been: " + output, output.contains("featureZ-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundlex/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlex/[1.0.0,2.0.0)")); + assertTrue("bundley/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundley/[1.0.0,2.0.0)")); + assertTrue("bundlez/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlez/[1.0.0,2.0.0)")); + + // Finally check that removing the feature will also uninstall the dependant features. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureX-1.0 was not uninstalled and should have been: " + output, output.contains("featureX-1.0")); + assertTrue("featureY-1.0 was not uninstalled and should have been: " + output, output.contains("featureY-1.0")); + assertTrue("featureZ-1.0 was not uninstalled and should have been: " + output, output.contains("featureZ-1.0")); + + // Now check that bundles of the features are gone. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundlex/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlex/[1.0.0,2.0.0)")); + assertFalse("bundley/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundley/[1.0.0,2.0.0)")); + assertFalse("bundlez/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlez/[1.0.0,2.0.0)")); + + Log.exiting(c, METHOD_NAME); + } + + @Test + public void testFeatureJavaVersionDependencyCheck() throws Exception { + final String METHOD_NAME = "testFeatureJavaVersionDependencyCheck"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // copy mf file and bundle jar + server.copyFileToLibertyInstallRoot(FEATURE_PATH, "featureJavaEight-1.0.mf"); + server.copyFileToLibertyInstallRoot(FEATURE_PATH, "featureJavaNine-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib", "bundleJavaEight_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "bundleJavaNine_1.0.0.jar"); + + // Now move the server xml with the first set of features available + server.setServerConfigurationFile("server_add_featureJavaEight.xml"); + + // Should find feature needing Java 1.888 + String output = server.waitForStringInLogUsingMark(missingJavaDependency1); + assertNotNull("No output message found: " + missingJavaDependency1, output); + assertTrue("Missing java version check failure message javaEight : " + output, output.contains(missingJavaDependency1)); + + // And one for (dependent feature needing Java 1.9) + output = server.waitForStringInLogUsingMark(missingJavaDependency2); + assertTrue("Missing java version check failure message javaNine : " + output, output.contains(missingJavaDependency2)); + + Log.exiting(c, METHOD_NAME); + } + + @Test + public void testClientFeatureInServerTest() throws Exception { + final String METHOD_NAME = "testClientFeatureInServerTest"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // copy mf file and bundle jar + server.copyFileToLibertyInstallRoot(FEATURE_PATH, "includeClientFeature-1.0.mf"); + + // Now move the server xml with the first set of features available + server.setServerConfigurationFile("server_with_client.xml"); + + // Should find feature is not found + String output = server.waitForStringInLogUsingMark(wrongProcessTypeMsgPrefix); + assertNotNull("We haven't found the " + wrongProcessTypeMsgPrefix + " in the logs.", output); + assertTrue("Client was installed and should not have been: " + output, output.contains("javaeeClient")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that the name of the .mf file does not matter and that the features + * listed under Subsystem-Content are also installed even if the + * Subsystem-Content feature's .mf file is not in lib/features when the + * server is started and added later before server.xml is updated. + * The test ensures that this happens during server update. + * + * The feature structure is as follows: + * + * featureV, featureW are normal features. + * + * featureV is defined in featureVv.mf by IBM-ShortName: featureV-1.0 + * featureW is defined in featureWw.mf by IBM-ShortName: featureW-1.0 + * + * featureV is a feature that has featureW listed under Subsystem-Content. + * featureW is a feature that has no other features listed under Subsystem-Content. + * + * @throws Exception + */ + @Mode(TestMode.FULL) + @Test + public void testSubsystemContentFeatureManifestFileAddedAfterServerIsAlreadyUp() throws Exception { + final String METHOD_NAME = "testSubsystemContentFeatureManifestFileAddedAfterServerIsAlreadyUp"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + + // ensure dependent feature manifest is not there when the server starts + server.deleteFileFromLibertyInstallRoot("lib/features/featureWw-1.0.mf"); + server.startServer(METHOD_NAME + ".log"); + + // copy mf file and bundle jar in after server start + server.copyFileToLibertyInstallRoot(FEATURE_PATH, "featureWw-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib", "bundlew_1.0.0.jar"); + + // Now move the server xml with the first set of features available (and reset mark) + TestUtils.makeConfigUpdateSetMark(server, "server_add_featureV.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureV-1.0 was not installed and should have been: " + output, output.contains("featureV-1.0")); + assertTrue("featureW-1.0 was not installed and should have been: " + output, output.contains("featureW-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundlev/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlev/[1.0.0,2.0.0)")); + assertTrue("bundlew/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlew/[1.0.0,2.0.0)")); + + // Finally check that removing the feature will also uninstall the dependant features. (and reset mark) + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureV-1.0 was not uninstalled and should have been: " + output, output.contains("featureV-1.0")); + assertTrue("featureW-1.0 was not uninstalled and should have been: " + output, output.contains("featureW-1.0")); + + // Now check that bundles of the features are gone. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundlev/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlev/[1.0.0,2.0.0)")); + assertFalse("bundlew/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlew/[1.0.0,2.0.0)")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that the name of the .mf file does not matter and that the features + * listed under Subsystem-Content are not installed because it's manifest file + * does not exist in lib/features. + * The test ensures that this happens during server update. + * + * expected messages + * CWWKF0001E: A feature definition could not be found for com.ibm.websphere.appserver.featureW-1.0 + * CWWKF0012I: The server installed the following features: [featureV-1.0]. + * + * The feature structure is as follows: + * + * featureV, featureW are normal features. + * + * featureV is defined in featureVv.mf by IBM-ShortName: featureV-1.0 + * featureW is defined in featureWw.mf by IBM-ShortName: featureW-1.0 + * + * featureV is a feature that has featureW listed under Subsystem-Content. + * featureW is a feature that has no other features listed under Subsystem-Content. + * + * @throws Exception + */ + @Mode(TestMode.FULL) + @Test + @AllowedFFDC("java.io.FileNotFoundException") + public void testSubsystemContentFeatureManifestFileNotAddedAfterServerIsAlreadyUp() throws Exception { + final String METHOD_NAME = "testSubsystemContentFeatureManifestFileNotAddedAfterServerIsAlreadyUp"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + // ensure dependent feature manifest is not there when the server starts + server.deleteFileFromLibertyInstallRoot("lib/features/featureWw-1.0.mf"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with the first set of features available (and update mark) + TestUtils.makeConfigUpdateSetMark(server, "server_add_featureV.xml"); + + String output = server.waitForStringInLogUsingMark(notFoundFeatureMsgPrefix); + assertNotNull("We haven't found the " + notFoundFeatureMsgPrefix + " in the logs.", output); + assertTrue("featureW-1.0 was installed and should not have been: " + output, output.contains("featureW-1.0")); + + // Get the install feature message for the initial set up of updated features + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureV-1.0 was not installed and should have been: " + output, output.contains("featureV-1.0")); + assertFalse("featureW-1.0 was installed and should not have been: " + output, output.contains("featureW-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundlev/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlev/[1.0.0,2.0.0)")); + assertFalse("bundlew/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlew/[1.0.0,2.0.0)")); + + // Finally check that removing the feature will also uninstall the dependant features. (update mark) + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureV-1.0 was not uninstalled and should have been: " + output, output.contains("featureV-1.0")); + assertFalse("featureW-1.0 was uninstalled and should not have been: " + output, output.contains("featureW-1.0")); + + // Now check that bundles of the features are gone. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundlev/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlev/[1.0.0,2.0.0)")); + assertFalse("bundlew/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlew/[1.0.0,2.0.0)")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a .mf file added to lib/features after the server is + * up and running will be found and installed when the feature is specified in server.xml. + * The test ensures that this happens during server update. + * + * The feature structure is as follows: + * + * featureA is defined in featureA.mf by IBM-ShortName: featureA-1.0 + * + * @throws Exception + */ + @Mode(TestMode.FULL) + @Test + public void testFeatureManifestFileAddedAfterServerIsAlreadyUp() throws Exception { + final String METHOD_NAME = "testFeatureManifestFileAddedAfterServerIsAlreadyUp"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.deleteFileFromLibertyInstallRoot("lib/features/featureA-1.0.mf"); + server.startServer(METHOD_NAME + ".log"); + + // copy mf file and bundle jar + server.copyFileToLibertyInstallRoot(FEATURE_PATH, "featureA-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib", "bundle1_1.0.0.jar"); + + // Now move the server xml with featureA + TestUtils.makeConfigUpdateSetMark(server, "server_add_featureA.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not installed and should have been: " + output, output.contains("featureA-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + + // Finally check that removing the feature will also uninstall the feature. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not uninstalled and should have been: " + output, output.contains("featureA-1.0")); + + // Now check that bundles of the features are gone. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that feature defined in it's .mf file as mixed case + * will be found and installed when the feature is specified in server.xml + * as FEATUREA-1.0. 850 was not case specific. 855 needs to also + * not be case specific. + * + * The feature structure is as follows: + * + * featureA is defined in featureA.mf by IBM-ShortName: featureA-1.0 + * + * @throws Exception + */ + @Mode(TestMode.FULL) + @Test + public void testFeatureNameInServerXmlAllUpperCaseManifestFileMixedCase() throws Exception { + final String METHOD_NAME = "testFeatureNameInServerXmlAllUpperCaseManifestFileMixedCase"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.deleteFileFromLibertyInstallRoot("lib/features/featureA-1.0.mf"); + // copy mf file and bundle jar + server.copyFileToLibertyInstallRoot(FEATURE_PATH, "featureA-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib", "bundle1_1.0.0.jar"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with FEATUREA-1.0 + // 850 was not case specific. 855 needs to be that way as well. + TestUtils.makeConfigUpdateSetMark(server, "server_add_feature_all_upper_a.xml"); + + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not installed and should have been: " + output, output.contains("featureA-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + + // Finally check that removing the feature will also uninstall the feature. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not uninstalled and should have been: " + output, output.contains("featureA-1.0")); + + // Now check that bundles of the features are gone. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that feature defined in it's .mf file as mixed case + * will be found and installed when the feature is specified in server.xml + * as featurea-1.0. 850 was not case specific. 855 needs to also + * not be case specific. + * + * The feature structure is as follows: + * + * featureA is defined in featureA.mf by IBM-ShortName: featureA-1.0 + * + * @throws Exception + */ + @Mode(TestMode.FULL) + @Test + public void testFeatureNameInServerXmlAllLowerCaseManifestFileMixedCase() throws Exception { + final String METHOD_NAME = "testFeatureNameInServerXmlAllLowerCaseManifestFileMixedCase"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.deleteFileFromLibertyInstallRoot("lib/features/featureA-1.0.mf"); + // copy mf file and bundle jar + server.copyFileToLibertyInstallRoot(FEATURE_PATH, "featureA-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib", "bundle1_1.0.0.jar"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with featurea-1.0 + // 850 was not case specific. 855 needs to be that way as well. + TestUtils.makeConfigUpdateSetMark(server, "server_add_feature_all_lower_a.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not installed and should have been: " + output, output.contains("featureA-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("bundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + + // Finally check that removing the feature will also uninstall the feature. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureA-1.0 was not uninstalled and should have been: " + output, output.contains("featureA-1.0")); + + // Now check that bundles of the features are gone. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("bundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundle1/[1.0.0,2.0.0)")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that the CWWKF0012I message is present in initial provisioning + * + * The feature structure is as follows: + * + * featureX, featureY, featureZ are all normal features. + * + * featureX is defined in featureXx.mf by IBM-ShortName: featureX-1.0 + * featureY is defined in featureYy.mf by IBM-ShortName: featureY-1.0 + * featureZ is defined in featureZz.mf by IBM-ShortName: featureZ-1.0 + * + * featureX is a feature that has featureY listed under Subsystem-Content. + * featureY is a feature that has featureZ listed under Subsystem-Content. + * featureZ is a feature that has no other features listed under Subsystem-Content. + * + * @throws Exception + */ + @Test + public void testInitialFeaturesAddedMessage() throws Exception { + final String METHOD_NAME = "testInitialFeaturesAddedMessage"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_add_featureX.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("featureX-1.0 was not installed and should have been: " + output, output.contains("featureX-1.0")); + assertTrue("featureY-1.0 was not installed and should have been: " + output, output.contains("featureY-1.0")); + assertTrue("featureZ-1.0 was not installed and should have been: " + output, output.contains("featureZ-1.0")); + + // now test with warm start + server.stopServer(); + + server.startServer(METHOD_NAME + "-2.log"); + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + assertTrue("featureX-1.0 was not installed and should have been: " + output, output.contains("featureX-1.0")); + assertTrue("featureY-1.0 was not installed and should have been: " + output, output.contains("featureY-1.0")); + assertTrue("featureZ-1.0 was not installed and should have been: " + output, output.contains("featureZ-1.0")); + + Log.exiting(c, METHOD_NAME); + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureToolTestCommon.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureToolTestCommon.java new file mode 100755 index 000000000000..972e2d4bd52f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/FeatureToolTestCommon.java @@ -0,0 +1,582 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.junit.AfterClass; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; + +/** + * + */ +public abstract class FeatureToolTestCommon { + public static final Class c = FeatureToolTestCommon.class; + public static LibertyServer server; + public static String javaExc; + public static String installRoot; + + // ETC product extension related variables. + public static final String PRODUCT_FEATURE_PATH = "producttest/lib/features/"; + public static final String PRODUCT_BUNDLE_PATH = "producttest/lib/"; + public static final String PRODUCT_EXTENSIONS_PATH = "etc/extensions/"; + public static final String PRODUCT_FEATURE_PROPERTIES_FILE = "testproduct.properties"; + public static final String PRODUCT_FEATURE_EMPTY_PATH_PROPERTIES_FILE = "testproductbadpath.properties"; + public static final String PRODUCT_FEATURE_PRODTEST_MF = "prodtest-1.0.mf"; + public static final String PRODUCT_FEATURE_PRODTEST_JAR = "com.ibm.ws.prodtest.internal_1.0.jar"; + public static final String PRODUCT_EXT_NAME = "testproduct"; + + // USR product extension related properties: + public static final String USR_PRODUCT_FEATURE_NAME = "usertest"; + + // Product pre-set return codes as set in: + // com.ibm.ws.kernel.feature.internal.cmdline.ReturnCode, + // com.ibm.ws.kernel.feature.internal.generator.FeatureListOptions. + public static final int PRODUCT_EXT_NOT_FOUND = 26; + public static final int PRODUCT_EXT_NOT_DEFINED = 27; + public static final int PRODUCT_EXT_NO_FEATURES_FOUND = 28; + + // Other variables. + public static final String CORE_PRODUCT_NAME = "core"; + public static final String USR_PRODUCT_NAME = "usr"; + public static final int SETUP_PROD_EXT = 1; + public static final int SETUP_USR_PROD_EXT = 2; + public static final int SETUP_ALL_PROD_EXTS = 3; + + /** + * Setup the environment. + * + * @param svr The server instance. + * + * @throws Exception + */ + public static void setupEnv(LibertyServer svr) throws Exception { + final String METHOD_NAME = "setup"; + server = svr; + installRoot = server.getInstallRoot(); + javaExc = System.getProperty("java.home") + "/bin/java"; + Log.entering(c, METHOD_NAME); + Log.info(c, METHOD_NAME, "java: " + javaExc); + Log.info(c, METHOD_NAME, "installRoot: " + installRoot); + + // Create a directory to store the output files. + File toolsOutputDir = new File(installRoot + "/tool.output.dir"); + toolsOutputDir.mkdir(); + } + + /** + * Setup product extensions. + * + * @param setupOption The option that determines what preset product extension will be installed. + * + * @throws Exception + */ + public static void setupProductExtensions(int setupOption) throws Exception { + final String METHOD_NAME = "setupProductExtensions"; + Log.exiting(c, METHOD_NAME); + boolean setupAll = false; + switch (setupOption) { + case SETUP_ALL_PROD_EXTS: + setupAll = true; + case SETUP_PROD_EXT: + // Install a product extension manually. Product name: testproduct. Install location: wlp/productTest (as specified in testproduct.properties). + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_FEATURE_PRODTEST_MF); + assertTrue("product feature: " + PRODUCT_FEATURE_PRODTEST_MF + " should have been copied to: " + PRODUCT_FEATURE_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_FEATURE_PATH + PRODUCT_FEATURE_PRODTEST_MF)); + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, PRODUCT_FEATURE_PRODTEST_JAR); + assertTrue("product bundle: " + PRODUCT_FEATURE_PRODTEST_JAR + " should have been copied to: " + PRODUCT_BUNDLE_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_BUNDLE_PATH + PRODUCT_FEATURE_PRODTEST_JAR)); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + assertTrue("product extension props file: " + PRODUCT_FEATURE_PROPERTIES_FILE + " should have been copied to: " + PRODUCT_EXTENSIONS_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE)); + Log.info(c, METHOD_NAME, "Product extension: " + PRODUCT_EXT_NAME + " has been installed."); + if (!setupAll) { + break; + } + case SETUP_USR_PROD_EXT: + // install a (usr) product extension. + ProgramOutput po = server.installFeature(null, USR_PRODUCT_FEATURE_NAME); + String stdout = po.getStdout(); + if (!stdout.contains("CWWKF1000I")) { + assertEquals("The feature: " + USR_PRODUCT_FEATURE_NAME + " should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, + po.getReturnCode()); + } + assertTrue("The " + USR_PRODUCT_FEATURE_NAME + " feature manifest should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/features/usertest.mf")); + assertTrue("The " + USR_PRODUCT_FEATURE_NAME + " bundle should exist.", server.fileExistsInLibertyInstallRoot("usr/extension/lib/usertest_1.0.0.jar")); + Log.info(c, METHOD_NAME, "Product extension: " + USR_PRODUCT_FEATURE_NAME + " has been installed in usr"); + + break; + default: + throw new Exception("Invalid setupOption: " + setupOption); + + } + + Log.exiting(c, METHOD_NAME); + } + + /** + * Cleans up the installation from any files that may have been left around. + * + * @throws Exception + */ + @AfterClass + public static void AfterClassCleanup() throws Exception { + final String METHOD_NAME = "cleanup"; + + Log.entering(c, METHOD_NAME); + + if (server == null) { + return; + } + + if (server.isStarted()) + server.stopServer(); + + server.deleteDirectoryFromLibertyInstallRoot("usr/extension/"); + server.deleteDirectoryFromLibertyInstallRoot("producttest"); + server.deleteDirectoryFromLibertyInstallRoot("etc/extensions"); + server.deleteDirectoryFromLibertyInstallRoot("tool.output.dir"); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Test that the --productExtension help option is displayed when help is requested. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testFeatureToolProductExtensionParmHelpDisplay(String cmd, String[] parms, String workDir) throws Exception { + final String METHOD_NAME = "testFeatureToolProductExtensionParmHelpDisplay"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + + String stdout = po.getStdout(); + int returnCode = po.getReturnCode(); + Log.info(c, METHOD_NAME, "Return Code: " + returnCode + ". STDOUT:" + stdout); + assertTrue("The output should contain the option --productExtension. ", stdout.contains("--productExtension")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the command to list features where the features folder for the product extension is empty. + * The request is expected to fail and issue a message. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * @param expectedMsg The expected message to use for validation. + * + * @throws Exception + */ + public void testFeatureToolUsingProductWithNoFeatureMfs(String cmd, String[] parms, String workDir, String expectedMsg) throws Exception { + final String METHOD_NAME = "testFeatureToolUsingProductWithNoFeatureMfs"; + Log.entering(c, METHOD_NAME); + + server.deleteFileFromLibertyInstallRoot(PRODUCT_FEATURE_PATH + PRODUCT_FEATURE_PRODTEST_MF); + assertFalse("Manifest file: " + PRODUCT_FEATURE_PATH + PRODUCT_FEATURE_PRODTEST_MF + "should not exist.", + server.fileExistsInLibertyInstallRoot(PRODUCT_FEATURE_PATH + PRODUCT_FEATURE_PRODTEST_MF)); + try { + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + String stdout = po.getStdout(); + int returnCode = po.getReturnCode(); + Log.info(c, METHOD_NAME, "Return Code: " + returnCode + ". STDOUT: " + stdout); + + assertTrue("The return code should have been: " + PRODUCT_EXT_NO_FEATURES_FOUND + ". Found: " + returnCode, (returnCode == PRODUCT_EXT_NO_FEATURES_FOUND)); + assertTrue("The features list request should have failed and message " + expectedMsg + " should have been issued :\r\n" + stdout, stdout.contains(expectedMsg)); + assertFalse("The prodExtFeaturelistNoFeatures.xml should not exist. The request should have failed.", + server.fileExistsInLibertyInstallRoot("tool.output.dir/prodExtFeaturelistNoFeatures.xml")); + } finally { + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_FEATURE_PRODTEST_MF); + assertTrue("product feature: " + PRODUCT_FEATURE_PRODTEST_MF + " should have been copied to: " + PRODUCT_FEATURE_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_FEATURE_PATH + PRODUCT_FEATURE_PRODTEST_MF)); + } + Log.exiting(c, METHOD_NAME); + } + + /** + * + * Tests the command to list features where the productExtension argument value points to a product that does not exist: --productExtension=testproductbadName. + * The request is expected to fail and issue a message. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * @param expectedMsg The expected message to use for validation. + * + * @throws Exception + */ + public void testFeatureToolUsingBadProductExtNameArgument(String cmd, String[] parms, String workDir, String expectedMsg) throws Exception { + final String METHOD_NAME = "testFeatureToolUsingBadProductExtNameArgument"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + String stdout = po.getStdout(); + int returnCode = po.getReturnCode(); + Log.info(c, METHOD_NAME, "Return Code: " + returnCode + ". STDOUT: " + stdout); + + assertTrue("The return code should have been: " + PRODUCT_EXT_NOT_DEFINED + ". Found: " + returnCode, (returnCode == PRODUCT_EXT_NOT_DEFINED)); + assertTrue("The features list request should have failed and message " + expectedMsg + " should have been issued :\r\n" + stdout, stdout.contains(expectedMsg)); + assertFalse("The prodExtFeaturelistBadNameArg.xml should not exist. The request should have failed.", + server.fileExistsInLibertyInstallRoot("tool.output.dir/prodExtFeaturelistBadNameArg.xml")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * + * Tests the command to list features where the com.ibm.websphere.productInstall in the product extension's properties file points to "". + * The request is expected to fail and issue a message. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * @param expectedMsg The expected message to use for validation. + * + * @throws Exception + */ + public void testFeatureToolUsingEmptyInstallLocationInProdExtPropsFile(String cmd, String[] parms, String workDir, String expectedMsg) throws Exception { + final String METHOD_NAME = "testFeatureToolUsingEmptyInstallLocationInProdExtPropsFile"; + Log.entering(c, METHOD_NAME); + + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE); + assertFalse(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE + " should not exist.", + server.fileExistsInLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE)); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_EMPTY_PATH_PROPERTIES_FILE); + assertTrue("product extension props file: " + PRODUCT_FEATURE_EMPTY_PATH_PROPERTIES_FILE + " should have been copied to: " + PRODUCT_EXTENSIONS_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_EMPTY_PATH_PROPERTIES_FILE)); + server.renameLibertyInstallRootFile(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_EMPTY_PATH_PROPERTIES_FILE, PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE); + assertTrue(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE + " should not exist.", + server.fileExistsInLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE)); + try { + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + String stdout = po.getStdout(); + int returnCode = po.getReturnCode(); + Log.info(c, METHOD_NAME, "Return Code: " + returnCode + ". STDOUT: " + stdout); + + assertTrue("The return code should have been: " + PRODUCT_EXT_NOT_FOUND + ". Found: " + returnCode, (returnCode == PRODUCT_EXT_NOT_FOUND)); + assertTrue("The features list request should have failed and message " + expectedMsg + " should have been issued :\r\n" + stdout, stdout.contains(expectedMsg)); + assertFalse("The prodExtFeaturelistWithInvalidInstLocInPropsFile.xml should not exist. The request should have failed.", + server.fileExistsInLibertyInstallRoot("tool.output.dir/prodExtFeaturelistWithInvalidInstLocInPropsFile.xml")); + } finally { + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE); + assertFalse(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE + " should not exist.", + server.fileExistsInLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE)); + + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + assertTrue("product extension props file: " + PRODUCT_FEATURE_PROPERTIES_FILE + " should have been copied to: " + PRODUCT_EXTENSIONS_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE)); + } + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the command to list features where the command does not contain the --productExtension argument. + * The request is expected complete. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testFeatureToolWithNoProdExtArgument(String cmd, String[] parms, String workDir) throws Exception { + final String METHOD_NAME = "testFeatureToolWithNoProdExtArgument"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po, "tool.output.dir/coreFeaturelist.xml"); + + // Open the resulting xml. + RemoteFile rf = server.getFileFromLibertyInstallRoot("tool.output.dir/coreFeaturelist.xml"); + InputStream in = rf.openForReading(); + DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = builder.parse(in); + + // Read the featureInfo header. There should only be one node tagged as such. + NodeList nl = doc.getElementsByTagName("featureInfo"); + assertTrue("There should only be one featureInfo node in feature list xml", nl.getLength() == 1); + Element e = (Element) nl.item(0); + + // Validate the featureInfo attributes: name, location, and productId. + String productName = e.getAttribute("name"); + assertTrue("The product name should be core. Found: " + productName, CORE_PRODUCT_NAME.equals(productName)); + String location = e.getAttribute("location"); + assertTrue("The location should be the install root. Found: " + location, location.endsWith("wlp")); + String productId = e.getAttribute("productId"); + assertTrue("Product extensions in usr location should not have a product id. Found: " + productId, productId.isEmpty()); + + // check for includes with tolerates + Element jspFeatureElement = getFeatureBySymbolicName(e, "com.ibm.websphere.appserver.jsp-2.2"); + NodeList includes = jspFeatureElement.getElementsByTagName("include"); + assertTrue("There should be at least one include node for jsp", includes.getLength() >= 1); + Element includeServlet = null; + for (int i = 0; i < includes.getLength(); i++) { + Element el = (Element) includes.item(i); + if ("com.ibm.websphere.appserver.servlet-3.0".equals(el.getAttribute("symbolicName"))) { + includeServlet = el; + break; + } + } + assertNotNull("Expected jsp-2.2 to include servlet-3.0 feature, but it was not found", includeServlet); + assertEquals("Wrong tolerates: " + includeServlet, "3.1", includeServlet.getAttribute("tolerates")); + + // Make sure short name is correct + assertEquals("Wrong short name: " + includeServlet, "servlet-3.0", includeServlet.getAttribute("shortName")); + + // check for private feature with singleton + Element servletApiFeatureElement = getFeatureBySymbolicName(e, "com.ibm.websphere.appserver.javax.servlet-3.0"); + assertEquals("Wrong singleton value: " + servletApiFeatureElement, "true", getSingletonElement(servletApiFeatureElement, "singleton").getTextContent()); + + // check servlet feature to make sure it has no process type + Set servletProcessTypes = getTextContents(servletApiFeatureElement.getElementsByTagName("processType")); + assertEquals("Wrong number of processTypes: " + servletProcessTypes, 0, servletProcessTypes.size()); + + // check that the javaeeClient feature has the client process type + Element artifactFeatureElement = getFeatureBySymbolicName(e, "com.ibm.websphere.appserver.javaeeClient-7.0"); + Set processTypes = getTextContents(artifactFeatureElement.getElementsByTagName("processType")); + assertEquals("Wrong number of processTypes: " + processTypes, 1, processTypes.size()); + assertTrue("Wrong process types: " + processTypes, processTypes.contains("CLIENT")); + + NodeList defaultConfigList = e.getElementsByTagName("defaultConfiguration"); + assertEquals("There should only be one defaultConfiguration node in the feature list", defaultConfigList.getLength(), 1); + List elements = findDefaultConfigurationByProvidingFeature(defaultConfigList, "com.ibm.websphere.appserver.channelfw-1.0"); + assertTrue("There should be three default instances provided by channelfw-1.0, found:" + elements.size(), elements.size() == 4); + for (Element instance : elements) { + NodeList configs = instance.getElementsByTagName("*"); + assertEquals(1, configs.getLength()); + Element config = (Element) configs.item(0); + assertNotNull(config); + + String name = config.getNodeName(); + if ("tcpOptions".equals(name)) { + assertEquals("defaultTCPOptions", config.getAttribute("id")); + assertEquals("-1", config.getAttribute("service.ranking")); + } else if ("variable".equals(name)) { + assertEquals("defaultHostName", config.getAttribute("name")); + assertEquals("localhost", config.getAttribute("value")); + } else if ("udpOptions".equals(name)) { + assertEquals("defaultUDPOptions", config.getAttribute("id")); + assertEquals("-1", config.getAttribute("service.ranking")); + } else if ("zosaio".equals(name)) { + assertEquals("defaultZOSAIO", config.getAttribute("id")); + assertEquals("-1", config.getAttribute("service.ranking")); + } else { + org.junit.Assert.fail("Invalid default configuration found for channelfw-1.0: " + name); + } + + } + Log.exiting(c, METHOD_NAME); + } + + private static Element getSingletonElement(Element parent, String childName) { + NodeList nl = parent.getElementsByTagName(childName); + assertEquals(parent.getNodeName() + '/' + childName + ": " + nl, 1, nl.getLength()); + return (Element) nl.item(0); + } + + private static Element getSingletonElementByAttribute(Element parent, String childName, String attributeName, String value) { + NodeList nl = parent.getElementsByTagName(childName); + List results = new ArrayList(); + for (int i = 0, length = nl.getLength(); i < length; i++) { + Element element = (Element) nl.item(i); + if (value.equals(element.getAttribute(attributeName))) { + results.add(element); + } + } + + assertEquals(parent.getNodeName() + '/' + childName + "[@" + attributeName + "='" + value + "': " + results, 1, results.size()); + return results.get(0); + } + + private static Element getFeatureBySymbolicName(Element parent, String symbolicName) { + List results = new ArrayList(); + NodeList nl = parent.getElementsByTagName("feature"); + findFeatureBySymbolicName(nl, symbolicName, results); + nl = parent.getElementsByTagName("protectedFeature"); + findFeatureBySymbolicName(nl, symbolicName, results); + nl = parent.getElementsByTagName("autoFeature"); + findFeatureBySymbolicName(nl, symbolicName, results); + nl = parent.getElementsByTagName("privateFeature"); + findFeatureBySymbolicName(nl, symbolicName, results); + + assertEquals(parent.getNodeName() + '/' + symbolicName + "': " + results, 1, results.size()); + return results.get(0); + } + + private static void findFeatureBySymbolicName(NodeList nl, String symboliName, List results) { + for (int i = 0, length = nl.getLength(); i < length; i++) { + Element featureElement = (Element) nl.item(i); + if (symboliName.equals(getSingletonElement(featureElement, "symbolicName").getTextContent())) { + results.add(featureElement); + } + } + } + + private List findDefaultConfigurationByProvidingFeature(NodeList nl, String featureName) { + List elements = new ArrayList(); + + Element root = (Element) nl.item(0); + NodeList instances = root.getElementsByTagName("defaultInstance"); + for (int i = 0, length = instances.getLength(); i < length; i++) { + Element defaultElement = (Element) instances.item(i); + if (featureName.equals(defaultElement.getAttribute("providingFeatures"))) { + elements.add(defaultElement); + } + } + return elements; + } + + private static Set getTextContents(NodeList nl) { + Set result = new LinkedHashSet(); + for (int i = 0, length = nl.getLength(); i < length; i++) { + result.add(nl.item(i).getTextContent()); + } + return result; + } + + private static Set set(String... values) { + return new LinkedHashSet(Arrays.asList(values)); + } + + /** + * Tests the command to list features with --productExtension=usr argument. + * The request is expected complete. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testFeatureToolWithUsrProdExtArgument(String cmd, String[] parms, String workDir) throws Exception { + final String METHOD_NAME = "testFeatureToolWithUsrProdExtArgument"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po, "tool.output.dir/usrFeaturelist.xml"); + + RemoteFile rf = server.getFileFromLibertyInstallRoot("tool.output.dir/usrFeaturelist.xml"); + InputStream in = rf.openForReading(); + DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = builder.parse(in); + NodeList nl = doc.getElementsByTagName("featureInfo"); + assertTrue("There should only be one featureInfo node in feature list xml", nl.getLength() == 1); + Element e = (Element) nl.item(0); + String productName = e.getAttribute("name"); + assertTrue("The product name should be usr. Found: " + productName, USR_PRODUCT_NAME.equals(productName)); + String location = e.getAttribute("location"); + assertTrue("The location should end in usr. Found: " + location, location.endsWith("usr")); + String productId = e.getAttribute("productId"); + assertTrue("Product extensions in usr location should not have a product id. Found: " + productId, productId.isEmpty()); + + Element featureElement = getSingletonElementByAttribute(e, "feature", "name", "usertest"); + assertEquals("feature/symbolicName", "usertest", getSingletonElement(featureElement, "symbolicName").getTextContent()); + assertEquals("feature/enables", set("ssl-1.0"), getTextContents(featureElement.getElementsByTagName("enables"))); + + NodeList defaultConfigList = e.getElementsByTagName("defaultConfiguration"); + assertTrue("There should only be one defaultConfiguration node in the feature list", defaultConfigList.getLength() == 1); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the command to list features with --productExtension=productx argument. + * The request is expected complete. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testFeatureToolWithProdExtArgument(String cmd, String[] parms, String workDir) throws Exception { + final String METHOD_NAME = "testFeatureToolWithProdExtArgument"; + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po, "tool.output.dir/prodExtFeaturelist.xml"); + + RemoteFile rf = server.getFileFromLibertyInstallRoot("tool.output.dir/prodExtFeaturelist.xml"); + InputStream in = rf.openForReading(); + DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = builder.parse(in); + NodeList nl = doc.getElementsByTagName("featureInfo"); + assertTrue("There should only be one featureInfo node in feature list xml", nl.getLength() == 1); + Element e = (Element) nl.item(0); + String productName = e.getAttribute("name"); + assertTrue("The product name should be usr. Found: " + productName, PRODUCT_EXT_NAME.equals(productName)); + String location = e.getAttribute("location"); + assertTrue("The location should be: wlp/producttest/. Found: " + location, location.equals("wlp/producttest/")); + String productId = e.getAttribute("productId"); + assertTrue("Product extensions should have a product id with the name of: bigProduct. Found: " + productId, productId.equals("bigProduct")); + + NodeList defaultConfigList = e.getElementsByTagName("defaultConfiguration"); + assertTrue("There should only be one defaultConfiguration node in the feature list", defaultConfigList.getLength() == 1); + Log.exiting(c, METHOD_NAME); + } + + /** + * Prints an extended debug output. + * + * @param po The programOutput + * @param fileName + * @throws Exception + */ + public void logInfo(ProgramOutput po, String fileName) throws Exception { + String methodName = "logInfo"; + Log.info(c, methodName, "Return Code: " + po.getReturnCode() + ". STDOUT: " + po.getStdout()); + + if (po.getReturnCode() != 0) { + Log.info(c, methodName, "STDERR: " + po.getStderr()); + RemoteFile rf = server.getFileFromLibertyInstallRoot(fileName); + BufferedReader br = new BufferedReader(new InputStreamReader(rf.openForReading())); + StringBuffer sb = new StringBuffer(); + String line = null; + while ((line = br.readLine()) != null) { + sb.append(line); + sb.append("\n"); + } + Log.info(c, methodName, "File " + fileName + " content:\n" + sb.toString()); + br.close(); + } + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/IconFeature.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/IconFeature.java new file mode 100755 index 000000000000..560ed7b27013 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/IconFeature.java @@ -0,0 +1,162 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import java.util.ArrayList; +import java.util.List; + +/** + *

Holder for fields that will be used for interactions with a feature.

+ * + *

This class only relies on the IBM-Shortname, i.e. the name as used in server.xml, and all other items + * are related to this value. To set up another feature in this way you need to adhere to the following:

+ *
    + *
  • set the Subsystem-SymbolicName to test.icons.shortName
  • + *
  • any ESA file relating to the feature must match the Subsystem-SymbolicName, and be in the + * testFeatures folder
  • + *
  • the feature should contain a test wab whose name must match the Subsystem-SymbolicName, In addition, + * the test wab must be available on the URL shortName/test, and should return the + * shortName from that URL
  • + *
+ */ +public class IconFeature { + + private final String shortName; + + List expectedIconFiles = new ArrayList(); + List unexpectedIconFiles = new ArrayList(); + + private String namespaceQualifier = ""; + private String namespaceRoot = ""; + + /** + * Initialise an IconFeature + * + * @param shortName the value of IBM-Shortname. For a user feature, this should not include the + * usr: prefix, but you should call setUserFeature(true) on the returned object. + */ + public IconFeature(String shortName) { + this.shortName = shortName; + } + + /** + * @return the Subsystem-SymbolicName, which will effectively be test.icons.shortName + */ + public String getSymbolicName() { + return "test.icons." + shortName; + } + + /** + * @return the list of expected Icons. The will never be null but may be empty + */ + public List getExpectedIcons() { + return expectedIconFiles; + } + + /** + * @return the list of unexpected Icons (i.e. Icon Files that should not appear in the image being tested). The will never be null but may be empty + */ + public List getUnexpectedIcons() { + return unexpectedIconFiles; + } + + /** + * @return the location in the autoFVT folder where the esa file will be located + */ + public String getAutoFVTLocation() { + return "testFeatures/" + getEsaFile(); + } + + /** + * @return the name of the ESA file, which should be the value of Subsystem-SymbolicName with the .esa suffix + */ + public String getEsaFile() { + return getSymbolicName() + ".esa"; + } + + /** + * @return the URL of the features WAB that can be accessed to verify the feature installed ok. + */ + public String getURL() { + return "/" + getShortName() + "/test"; + } + + /** + * Gets the IBM-Shortname value. This won't handle the namespacing if this is a user feature, e.g. for + * adding into server.xml. For that, use getNamespacedShortname(). + * + * @return the shortName of the feature, as provided to the class. This should match the feature's + * IBM-Shortname + */ + public String getShortName() { + return shortName; + } + + /** + * Add a file that will be expected to be included in the image to be tested. + * + * @param filePath the path as specified in the feature manifest + */ + public void addExpectedIcon(String filePath) { + expectedIconFiles.add(getIconFolder() + "/" + filePath); + } + + /** + * @return the folder inside the image to be tested where all icons are expected to go + */ + public String getIconFolder() { + return namespaceRoot + "lib/features/icons/" + getSymbolicName(); + } + + /** + * Add a file that will be expected not to be included in the image to be tested. + * + * @param filePath the path as specified in the feature manifest + */ + public void addUnexpectedIcon(String filePath) { + unexpectedIconFiles.add(getIconFolder() + "/" + filePath); + } + + /** + * @return the location of the feature manifest inside the image. the manifest should be named the + * same as the IBM-Shortname + */ + public String getFeatureManifest() { + return namespaceRoot + "lib/features/" + getShortName() + ".mf"; + } + + /** + * @return the location of the feature's test bundle within the image to test. The bundle should be a + * jar named after the Subsystem-Symbolicname of the feature. + */ + public String getFeatureBundle() { + return namespaceRoot + "lib/" + getSymbolicName() + "_1.0.0.jar"; + } + + /** + * Specify that this is a user feature. Once called, files will be assumed to go into the + * usr/extension folder, and the feature name for the server.xml will be prefixed with usr: + */ + public void markAsUserFeature() { + namespaceRoot = "usr/extension/"; + namespaceQualifier = "usr:"; + } + + /** + * @return the feature name, plus any namespace prefix. Use this to specify the feature name in + * server.xml + */ + public String getNamespacedShortName() { + return namespaceQualifier + getShortName(); + } + +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/IgnoreAPITest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/IgnoreAPITest.java new file mode 100755 index 000000000000..f65a376c4d03 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/IgnoreAPITest.java @@ -0,0 +1,46 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This test ensures that when a user intends to block/ignore an API or SPI package, + * that user apps are actually prevented from loading classes in it. + * Note: this bootstrap property that is used to block/ignore API packages is not + * intended for public use. It is specifically intended for SPSS (stack product) + * to use until a better answer can be found for the jaxrs (and feature that depend + * on jaxrs) feature exposing unwanted APIs. + */ +public class IgnoreAPITest { + + @Test + public void testCannotLoadBlockedAPIClass() throws Throwable { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.ignoreAPI"); + try { + server.startServer(); + String appOutput = server.waitForStringInLog("IgnoreAPITest. able to load blocked package. "); + assertNotNull("No output from startup singleton - app problem?", appOutput); + assertTrue("App was able to load blocked package", appOutput.endsWith("false")); + } finally { + if (server != null) { + server.stopServer(true); + } + } + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/MinifiedServerTestUtils.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/MinifiedServerTestUtils.java new file mode 100755 index 000000000000..5736fc445919 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/MinifiedServerTestUtils.java @@ -0,0 +1,461 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; +import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream; + +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServer.IncludeArg; +import componenttest.topology.impl.LibertyServerFactory; + +/** + *

This class contains utilities for working with minified servers. It lets you both minify and expand the server then run against the expanded server. There are two valid use + * case scenarios:

+ * + * MinifiedServerTestUtils minifyUtils = new MinifiedServerTestUtils();
+ * try {
+ *   LibertyServer someServer = LibertyServerFactory.getServer("someServer");
+ *   minifyUtils.setupAndStartMinifiedServer(this.getClass().getName(), "someServer", someServer);
+ *   // do some tests
+ *   minifyUtils.testViaHttpGet(new URL("http://someurl"));
+ * } finally {
+ *   minifyUtils.tearDown();
+ * }
+ *
+ *

Or if you want to re-use a single minified server multiple times:

+ * + * try {
+ *   LibertyServer someServer = LibertyServerFactory.getServer("someServer");
+ *   minifyUtils.setup(this.getClass().getName(), "someServer", someServer);
+ *   RemoteFile packagedServer = minifyUtils.minifyServer();
+ *   LibertyServer minifiedServer = minifyUtils.useMinifiedServer(packagedServer);
+ *   //Do some tests on this server
+ *   minifyUtils.deletedNestedServer();
+ *   //Repeat
+ *   minifiedServer = minifyUtils.useMinifiedServer(packagedServer);
+ *   //Do some tests on this server
+ *   minifyUtils.deletedNestedServer();
+ * } finally {
+ *   minifyUtils.tearDown();
+ * }
+ *
+ * + */ +public class MinifiedServerTestUtils { + LibertyServer server; + String testServerName; + String testClassName; + RemoteFile libExtract; + RemoteFile manifest; + RemoteFile nestedServerRoot; + RemoteFile libExtractMetaInf; + RemoteFile laFiles; + RemoteFile templates; + boolean createdManifest = false; + boolean createdLibExtract = false; + boolean createdLaFiles = false; + boolean createdTemplates = false; + private LibertyServer parentServer; + + /** + * This sets up the class ready to be used but does not create the minified server. + * + * @param className The name of the test class + * @param serverName The name of the server being used + * @param lserver The server to be minified + * @throws Exception + */ + public void setup(String className, String serverName, LibertyServer lserver) throws Exception { + Log.info(MinifiedServerTestUtils.class, "setup", "**** Begin Minify test setup for " + className + " " + serverName); + + //remember this for teardown later.. + testClassName = className; + testServerName = serverName; + server = lserver; + //reset the vars + createdManifest = false; + createdLibExtract = false; + createdLaFiles = false; + createdTemplates = false; + //tidy up any servers we made last time.. + LibertyServerFactory.tidyAllKnownServers(MinifiedServerTestUtils.class.getName()); + + parentServer = server; + } + + /** + * This minifies a server and then extracts the minified server and starts it. + * + * @param className The name of the test class + * @param serverName The name of the server being used + * @param lserver The server to be minified + * @throws Exception + */ + public void setupAndStartMinifiedServer(String className, String serverName, LibertyServer lserver) throws Exception { + setup(className, serverName, lserver); + + //sadly the tricks performed below would likely not work well on zOS.. + // a) the default extension for an archive on zos is not .zip + // b) if we forced the extension to .zip, the permissions on the sub install would be incorrect, and it's not clear how to correct them + // c) if we allowed the extension to be .pax, we'd need a way to extract the pax archive. + //when we resolve these issues, we can implement the zOS case correctly. + if (server.getMachine().getOperatingSystem().compareTo(OperatingSystem.ZOS) == 0) { + Log.info(MinifiedServerTestUtils.class, "setup", "Tests for minify are not active currently on zOS"); + server.startServer(); + } else { + + RemoteFile packageZip = minifyServer(); + + // Remember the dependency of the external test files, these will not be minified, and will be copied + // in afterward. We must remember them now, because we use server.getServerRoot to find them, and that will change + // once we swap to the minified image. + RemoteFile fatTestCommon = server.getMachine().getFile(server.getServerRoot() + "/../fatTestCommon.xml"); + RemoteFile fatTestPorts = server.getMachine().getFile(server.getServerRoot() + "/../fatTestPorts.xml"); + RemoteFile testPortsProps = server.getMachine().getFile(server.getServerRoot() + "/../testports.properties"); + + useMinifiedServer(packageZip); + + // Put the required test files into the right place for new server.. + fatTestCommon.copyToDest(new RemoteFile(server.getMachine(), server.getServerRoot() + "/../fatTestCommon.xml")); + fatTestPorts.copyToDest(new RemoteFile(server.getMachine(), server.getServerRoot() + "/../fatTestPorts.xml")); + testPortsProps.copyToDest(new RemoteFile(server.getMachine(), server.getServerRoot() + "/../testports.properties")); + + Log.info(MinifiedServerTestUtils.class, "setup", "minified Install Root : " + server.getInstallRoot()); + Log.info(MinifiedServerTestUtils.class, "setup", "minified Server Root : " + server.getServerRoot()); + + //finally launch server so tests can run. + server.startServer(); + } + Log.info(MinifiedServerTestUtils.class, "setup", "started? " + server.isStarted()); + } + + /** + * This method will extract a minified server and swap this instance to use it as it's server + * + * + * @param packageZip + * @return returns the minified server + * @throws Exception + * @throws IOException + */ + public LibertyServer useMinifiedServer(RemoteFile packageZip) throws Exception, IOException { + // Unzip the packaged server + extractMinifiedImage(packageZip); + + // swap to using the minfied server.. + swapToMinifiedServer(); + + nestedServerRoot = server.getMachine().getFile(server.getInstallRoot()); + return server; + } + + /** + * Minifies the current server and returns a remote file to the minified server zip. + * + * @return The minified server or null if on z/os + * @throws Exception + * @throws IOException + */ + public RemoteFile minifyServer() throws Exception, IOException { + if (server.getMachine().getOperatingSystem().compareTo(OperatingSystem.ZOS) == 0) { + return null; + } + + //get the image into a state where it can be minified.. + prepareForMinify(); + + // run minify against our server: DO NOT CLEAN START.. let's try to reuse the cache files so these + // tests don't take forever. + server.packageServer(IncludeArg.MINIFY, null); + RemoteFile packageZip = server.getMachine().getFile(server.getServerRoot() + "/" + server.getServerName() + ".zip"); + // try to move the packaged zip file to the servers directory + RemoteFile serversDir = packageZip.getParentFile().getParentFile(); + if (packageZip.copyToDest(serversDir)) { + packageZip.delete(); + packageZip = server.getMachine().getFile(server.getServerRoot() + "/../" + server.getServerName() + ".zip"); + } + + ZipArchiveInputStream zipIn = null; + try { + InputStream in = packageZip.openForReading(); + + zipIn = new ZipArchiveInputStream(in); + + for (ZipArchiveEntry entry = zipIn.getNextZipEntry(); entry != null; entry = zipIn.getNextZipEntry()) { + if ("wlp/bin/server".equals(entry.getName())) { + int unixMode = entry.getUnixMode(); + if ((unixMode ^ 256) != 256) { + throw new Exception("unix mode not set with user execute. UnixMode was " + unixMode); + } + } + } + } finally { + if (zipIn != null) { + zipIn.close(); + } + } + + //verify that server created a logs dir where we expected + //minify is using the embedded api to launch, which led to 96988, this test checks that doesn't happen again. + RemoteFile logDir = server.getMachine().getFile(server.getServerRoot() + "/logs"); + if (!logDir.exists()) { + throw new Exception("ERROR: minify did not create logs where expected.."); + } + return packageZip; + } + + /** + * @throws Exception + */ + private void swapToMinifiedServer() throws Exception { + //before we can get a new server, we need to tidy up the one we minified, as it shares the same name.. + //and if we request the same name again, it'll give us the cached one. tidyAllKnownServer should remove + //the old server from the cache, and let us build a new one with our special bootstrap + //we use the testClassName, as it was the class that originally obtained the server.. + LibertyServerFactory.tidyAllKnownServers(testClassName); + + Bootstrap minifiedBootstrap = createMinifiedBootstrapForFramework(); + + //swap the server instance variable for our minified server. + server = LibertyServerFactory.getLibertyServer(testServerName, minifiedBootstrap, true); + } + + private Bootstrap createMinifiedBootstrapForFramework() throws Exception { + //now we need to carefully obtain a new server instance over our new expanded dir.. + Bootstrap b = Bootstrap.getInstance(); + File bootStrapFile = b.getFile(); + Log.info(MinifiedServerTestUtils.class, "setup", "Bootstrap path : " + bootStrapFile.getAbsolutePath()); + + //read the old bootstrapping.properties (using whichever one was read to create the 'Bootstrap') + //and rewrite it as a new file, with liberty root pointing at our new expanded dir. + File minifiedBootstrapFile = new File(bootStrapFile.getAbsolutePath() + ".minified"); + BufferedReader fr = new BufferedReader(new FileReader(bootStrapFile)); + BufferedWriter bw = new BufferedWriter(new FileWriter(minifiedBootstrapFile, false)); + while (fr.ready()) { + String line = fr.readLine(); + if (line.startsWith("libertyInstallPath=")) { + Log.info(MinifiedServerTestUtils.class, "setup", "install path : " + line); + line = "libertyInstallPath=" + server.getServerRoot() + "/wlp"; //use of '/' tested on win & unix. + Log.info(MinifiedServerTestUtils.class, "setup", "install path 2 : " + line); + } + bw.write(line + "\n"); + } + fr.close(); + bw.close(); + //special instance returns us one based on the file, rather than the cached static instance. + //it also won't cache the instance so we don't break other tests. + return Bootstrap.getSpecialInstance(minifiedBootstrapFile); + } + + /** + * @param packageZip + * @throws Exception + * @throws IOException + */ + private void extractMinifiedImage(RemoteFile packageZip) throws Exception, IOException { + // Can't use unzip because it isn't on all machines so need to use jar + String command = server.getMachine().getFile(server.getMachineJavaJarCommandPath()).getAbsolutePath(); + String[] parameters = { "xf", "\"" + packageZip.getAbsolutePath() + "\"" }; + ProgramOutput unzipPackagedServerOutput = server.getMachine().execute(command, parameters, server.getServerRoot()); + if (unzipPackagedServerOutput.getReturnCode() != 0) { + throw new IOException(unzipPackagedServerOutput.getCommand() + " reported; retcode'" + unzipPackagedServerOutput.getReturnCode() + "' stdout'" + + unzipPackagedServerOutput.getStdout() + "' stderr'" + + unzipPackagedServerOutput.getStderr() + "'"); + } + + //fudge the permissions on the wlp/bin/server script.. + if (server.getMachine().getOperatingSystem().compareTo(OperatingSystem.WINDOWS) != 0) { + //try to exec this on all non windows platforms.. + server.getMachine().execute("/bin/chmod", //POSIX says chmod lives here... + new String[] { "755", server.getServerRoot() + File.separator + "wlp" + File.separator + "bin" + File.separator + "server" }); + server.getMachine().execute("/bin/chmod", //POSIX says chmod lives here... + new String[] { "755", server.getServerRoot() + File.separator + "wlp" + File.separator + "bin" + File.separator + "featureManager" }); + server.getMachine().execute("/bin/chmod", //POSIX says chmod lives here... + new String[] { "755", server.getServerRoot() + File.separator + "wlp" + File.separator + "bin" + File.separator + "productInfo" }); + } + } + + /** + * @throws Exception + * @throws IOException + */ + private void prepareForMinify() throws Exception, IOException { + //first, we need to check that some parts of liberty that WILL be there on a customer install, are here as part of our FAT + //they may not be, which caused 95749 + //lib/extract should hold the self-extractor code, which we wont use anyways, as we're building a zip in the testcase. + libExtract = server.getMachine().getFile(server.getInstallRoot() + "/lib/extract"); + if (!libExtract.exists()) { + libExtract.mkdir(); + createdLibExtract = true; + } + libExtractMetaInf = server.getMachine().getFile(server.getInstallRoot() + "/lib/extract/META-INF"); + if (!libExtractMetaInf.exists()) { + libExtractMetaInf.mkdir(); + manifest = server.getMachine().getFile(libExtractMetaInf, "MANIFEST.MF"); + java.io.OutputStream os = manifest.openForWriting(false); + os.write("Dummy manifest written during minify test".getBytes()); + os.flush(); + os.close(); + createdManifest = true; + } + laFiles = server.getMachine().getFile(server.getInstallRoot() + "/lafiles"); + if (!laFiles.exists()) { + laFiles.mkdir(); + createdLaFiles = true; + } + templates = server.getMachine().getFile(server.getInstallRoot() + "/templates"); + if (!templates.exists()) { + templates.mkdir(); + createdTemplates = true; + } + } + + public void tearDown() throws Exception { + Log.info(MinifiedServerTestUtils.class, "tearDown", "issuing stop to server at " + server.getInstallRoot()); + + server.stopServer(); + + Log.info(MinifiedServerTestUtils.class, "tearDown", "after stop of server at " + server.getInstallRoot()); + + //tidy up those extra dirs we built.. if we built them.. + if (createdLibExtract) { + if (!libExtract.delete()) { + Log.info(MinifiedServerTestUtils.class, "tearDown", "Failed to cleanup " + libExtract.getAbsolutePath()); + } + } else if (createdManifest) { + if (!libExtractMetaInf.delete()) { + Log.info(MinifiedServerTestUtils.class, "tearDown", "Failed to cleanup " + libExtractMetaInf.getAbsolutePath()); + } + } + if (createdLaFiles) { + if (!laFiles.delete()) { + Log.info(MinifiedServerTestUtils.class, "tearDown", "Failed to cleanup " + laFiles.getAbsolutePath()); + } + } + if (createdTemplates) { + if (!templates.delete()) { + Log.info(MinifiedServerTestUtils.class, "tearDown", "Failed to cleanup " + templates.getAbsolutePath()); + } + } + + deletedNestedServer(); + + Log.info(MinifiedServerTestUtils.class, "tearDown", "tidying up our server at " + server.getInstallRoot()); + //also tidy up our servers, the nature of our tests, and the arrangement of our classes + //doesnt work well with the way the framework expects it.. + LibertyServerFactory.tidyAllKnownServers(testClassName); + LibertyServerFactory.tidyAllKnownServers(MinifiedServerTestUtils.class.getName()); + } + + /** + * This deletes the nested server if one was created by extracting a minified server. Also sets the active server back to the parent server. + * + * @return true if the nested server is deleted + * @throws Exception + */ + public boolean deletedNestedServer() throws Exception { + server = parentServer; + if (nestedServerRoot != null) { + if (!nestedServerRoot.delete()) { + Log.info(MinifiedServerTestUtils.class, "tearDown", "Failed to cleanup " + nestedServerRoot.getAbsolutePath()); + return false; + } else { + nestedServerRoot = null; + } + } + + return true; + } + + protected static final String staticUrlPrefix = "http://localhost:" + System.getProperty("HTTP_default", "8000") + "/static"; + protected static final String servletUrlPrefix = "http://localhost:" + System.getProperty("HTTP_default", "8000") + "/ServletTest"; + + public void testViaHttpGet(URL url) throws IOException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + + try { + // read the page contents + String line = br.readLine(); + List lines = new ArrayList(); + while (line != null) { + lines.add(line); + line = br.readLine(); + } + con.disconnect(); + + // log the output lines so we can debug + Log.info(MinifiedServerTestUtils.class, "testViaHttpGet", "start - response from url " + url); + for (String msg : lines) { + Log.info(MinifiedServerTestUtils.class, "testViaHttpGet", msg); + } + Log.info(MinifiedServerTestUtils.class, "testViaHttpGet", "end - response from url " + url); + + // check the first line to be sure we at least got to the right place. + assertEquals("Servlet content was incorrect", "This is Mini-WOPR. Welcome Dr Falken.", lines.get(0)); + + boolean foundPass = false; + + //Pass criteria: + // - No FAIL: lines + // - at least one PASS line + for (String msg : lines) { + if (msg.startsWith("FAIL: ")) { + // When there is a fail log the whole output + StringBuilder builder = new StringBuilder(); + for (String lineForMessage : lines) { + builder.append(lineForMessage); + builder.append("\n"); + } + fail(builder.toString()); + } + if (msg.startsWith("PASS")) { + foundPass = true; + } + } + if (!foundPass) { + fail("Did not see PASS from servlet invocation at " + url); + } + } finally { + br.close(); + } + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/MinifyIconsTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/MinifyIconsTest.java new file mode 100755 index 000000000000..2578bde558a5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/MinifyIconsTest.java @@ -0,0 +1,362 @@ +package com.ibm.ws.kernel.feature.fat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.ProtocolException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.RemoteFile; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Test minifying a server that contains features with Icons. Ensure the icons are handled correctly. + */ +public class MinifyIconsTest { + // private static LibertyServer server = LibertyServerFactory.getLibertyServer(); + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.icons_test"); + private static LibertyServer minifiedServer = null; + private static MinifiedServerTestUtils minifyUtils = null; + private static Map iconFeaturesInstalled = new HashMap(); + private static boolean supportedPlatform = true; + + /** + * Set up the test. This method is called very early on and does almost all of the heavy lifting. That's + * because minify will be very slow when we have a bunch of features. So instead of re-minifying each + * test we do it once. But to make sure what we minify is good we need to do a few pre-flight checks. + * + * @throws Exception + */ + @BeforeClass + public static void setup() throws Exception { + List features = new ArrayList(); + // Any new features in this test should be added to this list + features.add("badPathTool-1.0"); + features.add("emptyIconHeader-1.0"); + features.add("goldenPathTool-1.0"); + features.add("iconDirectivesTool-1.0"); + features.add("missingIconsTool-1.0"); + features.add("noHeaderTool-1.0"); + + // Create an IconFeature class for every string. Makes it easier to manage this way round + for (String featureName : features) { + iconFeaturesInstalled.put(featureName, new IconFeature(featureName)); + } + + // Set up expected files + iconFeaturesInstalled.get("goldenPathTool-1.0").addExpectedIcon("OSGI-INF/toolicon.png"); + iconFeaturesInstalled.get("iconDirectivesTool-1.0").addExpectedIcon("OSGI-INF/toolicon10.png"); + iconFeaturesInstalled.get("iconDirectivesTool-1.0").addExpectedIcon("OSGI-INF/toolicon64.png"); + iconFeaturesInstalled.get("missingIconsTool-1.0").addExpectedIcon("OSGI-INF/toolicon.png"); + + // set up unexpectedFiles + iconFeaturesInstalled.get("badPathTool-1.0").addUnexpectedIcon("OSGI-INF/toolicon.png"); + iconFeaturesInstalled.get("emptyIconHeader-1.0").addUnexpectedIcon("OSGI-INF/toolicon.png"); + iconFeaturesInstalled.get("iconDirectivesTool-1.0").addUnexpectedIcon("OSGI-INF/toolicon.png"); + iconFeaturesInstalled.get("missingIconsTool-1.0").addUnexpectedIcon("OSGI-INF/missingtoolicon.png"); + iconFeaturesInstalled.get("noHeaderTool-1.0").addUnexpectedIcon("OSGI-INF/toolicon.png"); + + // Deploy each of these features. We'll use the local bundles, rather than the featureManager, to + // do this as we'll want to add files that shouldn't get picked up in the minify + for (IconFeature feature : iconFeaturesInstalled.values()) { + deployIconFeature(feature); + } + + // Add wab-1.0 to the list of features because we need it to load the test URLs. Don't add it + // because we don't want to create an IconFeature class for it + features.add("wab-1.0"); + server.changeFeatures(features); + + server.startServer(); + // Check all the apps installed ok and work + for (IconFeature feature : iconFeaturesInstalled.values()) { + server.waitForStringInLog("CWWKT0016I.*" + feature.getShortName()); + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + feature.getURL()); + HttpURLConnection con = getHttpConnection(url); + BufferedReader br = getConnectionStream(con); + String line = br.readLine(); + //If there is output then the Application automatically installed correctly + assertTrue("The output for feature " + feature.getShortName() + " should contain the feature shortname of " + feature.getShortName(), + line.contains(feature.getShortName())); + } + + server.stopServer(); + + // Minify the server. The minified version will be the one we'll want to run tests against + minifyUtils = new MinifiedServerTestUtils(); + minifyUtils.setup(MinifyIconsTest.class.getName(), + "com.ibm.ws.kernel.icons_test", + server); + RemoteFile miniServerPackage = minifyUtils.minifyServer(); + if (miniServerPackage != null) { + minifiedServer = minifyUtils.useMinifiedServer(miniServerPackage); + + minifiedServer.changeFeatures(features); + + // Due to the dependency of the external test files, need to package and include them into the minfied archive + RemoteFile fatTestCommon = server.getFileFromLibertyServerRoot("/../fatTestCommon.xml"); + RemoteFile fatTestPorts = server.getFileFromLibertyServerRoot("/../fatTestPorts.xml"); + RemoteFile testPortsProps = server.getFileFromLibertyServerRoot("/../testports.properties"); + + // Put the required test files into the right place for new server.. + fatTestCommon.copyToDest(new RemoteFile(minifiedServer.getMachine(), minifiedServer.getServerRoot() + "/../fatTestCommon.xml")); + fatTestPorts.copyToDest(new RemoteFile(minifiedServer.getMachine(), minifiedServer.getServerRoot() + "/../fatTestPorts.xml")); + testPortsProps.copyToDest(new RemoteFile(minifiedServer.getMachine(), minifiedServer.getServerRoot() + "/../testports.properties")); + + // We should start the server again and make sure all our features are available + minifiedServer.startServer(); + for (IconFeature feature : iconFeaturesInstalled.values()) { + minifiedServer.waitForStringInLog("CWWKT0016I.*" + feature.getShortName()); + URL url = new URL("http://" + minifiedServer.getHostname() + ":" + minifiedServer.getHttpDefaultPort() + feature.getURL()); + HttpURLConnection con = getHttpConnection(url); + BufferedReader br = getConnectionStream(con); + String line = br.readLine(); + // If there is output then the Application automatically installed correctly + assertTrue("The output did not contain the automatically installed message", + line.contains(feature.getShortName())); + } + + // but we can stop the server as it shouldn't need to be running for the tests + minifiedServer.stopServer(); + } else if (server.getMachine().getOperatingSystem().equals(OperatingSystem.ZOS)) { + supportedPlatform = false; + } else { + Assert.fail("The minified server should not be null"); + } + } + + /** + * Deploy the feature file, the feature bundle, and both unexpected and expected icon files + * + * @param iconFeature the feature to deploy + * @throws Exception + */ + private static void deployIconFeature(IconFeature iconFeature) throws Exception { + // Note that pathToAutoFVTTestFiles may change when we're on Moonstone + String rootOfFiles = server.pathToAutoFVTTestFiles + "filesForPreMinify/"; + + // Copy the manifest + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getInstallRoot() + "/lib/features", + rootOfFiles + iconFeature.getFeatureManifest()); + + // Copy the bundle + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getInstallRoot() + "/lib", + rootOfFiles + iconFeature.getFeatureBundle()); + + // Copy icons we expect to see in the minified image + for (String expectedFile : iconFeature.getExpectedIcons()) { + int delimiterPos = expectedFile.lastIndexOf("/"); + String expectedFolder = "/" + expectedFile; + if (delimiterPos >= 0) { + expectedFolder = "/" + expectedFile.substring(0, delimiterPos); + } + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getInstallRoot() + expectedFolder, + rootOfFiles + "/" + expectedFile); + } + + // Lay down any unexpected icons too, since they shouldn't make it into the minified image + for (String unexpectedFile : iconFeature.getExpectedIcons()) { + int delimiterPos = unexpectedFile.lastIndexOf("/"); + String unexpectedFolder = "/" + unexpectedFile; + if (delimiterPos >= 0) { + unexpectedFolder = "/" + unexpectedFile.substring(0, delimiterPos); + } + + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getInstallRoot() + unexpectedFolder, + rootOfFiles + "/" + unexpectedFile); + } + + } + + /** + * We need to tidy up the minified server at the end of the test, and also ensure that no test files + * were left behind + * + * @throws Exception + */ + @AfterClass + public static void tearDown() throws Exception { + if (minifiedServer != null) + minifiedServer.stopServer(); + // tear down minfiy + if (minifyUtils != null) + minifyUtils.tearDown(); + // Remove the files from the runtime + for (IconFeature feature : iconFeaturesInstalled.values()) { + removeIconFeature(feature); + } + + } + + /** + * Delete all files relating to the feature + * + * @param feature + * @throws Exception + */ + private static void removeIconFeature(IconFeature feature) throws Exception { + server.deleteDirectoryFromLibertyInstallRoot(feature.getIconFolder()); + server.deleteFileFromLibertyInstallRoot(feature.getFeatureManifest()); + server.deleteFileFromLibertyInstallRoot(feature.getFeatureBundle()); + } + + /** + * Verify that a feature with a badly formed Subsystem-Icon header will get its icons ignored + * + * @throws Exception + */ + @Test + public void minifyBadPath() throws Exception { + validateFeature("badPathTool-1.0"); + + } + + /** + * Verify that a feature with a Subsystem-Icon header but no content will get no icons + * + * @throws Exception + */ + @Test + public void minifyEmptyHeader() throws Exception { + validateFeature("emptyIconHeader-1.0"); + + } + + /** + * Verify that a valid header will get its icons picked up + * + * @throws Exception + */ + @Test + public void minifyGoldenPath() throws Exception { + validateFeature("goldenPathTool-1.0"); + } + + /** + * Verify that directives to not stop the icons being gathered + * + * @throws Exception + */ + @Test + public void minifyIconDirectives() throws Exception { + validateFeature("iconDirectivesTool-1.0"); + } + + /** + * Verify that we can ignore icons that are in the Subsystem-Icon header but not on disk + * + * @throws Exception + */ + @Test + public void minifyMissingIcons() throws Exception { + validateFeature("missingIconsTool-1.0"); + } + + /** + * Verify that if the header is totally missing no icons are gathered but the feature is correctly + * minified + * + * @throws Exception + */ + @Test + public void minifyNoHeader() throws Exception { + validateFeature("noHeaderTool-1.0"); + } + + /** + * Validate that the passed in feature was installed correctly, its expected icons were laid down and nothing unexpected was laid down. + * + * @param featureName The feature to validate + * @throws Exception + */ + private void validateFeature(String featureName) throws Exception { + // Only perform this work if the test setup didn't indicate we are on an unsupported platform + if (supportedPlatform) { + // Check that the bundle and the manifest made it in ok. + // It should be tough for this to fail if the minified + // server was checked in the BeforeClass + IconFeature feature = iconFeaturesInstalled.get(featureName); + Assert.assertNotNull("The icon feature " + featureName + " should be in the map of installed features", feature); + assertTrue("The manifest file at " + feature.getFeatureManifest() + " should exist in the install root of the minified server", + minifiedServer.fileExistsInLibertyInstallRoot(feature.getFeatureManifest())); + + assertTrue("The bundle file " + feature.getFeatureBundle() + " should exist in the install root of the minified server", + minifiedServer.fileExistsInLibertyInstallRoot(feature.getFeatureBundle())); + + if (feature.expectedIconFiles.size() > 0) { + assertTrue("The icons folder " + feature.getIconFolder() + " should exist in the install root of the minified server", + minifiedServer.fileExistsInLibertyInstallRoot(feature.getIconFolder())); + } else { + Assert.assertFalse("The icons folder " + feature.getIconFolder() + " should not exist in the install root of the minified server", + minifiedServer.fileExistsInLibertyInstallRoot(feature.getIconFolder())); + } + + for (String expectedIcon : feature.getExpectedIcons()) { + assertTrue("The icon " + expectedIcon + " should exist in the install root of the minified server", + minifiedServer.fileExistsInLibertyInstallRoot(expectedIcon)); + } + + for (String unexpectedIcon : feature.getUnexpectedIcons()) { + Assert.assertFalse("The icon " + unexpectedIcon + " should not exist in the install root of the minified server", + minifiedServer.fileExistsInLibertyInstallRoot(unexpectedIcon)); + } + } + } + + /** + * This method is used to get a connection stream from an HTTP connection. It + * gives the output from the webpage that it gets from the connection + * + * @param con The connection to the HTTP address + * @return The Output from the webpage + */ + private static BufferedReader getConnectionStream(HttpURLConnection con) throws IOException { + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + return br; + } + + /** + * This method creates a connection to a webpage and then reutrns the connection + * + * @param url The Http Address to connect to + * @return The connection to the http address + */ + private static HttpURLConnection getHttpConnection(URL url) throws IOException, ProtocolException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + return con; + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/ProductFeatureTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/ProductFeatureTest.java new file mode 100755 index 000000000000..ef69aa712515 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/ProductFeatureTest.java @@ -0,0 +1,769 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.AllowedFFDC; +import componenttest.annotation.ExpectedFFDC; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +@Mode(TestMode.FULL) +public class ProductFeatureTest { + + private static final Class c = ProductFeatureTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.product"); + + private static final String PRODUCT_FEATURE_PRODTEST_MF = "prodtest-1.0.mf"; + private static final String PRODUCT_FEATURE_PRODTEST_PRIVATE_MF = "prodtestprivate-1.0.mf"; + private static final String PRODUCT_FEATURE_PRODTEST_JAR = "com.ibm.ws.prodtest.internal_1.0.jar"; + private static final String PRODUCT_FEATURE_PROPERTIES_FILE = "testproduct.properties"; + private static final String PRODUCT2_FEATURE_PROPERTIES_FILE = "testproduct2.properties"; + private static final String PRODUCT3_FEATURE_PROPERTIES_FILE = "testproduct3.properties"; + private static final String PRODUCT_FEATURE_BAD_PROPERTIES_FILE = "testproductbad.properties"; + private static final String PRODUCT_FEATURE_BAD_WLP_PROPERTIES_FILE = "testproductbadwlp.properties"; + private static final String PRODUCT_FEATURE_CONTAINS_SYMBOL_PROPERTIES_FILE = "testproductcontainssymbol.properties"; + private static final String PRODUCT_FEATURE_BAD_PATH_PROPERTIES_FILE = "testproductbadpath.properties"; + private static final String PRODUCT_FEATURE_USR_PROPERTIES_FILE = "usr.properties"; + private static final String ODD_CHARS_IN_PATH = "(test a&)"; + + private static final String installFeatureMsgPrefix = "CWWKF0012I:"; + private static final String uninstallFeatureMsgPrefix = "CWWKF0013I:"; + private static final String productInstallnotInPropertiesFilePrefix = "CWWKF0018E:"; + private static final String productInstallPathPrefix = "CWWKF0017E:"; + private static final String productInstallPathContainsSymbol = "CWWKF0027E:"; + private static final String productInstallPathSameAsWlp = "CWWKF0028E:"; + private static final String serverUpdatedMsgPrefix = "CWWKG0017I:"; + private static final String missingFeatureMsgPrefix = "CWWKF0001E"; + private static final String missingFeatureCoreMsgPrefix = "CWWKF0042E"; + + private static final String PRODUCT_FEATURE_PATH = "producttest/lib/features/"; + private static final String PRODUCT_BUNDLE_PATH = "producttest/lib/"; + private static final String PRODUCT_EXTENSIONS_PATH = "etc/extensions/"; + + private static final String CACHE_DIRECTORY = "workarea/platform/"; + private static final String FEATURE_BUNDLE_CACHE = CACHE_DIRECTORY + "feature.bundles.cache"; + + /** + * Copy the necessary features and bundles to the liberty server directories + * + * @throws Exception + */ + @Before + public void setup() throws Exception { + final String METHOD_NAME = "setup"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This method removes all the testing artifacts from the server directories. + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + final String METHOD_NAME = "tearDown"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) + server.stopServer(); + + server.uninstallProductExtension("productA"); + server.uninstallProductExtension("productB"); + server.uninstallProductExtension("producttest"); + server.uninstallProductExtension("testproduct"); + server.uninstallProductExtension("testproduct2"); + server.uninstallProductExtension("testproduct3"); + server.deleteDirectoryFromLibertyInstallRoot("producttest"); + + server.deleteDirectoryFromLibertyInstallRoot(ODD_CHARS_IN_PATH); + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE); + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT2_FEATURE_PROPERTIES_FILE); + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT3_FEATURE_PROPERTIES_FILE); + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_BAD_PROPERTIES_FILE); + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_BAD_WLP_PROPERTIES_FILE); + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_USR_PROPERTIES_FILE); + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_CONTAINS_SYMBOL_PROPERTIES_FILE); + server.deleteFileFromLibertyInstallRoot(PRODUCT_BUNDLE_PATH + "../bin/test.bat"); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a product feature is installed when added to server.xml. + * * com.ibm.websphere.productInstall= ends with a / + * + * @throws Exception + */ + @Mode(TestMode.LITE) + @Test + public void testProductFeatureInstalled() throws Exception { + final String METHOD_NAME = "testProductFeatureInstalled"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_FEATURE_PRODTEST_MF); + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, PRODUCT_FEATURE_PRODTEST_JAR); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a product feature available + TestUtils.makeConfigUpdateSetMark(server, "server_product_features.xml"); + // Get the install feature message for the added product feature. + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("prodtest-1.0 product feature was not installed and should have been: " + output, output.contains("prodtest-1.0")); + + // Finally check that removing the product feature from server.xml will uninstall it. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("product feature prodtest-1.0 was not uninstalled and should have been: " + output, output.contains("prodtest-1.0")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a product feature cannot include private features from core + * + * @throws Exception + */ + @Mode(TestMode.LITE) + @Test + public void testProductFeatureInstalledWithPrivateContent() throws Exception { + final String METHOD_NAME = "testProductFeatureInstalledWithPrivateContent"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_FEATURE_PRODTEST_PRIVATE_MF); + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, PRODUCT_FEATURE_PRODTEST_JAR); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a product feature available + TestUtils.makeConfigUpdateSetMark(server, "server_product_private_features.xml"); + // Get the install feature message for the added product feature. + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("prodtestprivate-1.0 product feature was not installed and should have been: " + output, output.contains("prodtestprivate-1.0")); + + // check for missing feature message for internal feature that we don't have access to + output = server.waitForStringInLogUsingMark(missingFeatureMsgPrefix); + assertNotNull("We haven't found the " + missingFeatureMsgPrefix + " in the logs.", output); + assertTrue("wrong missing feature found: " + output, output.contains("com.ibm.websphere.appserver.javax.servlet-3.0")); + + // Finally check that removing the product feature from server.xml will uninstall it. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("product feature prodtestprivate-1.0 was not uninstalled and should have been: " + output, output.contains("prodtestprivate-1.0")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a product feature is installed when added to server.xml. + * com.ibm.websphere.productInstall= does not end with a / + * + * @throws Exception + */ + @Test + public void testProductFeatureInstalledNoSlashAtEnd() throws Exception { + final String METHOD_NAME = "testProductFeatureInstalledNoSlashAtEnd"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_FEATURE_PRODTEST_MF); + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, PRODUCT_FEATURE_PRODTEST_JAR); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT2_FEATURE_PROPERTIES_FILE); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a product feature available + TestUtils.makeConfigUpdateSetMark(server, "server_product2_features.xml"); + // Get the install feature message for the added product feature. + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("prodtest-1.0 product feature was not installed and should have been: " + output, output.contains("prodtest-1.0")); + + // Finally check that removing the product feature from server.xml will uninstall it. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("product feature prodtest-1.0 was not uninstalled and should have been: " + output, output.contains("prodtest-1.0")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a product feature is installed when added to server.xml. + * com.ibm.websphere.productInstall= has odd characters in it + * + * @throws Exception + */ + @Test + public void testProductFeatureInstalledOddCharacters() throws Exception { + final String METHOD_NAME = "testProductFeatureInstalledOddCharacters"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot(ODD_CHARS_IN_PATH + "/" + PRODUCT_FEATURE_PATH, PRODUCT_FEATURE_PRODTEST_MF); + server.copyFileToLibertyInstallRoot(ODD_CHARS_IN_PATH + "/" + PRODUCT_BUNDLE_PATH, PRODUCT_FEATURE_PRODTEST_JAR); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT3_FEATURE_PROPERTIES_FILE); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a product feature available + TestUtils.makeConfigUpdateSetMark(server, "server_product3_features.xml"); + // Get the install feature message for the added product feature. + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("prodtest-1.0 product feature was not installed and should have been: " + output, output.contains("prodtest-1.0")); + + // Finally check that removing the product feature from server.xml will uninstall it. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("product feature prodtest-1.0 was not uninstalled and should have been: " + output, output.contains("prodtest-1.0")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a product feature located as a peer of wlp/ can have + * it's features installed and uninstalled. + * com.ibm.websphere.productInstall= does not end with a / + * + * C:\stuff\wlp + * C:\stuff\productA\lib\features + * + * @throws Exception + */ + @Test + public void testProductFeatureInstalledAsPeerToWLPNoSlashAtEnd() throws Exception { + final String METHOD_NAME = "testProductFeatureInstalledAsPeerToWLPNoSlashAtEnd"; + + Log.entering(c, METHOD_NAME); + + server.installProductExtension("productA"); + server.installProductBundle("productA", "com.ibm.ws.prodtest.internal_1.0"); + server.installProductFeature("productA", "prodtest-1.0"); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a product feature available + TestUtils.makeConfigUpdateSetMark(server, "server_productA_features.xml"); + // Get the install feature message for the added product feature. + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + assertTrue("prodtest-1.0 product feature was not installed and should have been: " + output, output.contains("prodtest-1.0")); + + // Finally check that removing the product feature from server.xml will uninstall it. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + assertTrue("product feature prodtest-1.0 was not uninstalled and should have been: " + output, output.contains("prodtest-1.0")); + + server.stopServer(); + server.uninstallProductBundle("productA", "com.ibm.ws.prodtest.internal_1.0"); + server.uninstallProductFeature("productA", "prodtest-1.0"); + server.uninstallProductExtension("productA"); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a product feature located as a peer of wlp/ can have + * it's features installed and uninstalled. + * com.ibm.websphere.productInstall= has a / on the end + * + * C:\stuff\wlp + * C:\stuff\productA\lib\features + * + * @throws Exception + */ + @Test + public void testProductFeatureInstalledAsPeerToWLPSlashAtEnd() throws Exception { + final String METHOD_NAME = "testProductFeatureInstalledAsPeerToWLPSlashAtEnd"; + + Log.entering(c, METHOD_NAME); + + server.installProductExtension("productB"); + server.installProductBundle("productB", "com.ibm.ws.prodtest.internal_1.0"); + server.installProductFeature("productB", "prodtest-1.0"); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a product feature available + TestUtils.makeConfigUpdateSetMark(server, "server_productB_features.xml"); + // Get the install feature message for the added product feature. + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + assertTrue("prodtest-1.0 product feature was not installed and should have been: " + output, output.contains("prodtest-1.0")); + + // Finally check that removing the product feature from server.xml will uninstall it. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + assertTrue("product feature prodtest-1.0 was not uninstalled and should have been: " + output, output.contains("prodtest-1.0")); + + server.stopServer(); + server.uninstallProductBundle("productB", "com.ibm.ws.prodtest.internal_1.0"); + server.uninstallProductFeature("productB", "prodtest-1.0"); + server.installProductExtension("productB"); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a product feature is installed when in server.xml at server start. + * + * @throws Exception + */ + @Test + public void testProductFeatureInstalledAtStartup() throws Exception { + final String METHOD_NAME = "testproductFeatureInstalledAtStartup"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_FEATURE_PRODTEST_MF); + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, PRODUCT_FEATURE_PRODTEST_JAR); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + + // Start with no features being installed. + server.setServerConfigurationFile("server_product_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Check that product feature was there by uninstalling it. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + String output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("product feature prodtest-1.0 was not uninstalled and should have been: " + output, output.contains("prodtest-1.0")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a product feature called usr is not installed when added to server.xml. + * + * @throws Exception + */ + @Test + public void testUsrProductFeatureNotInstalled() throws Exception { + final String METHOD_NAME = "testUsrProductFeatureNotInstalled"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_FEATURE_PRODTEST_MF); + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, PRODUCT_FEATURE_PRODTEST_JAR); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_USR_PROPERTIES_FILE); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a product feature available + TestUtils.makeConfigUpdateSetMark(server, "server_usr_product_features.xml"); + //CWWKF0001E: A feature definition could not be found for usr:prodtest-1.0 + // Get the install feature message for the added product feature. + String output = server.waitForStringInLogUsingMark(missingFeatureMsgPrefix); + assertNotNull("We haven't found the " + missingFeatureMsgPrefix + " in the logs.", output); + assertTrue("product feature usr:prodtest-1.0 should not have been installed: " + output, output.contains("usr:prodtest-1.0")); + + // Finally check that removing the product feature from server.xml will uninstall it. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + //CWWKG0017I: The server configuration was successfully updated in 0.229 seconds. + output = server.waitForStringInLogUsingMark(serverUpdatedMsgPrefix); + assertNotNull("We haven't found the " + serverUpdatedMsgPrefix + " in the logs.", output); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test issues an error for a product properties file that does not contain com.ibm.websphere.productInstall. + * + * @throws Exception + */ + @Test + public void testProductFeatureBadPropertiesFile() throws Exception { + final String METHOD_NAME = "testProductFeatureBadPropertiesFile"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_BAD_PROPERTIES_FILE); + + server.startServer(METHOD_NAME + ".log"); + + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_BAD_PROPERTIES_FILE); + // CWWKF0018E: Property com.ibm.websphere.productInstall not found in product properties file testproductbad.properties. + // Get the com.ibm.websphere.productInstall not found in product properties file message. + String output = server.waitForStringInLog(productInstallnotInPropertiesFilePrefix); + assertNotNull("We haven't found the " + productInstallnotInPropertiesFilePrefix + " in the logs.", output); + + assertTrue(PRODUCT_FEATURE_BAD_PROPERTIES_FILE + " was not flagged with an error and should have been: " + output, output.contains(PRODUCT_FEATURE_BAD_PROPERTIES_FILE)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test issues an error for a product properties file that has a product install + * path that is the same as ${wlp.install.dir}. + * + * @throws Exception + */ + @Test + @ExpectedFFDC("com.ibm.ws.kernel.productinfo.DuplicateProductInfoException") + public void testProductFeatureInstallSameAsWlpInstallDir() throws Exception { + final String METHOD_NAME = "testProductFeatureInstallSameAsWlpInstallDir"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_BAD_WLP_PROPERTIES_FILE); + server.startServer(METHOD_NAME + ".log"); + + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_BAD_WLP_PROPERTIES_FILE); + // look for the error message + String output = server.waitForStringInLog(productInstallPathSameAsWlp); + assertNotNull("We haven't found the " + productInstallPathSameAsWlp + " in the logs.", output); + + assertTrue(PRODUCT_FEATURE_BAD_WLP_PROPERTIES_FILE + " was not flagged with an error and should have been: " + output, + output.contains(PRODUCT_FEATURE_BAD_WLP_PROPERTIES_FILE)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test issues an error for a product properties file that has a product install + * path that has a symbol. + * + * @throws Exception + */ + @Test + public void testProductFeatureInstallContainsSymbol() throws Exception { + final String METHOD_NAME = "testProductFeatureInstallContainsSymbol"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_CONTAINS_SYMBOL_PROPERTIES_FILE); + server.startServer(METHOD_NAME + ".log"); + + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_CONTAINS_SYMBOL_PROPERTIES_FILE); + // look for the error message + String output = server.waitForStringInLog(productInstallPathContainsSymbol); + assertNotNull("We haven't found the " + productInstallPathContainsSymbol + " in the logs.", output); + + assertTrue(PRODUCT_FEATURE_CONTAINS_SYMBOL_PROPERTIES_FILE + " was not flagged with an error and should have been: " + output, + output.contains(PRODUCT_FEATURE_CONTAINS_SYMBOL_PROPERTIES_FILE)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test issues an error for a product properties file that contains a bad path. + * + * @throws Exception + */ + @Test + public void testProductFeatureBadPath() throws Exception { + final String METHOD_NAME = "testProductFeatureBadPath"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + // delete extensions dir incase a previous test did not clean up it's .properties files + // extra .properties file was causing an extra CWWKF0017E with a different filename in it so this test would fail + server.deleteDirectoryFromLibertyInstallRoot("etc/extensions"); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_BAD_PATH_PROPERTIES_FILE); + server.startServer(METHOD_NAME + ".log"); + + server.deleteFileFromLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_BAD_PATH_PROPERTIES_FILE); + // CWWKF0017E: Product install path {0} specified in product properties file {1} could not be found. + // CWWKF0017E: Product install path lib/features/ specified in product properties file testproductbadpath.properties could not be found. + // Get the path not found message. + String output = server.waitForStringInLog(productInstallPathPrefix); + assertNotNull("We haven't found the " + productInstallPathPrefix + " in the logs.", output); + + assertTrue(PRODUCT_FEATURE_BAD_PATH_PROPERTIES_FILE + " was not flagged with an path error and should have been: " + output, + output.contains(PRODUCT_FEATURE_BAD_PATH_PROPERTIES_FILE)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test tests with a product feature that does not have a .mf file. + * + * @throws Exception + */ + @Test + @AllowedFFDC("java.io.FileNotFoundException") + public void testProductFeatureNotFound() throws Exception { + final String METHOD_NAME = "testProductFeatureNotFound"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a product feature that will not be found. + TestUtils.makeConfigUpdateSetMark(server, "server_product_features_not_found.xml"); + // Get the feature definition could not be found message. + String output = server.waitForStringInLogUsingMark(missingFeatureMsgPrefix); + assertNotNull("We haven't found the " + missingFeatureMsgPrefix + " in the logs.", output); + + assertTrue("testproduct:producttestnotfound product feature was installed and should have been: " + output, output.contains("testproduct:producttestnotfound")); + + Log.exiting(c, METHOD_NAME); + } + + @Test + @AllowedFFDC("java.io.FileNotFoundException") + public void testCoreFeatureNotFound() throws Exception { + final String METHOD_NAME = "testCoreFeatureNotFound"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a product feature that will not be found. + TestUtils.makeConfigUpdateSetMark(server, "server_core_features_not_found.xml"); + // Get the feature definition could not be found message. + String output = server.waitForStringInLogUsingMark(missingFeatureCoreMsgPrefix); + assertNotNull("We haven't found the " + missingFeatureCoreMsgPrefix + " in the logs.", output); + + assertTrue("coretest-1.0 product feature name was not found in the output: " + output, output.contains("coretest-1.0")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a .mf file added to producttest/lib/features after the server is + * up and running will be found and installed when the feature is specified in server.xml. + * The test ensures that this happens during server update. + * + * The feature structure is as follows: + * + * pfeatureA is defined in pfeatureA.mf by IBM-ShortName: pfeatureA-1.0 + * + * @throws Exception + */ + @Test + public void testProductFeatureManifestFileAddedAfterServerIsAlreadyUp() throws Exception { + final String METHOD_NAME = "testProductFeatureManifestFileAddedAfterServerIsAlreadyUp"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + + server.deleteDirectoryFromLibertyInstallRoot("producttest"); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, "pfeatureA-1.0.mf"); + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, "pbundle1_1.0.0.jar"); + + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with pfeatureA + TestUtils.makeConfigUpdateSetMark(server, "server_product_featureA.xml"); + + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + assertTrue("pfeatureA-1.0 was not installed and should have been: " + output, output.contains("pfeatureA-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = getCacheProperties(FEATURE_BUNDLE_CACHE); + + assertTrue("testproduct|pbundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("testproduct|pbundle1/[1.0.0,2.0.0)")); + + // Finally check that removing the feature will also uninstall the feature. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + assertTrue("pfeatureA-1.0 was not uninstalled and should have been: " + output, output.contains("pfeatureA-1.0")); + + // Now check that bundles of the features are gone. + bundleCacheProperties = getCacheProperties(FEATURE_BUNDLE_CACHE); + + assertFalse("testproduct|pbundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("testproduct|pbundle1/[1.0.0,2.0.0)")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This method loads the feature.cache file as properties. + * + * @param cacheFile - The cache file to read. + * @return - A properties object containing the properties from the feature.cache file. + * @throws Exception + */ + private Properties getCacheProperties(String cacheFile) throws Exception { + Properties cacheProps = new Properties(); + InputStream cacheStream = null; + try { + cacheStream = server.getFileFromLibertyServerRoot(cacheFile).openForReading(); + cacheProps.load(cacheStream); + } finally { + if (cacheStream != null) + cacheStream.close(); + } + + return cacheProps; + } + + /** + * TestDescription: + * This test ensures that a product feature can be packaged with minify. + * Including type=file content. + * + * @throws Exception + */ + @Test + public void testProductFeatureMinifiable() throws Exception { + final String METHOD_NAME = "testProductFeatureMinifiable"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_FEATURE_PRODTEST_MF); + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, PRODUCT_FEATURE_PRODTEST_JAR); + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + + //add some the "test.bat" type=file content to the product extension's "bin" directory + //bin is a peer of lib similar to the wlp.install.dir + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH + "../bin", "test.bat"); + + // Ensure we use a server xml with the testproduct feature product extension available + server.setServerConfigurationFile("product_ext_for_minify.xml"); + + //we want to validate that the content related to our product extension got packaged + List names = Arrays.asList(new String[] { "wlp/producttest/bin/test.bat", + "wlp/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar", + "wlp/producttest/lib/features/prodtest-1.0.mf", + "wlp/etc/extensions/testproduct.properties" }); + List namesToValidate = new ArrayList(names.size()); + namesToValidate.addAll(names); + + //minify the server + MinifiedServerTestUtils minifyUtils = new MinifiedServerTestUtils(); + try { + //set up to minify + minifyUtils.setup(this.getClass().getName(), + "com.ibm.ws.kernel.feature.fat.product", + server); + //actually minify + RemoteFile serverPackage = minifyUtils.minifyServer(); + if (serverPackage != null) { + ZipInputStream minifiedServerZip = null; + try { + minifiedServerZip = new ZipInputStream(serverPackage.openForReading()); + + ZipEntry entry; + while ((entry = minifiedServerZip.getNextEntry()) != null) { + if (namesToValidate.remove(entry.getName())) + Log.info(c, METHOD_NAME, "Found match in minified archive for: " + entry.getName()); + } + } finally { + //close stream + if (minifiedServerZip != null) + minifiedServerZip.close(); + } + for (String name : namesToValidate) { + fail("The minified package did not contain the product extension file: " + name); + } + } else { + //if the server package was null we are on z/os + Log.info(c, METHOD_NAME, "Tests for minify are not active currently on zOS"); + } + + } finally { + //be sure to clean up + minifyUtils.tearDown(); + } + Log.exiting(c, METHOD_NAME); + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SPIIsolationTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SPIIsolationTest.java new file mode 100755 index 000000000000..97d22e78f5a4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SPIIsolationTest.java @@ -0,0 +1,218 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This test uses the "usr" user feature space as the alternative product. Each product and the user + * features have their own isolation space. The test comprises 8 bundles and 4 features. The bundles + * are checked in as binaries because the test-bundles infrastructure did not provide any method of + * dependency ordering the build of the bundles and the contents are trivial (marker interfaces and activators + * that print a single line message to system out). + * + */ +public class SPIIsolationTest { + + private final static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.isolation"); + + private final long timeout = 30000; + + @BeforeClass + public static void setup() throws Exception { + + // BVT/UT build prep and FAT fight with each other + // Make sure that a BVT step did not put these where they don't belong. + server.uninstallFeature("isolation.Product.Test.Feature.Negative-1.0"); + server.uninstallFeature("isolation.Product.Test.Feature-1.0"); + server.uninstallFeature("isolation.KernelSPI.Test.Feature-1.0"); + server.uninstallBundle("test.feature.isolation.U4_1.0.0"); + server.uninstallBundle("test.feature.isolation.U5_1.0.0"); + server.uninstallBundle("test.feature.isolation.U6_1.0.0"); + server.uninstallBundle("test.feature.isolation.U7_1.0.0"); + server.uninstallBundle("test.feature.isolation.K1_1.0.0"); + + //copy the isolation test runtime feature into the server features location + server.copyFileToLibertyInstallRoot("lib/features", "isolation.Runtime.Test.Feature-1.0.mf"); + //copy the isolation test runtime bundles into the server lib location + server.copyFileToLibertyInstallRoot("lib", "bundles/test.feature.isolation.L1_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "bundles/test.feature.isolation.L2_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "bundles/test.feature.isolation.L3_1.0.0.jar"); + + //copy the negative runtime feature and bundle + server.copyFileToLibertyInstallRoot("lib/features", "isolation.Runtime.Test.Feature.Negative-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib", "bundles/test.feature.isolation.L8_1.0.0.jar"); + + //install the user (different product isolation space) feature and bundles + server.installUserFeature("isolation.Product.Test.Feature-1.0"); + server.installUserBundle("test.feature.isolation.U4_1.0.0"); + server.installUserBundle("test.feature.isolation.U5_1.0.0"); + server.installUserBundle("test.feature.isolation.U6_1.0.0"); + + //install the negative user feature and bundles + server.installUserFeature("isolation.Product.Test.Feature.Negative-1.0"); + server.installUserBundle("test.feature.isolation.U7_1.0.0"); + + //install the kernel SPI user feature and bundle + server.installUserFeature("isolation.KernelSPI.Test.Feature-1.0"); + server.installUserBundle("test.feature.isolation.K1_1.0.0"); + + server.setServerConfigurationFile("isolation.server.xml"); + + //all features and bundles in place, start the server + server.startServer("SPIIsolationTest.log"); + } + + @AfterClass + public static void shutdown() throws Exception { + server.stopServer(); + + //copy the isolation test runtime feature into the server features location + server.deleteFileFromLibertyInstallRoot("lib/features/isolation.Runtime.Test.Feature-1.0.mf"); + //copy the isolation test runtime bundles into the server lib location + server.deleteFileFromLibertyInstallRoot("lib/bundles/test.feature.isolation.L1_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/bundles/test.feature.isolation.L2_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/bundles/test.feature.isolation.L3_1.0.0.jar"); + + //copy the negative runtime feature and bundle + server.deleteFileFromLibertyInstallRoot("lib/features/isolation.Runtime.Test.Feature.Negative-1.0.mf"); + server.deleteFileFromLibertyInstallRoot("lib/bundles/test.feature.isolation.L8_1.0.0.jar"); + + //install the user (different product isolation space) feature and bundles + server.uninstallUserFeature("isolation.Product.Test.Feature-1.0"); + server.uninstallUserBundle("test.feature.isolation.U4_1.0.0"); + server.uninstallUserBundle("test.feature.isolation.U5_1.0.0"); + server.uninstallUserBundle("test.feature.isolation.U6_1.0.0"); + + //install the negative user feature and bundles + server.uninstallUserFeature("isolation.Product.Test.Feature.Negative-1.0"); + server.uninstallUserBundle("test.feature.isolation.U7_1.0.0"); + + //install the kernel SPI user feature and bundle + server.uninstallUserFeature("isolation.KernelSPI.Test.Feature-1.0"); + server.uninstallUserBundle("test.feature.isolation.K1_1.0.0"); + + } + + /** + * Verify that the bundle L2 started. + * It uses package p1b from bundle L1 so verifies that + * a non-SPI package is allowed between runtime features. + * + * @throws Exception + */ + @Test + public void testPackageAllowedBetweenRuntimeFeatures() throws Exception { + assertFalse(server.findStringsInLogs("Isolation test: P2").isEmpty()); + } + + /** + * Verify that the bundle L3 started. + * It uses package p4a from bundle U4 so verifies that + * a "stack product" SPI package is in a runtime feature + * + * @throws Exception + */ + @Test + public void testProductFeatureSPIAllowedInRuntime() throws Exception { + assertFalse(server.findStringsInLogs("Isolation test: P3").isEmpty()); + } + + /** + * Verify that the bundle U5 started. + * It uses package p4b from bundle U4 so verifies that + * a non-SPI package can be used within a "stack product" + * + * @throws Exception + */ + @Test + public void testPackageAllowedBetweenSameProductFeatures() throws Exception { + assertFalse(server.findStringsInLogs("Isolation test: P5").isEmpty()); + } + + /** + * Verify that the bundle L8 did not start + * It uses package p4b from bundle U4 so verifies that a + * non-SPI package is restricted between a "stack product" + * and a runtime feature + */ + @Test + public void testNonSPIPackageRefusedProductExportRuntimeImport() throws Exception { + try { + //enable the feature with bundle L8 + TestUtils.makeConfigUpdateSetMark(server, "isolationUtoL.server.xml"); + + //expect L8 resolve failure + assertNotNull(server.waitForStringInLogUsingMark("CWWKF0029E.*test.feature.isolation.L8", timeout)); + assertNotNull(server.waitForStringInLogUsingMark(".*Unresolved requirement: Import-Package: test.feature.isolation.p4b", timeout)); + } finally { + //revert to the original xml + TestUtils.makeConfigUpdateSetMark(server, "isolation.server.xml"); + } + } + + /** + * Verify that the bundle U7 did not start + * It uses package p1b from bundle L1 so verifies that a + * non-SPI package is restricted between the runtime and + * a "stack product" feature + */ + @Test + public void testNonSPIPackageRefusedRuntimeExportProductImport() throws Exception { + try { + //enable the feature with bundle U7 + TestUtils.makeConfigUpdateSetMark(server, "isolationLtoU.server.xml"); + + //expect U7 resolve failure + assertNotNull(server.waitForStringInLogUsingMark("CWWKF0029E.*test.feature.isolation.U7", timeout)); + assertNotNull(server.waitForStringInLogUsingMark(".*Unresolved requirement: Import-Package: test.feature.isolation.p1b", timeout)); + } finally { + //revert to the original xml + TestUtils.makeConfigUpdateSetMark(server, "isolation.server.xml"); + } + } + + /** + * Verify that the bundle U6 started. + * It uses package p1a from bundle L1 so verifies that + * a "stack product" can use a runtime SPI package + */ + @Test + public void testSPIAllowedBetweenProducts() throws Exception { + assertFalse(server.findStringsInLogs("Isolation test: P6").isEmpty()); + } + + /** + * Checks whether some SPIs provided by the kernel are available to + * a user feature. + */ + @Test + public void testKernelProvidedSPI() throws Exception { + try { + TestUtils.makeConfigUpdateSetMark(server, "isolationKtoU.server.xml"); + + //wait for the message from the kernel bundle + assertNotNull(server.waitForStringInLogUsingMark("Isolation test: K1", timeout)); + } finally { + //revert to the original xml + TestUtils.makeConfigUpdateSetMark(server, "isolation.server.xml"); + } + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SimpleFeatureUpdateTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SimpleFeatureUpdateTest.java new file mode 100755 index 000000000000..c556ab392991 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SimpleFeatureUpdateTest.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import org.junit.Test; + +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class SimpleFeatureUpdateTest { + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.simple"); + + @Test + public void testFeatureRemoval() throws Exception { + // Start the server with a set of features installed, stop the server, remove a feature, start the server. + + server.startServer(); + + server.stopServer(); + + ServerConfiguration config = server.getServerConfiguration(); + + config.getFeatureManager().getFeatures().remove("osgiConsole-1.0"); + + server.updateServerConfiguration(config); + + server.startServer(false); + + server.stopServer(""); + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SimpleMinifiedServerTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SimpleMinifiedServerTest.java new file mode 100755 index 000000000000..93e784ef0d93 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SimpleMinifiedServerTest.java @@ -0,0 +1,46 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import java.net.URL; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class SimpleMinifiedServerTest { + + static MinifiedServerTestUtils minifyUtils = new MinifiedServerTestUtils(); + + @BeforeClass + public static void setup() throws Exception { + minifyUtils.setupAndStartMinifiedServer(SimpleMinifiedServerTest.class.getName(), + "com.ibm.ws.kernel.feature.fat.minify", + LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.minify")); + } + + @AfterClass + public static void tearDown() throws Exception { + minifyUtils.tearDown(); + } + + @Test + public void testStaticContentForDefaultServer() throws Exception { + //a simple test, gets the static file, looks for the eyecatcher & pass lines. + minifyUtils.testViaHttpGet(new URL(minifyUtils.staticUrlPrefix + "/test.txt")); + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SystemBundleOverrideTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SystemBundleOverrideTest.java new file mode 100755 index 000000000000..04e9d2c332f3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/SystemBundleOverrideTest.java @@ -0,0 +1,205 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertNotNull; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class SystemBundleOverrideTest { + + private final static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.override"); + private final String bundleActivatorEyecatcher = "override.systemFeature.requiresJavaxRMI.Activator.start: javax.rmi.PortableRemoteObject loaded from"; + + private final long timeout = 30000; + + private static final Class TEST_CLASS = SystemBundleOverrideTest.class; + + private static final String SYS_FEATURES_SUBDIR = "lib/features/"; + private static final String USR_FEATURES_SUBDIR = "usr/extension/lib/features/"; + + @Before + public void setup() throws Exception { + Log.entering(TEST_CLASS, "setup"); + + // Scrub test feature manifests from all possible install root subdirectories + if (server.isStarted()) { + server.stopServer(); + } + if (server.fileExistsInLibertyInstallRoot(SYS_FEATURES_SUBDIR + "override.systemFeature.requiresJavaxRMI.mf")) { + server.deleteFileFromLibertyInstallRoot(SYS_FEATURES_SUBDIR + "override.systemFeature.requiresJavaxRMI.mf"); + } + if (server.fileExistsInLibertyInstallRoot(SYS_FEATURES_SUBDIR + "override.systemFeature.providesJavaxRMI.mf")) { + server.deleteFileFromLibertyInstallRoot(SYS_FEATURES_SUBDIR + "override.systemFeature.providesJavaxRMI.mf"); + } + if (server.fileExistsInLibertyInstallRoot(SYS_FEATURES_SUBDIR + "override.userFeature.providesJavaxRMI.mf")) { + server.deleteFileFromLibertyInstallRoot(SYS_FEATURES_SUBDIR + "override.userFeature.providesJavaxRMI.mf"); + } + if (server.fileExistsInLibertyInstallRoot(USR_FEATURES_SUBDIR + "override.systemFeature.requiresJavaxRMI.mf")) { + server.deleteFileFromLibertyInstallRoot(USR_FEATURES_SUBDIR + "override.systemFeature.requiresJavaxRMI.mf"); + } + if (server.fileExistsInLibertyInstallRoot(USR_FEATURES_SUBDIR + "override.systemFeature.providesJavaxRMI.mf")) { + server.deleteFileFromLibertyInstallRoot(USR_FEATURES_SUBDIR + "override.systemFeature.providesJavaxRMI.mf"); + } + if (server.fileExistsInLibertyInstallRoot(USR_FEATURES_SUBDIR + "override.userFeature.providesJavaxRMI.mf")) { + server.deleteFileFromLibertyInstallRoot(USR_FEATURES_SUBDIR + "override.userFeature.providesJavaxRMI.mf"); + } + + // Install test features + server.installSystemFeature("override.systemFeature.requiresJavaxRMI"); + server.installSystemBundle("override.systemFeature.requiresJavaxRMI_1.0.0"); + + server.installSystemFeature("override.systemFeature.providesJavaxRMI"); + server.installSystemBundle("override.systemFeature.providesJavaxRMI_1.0.0"); + + server.installUserFeature("override.userFeature.providesJavaxRMI"); + server.installUserBundle("override.userFeature.providesJavaxRMI_1.0.0"); + + server.setServerConfigurationFile("override.server.xml"); + + // All features and bundles in place, start the server + server.startServer("SystemBundleOverrideTest.log"); + + Log.exiting(TEST_CLASS, "setup"); + } + + @After + public void teardown() throws Exception { + Log.entering(TEST_CLASS, "teardown"); + + server.stopServer(); + + server.uninstallSystemFeature("override.systemFeature.requiresJavaxRMI"); + server.uninstallSystemBundle("override.systemFeature.requiresJavaxRMI_1.0.0"); + + server.uninstallSystemFeature("override.systemFeature.providesJavaxRMI"); + server.uninstallSystemBundle("override.systemFeature.providesJavaxRMI_1.0.0"); + + server.uninstallUserFeature("override.userFeature.providesJavaxRMI"); + server.uninstallUserBundle("override.userFeature.providesJavaxRMI_1.0.0"); + + Log.exiting(TEST_CLASS, "teardown"); + } + + /** + * + * @throws Exception + */ + @Test + public void testSystemBundlePackagesOverrides() throws Exception { + Log.entering(TEST_CLASS, "testSystemBundlePackagesOverrides"); + + try { + // The override.systemFeature.requiresJavaxRMI_1.0.0 Bundle activator start method looks like this: + + // Class clazz = PortableRemoteObject.class; + // URL location = clazz.getResource('/' + clazz.getName().replace('.', '/') + ".class"); + // System.out.println("override.systemFeature.requiresJavaxRMI.Activator.start: javax.rmi.PortableRemoteObject loaded from: " + location.getPath()); + + // This will give the URL to the location where the PortableRemoteObject.class was loaded from. I felt it was a better test + // to avoid using osgi/equinox interfaces to verify where the class was loading from + + // Case 1 + // A system feature requires javax.rmi, which is provided by base java. + // Check activator message to make sure it was loaded from the rt.jar + TestUtils.makeConfigUpdateSetMark(server, "override.case1.server.xml"); + assertNotNull(server.waitForStringInLogUsingMark(bundleActivatorEyecatcher + ".*rt.jar.*", timeout)); + + // Case 2 + // A system feature requires javax.rmi, which is now provided from a newly installed system feature + // Check activator message to make sure it was loaded from a bundleresource and not rt.jar + TestUtils.makeConfigUpdateSetMark(server, "override.case2.server.xml"); + assertNotNull(server.waitForStringInLogUsingMark(bundleActivatorEyecatcher + ".*bundleresource.*", timeout)); + + // Case 3 + // A system feature requires javax.rmi, but the new system feature added in case 2 is removed, so + // it is again provide by base java. + // Check activator message to make sure it was loaded from rt.jar once again + TestUtils.makeConfigUpdateSetMark(server, "override.case1.server.xml"); + assertNotNull(server.waitForStringInLogUsingMark(bundleActivatorEyecatcher + ".*rt.jar.*", timeout)); + + // Case 4 + // Switch back to Case 2 such that on the following case, the bundle will refresh and reactivate and + // display the activator eyecatcher again. + TestUtils.makeConfigUpdateSetMark(server, "override.case2.server.xml"); + assertNotNull(server.waitForStringInLogUsingMark(bundleActivatorEyecatcher + ".*bundleresource.*", timeout)); + + // Case 5 + // A system feature requires javax.rmi, which is provided by base java. + // A user feature is installed that exports/provides javax.rmi, however, this should not + // override the system bundle export. We don't want user features to be able to override + // system packages and alter the behavior of the core Liberty features + TestUtils.makeConfigUpdateSetMark(server, "override.case3.server.xml"); + assertNotNull(server.waitForStringInLogUsingMark(bundleActivatorEyecatcher + ".*rt.jar.*", timeout)); + } catch (Exception e) { + Log.error(TEST_CLASS, "testSystemBundlePackagesOverrides", e); + throw e; + } finally { + // Revert to the original xml + TestUtils.makeConfigUpdateSetMark(server, "override.server.xml"); + } + + Log.exiting(TEST_CLASS, "testSystemBundlePackagesOverrides"); + } + + /** + * + * @throws Exception + */ + @Test + public void testSystemBundlePackagesOverridesWarmStarts() throws Exception { + Log.entering(TEST_CLASS, "testSystemBundlePackagesOverridesWarmStarts"); + + try { + // The override.systemFeature.requiresJavaxRMI_1.0.0 Bundle activator start method looks like this: + + // Class clazz = PortableRemoteObject.class; + // URL location = clazz.getResource('/' + clazz.getName().replace('.', '/') + ".class"); + // System.out.println("override.systemFeature.requiresJavaxRMI.Activator.start: javax.rmi.PortableRemoteObject loaded from: " + location.getPath()); + + // This will give the URL to the location where the PortableRemoteObject.class was loaded from. I felt it was a better test + // to avoid using osgi/equinox interfaces to verify where the class was loading from + + // Case 1 + // A system feature requires javax.rmi, which is provided by base java. + // Check activator message to make sure it was loaded from the rt.jar + TestUtils.makeConfigUpdateSetMark(server, "override.case1.server.xml"); + assertNotNull(server.waitForStringInLogUsingMark(bundleActivatorEyecatcher + ".*rt.jar.*", timeout)); + + // Case 2 + // A system feature requires javax.rmi, which is now provided from a newly installed system feature + // Check activator message to make sure it was loaded from a bundleresource and not rt.jar + TestUtils.makeConfigUpdateSetMark(server, "override.case2.server.xml"); + assertNotNull(server.waitForStringInLogUsingMark(bundleActivatorEyecatcher + ".*bundleresource.*", timeout)); + + // Case 3 + // Make sure that Case 2 still works on a warm start and that no exceptions occur + server.stopServer(); + server.startServer("SystemOverrideTest2.log"); + assertNotNull(server.waitForStringInLogUsingMark(bundleActivatorEyecatcher + ".*bundleresource.*", timeout)); + } catch (Exception e) { + Log.error(TEST_CLASS, "testSystemBundlePackagesOverridesWarmStarts", e); + throw e; + } finally { + // Revert to the original xml + TestUtils.makeConfigUpdateSetMark(server, "override.server.xml"); + } + + Log.exiting(TEST_CLASS, "testSystemBundlePackagesOverridesWarmStarts"); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/TestUtils.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/TestUtils.java new file mode 100755 index 000000000000..2b550aa507c5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/TestUtils.java @@ -0,0 +1,114 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import java.io.BufferedReader; +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Properties; + +import org.junit.Assert; + +import componenttest.topology.impl.LibertyServer; + +/** + * + */ +public class TestUtils { + + /** + * This method loads the feature.cache file as properties. + * + * @param server TODO + * @param cacheFile - The cache file to read. + * + * @return - A properties object containing the properties from the feature.cache file. + * @throws Exception + */ + public static Properties getCacheProperties(LibertyServer server, String cacheFile) throws Exception { + Properties cacheProps = new Properties(); + InputStream cacheStream = null; + try { + cacheStream = server.getFileFromLibertyServerRoot(cacheFile).openForReading(); + cacheProps.load(new BufferedReader(new InputStreamReader(cacheStream, "UTF-8"))); + + // Race with the server replacing this file + if (cacheProps.isEmpty()) { + Thread.currentThread().sleep(1000); + cacheStream = server.getFileFromLibertyServerRoot(cacheFile).openForReading(); + cacheProps.load(new BufferedReader(new InputStreamReader(cacheStream, "UTF-8"))); + } + + Assert.assertFalse("feature.bundle.cache should not be empty unless there was a race reading it", cacheProps.isEmpty()); + } finally { + tryToClose(cacheStream); + } + + return cacheProps; + } + + /** + * This method finds the installed features from the cache file. + * Note this is sleazy and evil and not something that is in general good practice, + * as the cache file contents should be able to change at any time. + * + * @param cacheFile - The cache file to read. + * @return The installed features list as a string + * @throws Exception + */ + public static String getInstalledFeatures(LibertyServer server, String cacheFile) throws Exception { + InputStream cacheStream = null; + BufferedReader reader = null; + String installedFeatures = null; + String line = null; + try { + cacheStream = server.getFileFromLibertyServerRoot(cacheFile).openForReading(); + reader = new BufferedReader(new InputStreamReader(cacheStream, "UTF-8")); + while ((line = reader.readLine()) != null) { + if (line.startsWith("@=")) { + installedFeatures = line.substring(2); + break; + } + } + } finally { + tryToClose(reader); + tryToClose(cacheStream); + } + + return installedFeatures; + } + + public static void tryToClose(Closeable c) { + if (c != null) { + try { + c.close(); + } catch (IOException ioe) { + } + } + } + + public static void makeConfigUpdateSetMark(LibertyServer server, String newServerXml) throws Exception { + // set a new mark + server.setMarkToEndOfLog(server.getDefaultLogFile()); + + // make the configuration update + server.setServerConfigurationFile(newServerXml); + + // wait for configuration and feature update to complete + // these two messages can happen in any order! + server.waitForStringInLogUsingMark("CWWKG0017I"); + server.waitForStringInLogUsingMark("CWWKF0008I"); + } + +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/UserFeatureTest.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/UserFeatureTest.java new file mode 100755 index 000000000000..3129a23b5f79 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/fat/UserFeatureTest.java @@ -0,0 +1,424 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.Properties; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.AllowedFFDC; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +@Mode(TestMode.FULL) +public class UserFeatureTest { + + private static final Class c = UserFeatureTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.user"); + + private static final String USER_FEATURE_USERTEST_MF = "usertest.mf"; + private static final String USER_FEATURE_PRIVATE_MF = "usertestprivate-1.0.mf"; + + private static final String USER_FEATURE_USERTEST_JAR = "usertest_1.0.0.jar"; + + private static final String installFeatureMsgPrefix = "CWWKF0012I:"; + private static final String uninstallFeatureMsgPrefix = "CWWKF0013I:"; + private static final String notFoundFeatureMsgPrefix = "CWWKF0001E"; + private static final String notPublicFeatureMsgPrefix = "CWWKF0021E:"; + + private static final String USER_FEATURE_PATH = "usr/extension/lib/features/"; + private static final String USER_BUNDLE_PATH = "usr/extension/lib/"; + + private static final String CACHE_DIRECTORY = "workarea/platform/"; + private static final String FEATURE_BUNDLE_CACHE = CACHE_DIRECTORY + "feature.bundles.cache"; + + /** + * Copy the necessary features and bundles to the liberty server directories + * + * @throws Exception + */ + @BeforeClass + public static void setup() throws Exception { + final String METHOD_NAME = "classSetUp"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot(USER_FEATURE_PATH, USER_FEATURE_USERTEST_MF); + server.copyFileToLibertyInstallRoot(USER_FEATURE_PATH, USER_FEATURE_PRIVATE_MF); + + server.copyFileToLibertyInstallRoot(USER_FEATURE_PATH, "featureVv-1.0.mf"); + + server.copyFileToLibertyInstallRoot(USER_BUNDLE_PATH, USER_FEATURE_USERTEST_JAR); + server.copyFileToLibertyInstallRoot(USER_BUNDLE_PATH, "bundlev_1.0.0.jar"); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This method removes all the testing artifacts from the server directories. + * + * @throws Exception + */ + @AfterClass + public static void cleanup() throws Exception { + final String METHOD_NAME = "classTearDown"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) + server.stopServer(); + + server.deleteFileFromLibertyInstallRoot("lib/features/featureWw-1.0.mf"); + + server.deleteFileFromLibertyInstallRoot(USER_FEATURE_PATH + USER_FEATURE_USERTEST_MF); + server.deleteFileFromLibertyInstallRoot(USER_FEATURE_PATH + USER_FEATURE_PRIVATE_MF); + server.deleteFileFromLibertyInstallRoot(USER_FEATURE_PATH + "ufeature1-1.0.mf"); + server.deleteFileFromLibertyInstallRoot(USER_FEATURE_PATH + "ufeatureA-1.0.mf"); + server.deleteFileFromLibertyInstallRoot(USER_FEATURE_PATH + "featureVv-1.0.mf"); + server.deleteFileFromLibertyInstallRoot(USER_FEATURE_PATH + "featureWw-1.0.mf"); + + server.deleteFileFromLibertyInstallRoot(USER_BUNDLE_PATH + USER_FEATURE_USERTEST_JAR); + server.deleteFileFromLibertyInstallRoot(USER_BUNDLE_PATH + "ubundle1_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot(USER_BUNDLE_PATH + "bundlev_1.0.0.jar"); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This method removes all the testing artifacts from the server directories. + * + * @throws Exception + */ + @After + public void stopServer() throws Exception { + final String METHOD_NAME = "stopServer"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a user feature is installed when added to server.xml. + * + * @throws Exception + */ + @Mode(TestMode.LITE) + @Test + public void testUserFeatureInstalled() throws Exception { + final String METHOD_NAME = "testUserFeatureInstalled"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a user feature available + TestUtils.makeConfigUpdateSetMark(server, "server_user_features.xml"); + // Get the install feature message for the added user feature. + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("usertest user feature was not installed and should have been: " + output, output.contains("usertest")); + + // Finally check that removing the user feature from server.xml will uninstall it. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("user feature usertest was not uninstalled and should have been: " + output, output.contains("usertest")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a message comes out indicating that a non public feature is specified in server.xml. + * + * @throws Exception + */ + @Test + public void testPrivateUserFeatureInServerXml() throws Exception { + final String METHOD_NAME = "testPrivateUserFeatureInServerXml"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) + server.stopServer(); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a user feature available + TestUtils.makeConfigUpdateSetMark(server, "server_user_private_feature.xml"); + // Get the not public feature message for the added user feature. + String output = server.waitForStringInLogUsingMark(notPublicFeatureMsgPrefix); + assertNotNull("We haven't found the " + notPublicFeatureMsgPrefix + " in the logs.", output); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a user feature is installed when added to server.xml. + * + * @throws Exception + */ + @Test + public void testUserFeatureInstalledAtStartup() throws Exception { + final String METHOD_NAME = "testUserFeatureInstalledAtStartup"; + + Log.entering(c, METHOD_NAME); + + // Start with features installed. + server.setServerConfigurationFile("server_user_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Check that user feature was there by uninstalling it. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + String output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("user feature usertest was not uninstalled and should have been: " + output, output.contains("usertest")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test tests with a user feature that does not have a .mf file. + * + * @throws Exception + */ + @Test + @AllowedFFDC("java.io.FileNotFoundException") + public void testUserFeatureNotFound() throws Exception { + final String METHOD_NAME = "testUserFeatureNotFound"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with a user feature that will not be found. + TestUtils.makeConfigUpdateSetMark(server, "server_user_features_not_found.xml"); + // Get the feature definition could not be found message. + String output = server.waitForStringInLogUsingMark(notFoundFeatureMsgPrefix); + assertNotNull("We haven't found the " + notFoundFeatureMsgPrefix + " in the logs.", output); + + assertTrue("usr:usertestnotfound user feature was installed and should have been: " + output, output.contains("usr:usertestnotfound")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a .mf file added to usr/extension/lib/features after the server is + * up and running will be found and installed when the feature is specified in server.xml. + * The test ensures that this happens during server update. + * + * The feature structure is as follows: + * + * ufeatureA is defined in ufeatureA.mf by IBM-ShortName: ufeatureA-1.0 + * + * @throws Exception + */ + @Test + public void testUsrFeatureManifestFileAddedAfterServerIsAlreadyUp() throws Exception { + final String METHOD_NAME = "testUsrFeatureManifestFileAddedAfterServerIsAlreadyUp"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + server.deleteFileFromLibertyInstallRoot(USER_FEATURE_PATH + "ufeatureA-1.0.mf"); + server.startServer(METHOD_NAME + ".log"); + + // copy mf file and bundle jar + server.copyFileToLibertyInstallRoot(USER_FEATURE_PATH, "ufeatureA-1.0.mf"); + server.copyFileToLibertyInstallRoot(USER_BUNDLE_PATH, "ubundle1_1.0.0.jar"); + + // Now move the server xml with ufeatureA + TestUtils.makeConfigUpdateSetMark(server, "server_user_featureA.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("ufeatureA-1.0 was not installed and should have been: " + output, output.contains("ufeatureA-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("usr|ubundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + + // Finally check that removing the feature will also uninstall the feature. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("ufeatureA-1.0 was not uninstalled and should have been: " + output, output.contains("ufeatureA-1.0")); + + // Now check that bundles of the features are gone. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("usr|ubundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, + bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that the features + * listed under Subsystem-Content of a user feature + * are not installed because it's manifest file + * does not exist. + * The test ensures that this happens during server update. + * + * expected messages + * CWWKF0001E: A feature definition could not be found for com.ibm.websphere.appserver.featureW-1.0 + * CWWKF0012I: The server installed the following features: [usr:featureV-1.0]. + * + * The feature structure is as follows: + * + * featureV is a user feature, featureW is a normal feature. + * + * featureV is defined in featureVv.mf by IBM-ShortName: featureV-1.0 + * featureW is defined in featureWw.mf by IBM-ShortName: featureW-1.0 + * + * featureV is a feature that has featureW listed under Subsystem-Content. + * featureW is a feature that has no other features listed under Subsystem-Content. + * + * @throws Exception + */ + @Test + @AllowedFFDC("java.io.FileNotFoundException") + public void testUsrSubsystemContentFeatureManifestFileNotAddedAfterServerIsAlreadyUp() throws Exception { + final String METHOD_NAME = "testUsrSubsystemContentFeatureManifestFileNotAddedAfterServerIsAlreadyUp"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + // ensure dependent feature manifest is not there when the server starts + server.deleteFileFromLibertyInstallRoot("usr/extension/lib/features/featureWw-1.0.mf"); + server.deleteFileFromLibertyInstallRoot("lib/features/featureWw-1.0.mf"); + server.startServer(METHOD_NAME + ".log"); + + // Now move the server xml with the first set of features available + TestUtils.makeConfigUpdateSetMark(server, "server_user_featureV.xml"); + + String output = server.waitForStringInLogUsingMark(notFoundFeatureMsgPrefix); + assertNotNull("We haven't found the " + notFoundFeatureMsgPrefix + " in the logs.", output); + assertTrue("featureW-1.0 was installed and should not have been: " + output, output.contains("featureW-1.0")); + + // Get the install feature message for the initial set up of updated features + output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("usr:featureV-1.0 was not installed and should have been: " + output, output.contains("usr:featureV-1.0")); + assertFalse("featureW-1.0 was installed and should not have been: " + output, output.contains("featureW-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("usr|bundlev/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|bundlev/[1.0.0,2.0.0)")); + assertFalse("bundlew/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlew/[1.0.0,2.0.0)")); + + // Finally check that removing the feature will also uninstall the dependant features. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("usr:featureV-1.0 was not uninstalled and should have been: " + output, output.contains("usr:featureV-1.0")); + assertFalse("featureW-1.0 was uninstalled and should not have been: " + output, output.contains("featureW-1.0")); + + // Now check that bundles of the features are gone. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("usr|bundlev/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|bundlev/[1.0.0,2.0.0)")); + assertFalse("bundlew/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("bundlew/[1.0.0,2.0.0)")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a feature manifest file ending in .MF ie. uppercase, + * will be found and installed when the feature is specified in server.xml. + * The test ensures that this happens during server update. + * + * The feature structure is as follows: + * + * ufeature1 is defined in ufeature1.MF by IBM-ShortName: ufeature1-1.0 + * + * @throws Exception + */ + @Test + public void testUsrFeatureManifestFileExtensionUpperCase() throws Exception { + final String METHOD_NAME = "testUsrFeatureManifestFileExtensionUpperCase"; + + Log.entering(c, METHOD_NAME); + + // Start with no features being installed. + server.setServerConfigurationFile("server_no_features.xml"); + // copy mf file and bundle jar + server.copyFileToLibertyInstallRoot(USER_FEATURE_PATH, "ufeature1-1.0.MF"); + server.copyFileToLibertyInstallRoot(USER_BUNDLE_PATH, "ubundle1_1.0.0.jar"); + + server.startServer(METHOD_NAME + ".log"); + // Now move the server xml with ufeature1 + TestUtils.makeConfigUpdateSetMark(server, "server_user_feature1.xml"); + // Get the install feature message for the initial set up of updated features + String output = server.waitForStringInLogUsingMark(installFeatureMsgPrefix); + assertNotNull("We haven't found the " + installFeatureMsgPrefix + " in the logs.", output); + + assertTrue("ufeature1-1.0 was not installed and should have been: " + output, output.contains("ufeature1-1.0")); + + // Now check that we have the expected bundles installed. + Properties bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertTrue("usr|ubundle1/[1.0.0,2.0.0) was not installed and should have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + + // Finally check that removing the feature will also uninstall the feature. + TestUtils.makeConfigUpdateSetMark(server, "server_no_features.xml"); + output = server.waitForStringInLogUsingMark(uninstallFeatureMsgPrefix); + assertNotNull("We haven't found the " + uninstallFeatureMsgPrefix + " in the logs.", output); + + assertTrue("ufeature1-1.0 was not uninstalled and should have been: " + output, output.contains("ufeature1-1.0")); + + // Now check that bundles of the features are gone. + bundleCacheProperties = TestUtils.getCacheProperties(server, FEATURE_BUNDLE_CACHE); + + assertFalse("usr|ubundle1/[1.0.0,2.0.0) was installed and should not have been: " + bundleCacheProperties, bundleCacheProperties.containsKey("usr|ubundle1/[1.0.0,2.0.0)")); + + Log.exiting(c, METHOD_NAME); + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/test/api/ApiService.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/test/api/ApiService.java new file mode 100755 index 000000000000..9c46beba5a37 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/test/api/ApiService.java @@ -0,0 +1,19 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.test.api; + +/** + * + */ +public interface ApiService { + public String doTest(); +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/test/api/NotApiService.java b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/test/api/NotApiService.java new file mode 100755 index 000000000000..9e53f74da623 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/fat/src/com/ibm/ws/kernel/feature/test/api/NotApiService.java @@ -0,0 +1,19 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.test.api; + +/** + * + */ +public interface NotApiService { + public String doTest(); +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/.gitignore b/dev/com.ibm.ws.kernel.feature_fat/publish/.gitignore new file mode 100644 index 000000000000..187d3623f5f4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/.gitignore @@ -0,0 +1 @@ +/images diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/.gitignore b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/.gitignore new file mode 100644 index 000000000000..f790cb3d06a2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/.gitignore @@ -0,0 +1,4 @@ +/test.feature.api_1.0.0.jar +/test.feature.provisioner_1.0.0.jar +/test.service.consumer_1.0.0.jar +/test.service.provider_1.0.0.jar diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/override.systemFeature.providesJavaxRMI_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/override.systemFeature.providesJavaxRMI_1.0.0.jar new file mode 100755 index 000000000000..cd65216d2438 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/override.systemFeature.providesJavaxRMI_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/override.systemFeature.requiresJavaxRMI_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/override.systemFeature.requiresJavaxRMI_1.0.0.jar new file mode 100755 index 000000000000..0e9fc2b0b7bb Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/override.systemFeature.requiresJavaxRMI_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/override.userFeature.providesJavaxRMI_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/override.userFeature.providesJavaxRMI_1.0.0.jar new file mode 100755 index 000000000000..a91f5458d6ff Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/override.userFeature.providesJavaxRMI_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.K1_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.K1_1.0.0.jar new file mode 100755 index 000000000000..e565ef18460b Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.K1_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U4_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U4_1.0.0.jar new file mode 100755 index 000000000000..2a7dda7eb4ad Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U4_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U5_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U5_1.0.0.jar new file mode 100755 index 000000000000..8fcaae403b7f Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U5_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U6_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U6_1.0.0.jar new file mode 100755 index 000000000000..2e1cb369989e Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U6_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U7_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U7_1.0.0.jar new file mode 100755 index 000000000000..13a376b15936 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/bundles/test.feature.isolation.U7_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/extension/lib/features/usertest.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/extension/lib/features/usertest.mf new file mode 100755 index 000000000000..e268d0c86e3d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/extension/lib/features/usertest.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: usertest;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: usertest; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/extension/lib/usertest_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/extension/lib/usertest_1.0.0.jar new file mode 100755 index 000000000000..53c5fe91b83f Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/extension/lib/usertest_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/.gitignore b/dev/com.ibm.ws.kernel.feature_fat/publish/features/.gitignore new file mode 100644 index 000000000000..976f91e81d4d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/.gitignore @@ -0,0 +1 @@ +/dhe_repo diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/auto-A10B10-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/auto-A10B10-1.0.mf new file mode 100755 index 000000000000..7c5532f8a91b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/auto-A10B10-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: auto-A10B10-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.auto-A10B10-1.0; visibility:=private +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle4; version="[1,1.1)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.capabilityA-1.0))", osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.capabilityB-1.0))" diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/auto-A11B11-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/auto-A11B11-1.0.mf new file mode 100755 index 000000000000..4dc2dc2a8bbc --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/auto-A11B11-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: auto-A10B10-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.auto-A11B11-1.0; visibility:=private +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle4; version="[1.0,1.1)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.capabilityA-1.1))", osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.capabilityB-1.1))" diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityA-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityA-1.0.mf new file mode 100755 index 000000000000..d3aba80b7538 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityA-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: capabilityA-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.capabilityA-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle1; version="[1,1.1)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityA-1.1.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityA-1.1.mf new file mode 100755 index 000000000000..e766c80f27be --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityA-1.1.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: capabilityA-1.1 +Subsystem-SymbolicName: com.ibm.websphere.appserver.capabilityA-1.1; visibility:=public; singleton:=true +Subsystem-Version: 1.1.0 +Subsystem-Content: bundle2; version="[1.0,1.1)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityA-2.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityA-2.0.mf new file mode 100755 index 000000000000..0ba6d667f7be --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityA-2.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: capabilityA-2.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.capabilityA-2.0; visibility:=public; singleton:=true +Subsystem-Version: 2.0.0 +Subsystem-Content: bundle3; version="[1.0,1.1)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityB-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityB-1.0.mf new file mode 100755 index 000000000000..714ed5527782 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityB-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: capabilityB-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.capabilityB-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle4; version="[1.0,1.1)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityB-1.1.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityB-1.1.mf new file mode 100755 index 000000000000..af4f3808c259 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityB-1.1.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: capabilityB-1.1 +Subsystem-SymbolicName: com.ibm.websphere.appserver.capabilityB-1.1; visibility:=public; singleton:=true +Subsystem-Version: 1.1.0 +Subsystem-Content: bundle5; version="[1.0,1.1)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityB-2.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityB-2.0.mf new file mode 100755 index 000000000000..f24b42b28454 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityB-2.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: capabilityB-2.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.capabilityB-2.0; visibility:=public; singleton:=true +Subsystem-Version: 2.0.0 +Subsystem-Content: bundle6; version="[1.0,1.1)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityC-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityC-1.0.mf new file mode 100755 index 000000000000..009d56e786fa --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityC-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: capabilityC-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.capabilityC-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.websphere.appserver.capabilityA-2.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityD-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityD-1.0.mf new file mode 100755 index 000000000000..2670b87e8eea --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/capabilityD-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: capabilityD-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.capabilityD-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.websphere.appserver.capabilityC-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/clientB-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/clientB-1.0.mf new file mode 100755 index 000000000000..b15b45194f54 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/clientB-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: clientB-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.clientB-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle1; version="[1.0,1.1)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 +IBM-Process-Types: client diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/comboA10B10-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/comboA10B10-1.0.mf new file mode 100755 index 000000000000..799bf07c6b70 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/comboA10B10-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: comboA10B10-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.comboA10B10-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle7; version="[1.0,1.1)", + com.ibm.websphere.appserver.capabilityA-1.0; ibm.tolerates:="1.1"; type="osgi.subsystem.feature", + com.ibm.websphere.appserver.capabilityB-1.0; ibm.tolerates:="1.1"; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/iFix1.lpmf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/iFix1.lpmf new file mode 100755 index 000000000000..1d881311a2a2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/iFix1.lpmf @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/iFix1.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/features/iFix1.xml new file mode 100755 index 000000000000..5e023fd87fdd --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/iFix1.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/isolation.KernelSPI.Test.Feature-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/isolation.KernelSPI.Test.Feature-1.0.mf new file mode 100755 index 000000000000..eb1330997a06 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/isolation.KernelSPI.Test.Feature-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: isolation.KernelSPI.Test.Feature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.feature.isolation.K1; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/isolation.Product.Test.Feature-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/isolation.Product.Test.Feature-1.0.mf new file mode 100755 index 000000000000..cad3c705aecc --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/isolation.Product.Test.Feature-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: isolation.Product.Test.Feature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.feature.isolation.U4; version="[1,1.0.100)", + test.feature.isolation.U5; version="[1,1.0.100)", + test.feature.isolation.U6; version="[1,1.0.100)" +IBM-Feature-Version: 2 +IBM-SPI-Package: test.feature.isolation.p4a diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/isolation.Product.Test.Feature.Negative-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/isolation.Product.Test.Feature.Negative-1.0.mf new file mode 100755 index 000000000000..88fb967f46f4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/isolation.Product.Test.Feature.Negative-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: isolation.Product.Test.Feature.Negative-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.feature.isolation.U7; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/override.systemFeature.providesJavaxRMI.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/override.systemFeature.providesJavaxRMI.mf new file mode 100755 index 000000000000..9218a4e9f38f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/override.systemFeature.providesJavaxRMI.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: override.systemFeature.providesJavaxRMI-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: override.systemFeature.providesJavaxRMI; version="[1,1.0.100)" +IBM-API-Package: javax.rmi; type="spec" +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/override.systemFeature.requiresJavaxRMI.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/override.systemFeature.requiresJavaxRMI.mf new file mode 100755 index 000000000000..a5ed4e837711 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/override.systemFeature.requiresJavaxRMI.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: override.systemFeature.requiresJavaxRMI-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: override.systemFeature.requiresJavaxRMI; version="[1,1.0.100)" +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/override.userFeature.providesJavaxRMI.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/override.userFeature.providesJavaxRMI.mf new file mode 100755 index 000000000000..f8acde00adcc --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/override.userFeature.providesJavaxRMI.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: override.userFeature.providesJavaxRMI-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: override.userFeature.providesJavaxRMI; version="[1,1.0.100)" +IBM-API-Package: javax.rmi; type="spec" +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/serverA-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/serverA-1.0.mf new file mode 100755 index 000000000000..2c76c7123d97 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/serverA-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: serverA-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.serverA-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle1; version="[1,1.1)", + com.ibm.websphere.appserver.clientB-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/test.feature.api-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/test.feature.api-1.0.mf new file mode 100755 index 000000000000..13efaf228100 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/test.feature.api-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: test.feature.api-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.feature.api.internal-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-API-Package: test.feature.api +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/test.feature.api.internal-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/test.feature.api.internal-1.0.mf new file mode 100755 index 000000000000..00a2f217513d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/test.feature.api.internal-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: test.feature.api.internal-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.feature.api; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/test.service.provider-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/features/test.service.provider-1.0.mf new file mode 100755 index 000000000000..d5bd9cc068e0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/features/test.service.provider-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: test.service.provider-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.service.provider +Subsystem-Type: osgi.subsystem.feature +IBM-API-Package:com.ibm.ws.kernel.feature.test.api +IBM-API-Service: com.ibm.ws.kernel.feature.test.api.ApiService +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.applies.to.current.source.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.applies.to.current.source.esa new file mode 100755 index 000000000000..308f18817f60 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.applies.to.current.source.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.applies.to.different.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.applies.to.different.esa new file mode 100755 index 000000000000..2939ee740722 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.applies.to.different.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.cyclic.1.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.cyclic.1.esa new file mode 100755 index 000000000000..4de2eff91542 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.cyclic.1.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.cyclic.2.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.cyclic.2.esa new file mode 100755 index 000000000000..8e2ec4f91cae Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.cyclic.2.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.dependency.duplicate.bundle.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.dependency.duplicate.bundle.esa new file mode 100755 index 000000000000..0cec528b6c40 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.dependency.duplicate.bundle.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.dependency.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.dependency.esa new file mode 100755 index 000000000000..0ef59087b4c4 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.dependency.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.depends.on.existing.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.depends.on.existing.esa new file mode 100755 index 000000000000..ca6980777524 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.depends.on.existing.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.esa new file mode 100755 index 000000000000..f4b1cb471d14 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.file.non.osgi.jar.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.file.non.osgi.jar.esa new file mode 100755 index 000000000000..a17fe00e3712 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.file.non.osgi.jar.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.install.to.core.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.install.to.core.esa new file mode 100755 index 000000000000..941434251240 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.install.to.core.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.invalid.feature.version.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.invalid.feature.version.esa new file mode 100755 index 000000000000..e389eb464674 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.invalid.feature.version.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.and.file.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.and.file.esa new file mode 100755 index 000000000000..a4b976fd1f43 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.and.file.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.with.dir.location.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.with.dir.location.esa new file mode 100755 index 000000000000..637b19a7235c Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.with.dir.location.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.with.exact.location.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.with.exact.location.esa new file mode 100755 index 000000000000..11e3422c9f75 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.with.exact.location.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.with.no.location.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.with.no.location.esa new file mode 100755 index 000000000000..7e0d416d9478 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.jar.with.no.location.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.missing.bundle.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.missing.bundle.esa new file mode 100755 index 000000000000..df5fc901858c Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.missing.bundle.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.missing.file.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.missing.file.esa new file mode 100755 index 000000000000..0b226e47dd0c Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.missing.file.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.missing.jar.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.missing.jar.esa new file mode 100755 index 000000000000..b5c4ce17798d Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.missing.jar.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.multiple.jars.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.multiple.jars.esa new file mode 100755 index 000000000000..8a2647a4cb18 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.multiple.jars.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.no.subsystem.manifest.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.no.subsystem.manifest.esa new file mode 100755 index 000000000000..f8b6b61a2d72 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.no.subsystem.manifest.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.same.bundle.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.same.bundle.esa new file mode 100755 index 000000000000..4d93ef01cd46 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.same.bundle.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.third.party.license.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.third.party.license.esa new file mode 100755 index 000000000000..7191f74bda05 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.third.party.license.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.two.manifests.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.two.manifests.esa new file mode 100755 index 000000000000..c29e391da4d0 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.two.manifests.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.api.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.api.esa new file mode 100755 index 000000000000..51a8cc22f0d5 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.api.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.checksum.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.checksum.esa new file mode 100755 index 000000000000..597c4708fcac Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.checksum.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.dependency.duplicate.bundle.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.dependency.duplicate.bundle.esa new file mode 100755 index 000000000000..a60d130f9137 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.dependency.duplicate.bundle.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.dependency.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.dependency.esa new file mode 100755 index 000000000000..ebbfcee9bc73 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.dependency.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.dir.location.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.dir.location.esa new file mode 100755 index 000000000000..1dfac8960f53 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.dir.location.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.exact.location.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.exact.location.esa new file mode 100755 index 000000000000..6db5ab9505ba Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.exact.location.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.file.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.file.esa new file mode 100755 index 000000000000..04859ed67b10 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.file.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.file.missing.location.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.file.missing.location.esa new file mode 100755 index 000000000000..f5c637d99a07 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.file.missing.location.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.ibm.license.different.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.ibm.license.different.esa new file mode 100755 index 000000000000..bcd4a40e6f6d Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.ibm.license.different.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.ibm.license.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.ibm.license.esa new file mode 100755 index 000000000000..38835b0285b3 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.ibm.license.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.ibm.license.same.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.ibm.license.same.esa new file mode 100755 index 000000000000..de246492c8e4 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.ibm.license.same.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.missing.dependency.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.missing.dependency.esa new file mode 100755 index 000000000000..ebbfcee9bc73 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.missing.dependency.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.multiple.dependencies.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.multiple.dependencies.esa new file mode 100755 index 000000000000..72f73bf2c588 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/features/usertest.with.multiple.dependencies.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/.gitignore b/dev/com.ibm.ws.kernel.feature_fat/publish/files/.gitignore new file mode 100644 index 000000000000..bbb6c65012ea --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/.gitignore @@ -0,0 +1,3 @@ +/ServletTest.zip +/test.feature.api.client.zip +/test.service.consumer.esa diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ESAFiles/test.service.consumer.esa/OSGI-INF/SUBSYSTEM.MF b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ESAFiles/test.service.consumer.esa/OSGI-INF/SUBSYSTEM.MF new file mode 100755 index 000000000000..2cb38b522188 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ESAFiles/test.service.consumer.esa/OSGI-INF/SUBSYSTEM.MF @@ -0,0 +1,6 @@ +Manifest-Version: 2.0 +Subsystem-ManifestVersion: 1.0 +Subsystem-SymbolicName: test.service.consumer.esa +Subsystem-Version: 1.0.0 +Subsystem-Content: test.service.consumer +Subsystem-Type: osgi.subsystem.application diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle1_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle1_1.0.0.jar new file mode 100755 index 000000000000..9dd40a555c68 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle1_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle2_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle2_1.0.0.jar new file mode 100755 index 000000000000..fdd3b1e16524 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle2_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle3_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle3_1.0.0.jar new file mode 100755 index 000000000000..8f5a4d246bdd Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle3_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle4_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle4_1.0.0.jar new file mode 100755 index 000000000000..f9950faacb7e Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle4_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle5_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle5_1.0.0.jar new file mode 100755 index 000000000000..98179f5b864b Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle5_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle6_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle6_1.0.0.jar new file mode 100755 index 000000000000..1b89ec5c37c1 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle6_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle7_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle7_1.0.0.jar new file mode 100755 index 000000000000..49ecdb53f5cc Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundle7_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundleJavaEight_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundleJavaEight_1.0.0.jar new file mode 100755 index 000000000000..4794056e9738 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundleJavaEight_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundleJavaNine_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundleJavaNine_1.0.0.jar new file mode 100755 index 000000000000..a4492953c740 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundleJavaNine_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L1_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L1_1.0.0.jar new file mode 100755 index 000000000000..f0dd46493160 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L1_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L2_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L2_1.0.0.jar new file mode 100755 index 000000000000..9299f8ff5fc5 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L2_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L3_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L3_1.0.0.jar new file mode 100755 index 000000000000..2d57d5f90321 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L3_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L8_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L8_1.0.0.jar new file mode 100755 index 000000000000..81373b4cf12e Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundles/test.feature.isolation.L8_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlev_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlev_1.0.0.jar new file mode 100755 index 000000000000..e0d828d75bf6 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlev_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlew_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlew_1.0.0.jar new file mode 100755 index 000000000000..c2dbfcb0a320 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlew_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlex_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlex_1.0.0.jar new file mode 100755 index 000000000000..fc8bbf24f6ac Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlex_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundley_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundley_1.0.0.jar new file mode 100755 index 000000000000..cc8ed685279e Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundley_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlez_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlez_1.0.0.jar new file mode 100755 index 000000000000..8f493b09d9b0 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/bundlez_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/com.ibm.ws.prodtest.internal_1.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/com.ibm.ws.prodtest.internal_1.0.jar new file mode 100755 index 000000000000..85a6fa4f6adf Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/com.ibm.ws.prodtest.internal_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureA-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureA-1.0.mf new file mode 100755 index 000000000000..db19664b9449 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureA-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: featureA-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureA-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle1; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureB-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureB-1.0.mf new file mode 100755 index 000000000000..53dc04335bf8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureB-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:featureB-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureB-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle2; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureC-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureC-1.0.mf new file mode 100755 index 000000000000..696834fe0342 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureC-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:featureC-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureC-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle3; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureD-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureD-1.0.mf new file mode 100755 index 000000000000..dc27710b0707 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureD-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:featureD-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureD-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle4; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureE-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureE-1.0.mf new file mode 100755 index 000000000000..bcd13f874d29 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureE-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:featureE-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureE-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle5; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureA-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureB-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureF-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureF-1.0.mf new file mode 100755 index 000000000000..69806bcf5be2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureF-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:featureF-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureF-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle6; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureB-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureC-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureG-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureG-1.0.mf new file mode 100755 index 000000000000..a34f5fa6f5ea --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureG-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:featureG-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureG-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle7; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureD-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureE-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureH-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureH-1.0.mf new file mode 100755 index 000000000000..f6a00464620d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureH-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:featureH-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureH-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle1; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureI-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureI-1.0.mf new file mode 100755 index 000000000000..7564951c7a0f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureI-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:featureI-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureI-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle2; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureJ-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureJ-1.0.mf new file mode 100755 index 000000000000..33c793568244 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureJ-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:featureJ-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureJ-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle3; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(|(osgi.identity=com.ibm.websphere.appserver.featureH-1.0)(osgi.identity=com.ibm.websphere.appserver.featureI-1.0)))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureJavaEight-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureJavaEight-1.0.mf new file mode 100755 index 000000000000..8a8721665e5e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureJavaEight-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: featureJavaEight-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureJavaEight-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundleJavaEight; version="[1,2)", + com.ibm.websphere.appserver.featureJavaNine-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureJavaNine-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureJavaNine-1.0.mf new file mode 100755 index 000000000000..64c74c3d58cb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureJavaNine-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: featureJavaNine-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureJavaNine-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundleJavaNine; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureVv-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureVv-1.0.mf new file mode 100755 index 000000000000..c5345386e458 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureVv-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: featureV-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureV-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundlev; version="[1,2)", + com.ibm.websphere.appserver.featureW-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureWw-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureWw-1.0.mf new file mode 100755 index 000000000000..f122e8867763 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureWw-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: featureW-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureW-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundlew; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureXx-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureXx-1.0.mf new file mode 100755 index 000000000000..280732c82300 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureXx-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: featureX-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureX-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundlex; version="[1,2)", + com.ibm.websphere.appserver.featureY-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureYy-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureYy-1.0.mf new file mode 100755 index 000000000000..cd661fa948ac --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureYy-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: featureY-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureY-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundley; version="[1,2)", + com.ibm.websphere.appserver.featureZ-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureZz-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureZz-1.0.mf new file mode 100755 index 000000000000..29efb5ddb4cc --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/featureZz-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: featureZ-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureZ-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundlez; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/badPathTool-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/badPathTool-1.0.mf new file mode 100755 index 000000000000..b4f8aab7b324 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/badPathTool-1.0.mf @@ -0,0 +1,16 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: badPathTool-1.0 +Subsystem-SymbolicName: test.icons.badPathTool-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Description: This is the description text for a feature where the file specified in the the icon header has a bad path +Subsystem-Vendor: IBM +Subsystem-Icon: size=64;OSGI-INF/toolicon.png +Subsystem-Content: test.icons.badPathTool-1.0; version="[1,1.0.100)" +IBM-Screenshots: +IBM-Feature-Version: 2 +IBM-AppliesTo: com.ibm.websphere.appserver; productVersion=2014.2.0.0; productInstallType=Archive +Subsystem-License: http://www.ibm.com/licenses/L-JTHS-9A6KF2 +IBM-License-Agreement: wlp/lafiles/LA +IBM-License-Information: wlp/lafiles/LI +IBM-InstallTo: core \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/emptyIconHeader-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/emptyIconHeader-1.0.mf new file mode 100755 index 000000000000..e07a63a2fe99 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/emptyIconHeader-1.0.mf @@ -0,0 +1,16 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: emptyIconHeader-1.0 +Subsystem-SymbolicName: test.icons.emptyIconHeader-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Description: This is the description text for a feature where the file specified in the the icon header is empty +Subsystem-Vendor: IBM +Subsystem-Icon: +Subsystem-Content: test.icons.emptyIconHeader-1.0; version="[1,1.0.100)" +IBM-Screenshots: +IBM-Feature-Version: 2 +IBM-AppliesTo: com.ibm.websphere.appserver; productVersion=2014.2.0.0; productInstallType=Archive +Subsystem-License: http://www.ibm.com/licenses/L-JTHS-9A6KF2 +IBM-License-Agreement: wlp/lafiles/LA +IBM-License-Information: wlp/lafiles/LI +IBM-InstallTo: core \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/goldenPathTool-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/goldenPathTool-1.0.mf new file mode 100755 index 000000000000..29b914de34c1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/goldenPathTool-1.0.mf @@ -0,0 +1,16 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: goldenPathTool-1.0 +Subsystem-SymbolicName: test.icons.goldenPathTool-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Description: This is the description text for a feature where the file specified in the the icon header has a good path +Subsystem-Vendor: IBM +Subsystem-Icon: OSGI-INF/toolicon.png +Subsystem-Content: test.icons.goldenPathTool-1.0; version="[1,1.0.100)" +IBM-Screenshots: +IBM-Feature-Version: 2 +IBM-AppliesTo: com.ibm.websphere.appserver; productVersion=2014.2.0.0; productInstallType=Archive; productEdition="DEVELOPERS,ND,zOS,NOSHIP" +Subsystem-License: http://www.ibm.com/licenses/L-JTHS-9A6KF2 +IBM-License-Agreement: wlp/lafiles/LA +IBM-License-Information: wlp/lafiles/LI +IBM-InstallTo: core \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/iconDirectivesTool-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/iconDirectivesTool-1.0.mf new file mode 100755 index 000000000000..c02e533f032e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/iconDirectivesTool-1.0.mf @@ -0,0 +1,16 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: iconDirectivesTool-1.0 +Subsystem-SymbolicName: test.icons.iconDirectivesTool-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Description: This is the description text for a feature where the directives are specified on the icon elements +Subsystem-Vendor: IBM +Subsystem-Icon: OSGI-INF/toolicon10.png;size=10,OSGI-INF/toolicon64.png;size=64 +Subsystem-Content: test.icons.iconDirectivesTool-1.0; version="[1,1.0.100)" +IBM-Screenshots: +IBM-Feature-Version: 2 +IBM-AppliesTo: com.ibm.websphere.appserver; productVersion=2014.2.0.0; productInstallType=Archive +Subsystem-License: http://www.ibm.com/licenses/L-JTHS-9A6KF2 +IBM-License-Agreement: wlp/lafiles/LA +IBM-License-Information: wlp/lafiles/LI +IBM-InstallTo: core \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.badPathTool-1.0/OSGI-INF/toolicon.png b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.badPathTool-1.0/OSGI-INF/toolicon.png new file mode 100755 index 000000000000..7b154d52ea0d Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.badPathTool-1.0/OSGI-INF/toolicon.png differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.emptyIconHeader-1.0/OSGI-INF/toolicon.png b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.emptyIconHeader-1.0/OSGI-INF/toolicon.png new file mode 100755 index 000000000000..7b154d52ea0d Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.emptyIconHeader-1.0/OSGI-INF/toolicon.png differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.goldenPathTool-1.0/OSGI-INF/toolicon.png b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.goldenPathTool-1.0/OSGI-INF/toolicon.png new file mode 100755 index 000000000000..7b154d52ea0d Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.goldenPathTool-1.0/OSGI-INF/toolicon.png differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.iconDirectivesTool-1.0/OSGI-INF/toolicon.png b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.iconDirectivesTool-1.0/OSGI-INF/toolicon.png new file mode 100755 index 000000000000..7b154d52ea0d Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.iconDirectivesTool-1.0/OSGI-INF/toolicon.png differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.iconDirectivesTool-1.0/OSGI-INF/toolicon10.png b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.iconDirectivesTool-1.0/OSGI-INF/toolicon10.png new file mode 100755 index 000000000000..7b154d52ea0d Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.iconDirectivesTool-1.0/OSGI-INF/toolicon10.png differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.iconDirectivesTool-1.0/OSGI-INF/toolicon64.png b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.iconDirectivesTool-1.0/OSGI-INF/toolicon64.png new file mode 100755 index 000000000000..7b154d52ea0d Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.iconDirectivesTool-1.0/OSGI-INF/toolicon64.png differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.missingIconsTool-1.0/OSGI-INF/toolicon.png b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.missingIconsTool-1.0/OSGI-INF/toolicon.png new file mode 100755 index 000000000000..7b154d52ea0d Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.missingIconsTool-1.0/OSGI-INF/toolicon.png differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.noHeaderTool-1.0/OSGI-INF/toolicon.png b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.noHeaderTool-1.0/OSGI-INF/toolicon.png new file mode 100755 index 000000000000..7b154d52ea0d Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/icons/test.icons.noHeaderTool-1.0/OSGI-INF/toolicon.png differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/missingIconsTool-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/missingIconsTool-1.0.mf new file mode 100755 index 000000000000..f7d0bc2654f2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/missingIconsTool-1.0.mf @@ -0,0 +1,16 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: missingIconsTool-1.0 +Subsystem-SymbolicName: test.icons.missingIconsTool-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Description: This is the description text for a feature where all the files specified in the the icon header are missing +Subsystem-Vendor: IBM +Subsystem-Icon: OSGI-INF/missingtoolicon.png,OSGI-INF/toolicon.png +Subsystem-Content: test.icons.missingIconsTool-1.0; version="[1,1.0.100)" +IBM-Screenshots: +IBM-Feature-Version: 2 +IBM-AppliesTo: com.ibm.websphere.appserver; productVersion=2014.2.0.0; productInstallType=Archive +Subsystem-License: http://www.ibm.com/licenses/L-JTHS-9A6KF2 +IBM-License-Agreement: wlp/lafiles/LA +IBM-License-Information: wlp/lafiles/LI +IBM-InstallTo: core \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/noHeaderTool-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/noHeaderTool-1.0.mf new file mode 100755 index 000000000000..48193066778d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/features/noHeaderTool-1.0.mf @@ -0,0 +1,15 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: noHeaderTool-1.0 +Subsystem-SymbolicName: test.icons.noHeaderTool-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Description: This is the description text for a feature where the icon header is missing +Subsystem-Vendor: IBM +Subsystem-Content: test.icons.noHeaderTool-1.0; version="[1,1.0.100)" +IBM-Screenshots: +IBM-Feature-Version: 2 +IBM-AppliesTo: com.ibm.websphere.appserver; productVersion=2014.2.0.0; productInstallType=Archive +Subsystem-License: http://www.ibm.com/licenses/L-JTHS-9A6KF2 +IBM-License-Agreement: wlp/lafiles/LA +IBM-License-Information: wlp/lafiles/LI +IBM-InstallTo: core \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.badPathTool-1.0_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.badPathTool-1.0_1.0.0.jar new file mode 100755 index 000000000000..3021b3435f30 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.badPathTool-1.0_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.emptyIconHeader-1.0_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.emptyIconHeader-1.0_1.0.0.jar new file mode 100755 index 000000000000..942a82bf1f24 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.emptyIconHeader-1.0_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.goldenPathTool-1.0_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.goldenPathTool-1.0_1.0.0.jar new file mode 100755 index 000000000000..14bd37a6b583 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.goldenPathTool-1.0_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.iconDirectivesTool-1.0_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.iconDirectivesTool-1.0_1.0.0.jar new file mode 100755 index 000000000000..e0d2ae616531 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.iconDirectivesTool-1.0_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.missingIconsTool-1.0_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.missingIconsTool-1.0_1.0.0.jar new file mode 100755 index 000000000000..b68f9b98d297 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.missingIconsTool-1.0_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.noHeaderTool-1.0_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.noHeaderTool-1.0_1.0.0.jar new file mode 100755 index 000000000000..faa622fee222 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/filesForPreMinify/lib/test.icons.noHeaderTool-1.0_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/includeClientFeature-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/includeClientFeature-1.0.mf new file mode 100755 index 000000000000..ca044422d04b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/includeClientFeature-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: includeClientFeature-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.includeClientFeature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.websphere.appserver.javaeeClient-7.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/invalidSubsystemTypeFeature-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/invalidSubsystemTypeFeature-1.0.mf new file mode 100755 index 000000000000..5fb996bf23ab --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/invalidSubsystemTypeFeature-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: InvalidSubsystemTypeFeature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureA-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureB-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Content: Bundle1; version="[1,2)" +Subsystem-Type: com.ibm.websphere.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/invalid_header_feature.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/invalid_header_feature.mf new file mode 100755 index 000000000000..b7cd49c55678 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/invalid_header_feature.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: invalid_header_feature; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle1; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolation.Runtime.Test.Feature-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolation.Runtime.Test.Feature-1.0.mf new file mode 100755 index 000000000000..2429231738dd --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolation.Runtime.Test.Feature-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: isolation.Runtime.Test.Feature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.feature.isolation.L1; version="[1,1.0.100)", + test.feature.isolation.L2; version="[1,1.0.100)", + test.feature.isolation.L3; version="[1,1.0.100)" +IBM-Feature-Version: 2 +IBM-SPI-Package: test.feature.isolation.p1a diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolation.Runtime.Test.Feature.Negative-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolation.Runtime.Test.Feature.Negative-1.0.mf new file mode 100755 index 000000000000..14edb36eba69 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolation.Runtime.Test.Feature.Negative-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: isolation.Runtime.Test.Feature.Negative-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.feature.isolation.L8; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolation.server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolation.server.xml new file mode 100755 index 000000000000..ec135d2f6450 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolation.server.xml @@ -0,0 +1,10 @@ + + + + + + isolation.Runtime.Test.Feature-1.0 + usr:isolation.Product.Test.Feature-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolationKtoU.server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolationKtoU.server.xml new file mode 100755 index 000000000000..895808f385b4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolationKtoU.server.xml @@ -0,0 +1,9 @@ + + + + + + usr:isolation.KernelSPI.Test.Feature-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolationLtoU.server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolationLtoU.server.xml new file mode 100755 index 000000000000..a7e28318ea34 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolationLtoU.server.xml @@ -0,0 +1,11 @@ + + + + + + isolation.Runtime.Test.Feature-1.0 + usr:isolation.Product.Test.Feature-1.0 + usr:isolation.Product.Test.Feature.Negative-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolationUtoL.server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolationUtoL.server.xml new file mode 100755 index 000000000000..418cf72d06ed --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/isolationUtoL.server.xml @@ -0,0 +1,11 @@ + + + + + + isolation.Runtime.Test.Feature-1.0 + isolation.Runtime.Test.Feature.Negative-1.0 + usr:isolation.Product.Test.Feature-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/base.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/base.xml new file mode 100755 index 000000000000..9c52ce6c9631 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/base.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/core.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/core.xml new file mode 100755 index 000000000000..a3aa99140482 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/core.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/full.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/full.xml new file mode 100755 index 000000000000..8e812d8eefd0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/full.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/nd.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/nd.xml new file mode 100755 index 000000000000..3b38e2fb4621 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/nd.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/zos.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/zos.xml new file mode 100755 index 000000000000..663af9515296 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/minifyConfigs/zos.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.case1.server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.case1.server.xml new file mode 100755 index 000000000000..13013ef5f007 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.case1.server.xml @@ -0,0 +1,10 @@ + + + + + + + override.systemFeature.requiresJavaxRMI-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.case2.server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.case2.server.xml new file mode 100755 index 000000000000..af165549ca3f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.case2.server.xml @@ -0,0 +1,11 @@ + + + + + + + override.systemFeature.requiresJavaxRMI-1.0 + override.systemFeature.providesJavaxRMI-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.case3.server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.case3.server.xml new file mode 100755 index 000000000000..d47277ac27b9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.case3.server.xml @@ -0,0 +1,11 @@ + + + + + + + override.systemFeature.requiresJavaxRMI-1.0 + usr:override.userFeature.providesJavaxRMI-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.server.xml new file mode 100755 index 000000000000..80dea30d1b32 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/override.server.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle1_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle1_1.0.0.jar new file mode 100755 index 000000000000..832ec9e3f7dc Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle1_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle2_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle2_1.0.0.jar new file mode 100755 index 000000000000..51d8b6f1c787 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle2_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle3_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle3_1.0.0.jar new file mode 100755 index 000000000000..5d8fb8b46a79 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle3_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle4_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle4_1.0.0.jar new file mode 100755 index 000000000000..d17c8e0f2c74 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle4_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle5_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle5_1.0.0.jar new file mode 100755 index 000000000000..c9405caa1a75 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle5_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle6_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle6_1.0.0.jar new file mode 100755 index 000000000000..04598b0185b8 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle6_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle7_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle7_1.0.0.jar new file mode 100755 index 000000000000..e93f1d84fc49 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2bundle7_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureA-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureA-1.0.mf new file mode 100755 index 000000000000..fc54af973296 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureA-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: p2featureA-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: p2bundle1; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureB-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureB-1.0.mf new file mode 100755 index 000000000000..1c2a6b5a749e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureB-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: p2featureB-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: p2bundle2; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureD-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureD-1.0.mf new file mode 100755 index 000000000000..63ba2bf229c8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureD-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: p2featureD-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: p2bundle4; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureE-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureE-1.0.mf new file mode 100755 index 000000000000..45b28f256960 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureE-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: p2featureE-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: p2bundle5; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=p2featureA-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=p2featureB-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureG-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureG-1.0.mf new file mode 100755 index 000000000000..84bcf17b9b2a --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/p2featureG-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: p2featureG-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: p2bundle7; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=p2featureD-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=p2featureE-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle1_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle1_1.0.0.jar new file mode 100755 index 000000000000..5ca3b4e8dba9 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle1_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle2_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle2_1.0.0.jar new file mode 100755 index 000000000000..d96f851b2602 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle2_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle3_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle3_1.0.0.jar new file mode 100755 index 000000000000..1f34dbcc61de Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle3_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle4_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle4_1.0.0.jar new file mode 100755 index 000000000000..1911e33e2c2e Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle4_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle5_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle5_1.0.0.jar new file mode 100755 index 000000000000..91c176c268b3 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle5_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle6_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle6_1.0.0.jar new file mode 100755 index 000000000000..577abf8694d3 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle6_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle7_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle7_1.0.0.jar new file mode 100755 index 000000000000..7b5816886b71 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pbundle7_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureA-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureA-1.0.mf new file mode 100755 index 000000000000..9a4aec683b0f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureA-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureA-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureA-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle1; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureB-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureB-1.0.mf new file mode 100755 index 000000000000..946ce1cce521 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureB-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureB-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureB-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle2; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureC-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureC-1.0.mf new file mode 100755 index 000000000000..cbb3afb66df2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureC-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureC-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureC-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle3; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureD-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureD-1.0.mf new file mode 100755 index 000000000000..78cde88510d6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureD-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureD-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureD-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle4; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureE-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureE-1.0.mf new file mode 100755 index 000000000000..9f7d674eef8f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureE-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureE-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureE-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle5; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.pfeatureA-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.pfeatureB-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureF-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureF-1.0.mf new file mode 100755 index 000000000000..7d9e62f687a0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureF-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureF-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureF-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle6; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.pfeatureB-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.pfeatureC-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureG-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureG-1.0.mf new file mode 100755 index 000000000000..4af6d08f1bbb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureG-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureG-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureG-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle7; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.pfeatureD-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.pfeatureE-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureH-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureH-1.0.mf new file mode 100755 index 000000000000..be72330c13eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureH-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureH-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureH-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle1; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureI-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureI-1.0.mf new file mode 100755 index 000000000000..d1cc37bae002 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureI-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureI-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureI-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle2; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureJ-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureJ-1.0.mf new file mode 100755 index 000000000000..f74f51c64734 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureJ-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureJ-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureJ-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle3; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(|(osgi.identity=com.ibm.websphere.appserver.pfeatureH-1.0)(osgi.identity=com.ibm.websphere.appserver.pfeatureI-1.0)))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureL-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureL-1.0.mf new file mode 100755 index 000000000000..1173080baa2a --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureL-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureL-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureL-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle5; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureA-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureB-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureM-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureM-1.0.mf new file mode 100755 index 000000000000..b1353bc7ec8b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureM-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureM-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureM-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle6; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureB-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureC-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureN-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureN-1.0.mf new file mode 100755 index 000000000000..ab13547656d0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/pfeatureN-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:pfeatureN-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.pfeatureN-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: pbundle7; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureD-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.pfeatureL-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/prodtest-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/prodtest-1.0.mf new file mode 100755 index 000000000000..fb4a03b453e7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/prodtest-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar", + test.bat; location:="bin/test.bat"; type=file +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/prodtestprivate-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/prodtestprivate-1.0.mf new file mode 100755 index 000000000000..27355bdd640c --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/prodtestprivate-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtestprivate-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar", + com.ibm.websphere.appserver.javax.servlet-3.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/product2Auto.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/files/product2Auto.properties new file mode 100755 index 000000000000..be1ed0816236 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/product2Auto.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=product2Auto +com.ibm.websphere.productInstall=wlp/product2Auto/ \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/productAuto.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/files/productAuto.properties new file mode 100755 index 000000000000..c920a739d86a --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/productAuto.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=productAuto +com.ibm.websphere.productInstall=wlp/productAuto/ \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/product_ext_for_minify.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/product_ext_for_minify.xml new file mode 100755 index 000000000000..5bd8aa241a78 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/product_ext_for_minify.xml @@ -0,0 +1,9 @@ + + + + + + testproduct:prodtest-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10a11.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10a11.xml new file mode 100755 index 000000000000..da1371589181 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10a11.xml @@ -0,0 +1,10 @@ + + + + + + capabilityA-1.0 + capabilityA-1.1 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b10.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b10.xml new file mode 100755 index 000000000000..e957ec9a6531 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b10.xml @@ -0,0 +1,10 @@ + + + + + + capabilityA-1.0 + capabilityB-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b11.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b11.xml new file mode 100755 index 000000000000..eba48b21c158 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b11.xml @@ -0,0 +1,10 @@ + + + + + + capabilityA-1.0 + capabilityB-1.1 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b11combo10.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b11combo10.xml new file mode 100755 index 000000000000..54e7c08400ef --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b11combo10.xml @@ -0,0 +1,11 @@ + + + + + + capabilityA-1.0 + capabilityB-1.1 + comboA10B10-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b20.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b20.xml new file mode 100755 index 000000000000..f76e1429e293 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10b20.xml @@ -0,0 +1,10 @@ + + + + + + capabilityA-1.0 + capabilityB-2.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10combo10.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10combo10.xml new file mode 100755 index 000000000000..afd73c9f2eb3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a10combo10.xml @@ -0,0 +1,10 @@ + + + + + + capabilityA-1.0 + comboA10B10-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b10.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b10.xml new file mode 100755 index 000000000000..1e46b2b331c8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b10.xml @@ -0,0 +1,10 @@ + + + + + + capabilityA-1.1 + capabilityB-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b11.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b11.xml new file mode 100755 index 000000000000..7660a1993582 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b11.xml @@ -0,0 +1,10 @@ + + + + + + capabilityA-1.1 + capabilityB-1.1 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b11combo10.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b11combo10.xml new file mode 100755 index 000000000000..4b2bb47acac4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b11combo10.xml @@ -0,0 +1,11 @@ + + + + + + capabilityA-1.1 + capabilityB-1.1 + comboA10B10-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b20.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b20.xml new file mode 100755 index 000000000000..72e47ce78edd --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a11b20.xml @@ -0,0 +1,10 @@ + + + + + + capabilityA-1.1 + capabilityB-2.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a20b10.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a20b10.xml new file mode 100755 index 000000000000..6345984fe17b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a20b10.xml @@ -0,0 +1,10 @@ + + + + + + capabilityA-2.0 + capabilityB-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a20b11.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a20b11.xml new file mode 100755 index 000000000000..5eb63aecdf62 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a20b11.xml @@ -0,0 +1,10 @@ + + + + + + capabilityA-2.0 + capabilityB-1.1 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a20b20.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a20b20.xml new file mode 100755 index 000000000000..d1013ef8b07d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_a20b20.xml @@ -0,0 +1,10 @@ + + + + + + capabilityA-2.0 + capabilityB-2.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureA.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureA.xml new file mode 100755 index 000000000000..6220995a611d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureA.xml @@ -0,0 +1,9 @@ + + + + + + featureA-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureC.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureC.xml new file mode 100755 index 000000000000..74a8924edcbf --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureC.xml @@ -0,0 +1,12 @@ + + + + + + featureA-1.0 + featureB-1.0 + featureC-1.0 + featureD-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureH.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureH.xml new file mode 100755 index 000000000000..45969694503b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureH.xml @@ -0,0 +1,9 @@ + + + + + + featureH-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureH_and_featureI.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureH_and_featureI.xml new file mode 100755 index 000000000000..346c80040c68 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureH_and_featureI.xml @@ -0,0 +1,11 @@ + + + + + + featureH-1.0 + featureI-1.0 + timedexit-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureI.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureI.xml new file mode 100755 index 000000000000..7a846d4241a5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureI.xml @@ -0,0 +1,9 @@ + + + + + + featureI-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureJavaEight.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureJavaEight.xml new file mode 100755 index 000000000000..92ab4a591cd4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureJavaEight.xml @@ -0,0 +1,9 @@ + + + + + + featureJavaEight-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureV.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureV.xml new file mode 100755 index 000000000000..81c55cc519f1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureV.xml @@ -0,0 +1,9 @@ + + + + + + featureV-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureX.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureX.xml new file mode 100755 index 000000000000..d12592440454 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_featureX.xml @@ -0,0 +1,9 @@ + + + + + + featureX-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_feature_all_lower_a.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_feature_all_lower_a.xml new file mode 100755 index 000000000000..a808940e4278 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_feature_all_lower_a.xml @@ -0,0 +1,9 @@ + + + + + + featurea-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_feature_all_upper_a.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_feature_all_upper_a.xml new file mode 100755 index 000000000000..8d855ce0a5c4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_feature_all_upper_a.xml @@ -0,0 +1,9 @@ + + + + + + FEATUREA-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureC.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureC.xml new file mode 100755 index 000000000000..234dd0623ccc --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureC.xml @@ -0,0 +1,12 @@ + + + + + + productAuto:pfeatureA-1.0 + productAuto:pfeatureB-1.0 + productAuto:pfeatureC-1.0 + productAuto:pfeatureD-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureH.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureH.xml new file mode 100755 index 000000000000..fa6591b02a42 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureH.xml @@ -0,0 +1,9 @@ + + + + + + productAuto:pfeatureH-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureH_and_featureI.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureH_and_featureI.xml new file mode 100755 index 000000000000..c2e504b433cb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureH_and_featureI.xml @@ -0,0 +1,11 @@ + + + + + + productAuto:pfeatureH-1.0 + productAuto:pfeatureI-1.0 + timedexit-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureI.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureI.xml new file mode 100755 index 000000000000..778e3c05e244 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_product_featureI.xml @@ -0,0 +1,9 @@ + + + + + + productAuto:pfeatureI-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureC.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureC.xml new file mode 100755 index 000000000000..250a7f21ba19 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureC.xml @@ -0,0 +1,12 @@ + + + + + + usr:ufeatureA-1.0 + usr:ufeatureB-1.0 + usr:ufeatureC-1.0 + usr:ufeatureD-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureH.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureH.xml new file mode 100755 index 000000000000..df8374dab61a --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureH.xml @@ -0,0 +1,9 @@ + + + + + + usr:ufeatureH-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureH_and_featureI.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureH_and_featureI.xml new file mode 100755 index 000000000000..cd9ac88aa2aa --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureH_and_featureI.xml @@ -0,0 +1,11 @@ + + + + + + usr:ufeatureH-1.0 + usr:ufeatureI-1.0 + timedexit-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureI.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureI.xml new file mode 100755 index 000000000000..3a18c217f779 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_add_usr_featureI.xml @@ -0,0 +1,9 @@ + + + + + + usr:ufeatureI-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_all_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_all_features.xml new file mode 100755 index 000000000000..2e6622d9d350 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_all_features.xml @@ -0,0 +1,12 @@ + + + + + + featureA-1.0 + featureB-1.0 + featureC-1.0 + featureD-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_client.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_client.xml new file mode 100755 index 000000000000..9caad90ef72f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_client.xml @@ -0,0 +1,9 @@ + + + + + + clientB-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_core_features_not_found.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_core_features_not_found.xml new file mode 100755 index 000000000000..991c1be2ab6d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_core_features_not_found.xml @@ -0,0 +1,15 @@ + + + + coretest-1.0 + timedexit-1.0 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_d10a10b10combo10.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_d10a10b10combo10.xml new file mode 100755 index 000000000000..018b27ca7cb7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_d10a10b10combo10.xml @@ -0,0 +1,10 @@ + + + + + + capabilityD-1.0 + comboA10B10-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_features.xml new file mode 100755 index 000000000000..6db80e50248e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_features.xml @@ -0,0 +1,11 @@ + + + + + + featureA-1.0 + featureB-1.0 + featureD-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_product2_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_product2_features.xml new file mode 100755 index 000000000000..7cc0f9ac9fd3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_product2_features.xml @@ -0,0 +1,14 @@ + + + + + + productAuto:pfeatureA-1.0 + productAuto:pfeatureB-1.0 + productAuto:pfeatureD-1.0 + product2Auto:p2featureA-1.0 + product2Auto:p2featureB-1.0 + product2Auto:p2featureD-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_product_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_product_features.xml new file mode 100755 index 000000000000..688d7e148556 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_product_features.xml @@ -0,0 +1,11 @@ + + + + + + productAuto:pfeatureA-1.0 + productAuto:pfeatureB-1.0 + productAuto:pfeatureD-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_usr_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_usr_features.xml new file mode 100755 index 000000000000..9827bef32018 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_initial_usr_features.xml @@ -0,0 +1,11 @@ + + + + + + usr:ufeatureA-1.0 + usr:ufeatureB-1.0 + usr:ufeatureD-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_invalid_header.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_invalid_header.xml new file mode 100755 index 000000000000..7cebedda9a73 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_invalid_header.xml @@ -0,0 +1,9 @@ + + + + + + invalid_header_feature + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_no_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_no_features.xml new file mode 100755 index 000000000000..7633b3db6954 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_no_features.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_performance_test.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_performance_test.xml new file mode 100755 index 000000000000..46a627afee46 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_performance_test.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product2_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product2_features.xml new file mode 100755 index 000000000000..04fd6dc74dc8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product2_features.xml @@ -0,0 +1,15 @@ + + + + testproduct2:prodtest-1.0 + timedexit-1.0 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product3_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product3_features.xml new file mode 100755 index 000000000000..46a66fec16d2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product3_features.xml @@ -0,0 +1,15 @@ + + + + testproduct3:prodtest-1.0 + timedexit-1.0 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_productA_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_productA_features.xml new file mode 100755 index 000000000000..7dec7f408c8d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_productA_features.xml @@ -0,0 +1,15 @@ + + + + productA:prodtest-1.0 + timedexit-1.0 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_productB_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_productB_features.xml new file mode 100755 index 000000000000..80c60788613c --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_productB_features.xml @@ -0,0 +1,15 @@ + + + + productB:prodtest-1.0 + timedexit-1.0 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_all_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_all_features.xml new file mode 100755 index 000000000000..1897e220c699 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_all_features.xml @@ -0,0 +1,12 @@ + + + + + + productAuto:pfeatureA-1.0 + productAuto:pfeatureB-1.0 + productAuto:pfeatureC-1.0 + productAuto:pfeatureD-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_featureA.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_featureA.xml new file mode 100755 index 000000000000..c6af9dd2dc76 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_featureA.xml @@ -0,0 +1,9 @@ + + + + + + testproduct:pfeatureA-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_features.xml new file mode 100755 index 000000000000..b8ea0d13ce14 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_features.xml @@ -0,0 +1,15 @@ + + + + testproduct:prodtest-1.0 + timedexit-1.0 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_features_not_found.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_features_not_found.xml new file mode 100755 index 000000000000..f13f4975df76 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_features_not_found.xml @@ -0,0 +1,15 @@ + + + + testproduct:producttestnotfound + timedexit-1.0 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_private_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_private_features.xml new file mode 100755 index 000000000000..9a2d0f8c64d5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_product_private_features.xml @@ -0,0 +1,15 @@ + + + + testproduct:prodtestprivate-1.0 + timedexit-1.0 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_refresh_autofeatures.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_refresh_autofeatures.xml new file mode 100755 index 000000000000..3a11aa1ef945 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_refresh_autofeatures.xml @@ -0,0 +1,13 @@ + + + + + + featureA-1.0 + featureB-1.0 + featureC-1.0 + featureD-1.0 + test.featureprovisioner-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_featureA.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_featureA.xml new file mode 100755 index 000000000000..4fbcc439b4ba --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_featureA.xml @@ -0,0 +1,11 @@ + + + + + + featureB-1.0 + featureC-1.0 + featureD-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_product2_featureD.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_product2_featureD.xml new file mode 100755 index 000000000000..625f70205122 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_product2_featureD.xml @@ -0,0 +1,13 @@ + + + + + + productAuto:pfeatureA-1.0 + productAuto:pfeatureB-1.0 + productAuto:pfeatureD-1.0 + product2Auto:p2featureA-1.0 + product2Auto:p2featureB-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_product_featureA.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_product_featureA.xml new file mode 100755 index 000000000000..f3ba89291f9e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_product_featureA.xml @@ -0,0 +1,11 @@ + + + + + + productAuto:pfeatureB-1.0 + productAuto:pfeatureC-1.0 + productAuto:pfeatureD-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_usr_featureA.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_usr_featureA.xml new file mode 100755 index 000000000000..5a105ab5d52f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_remove_usr_featureA.xml @@ -0,0 +1,11 @@ + + + + + + usr:ufeatureB-1.0 + usr:ufeatureC-1.0 + usr:ufeatureD-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_serverclient.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_serverclient.xml new file mode 100755 index 000000000000..df6380f82e32 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_serverclient.xml @@ -0,0 +1,9 @@ + + + + + + serverA-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_feature1.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_feature1.xml new file mode 100755 index 000000000000..191089aabb05 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_feature1.xml @@ -0,0 +1,9 @@ + + + + + + usr:ufeature1-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_featureA.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_featureA.xml new file mode 100755 index 000000000000..52445237a4fc --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_featureA.xml @@ -0,0 +1,9 @@ + + + + + + usr:ufeatureA-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_featureV.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_featureV.xml new file mode 100755 index 000000000000..9a07405f4a16 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_featureV.xml @@ -0,0 +1,9 @@ + + + + + + usr:featureV-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_features.xml new file mode 100755 index 000000000000..9a95d4878a61 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_features.xml @@ -0,0 +1,9 @@ + + + + + + usr:usertest + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_features_not_found.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_features_not_found.xml new file mode 100755 index 000000000000..8ebde9fa51fa --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_features_not_found.xml @@ -0,0 +1,9 @@ + + + + + + usr:usertestnotfound + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_private_feature.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_private_feature.xml new file mode 100755 index 000000000000..1675104b0d61 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_user_private_feature.xml @@ -0,0 +1,9 @@ + + + + + + usr:usertestprivate-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_usr_all_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_usr_all_features.xml new file mode 100755 index 000000000000..b2b085aef7c5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_usr_all_features.xml @@ -0,0 +1,12 @@ + + + + + + usr:ufeatureA-1.0 + usr:ufeatureB-1.0 + usr:ufeatureC-1.0 + usr:ufeatureD-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_usr_product_features.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_usr_product_features.xml new file mode 100755 index 000000000000..2824b1ef6c7e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_usr_product_features.xml @@ -0,0 +1,15 @@ + + + + usr:prodtest-1.0 + timedexit-1.0 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_with_client.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_with_client.xml new file mode 100755 index 000000000000..6b8135be4cc4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/server_with_client.xml @@ -0,0 +1,9 @@ + + + + + + includeClientFeature-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/skeletonTestFeature-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/skeletonTestFeature-1.0.mf new file mode 100755 index 000000000000..706f77bd4f04 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/skeletonTestFeature-1.0.mf @@ -0,0 +1,11 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: skeletonFeature-1.0 +Subsystem-Version: 1.0.0 +Subsystem-ManifestVersion: 1 +Subsystem-Content: bundle1; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +Subsystem-SymbolicName: featureE-1.0; visibility:=public +IBM-Feature-Version: 2 +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=someFeature-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=anotherFeature-1.0))" +IBM-Install-Policy: when-satisfied diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/test.bat b/dev/com.ibm.ws.kernel.feature_fat/publish/files/test.bat new file mode 100755 index 000000000000..b6435e2b9a05 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/test.bat @@ -0,0 +1,2 @@ +REM not a real batch file +REM just a placeholder for testing type=file in a product extension \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/test.featureprovisioner-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/test.featureprovisioner-1.0.mf new file mode 100755 index 000000000000..957bd812a076 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/test.featureprovisioner-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: test.featureprovisioner-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.feature.provisioner; version="[1,1.0.100)", + com.ibm.wsspi.appserver.webBundle-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.badPathTool-1.0.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.badPathTool-1.0.esa new file mode 100755 index 000000000000..ac448fba0383 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.badPathTool-1.0.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.emptyIconHeader-1.0.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.emptyIconHeader-1.0.esa new file mode 100755 index 000000000000..684077d5d773 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.emptyIconHeader-1.0.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.goldenPathTool-1.0.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.goldenPathTool-1.0.esa new file mode 100755 index 000000000000..108ad44661d6 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.goldenPathTool-1.0.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.iconDirectivesTool-1.0.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.iconDirectivesTool-1.0.esa new file mode 100755 index 000000000000..31738646e277 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.iconDirectivesTool-1.0.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.missingIconsTool-1.0.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.missingIconsTool-1.0.esa new file mode 100755 index 000000000000..401a4ed448a6 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.missingIconsTool-1.0.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.noHeaderTool-1.0.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.noHeaderTool-1.0.esa new file mode 100755 index 000000000000..0c05e840d6e2 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.noHeaderTool-1.0.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.userIconFeature-1.0.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.userIconFeature-1.0.esa new file mode 100755 index 000000000000..436e8be2e35e Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testFeatures/test.icons.userIconFeature-1.0.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/test_product_extensions/testproduct.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/files/test_product_extensions/testproduct.properties new file mode 100755 index 000000000000..1b80aa40d231 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/test_product_extensions/testproduct.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall=wlp/producttest/ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproduct.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproduct.properties new file mode 100755 index 000000000000..1b80aa40d231 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproduct.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall=wlp/producttest/ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproduct2.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproduct2.properties new file mode 100755 index 000000000000..b52c5855c2e7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproduct2.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall=wlp/producttest diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproduct3.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproduct3.properties new file mode 100755 index 000000000000..e872bb4cd505 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproduct3.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall=wlp/(test a&)/producttest \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductbad.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductbad.properties new file mode 100755 index 000000000000..af2c9e0b4fc2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductbad.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductbadpath.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductbadpath.properties new file mode 100755 index 000000000000..16feea18c333 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductbadpath.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall= diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductbadwlp.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductbadwlp.properties new file mode 100755 index 000000000000..95ec4fee9284 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductbadwlp.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall=wlp \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductcontainssymbol.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductcontainssymbol.properties new file mode 100755 index 000000000000..78a4774d6aa0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/testproductcontainssymbol.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall=${wlp.install.dir}/x \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle1_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle1_1.0.0.jar new file mode 100755 index 000000000000..beab8460413f Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle1_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle2_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle2_1.0.0.jar new file mode 100755 index 000000000000..643d8a0875ff Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle2_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle3_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle3_1.0.0.jar new file mode 100755 index 000000000000..f07bf9ef0b72 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle3_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle4_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle4_1.0.0.jar new file mode 100755 index 000000000000..adda7e8ee0fd Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle4_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle5_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle5_1.0.0.jar new file mode 100755 index 000000000000..d62032391196 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle5_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle6_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle6_1.0.0.jar new file mode 100755 index 000000000000..92183e2ec793 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle6_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle7_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle7_1.0.0.jar new file mode 100755 index 000000000000..e1a3c6e516ba Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ubundle7_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeature1-1.0.MF b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeature1-1.0.MF new file mode 100755 index 000000000000..652cea5a863c --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeature1-1.0.MF @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeature1-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeature1-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle1; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureA-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureA-1.0.mf new file mode 100755 index 000000000000..1e177f0c6e7e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureA-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureA-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureA-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle1; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureB-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureB-1.0.mf new file mode 100755 index 000000000000..903deff03938 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureB-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureB-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureB-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle2; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureC-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureC-1.0.mf new file mode 100755 index 000000000000..206d46aa332e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureC-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureC-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureC-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle3; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureD-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureD-1.0.mf new file mode 100755 index 000000000000..b726bd2ec114 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureD-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureD-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureD-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle4; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureE-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureE-1.0.mf new file mode 100755 index 000000000000..16d4c3818077 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureE-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureE-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureE-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle5; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.ufeatureA-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.ufeatureB-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureF-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureF-1.0.mf new file mode 100755 index 000000000000..c214760ec62f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureF-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureF-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureF-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle6; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.ufeatureB-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.ufeatureC-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureG-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureG-1.0.mf new file mode 100755 index 000000000000..fa251b5f8471 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureG-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureG-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureG-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle7; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.ufeatureD-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.ufeatureE-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureH-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureH-1.0.mf new file mode 100755 index 000000000000..0ee6c7f8520f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureH-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureH-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureH-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle1; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureI-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureI-1.0.mf new file mode 100755 index 000000000000..11ae83ecbe1a --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureI-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureI-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureI-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle2; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureJ-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureJ-1.0.mf new file mode 100755 index 000000000000..0a1dabee65c2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureJ-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureJ-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureJ-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle3; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(|(osgi.identity=com.ibm.websphere.appserver.ufeatureH-1.0)(osgi.identity=com.ibm.websphere.appserver.ufeatureI-1.0)))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureL-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureL-1.0.mf new file mode 100755 index 000000000000..745cd8db2734 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureL-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureL-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureL-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle5; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureA-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureB-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureM-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureM-1.0.mf new file mode 100755 index 000000000000..9ab5c5a4a6c8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureM-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureM-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureM-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle6; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureB-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureC-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureN-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureN-1.0.mf new file mode 100755 index 000000000000..8d006ce68184 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/ufeatureN-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:ufeatureN-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.ufeatureN-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ubundle7; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureD-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.ufeatureL-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertest.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertest.esa new file mode 100755 index 000000000000..05653fcc8224 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertest.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertest.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertest.mf new file mode 100755 index 000000000000..e268d0c86e3d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertest.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: usertest;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: usertest; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertest_1.0.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertest_1.0.0.jar new file mode 100755 index 000000000000..53c5fe91b83f Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertest_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertestprivate-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertestprivate-1.0.mf new file mode 100755 index 000000000000..c3d3eb9b6814 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/usertestprivate-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: usertestprivate-1.0; visibility:=private +Subsystem-Version: 1.0.0 +Subsystem-Content: usertest; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/files/usr.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/files/usr.properties new file mode 100755 index 000000000000..c8d9846db4f1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/files/usr.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=badUsr +com.ibm.websphere.productInstall=wlp/producttest/ \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/productbundles/com.ibm.ws.prodtest.internal_1.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/productbundles/com.ibm.ws.prodtest.internal_1.0.jar new file mode 100755 index 000000000000..85a6fa4f6adf Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/productbundles/com.ibm.ws.prodtest.internal_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/productfeatures/prodtest-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/productfeatures/prodtest-1.0.mf new file mode 100755 index 000000000000..21b5ef9153be --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/productfeatures/prodtest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/productproperties/productA.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/productproperties/productA.properties new file mode 100755 index 000000000000..58638ec930fd --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/productproperties/productA.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall=productA diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/productproperties/productB.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/productproperties/productB.properties new file mode 100755 index 000000000000..cd5b25bcea4d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/productproperties/productB.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProductB +com.ibm.websphere.productInstall=productB/ \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar b/dev/com.ibm.ws.kernel.feature_fat/publish/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar new file mode 100755 index 000000000000..85a6fa4f6adf Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/producttest/lib/features/prodtest-1.0.mf b/dev/com.ibm.ws.kernel.feature_fat/publish/producttest/lib/features/prodtest-1.0.mf new file mode 100755 index 000000000000..21b5ef9153be --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/producttest/lib/features/prodtest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api.service/.gitignore b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api.service/.gitignore new file mode 100644 index 000000000000..f3f483d82c07 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api.service/.gitignore @@ -0,0 +1 @@ +/dropins diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api.service/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api.service/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api.service/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api.service/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api.service/server.xml new file mode 100755 index 000000000000..4211b28d7854 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api.service/server.xml @@ -0,0 +1,10 @@ + + + + + + usr:test.service.provider-1.0 + blueprint-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api/.gitignore b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api/.gitignore new file mode 100644 index 000000000000..f3f483d82c07 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api/.gitignore @@ -0,0 +1 @@ +/dropins diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api/server.xml new file mode 100755 index 000000000000..56641bdcb664 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.api/server.xml @@ -0,0 +1,10 @@ + + + + + + test.feature.api.internal-1.0 + servlet-3.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.autofeature/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.autofeature/bootstrap.properties new file mode 100755 index 000000000000..a809f012e2eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.autofeature/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.autofeature/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.autofeature/server.xml new file mode 100755 index 000000000000..2e6622d9d350 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.autofeature/server.xml @@ -0,0 +1,12 @@ + + + + + + featureA-1.0 + featureB-1.0 + featureC-1.0 + featureD-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/bootstrap.properties new file mode 100755 index 000000000000..c8672224d93c --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=FileInstall=event=enabled:FileMonitor=event=enabled:FeatureManager=all=enabled:config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-add.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-add.xml new file mode 100755 index 000000000000..02de44cf6084 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-add.xml @@ -0,0 +1,11 @@ + + + + + + + httpservice-2.2 + ssl-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-product-add.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-product-add.xml new file mode 100755 index 000000000000..146631537b27 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-product-add.xml @@ -0,0 +1,11 @@ + + + + + + + httpservice-2.2 + testproduct:prodtest-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-remove.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-remove.xml new file mode 100755 index 000000000000..5de305e78ab6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-remove.xml @@ -0,0 +1,10 @@ + + + + + + + httpservice-2.2 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-user-add.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-user-add.xml new file mode 100755 index 000000000000..23ea4a99ed83 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server-user-add.xml @@ -0,0 +1,11 @@ + + + + + + + httpservice-2.2 + usr:usertest + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server.xml new file mode 100755 index 000000000000..5de305e78ab6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.bvt/server.xml @@ -0,0 +1,10 @@ + + + + + + + httpservice-2.2 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/bootstrap.properties new file mode 100755 index 000000000000..a809f012e2eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/dropins/esas.war/usertest.dependency.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/dropins/esas.war/usertest.dependency.esa new file mode 100755 index 000000000000..0ef59087b4c4 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/dropins/esas.war/usertest.dependency.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/dropins/esas.war/usertest.with.dependency.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/dropins/esas.war/usertest.with.dependency.esa new file mode 100755 index 000000000000..ebbfcee9bc73 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/dropins/esas.war/usertest.with.dependency.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/server.xml new file mode 100755 index 000000000000..a27e8218a497 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.esa.provider/server.xml @@ -0,0 +1,10 @@ + + + + + + + servlet-3.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.install/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.install/bootstrap.properties new file mode 100755 index 000000000000..a809f012e2eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.install/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.install/dropins/feature.war/usertest.esa b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.install/dropins/feature.war/usertest.esa new file mode 100755 index 000000000000..05653fcc8224 Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.install/dropins/feature.war/usertest.esa differ diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.install/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.install/server.xml new file mode 100755 index 000000000000..789e25dd925e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.install/server.xml @@ -0,0 +1,9 @@ + + + + + + servlet-3.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/dropins/static.war/test.html b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/dropins/static.war/test.html new file mode 100755 index 000000000000..a6ab6a86412f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/dropins/static.war/test.html @@ -0,0 +1,8 @@ + + +Test page. + + +

Success

+ + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/dropins/static.war/test.txt b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/dropins/static.war/test.txt new file mode 100755 index 000000000000..4ccc03a671d4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/dropins/static.war/test.txt @@ -0,0 +1,2 @@ +This is Mini-WOPR. Welcome Dr Falken. +PASS static content worked ok =) \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/server.xml new file mode 100755 index 000000000000..789e25dd925e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.minify/server.xml @@ -0,0 +1,9 @@ + + + + + + servlet-3.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.product/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.product/bootstrap.properties new file mode 100755 index 000000000000..a809f012e2eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.product/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.tool/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.tool/bootstrap.properties new file mode 100755 index 000000000000..a809f012e2eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.tool/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.user/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.user/bootstrap.properties new file mode 100755 index 000000000000..a809f012e2eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat.user/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat/bootstrap.properties new file mode 100755 index 000000000000..a809f012e2eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat/server.xml new file mode 100755 index 000000000000..2e6622d9d350 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.fat/server.xml @@ -0,0 +1,12 @@ + + + + + + featureA-1.0 + featureB-1.0 + featureC-1.0 + featureD-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.featureConflict/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.featureConflict/bootstrap.properties new file mode 100755 index 000000000000..922f8152702e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.featureConflict/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties +osgi.console=5678 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.featureConflict/override_tolerates_bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.featureConflict/override_tolerates_bootstrap.properties new file mode 100755 index 000000000000..e68eac5f5975 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.featureConflict/override_tolerates_bootstrap.properties @@ -0,0 +1,4 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties +osgi.console=5678 +tolerates.com.ibm.websphere.appserver.capabilityA=2.0 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.ignoreAPI/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.ignoreAPI/bootstrap.properties new file mode 100755 index 000000000000..e92768692960 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.ignoreAPI/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +com.ibm.ws.kernel.classloading.apiPackagesToHide=org.codehaus.jackson.xc \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.ignoreAPI/dropins/IgnoreAPI.ear/IgnoreAPIEJB.jar/com/ibm/ws/kernel/feature/ignoreAPI/IgnoreAPIBean.java b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.ignoreAPI/dropins/IgnoreAPI.ear/IgnoreAPIEJB.jar/com/ibm/ws/kernel/feature/ignoreAPI/IgnoreAPIBean.java new file mode 100755 index 000000000000..97a2276836cb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.ignoreAPI/dropins/IgnoreAPI.ear/IgnoreAPIEJB.jar/com/ibm/ws/kernel/feature/ignoreAPI/IgnoreAPIBean.java @@ -0,0 +1,40 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package com.ibm.ws.kernel.feature.ignoreAPI; + +import javax.annotation.PostConstruct; +import javax.ejb.LocalBean; +import javax.ejb.Singleton; +import javax.ejb.Startup; + + + +@Startup +@Singleton +@LocalBean +public class IgnoreAPIBean { + private final static String EYE_CATCHER = "*** IgnoreAPITest- able to load blocked package: "; + + @PostConstruct + public void init() { + // Using our super-secret bootstrap propery, we have blocked access to the + // org.codehaus.jackson.xc package. So the following class load should fail. + try { + Class.forName("org.codehaus.jackson.xc.XmlAdapterJsonSerializer"); + System.out.println(EYE_CATCHER + "true"); + } catch (ClassNotFoundException ex) { + System.out.println(EYE_CATCHER + "false"); + } + } + +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.ignoreAPI/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.ignoreAPI/server.xml new file mode 100755 index 000000000000..6774e763e134 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.ignoreAPI/server.xml @@ -0,0 +1,7 @@ + + + + restConnector-1.0 + ejbLite-3.1 + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.isolation/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.isolation/bootstrap.properties new file mode 100755 index 000000000000..ed2a90758a5d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.isolation/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.logging.trace.specification=FeatureManager=all=enabled:*=event=enabled +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.miniest/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.miniest/server.xml new file mode 100755 index 000000000000..fb1e4f77cb28 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.miniest/server.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.override/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.override/bootstrap.properties new file mode 100755 index 000000000000..ed2a90758a5d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.override/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.logging.trace.specification=FeatureManager=all=enabled:*=event=enabled +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.process.type/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.process.type/bootstrap.properties new file mode 100755 index 000000000000..ed2a90758a5d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.process.type/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.logging.trace.specification=FeatureManager=all=enabled:*=event=enabled +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.simple/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.simple/bootstrap.properties new file mode 100755 index 000000000000..dbefe35492b0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.simple/bootstrap.properties @@ -0,0 +1,2 @@ +ds.logLevel=DEBUG +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.simple/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.simple/server.xml new file mode 100755 index 000000000000..911636c0b040 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature.simple/server.xml @@ -0,0 +1,11 @@ + + + + + + osgiConsole-1.0 + jsp-2.2 + jdbc-4.0 + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature/bootstrap.properties new file mode 100755 index 000000000000..a809f012e2eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.feature/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.icons_test/bootstrap.properties b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.icons_test/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.icons_test/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.icons_test/server.xml b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.icons_test/server.xml new file mode 100755 index 000000000000..0f3ee238e9d7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/publish/servers/com.ibm.ws.kernel.icons_test/server.xml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-applications/ServletTest/resources/WEB-INF/web.xml b/dev/com.ibm.ws.kernel.feature_fat/test-applications/ServletTest/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..44819f071443 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-applications/ServletTest/resources/WEB-INF/web.xml @@ -0,0 +1,12 @@ + + + KernelTestServlet + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-applications/ServletTest/src/com/ibm/ws/kernel/test/ServletTest.java b/dev/com.ibm.ws.kernel.feature_fat/test-applications/ServletTest/src/com/ibm/ws/kernel/test/ServletTest.java new file mode 100755 index 000000000000..a04283ca9782 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-applications/ServletTest/src/com/ibm/ws/kernel/test/ServletTest.java @@ -0,0 +1,48 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.test; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet implementation class Servlet1 + */ +@WebServlet("/ServletTest") +public class ServletTest extends HttpServlet { + + /** */ + private static final long serialVersionUID = -451670363319769693L; + + /** + * @see HttpServlet#HttpServlet() + */ + public ServletTest() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + response.getOutputStream().println("This is Mini-WOPR. Welcome Dr Falken."); + response.getOutputStream().println("PASS: servlet ran"); + } + +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-applications/test.feature.api.client/resources/WEB-INF/web.xml b/dev/com.ibm.ws.kernel.feature_fat/test-applications/test.feature.api.client/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..44819f071443 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-applications/test.feature.api.client/resources/WEB-INF/web.xml @@ -0,0 +1,12 @@ + + + KernelTestServlet + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-applications/test.feature.api.client/src/test/feature/api/client/ApiClientTest.java b/dev/com.ibm.ws.kernel.feature_fat/test-applications/test.feature.api.client/src/test/feature/api/client/ApiClientTest.java new file mode 100755 index 000000000000..e0cddf771f59 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-applications/test.feature.api.client/src/test/feature/api/client/ApiClientTest.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.feature.api.client; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet("/apiClient") +public class ApiClientTest extends HttpServlet { + /** */ + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + try { + Class someAPIClass = Class.forName("test.feature.api.SomeAPI"); + response.getOutputStream().println(getClass().getSimpleName() + ":" + someAPIClass.newInstance().toString()); + } catch (ClassNotFoundException e) { + response.getOutputStream().println("FAILED"); + } catch (Exception e) { + throw new ServletException(e); + } + } + +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.api/bnd.bnd b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.api/bnd.bnd new file mode 100755 index 000000000000..e63a956e8773 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.api/bnd.bnd @@ -0,0 +1,10 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: test.feature.api +Bundle-SymbolicName: test.feature.api +Bundle-Description: test feature bundle that exports some API + +Export-Package: test.feature.api diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.api/src/test/feature/api/SomeAPI.java b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.api/src/test/feature/api/SomeAPI.java new file mode 100755 index 000000000000..38a8f500868a --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.api/src/test/feature/api/SomeAPI.java @@ -0,0 +1,19 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.feature.api; + +public class SomeAPI { + @Override + public String toString() { + return "SUCCESS"; + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.provisioner/bnd.bnd b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.provisioner/bnd.bnd new file mode 100755 index 000000000000..d71372d34d90 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.provisioner/bnd.bnd @@ -0,0 +1,13 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: FeatureProvisioner +Bundle-SymbolicName: test.feature.provisioner; singleton:=true +Bundle-Description: This bundle provides a web interface for the tests to refresh the autofeatures in the features directory; version=${bVersion} +Web-ContextPath: feature + +# hide the implementation packages +Private-Package: \ + test.kernel.feature \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.provisioner/src/test/kernel/feature/FeatureProvisionerServlet.java b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.provisioner/src/test/kernel/feature/FeatureProvisionerServlet.java new file mode 100755 index 000000000000..6558de164876 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.feature.provisioner/src/test/kernel/feature/FeatureProvisionerServlet.java @@ -0,0 +1,63 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.kernel.feature; + +import java.io.IOException; +import java.io.Writer; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +import com.ibm.ws.kernel.feature.FeatureProvisioner; + +/** + * + */ +@WebServlet(urlPatterns = { "provisioner" }) +public class FeatureProvisionerServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = 8280749374546298397L; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + Writer responseWriter = resp.getWriter(); + FeatureProvisioner provisionerService = null; + try { + BundleContext ctxt = (BundleContext) req.getServletContext().getAttribute("osgi-bundlecontext"); + ServiceReference featureProvisionerRef = ctxt.getServiceReference(FeatureProvisioner.class); + if (featureProvisionerRef != null) { + provisionerService = ctxt.getService(featureProvisionerRef); + } + if (provisionerService != null) { + provisionerService.refreshFeatures(); + responseWriter.write("FeatureProvisioner: features refreshed."); + } else { + responseWriter.write("FeatureProvisioner: No service found."); + } + } finally { + responseWriter.flush(); + responseWriter.close(); + } + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.consumer/bnd.bnd b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.consumer/bnd.bnd new file mode 100755 index 000000000000..1ab0409b34b7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.consumer/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: test.service.consumer +Bundle-SymbolicName: test.service.consumer + +# hide the implementation packages +Private-Package: \ + test.service.consumer + +-dsannotations: \ + test.service.consumer.ApiServiceConsumer, \ + test.service.consumer.NotApiServiceConsumer diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.consumer/src/test/service/consumer/ApiServiceConsumer.java b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.consumer/src/test/service/consumer/ApiServiceConsumer.java new file mode 100755 index 000000000000..f33a523be0a5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.consumer/src/test/service/consumer/ApiServiceConsumer.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.service.consumer; + +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; + +import com.ibm.ws.kernel.feature.test.api.ApiService; + +/** + * + */ +@Component(service = {}) +public class ApiServiceConsumer { + private ApiService apiService; + + @Reference(cardinality = ReferenceCardinality.OPTIONAL) + protected void setApiService(ApiService apiService) { + this.apiService = apiService; + } + + @Activate + protected void activate() { + if (apiService == null) { + // This is unexpected because ApiService should be accessible + System.out.println("ApiService - FAILED"); + } else { + System.out.println(apiService.doTest()); + } + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.consumer/src/test/service/consumer/NotApiServiceConsumer.java b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.consumer/src/test/service/consumer/NotApiServiceConsumer.java new file mode 100755 index 000000000000..9f2e0569eaa8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.consumer/src/test/service/consumer/NotApiServiceConsumer.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.service.consumer; + +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; + +import com.ibm.ws.kernel.feature.test.api.NotApiService; + +/** + * + */ +@Component(service = {}) +public class NotApiServiceConsumer { + private NotApiService notApiService; + + @Reference(cardinality = ReferenceCardinality.OPTIONAL) + protected void setNotApiService(NotApiService apiService) { + this.notApiService = apiService; + } + + @Activate + protected void activate() { + if (notApiService == null) { + // this is the expected outcome because NotApiService should be hidden + System.out.println("NotApiService - SUCCESS"); + } else { + System.out.println(notApiService.doTest()); + } + } +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.provider/bnd.bnd b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.provider/bnd.bnd new file mode 100755 index 000000000000..9b62d785d9e9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.provider/bnd.bnd @@ -0,0 +1,18 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: test.service.provider +Bundle-SymbolicName: test.service.provider + +Export-Package: \ + com.ibm.ws.kernel.feature.test.api + +# hide the implementation packages +Private-Package: \ + test.service.provider + +-dsannotations: \ + test.service.provider.ApiServiceImpl, \ + test.service.provider.NotApiServiceImpl diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.provider/src/test/service/provider/ApiServiceImpl.java b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.provider/src/test/service/provider/ApiServiceImpl.java new file mode 100755 index 000000000000..a54255885603 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.provider/src/test/service/provider/ApiServiceImpl.java @@ -0,0 +1,34 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.service.provider; + +import org.osgi.service.component.annotations.Component; + +import com.ibm.ws.kernel.feature.test.api.ApiService; + +/** + * + */ +@Component(service = ApiService.class) +public class ApiServiceImpl implements ApiService { + + /* + * (non-Javadoc) + * + * @see com.ibm.ws.kernel.feature.test.api.ApiService#doTest() + */ + @Override + public String doTest() { + return "ApiService - SUCCESS"; + } + +} diff --git a/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.provider/src/test/service/provider/NotApiServiceImpl.java b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.provider/src/test/service/provider/NotApiServiceImpl.java new file mode 100755 index 000000000000..952db9536c53 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_fat/test-bundles/test.service.provider/src/test/service/provider/NotApiServiceImpl.java @@ -0,0 +1,34 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.service.provider; + +import org.osgi.service.component.annotations.Component; + +import com.ibm.ws.kernel.feature.test.api.NotApiService; + +/** + * + */ +@Component(service = NotApiService.class) +public class NotApiServiceImpl implements NotApiService { + + /* + * (non-Javadoc) + * + * @see com.ibm.ws.kernel.feature.test.api.NotApiService#doTest() + */ + @Override + public String doTest() { + return "NotApiService - FAILED"; + } + +} diff --git a/dev/com.ibm.ws.kernel.feature_test/.classpath b/dev/com.ibm.ws.kernel.feature_test/.classpath new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_test/.classpath.gradle b/dev/com.ibm.ws.kernel.feature_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.feature_test/.gitignore b/dev/com.ibm.ws.kernel.feature_test/.gitignore new file mode 100644 index 000000000000..c1887a90e517 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/.gitignore @@ -0,0 +1,7 @@ +*.log* +defaultServer +dist +workarea +/*.ec +/lib +/reports diff --git a/dev/com.ibm.ws.kernel.feature_test/.project b/dev/com.ibm.ws.kernel.feature_test/.project new file mode 100755 index 000000000000..e3db019e6c5c --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.feature_test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.feature_test/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.feature_test/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.feature_test/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.feature_test/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..845c3083c7df --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.feature_test/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.feature_test/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..fadbc117581b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=true +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.feature_test/bnd.bnd b/dev/com.ibm.ws.kernel.feature_test/bnd.bnd new file mode 100644 index 000000000000..f915f94644ea --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/bnd.bnd @@ -0,0 +1,27 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.kernel.feature_test/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.feature_test/bnd.bnd.gradle new file mode 100644 index 000000000000..f915f94644ea --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/bnd.bnd.gradle @@ -0,0 +1,27 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.kernel.feature_test/build-unittest.xml b/dev/com.ibm.ws.kernel.feature_test/build-unittest.xml new file mode 100755 index 000000000000..1aae8cf30edc --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/build-unittest.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.zos.diagnostics_test/build.nogradle b/dev/com.ibm.ws.kernel.feature_test/build.gradle similarity index 100% rename from dev/com.ibm.ws.zos.diagnostics_test/build.nogradle rename to dev/com.ibm.ws.kernel.feature_test/build.gradle diff --git a/dev/com.ibm.ws.kernel.feature_test/delivery.sets b/dev/com.ibm.ws.kernel.feature_test/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.a-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.a-1.0.mf new file mode 100755 index 000000000000..b5719d97dc97 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.a-1.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t1.a-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.a-1.1.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.a-1.1.mf new file mode 100755 index 000000000000..5ebc35aabdc6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.a-1.1.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t1.a-1.1; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.auto.t1.c-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.auto.t1.c-1.0.mf new file mode 100755 index 000000000000..3e8ac541daa0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.auto.t1.c-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t1.auto.t1.c-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +IBM-Provision-Capability: osgi.identity; filter:="(osgi.identity=t1.c-1.0)" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.b-0.9.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.b-0.9.mf new file mode 100755 index 000000000000..60677caa5638 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.b-0.9.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t1.b-0.9; visibility:=public; singleton:=true +Subsystem-Version: 0.9 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t1.a-0.9; type="osgi.subsystem.feature"; ibm.tolerates:="1.0, 1.1" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.b-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.b-1.0.mf new file mode 100755 index 000000000000..2fe37194f0ad --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.b-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t1.b-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t1.a-1.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.b-1.1.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.b-1.1.mf new file mode 100755 index 000000000000..a514c0ffdd24 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.b-1.1.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t1.b-1.1; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t1.a-1.1; type="osgi.subsystem.feature"; ibm.tolerates:="1.0" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.c-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.c-1.0.mf new file mode 100755 index 000000000000..18907db623c0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.c-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t1.c-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t1.a-1.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.c-1.1.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.c-1.1.mf new file mode 100755 index 000000000000..63f07dc428f0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t1.c-1.1.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t1.c-1.1; visibility:=public; singleton:=true +Subsystem-Version: 1.1 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t1.a-1.1; type="osgi.subsystem.feature"; ibm.tolerates:="1.0" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t10.a-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t10.a-1.0.mf new file mode 100644 index 000000000000..82e0bf81ab1d Binary files /dev/null and b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t10.a-1.0.mf differ diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.x-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.x-1.0.mf new file mode 100755 index 000000000000..d2fb5977b325 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.x-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t2.x-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t2.y-1.0; type="osgi.subsystem.feature"; ibm.tolerates:="1.1", + t2.z-1.0; type="osgi.subsystem.feature"; ibm.tolerates:="1.1", + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.y-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.y-1.0.mf new file mode 100755 index 000000000000..2bb6dd748aa9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.y-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t2.y-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t2.z-1.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.y-1.1.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.y-1.1.mf new file mode 100755 index 000000000000..23a531e5bda0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.y-1.1.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t2.y-1.1; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t2.z-1.1; type="osgi.subsystem.feature"; ibm.tolerates:="1.0" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.z-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.z-1.0.mf new file mode 100755 index 000000000000..665b5b9488ca --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.z-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t2.z-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.z-1.1.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.z-1.1.mf new file mode 100755 index 000000000000..bed7270a8534 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t2.z-1.1.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t2.z-1.1; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.a-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.a-1.0.mf new file mode 100755 index 000000000000..7d9c05a7195d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.a-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t3.a-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t3.d-2.0; ibm.tolerates:="1.0, 3.0"; type="osgi.subsystem.feature", + t3.e-2.0; ibm.tolerates:="1.0, 3.0"; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.b-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.b-1.0.mf new file mode 100755 index 000000000000..04449dbb9ae3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.b-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t3.b-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t3.d-3.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature", + t3.e-3.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.c-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.c-1.0.mf new file mode 100755 index 000000000000..5325aa963d34 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.c-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t3.c-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t3.d-1.0; ibm.tolerates:="1.0, 2.0"; type="osgi.subsystem.feature", + t3.e-1.0; ibm.tolerates:="1.0, 2.0"; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-1.0.mf new file mode 100755 index 000000000000..a7895b4dea71 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-1.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t3.d-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-2.0.mf new file mode 100755 index 000000000000..dc94f5181046 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-2.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t3.d-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-3.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-3.0.mf new file mode 100755 index 000000000000..f3776ffb91e3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-3.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t3.d-3.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-4.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-4.0.mf new file mode 100755 index 000000000000..e27161979003 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.d-4.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t3.d-4.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-1.0.mf new file mode 100755 index 000000000000..415d58659a3c --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-1.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t3.e-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-2.0.mf new file mode 100755 index 000000000000..2ace4143f97e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-2.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t3.e-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-3.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-3.0.mf new file mode 100755 index 000000000000..7d5c35c6fd1d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-3.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t3.e-3.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-4.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-4.0.mf new file mode 100755 index 000000000000..2943f798499f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.e-4.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t3.e-4.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.f-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.f-1.0.mf new file mode 100755 index 000000000000..5a5d9e2dc464 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.f-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t3.f-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t3.d-1.0; type="osgi.subsystem.feature", + t3.e-1.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.g-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.g-1.0.mf new file mode 100755 index 000000000000..aa149ec5544b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t3.g-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t3.g-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t3.d-3.0; ibm.tolerates:="4.0"; type="osgi.subsystem.feature", + t3.e-3.0; ibm.tolerates:="4.0"; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.a-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.a-1.0.mf new file mode 100755 index 000000000000..e6c9facf36fc --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.a-1.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t4.a-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.a-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.a-2.0.mf new file mode 100755 index 000000000000..c7510e047810 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.a-2.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t4.a-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.b-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.b-1.0.mf new file mode 100755 index 000000000000..080dec092b5f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.b-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t4.b-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t4.a-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.b-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.b-2.0.mf new file mode 100755 index 000000000000..120e10388101 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.b-2.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t4.b-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t4.a-2.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.c-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.c-1.0.mf new file mode 100755 index 000000000000..98f652decf5a --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.c-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t4.c-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t4.a-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature", + t4.b-2.0; ibm.tolerates:="1.0"; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.d-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.d-1.0.mf new file mode 100755 index 000000000000..f1dce7149753 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.d-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t4.d-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t4.e-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.d-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.d-2.0.mf new file mode 100755 index 000000000000..02c3b7ed1e34 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.d-2.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t4.d-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t4.e-2.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.e-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.e-1.0.mf new file mode 100755 index 000000000000..9f347047a694 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.e-1.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t4.e-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.e-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.e-2.0.mf new file mode 100755 index 000000000000..fca373b97b4d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.e-2.0.mf @@ -0,0 +1,3 @@ +Subsystem-SymbolicName: t4.e-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.f-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.f-1.0.mf new file mode 100755 index 000000000000..c2eb351f937c --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t4.f-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t4.f-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t4.d-2.0; ibm.tolerates:="1.0"; type="osgi.subsystem.feature", + t4.e-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t5.a-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t5.a-1.0.mf new file mode 100755 index 000000000000..e14d68f14db6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t5.a-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t5.a-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t5.c-1.0; type="osgi.subsystem.feature" \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t5.b-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t5.b-1.0.mf new file mode 100755 index 000000000000..9ccd93f82bee --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t5.b-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t5.b-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t5.a-1.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t5.c-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t5.c-1.0.mf new file mode 100755 index 000000000000..0b68fa10a1ce --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t5.c-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t5.c-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t5.b-1.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t6.a-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t6.a-1.0.mf new file mode 100755 index 000000000000..2a09909a9686 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t6.a-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t6.a-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t6.b-1.0; type="osgi.subsystem.feature", + missing.a-1.0; type="osgi.subsystem.feature", + missing.b-1.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t6.b-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t6.b-1.0.mf new file mode 100755 index 000000000000..1b6a35b5ee97 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t6.b-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t6.b-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + missing.a-1.0; type="osgi.subsystem.feature", + missing.b-1.0; type="osgi.subsystem.feature", + missing.c-1.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.a-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.a-1.0.mf new file mode 100755 index 000000000000..7542309c0356 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.a-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.a-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.c-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature", + t7.d-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.1-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.1-1.0.mf new file mode 100755 index 000000000000..ad4e10aafcfa --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.1-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t7.auto.1-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +IBM-Provision-Capability: osgi.identity; filter:="(osgi.identity=t7.h-2.0)", osgi.identity; filter:="(osgi.identity=t7.i-2.0)" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.2-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.2-1.0.mf new file mode 100755 index 000000000000..8ccb10a8947e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.2-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t7.auto.2-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +IBM-Provision-Capability: osgi.identity; filter:="(osgi.identity=t7.j-1.0)", osgi.identity; filter:="(osgi.identity=t7.k-1.0)" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.3-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.3-1.0.mf new file mode 100755 index 000000000000..d1aad079fa82 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.3-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t7.auto.3-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +IBM-Provision-Capability: osgi.identity; filter:="(|(osgi.identity=t7.h-2.0)(osgi.identity=t7.h-1.0))" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.4-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.4-1.0.mf new file mode 100755 index 000000000000..c301c6741740 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.4-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-SymbolicName: t7.auto.4-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.b-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature" +IBM-Provision-Capability: + osgi.identity; filter:="(|(osgi.identity=t7.h-1.0)(osgi.identity=t7.h-2.0))", + osgi.identity; filter:="(osgi.identity=t7.p-1.0)" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.5-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.5-1.0.mf new file mode 100755 index 000000000000..af7919d5f7ec --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.auto.5-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.auto.5-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +IBM-Provision-Capability: + osgi.identity; filter:="(osgi.identity=t7.auto.4-1.0)", + osgi.identity; filter:="(osgi.identity=t7.q-1.0)" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.b-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.b-1.0.mf new file mode 100755 index 000000000000..5807e69239f0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.b-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.b-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.f-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature", + t7.g-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.c-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.c-1.0.mf new file mode 100755 index 000000000000..842bcb08a2f9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.c-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.c-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.h-1.0; type="osgi.subsystem.feature", + t7.i-1.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.c-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.c-2.0.mf new file mode 100755 index 000000000000..940b642a9c36 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.c-2.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.c-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.h-2.0; ibm.tolerates:="1.0"; type="osgi.subsystem.feature", + t7.i-2.0; ibm.tolerates:="1.0"; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.d-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.d-1.0.mf new file mode 100755 index 000000000000..85a285856639 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.d-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.d-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.j-1.0; type="osgi.subsystem.feature", + t7.k-1.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.d-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.d-2.0.mf new file mode 100755 index 000000000000..50bd36a5331d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.d-2.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.d-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.j-2.0; ibm.tolerates:="1.0"; type="osgi.subsystem.feature", + t7.k-2.0; ibm.tolerates:="1.0"; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.f-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.f-1.0.mf new file mode 100755 index 000000000000..057900cdef82 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.f-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.f-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.l-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature", + t7.m-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature", + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.f-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.f-2.0.mf new file mode 100755 index 000000000000..021fe04e57bd --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.f-2.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.f-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.l-2.0; type="osgi.subsystem.feature", + t7.m-2.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.g-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.g-1.0.mf new file mode 100755 index 000000000000..d432fe62417d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.g-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.g-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.n-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature", + t7.o-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.g-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.g-2.0.mf new file mode 100755 index 000000000000..5b197cf19ed1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.g-2.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.g-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.n-2.0; type="osgi.subsystem.feature", + t7.o-2.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.h-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.h-1.0.mf new file mode 100755 index 000000000000..db61badce568 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.h-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t7.h-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.h-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.h-2.0.mf new file mode 100755 index 000000000000..30595b8ccf4d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.h-2.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t7.h-2.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.i-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.i-1.0.mf new file mode 100755 index 000000000000..3d9bc66d04c7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.i-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t7.i-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.i-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.i-2.0.mf new file mode 100755 index 000000000000..fda1018e3c8b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.i-2.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t7.i-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.j-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.j-1.0.mf new file mode 100755 index 000000000000..b577be5c3709 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.j-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t7.j-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.j-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.j-2.0.mf new file mode 100755 index 000000000000..6f1c2530e00f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.j-2.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t7.j-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.k-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.k-1.0.mf new file mode 100755 index 000000000000..5fa6556492f3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.k-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t7.k-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.k-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.k-2.0.mf new file mode 100755 index 000000000000..43bd5d885a0e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.k-2.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t7.k-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.l-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.l-1.0.mf new file mode 100755 index 000000000000..58dfb4b0c9d6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.l-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t7.l-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.h-2.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.l-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.l-2.0.mf new file mode 100755 index 000000000000..301322b8b8ff --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.l-2.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t7.l-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.h-2.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.m-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.m-1.0.mf new file mode 100755 index 000000000000..4878f6790456 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.m-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t7.m-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.i-2.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.m-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.m-2.0.mf new file mode 100755 index 000000000000..aeb76af1376e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.m-2.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t7.m-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.i-2.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.n-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.n-1.0.mf new file mode 100755 index 000000000000..6be87f110386 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.n-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t7.n-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.j-2.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.n-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.n-2.0.mf new file mode 100755 index 000000000000..3d34483cdda9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.n-2.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t7.n-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.j-2.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.o-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.o-1.0.mf new file mode 100755 index 000000000000..50c11759e79b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.o-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t7.o-1.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.k-2.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.o-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.o-2.0.mf new file mode 100755 index 000000000000..560672ad2632 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.o-2.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t7.o-2.0; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.k-2.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.p-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.p-1.0.mf new file mode 100755 index 000000000000..d56929961d01 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.p-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t7.p-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.q-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.q-1.0.mf new file mode 100755 index 000000000000..fc23ef815304 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.q-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t7.q-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.r-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.r-1.0.mf new file mode 100755 index 000000000000..13ce4974ae48 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.r-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t7.r-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.a-1.0; type="osgi.subsystem.feature", + t7.b-1.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.s-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.s-1.0.mf new file mode 100755 index 000000000000..45101da376cb --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.s-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-SymbolicName: t7.s-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.a-1.0; type="osgi.subsystem.feature", + t7.b-1.0; type="osgi.subsystem.feature", + t7.c-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature", + t7.d-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.t-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.t-1.0.mf new file mode 100755 index 000000000000..6f5d3f10f40e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.t-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-SymbolicName: t7.t-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.a-1.0; type="osgi.subsystem.feature", + t7.b-1.0; type="osgi.subsystem.feature", + t7.c-1.0; type="osgi.subsystem.feature", + t7.d-1.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.u-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.u-1.0.mf new file mode 100755 index 000000000000..441185a03a5b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.u-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.u-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.s-1.0; type="osgi.subsystem.feature", + t7.c-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature", + t7.d-1.0; ibm.tolerates:="2.0"; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.v-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.v-1.0.mf new file mode 100755 index 000000000000..59f122772871 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t7.v-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t7.v-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t7.s-1.0; type="osgi.subsystem.feature", + t7.c-1.0; ibm.tolerates:="1.0"; type="osgi.subsystem.feature", + t7.d-1.0; ibm.tolerates:="1.0"; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.jsp-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.jsp-1.0.mf new file mode 100755 index 000000000000..64a0f8a8592f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.jsp-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t8.jsp-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t8.servlet-1.0; ibm.tolerates:=2.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.portlet-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.portlet-1.0.mf new file mode 100755 index 000000000000..82863006d5d5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.portlet-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t8.portlet-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t8.jsp-1.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.portlet-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.portlet-2.0.mf new file mode 100755 index 000000000000..5ec9b0ffa6e0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.portlet-2.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t8.portlet-2.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t8.jsp-1.0; type="osgi.subsystem.feature", + t8.servlet-1.0; type="osgi.subsystem.feature"; ibm.tolerates:=2.0 diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.servlet-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.servlet-1.0.mf new file mode 100755 index 000000000000..3d79417ee731 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.servlet-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t8.servlet-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.servlet-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.servlet-2.0.mf new file mode 100755 index 000000000000..54729ed67e06 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.servlet-2.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t8.servlet-2.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.websockets-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.websockets-1.0.mf new file mode 100755 index 000000000000..950b5d425191 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.websockets-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t8.websockets-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t8.servlet-2.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.x-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.x-1.0.mf new file mode 100755 index 000000000000..cdbecca99f70 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.x-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t8.x-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t8.servlet-1.0; type="osgi.subsystem.feature"; ibm.tolerates:=2.0, + t8.portlet-1.0; type="osgi.subsystem.feature" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.x-2.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.x-2.0.mf new file mode 100755 index 000000000000..f69d41b6e0c2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t8.x-2.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t8.x-2.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t8.servlet-1.0; type="osgi.subsystem.feature"; ibm.tolerates:=2.0, + t8.portlet-1.0; type="osgi.subsystem.feature"; ibm.tolerates:=2.0 diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a-1.0.mf new file mode 100755 index 000000000000..a7c0daf0ebf7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t9.a-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t9.b-1.0; ibm.tolerates:="1.1"; type="osgi.subsystem.feature", + t9.c-1.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a-1.1.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a-1.1.mf new file mode 100755 index 000000000000..d576e5d6868b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a-1.1.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t9.a-1.1; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t9.c-1.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.client-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.client-1.0.mf new file mode 100755 index 000000000000..3e5b6ffb7f57 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.client-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t9.a.client-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +IBM-Process-Types: client diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.client.server-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.client.server-1.0.mf new file mode 100755 index 000000000000..c0eda910c6c6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.client.server-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t9.a.client.server-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +IBM-Process-Types: client, server diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.client.server.auto.server-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.client.server.auto.server-1.0.mf new file mode 100755 index 000000000000..8a118a05c57c --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.client.server.auto.server-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t9.a.client.server.auto.server-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +IBM-Process-Types: server +IBM-Provision-Capability: osgi.identity; filter:="(osgi.identity=t9.a.client.server-1.0)" diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.server-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.server-1.0.mf new file mode 100755 index 000000000000..2f361668c9c8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.a.server-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t9.a.server-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +IBM-Process-Types: server diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b-1.0.mf new file mode 100755 index 000000000000..bf4825886fda --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b-1.0.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t9.b-1.0; visibility:=public; singleton:=true +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b-1.1.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b-1.1.mf new file mode 100755 index 000000000000..f6b8c8da470d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b-1.1.mf @@ -0,0 +1,4 @@ +Subsystem-SymbolicName: t9.b-1.1; visibility:=public; singleton:=true +Subsystem-Version: 1.1 +Subsystem-Type: osgi.subsystem.feature + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b.client-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b.client-1.0.mf new file mode 100755 index 000000000000..fab545330c09 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b.client-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t9.b.client-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t9.a.client-1.0; type="osgi.subsystem.feature" +IBM-Process-Types: client, server diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b.client.server-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b.client.server-1.0.mf new file mode 100755 index 000000000000..a6aeb8aa4fe4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b.client.server-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t9.b.client.server-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t9.a.client.server-1.0; type="osgi.subsystem.feature" +IBM-Process-Types: client, server diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b.server-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b.server-1.0.mf new file mode 100755 index 000000000000..a83efe18a73b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.b.server-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t9.b.server-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t9.a.server-1.0; type="osgi.subsystem.feature" +IBM-Process-Types: client, server diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c-1.0.mf new file mode 100755 index 000000000000..b2735bfc40ed --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-SymbolicName: t9.c-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t9.b-1.1; type="osgi.subsystem.feature", + t9.d-1.0; type="osgi.subsystem.feature" + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c.client-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c.client-1.0.mf new file mode 100755 index 000000000000..31c37fae90f0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c.client-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t9.c.client-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t9.b.client-1.0; type="osgi.subsystem.feature" +IBM-Process-Types: client, server diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c.client.server-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c.client.server-1.0.mf new file mode 100755 index 000000000000..9e69cdc416d3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c.client.server-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t9.c.client.server-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t9.b.client.server-1.0; type="osgi.subsystem.feature" +IBM-Process-Types: client, server diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c.server-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c.server-1.0.mf new file mode 100755 index 000000000000..6462686c5d86 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.c.server-1.0.mf @@ -0,0 +1,5 @@ +Subsystem-SymbolicName: t9.c.server-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: t9.b.server-1.0; type="osgi.subsystem.feature" +IBM-Process-Types: client, server diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.d-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.d-1.0.mf new file mode 100755 index 000000000000..f35bd3136a8e --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/resolverData/lib/features/t9.d-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-SymbolicName: t9.d-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: + t9.b-1.0; ibm.tolerates:="1.1"; type="osgi.subsystem.feature", + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/simple.bnd b/dev/com.ibm.ws.kernel.feature_test/unittest/simple.bnd new file mode 100755 index 000000000000..e8c036c941a7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/simple.bnd @@ -0,0 +1,9 @@ +-nouses=true +-resourceonly=true +bVersion=0.1 + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/simple2.bnd b/dev/com.ibm.ws.kernel.feature_test/unittest/simple2.bnd new file mode 100755 index 000000000000..83ffdaf22c9b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/simple2.bnd @@ -0,0 +1,9 @@ +-nouses=true +-resourceonly=true +bVersion=2.0 + +Bundle-Name: simple bundle +Bundle-SymbolicName: simpleTwo +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/simple3.bnd b/dev/com.ibm.ws.kernel.feature_test/unittest/simple3.bnd new file mode 100755 index 000000000000..e39910811dc2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/simple3.bnd @@ -0,0 +1,9 @@ +-nouses=true +-resourceonly=true +bVersion=0.3 + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/simple4.bnd b/dev/com.ibm.ws.kernel.feature_test/unittest/simple4.bnd new file mode 100755 index 000000000000..866b1474f3d1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/simple4.bnd @@ -0,0 +1,9 @@ +-nouses=true +-resourceonly=true +bVersion=0.4 + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} + diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/FeatureManagerTest.java b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/FeatureManagerTest.java new file mode 100755 index 000000000000..2b4450050c0b --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/FeatureManagerTest.java @@ -0,0 +1,804 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.util.Collections; +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; + +import org.eclipse.equinox.region.Region; +import org.eclipse.equinox.region.RegionDigraph; +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JMock; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleListener; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.startlevel.FrameworkStartLevel; +import org.osgi.service.component.ComponentConstants; +import org.osgi.service.component.ComponentContext; + +import com.ibm.ws.kernel.boot.internal.BootstrapConstants; +import com.ibm.ws.kernel.feature.ServerStarted; +import com.ibm.ws.kernel.feature.internal.BundleList.FeatureResourceHandler; +import com.ibm.ws.kernel.feature.internal.FeatureManager.FeatureChange; +import com.ibm.ws.kernel.feature.internal.FeatureManager.ProvisioningMode; +import com.ibm.ws.kernel.feature.internal.subsystem.FeatureRepository; +import com.ibm.ws.kernel.feature.internal.subsystem.FeatureResourceImpl; +import com.ibm.ws.kernel.feature.internal.subsystem.SubsystemFeatureDefinitionImpl; +import com.ibm.ws.kernel.feature.provisioning.FeatureResource; +import com.ibm.ws.kernel.feature.resolver.FeatureResolver.Result; +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry; +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry.BundleRepositoryHolder; +import com.ibm.ws.kernel.provisioning.ContentBasedLocalBundleRepository; +import com.ibm.ws.kernel.service.location.internal.SymbolRegistry; +import com.ibm.ws.runtime.update.RuntimeUpdateManager; +import com.ibm.ws.runtime.update.RuntimeUpdateNotification; +import com.ibm.wsspi.kernel.service.location.VariableRegistry; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; +import com.ibm.wsspi.kernel.service.location.WsResource; +import com.ibm.wsspi.kernel.service.utils.OnErrorUtil; +import com.ibm.wsspi.kernel.service.utils.OnErrorUtil.OnError; + +import junit.framework.AssertionFailedError; +import test.common.SharedLocationManager; +import test.common.SharedOutputManager; +import test.utils.SharedConstants; +import test.utils.TestUtils; +import test.utils.TestUtils.TestBundleRevision; +import test.utils.TestUtils.TestBundleStartLevel; +import test.utils.TestUtils.TestFrameworkStartLevel; + +/** + * + */ +@RunWith(JMock.class) +public class FeatureManagerTest { + static final SharedOutputManager outputMgr = SharedOutputManager.getInstance().trace("*=audit=enabled:featureManager=all=enabled"); + + static final String serverName = "FeatureManagerTest"; + static WsLocationAdmin locSvc; + static Field bListResources; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + outputMgr.captureStreams(); + + bListResources = BundleList.class.getDeclaredField("resources"); + bListResources.setAccessible(true); + + File root = SharedConstants.TEST_DATA_FILE.getCanonicalFile(); + File lib = new File(root, "lib"); + + TestUtils.setUtilsInstallDir(root); + TestUtils.setKernelUtilsBootstrapLibDir(lib); + TestUtils.clearBundleRepositoryRegistry(); + + locSvc = (WsLocationAdmin) SharedLocationManager.createLocations(SharedConstants.TEST_DATA_DIR, serverName); + TestUtils.recursiveClean(locSvc.getServerResource(null)); + + BundleRepositoryRegistry.initializeDefaults(serverName, true); + + SymbolRegistry.getRegistry().addStringSymbol("websphere.kernel", "kernelCore-1.0.mf"); + SymbolRegistry.getRegistry().addStringSymbol("websphere.log.provider", "defaultLogging-1.0.mf"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + outputMgr.restoreStreams(); + + TestUtils.setUtilsInstallDir(null); + TestUtils.setKernelUtilsBootstrapLibDir(null); + TestUtils.clearBundleRepositoryRegistry(); + } + + Mockery context = new JUnit4Mockery(); + + final Bundle mockBundle = context.mock(Bundle.class); + final BundleContext mockBundleContext = context.mock(BundleContext.class); + final ComponentContext mockComponentContext = context.mock(ComponentContext.class); + final ExecutorService executorService = context.mock(ExecutorService.class); + final VariableRegistry variableRegistry = context.mock(VariableRegistry.class); + final MockServiceReference mockLocationService = new MockServiceReference(locSvc); + final MockServiceReference mockScheduledExecutorService = new MockServiceReference(context.mock(ScheduledExecutorService.class)); + final RegionDigraph mockDigraph = context.mock(RegionDigraph.class); + final RuntimeUpdateManager runtimeUpdateManager = context.mock(RuntimeUpdateManager.class); + final RuntimeUpdateNotification appForceRestart = context.mock(RuntimeUpdateNotification.class, "appForceRestart"); + final RuntimeUpdateNotification featureBundlesResolved = context.mock(RuntimeUpdateNotification.class, "featureBundlesResolved"); + final RuntimeUpdateNotification featureBundlesProcessed = context.mock(RuntimeUpdateNotification.class, "featureBundlesProcessed"); + final RuntimeUpdateNotification featureUpdatesCompleted = context.mock(RuntimeUpdateNotification.class, "featureUpdatesCompleted"); + final Region mockKernelRegion = context.mock(Region.class); + final TestBundleRevision mockBundleRevision = context.mock(TestBundleRevision.class); + final TestBundleStartLevel mockBundleStartLevel = context.mock(TestBundleStartLevel.class); + final TestFrameworkStartLevel testFrameworkStartLevel = new TestFrameworkStartLevel(); + + FeatureManager fm; + Provisioner provisioner; + + @Before + public void setUp() { + fm = new FeatureManager(); + fm.featureChanges.clear(); + fm.onError = OnError.WARN; + fm.bundleContext = mockBundleContext; + fm.fwStartLevel = testFrameworkStartLevel; + fm.setExecutorService(executorService); + fm.setLocationService(locSvc); + fm.setVariableRegistry(variableRegistry); + fm.setDigraph(mockDigraph); + fm.setRuntimeUpdateManager(runtimeUpdateManager); + + // We have to activate the FeatureManager here so that the component context will be + // propagated to the AtomicServiceReferences for the locationService and executorService + try { + context.checking(new Expectations() { + { + allowing(mockComponentContext).getBundleContext(); + will(returnValue(mockBundleContext)); + + allowing(mockBundleContext).getBundle(Constants.SYSTEM_BUNDLE_LOCATION); + will(returnValue(mockBundle)); + allowing(mockBundle).getBundleContext(); + will(returnValue(mockBundleContext)); + allowing(mockBundleContext).getBundles(); + will(returnValue(new Bundle[0])); + + //allow mock calls from the BundleInstallOriginBundleListener + allowing(mockBundleContext).getBundle(); + will(returnValue(mockBundle)); + one(mockBundle).getDataFile("bundle.origin.cache"); + //allow the BundleInstallOriginBundleListener to get a ScheduledExecutorService + //and schedule a purge for the future + one(mockBundleContext).getServiceReference(ScheduledExecutorService.class); + will(returnValue(mockScheduledExecutorService)); + one(mockBundleContext).getService(mockScheduledExecutorService); + will(returnValue(mockScheduledExecutorService.getService())); + one(mockScheduledExecutorService.getService()).schedule(with(any(BundleInstallOriginBundleListener.class)), with(any(Integer.class)), + with(any(TimeUnit.class))); + one(mockBundleContext).ungetService(mockScheduledExecutorService); + + allowing(mockBundleContext).addBundleListener(with(any(BundleListener.class))); + + allowing(mockBundleContext).getProperty("websphere.os.extension"); + will(returnValue(null)); + + allowing(mockBundleContext).removeBundleListener(with(any(BundleListener.class))); + + one(mockBundle).adapt(FrameworkStartLevel.class); + will(returnValue(testFrameworkStartLevel)); + + allowing(mockBundleContext).getProperty(with("com.ibm.ws.liberty.content.request")); + will(returnValue(null)); + + allowing(mockBundleContext).getProperty(with("com.ibm.ws.liberty.feature.request")); + will(returnValue(null)); + + allowing(mockBundleContext).getProperty(with("com.ibm.ws.kernel.classloading.apiPackagesToHide")); + will(returnValue(null)); + + allowing(mockBundleContext).getProperty(with("wlp.process.type")); + will(returnValue(BootstrapConstants.LOC_PROCESS_TYPE_SERVER)); + + allowing(mockComponentContext).locateService(with("locationService"), with(any(ServiceReference.class))); + will(returnValue(locSvc)); + allowing(mockComponentContext).locateService(with("executorService"), with(any(ServiceReference.class))); + will(returnValue(executorService)); + allowing(mockComponentContext).locateService(with("variableRegistry"), with(any(ServiceReference.class))); + will(returnValue(variableRegistry)); + + allowing(executorService).execute(with(any(Runnable.class))); + one(variableRegistry).addVariable(with("feature:usr"), with("${usr.extension.dir}/lib/features/")); + + allowing(mockBundleContext).getBundles(); + allowing(mockBundleContext).registerService(with(any(Class.class)), with(any(ServerStarted.class)), with(any(Dictionary.class))); + allowing(mockBundleContext).registerService(with(any(String[].class)), with(any(PackageInspectorImpl.class)), with(any(Dictionary.class))); + + // allow calls to digraph by Provisioner + allowing(mockDigraph).getRegion(mockBundle); + will(returnValue(mockKernelRegion)); + allowing(mockKernelRegion).getName(); + will(returnValue("kernel.region")); + allowing(mockDigraph).copy(); + will(returnValue(mockDigraph)); + + allowing(runtimeUpdateManager).createNotification(RuntimeUpdateNotification.FEATURE_UPDATES_COMPLETED); + will(returnValue(featureUpdatesCompleted)); + allowing(runtimeUpdateManager).createNotification(RuntimeUpdateNotification.APP_FORCE_RESTART); + will(returnValue(appForceRestart)); + allowing(runtimeUpdateManager).createNotification(RuntimeUpdateNotification.FEATURE_BUNDLES_RESOLVED); + will(returnValue(featureBundlesResolved)); + allowing(appForceRestart).setResult(with(any(Boolean.class))); + allowing(featureBundlesResolved).setResult(with(any(Boolean.class))); + allowing(runtimeUpdateManager).getNotification(RuntimeUpdateNotification.FEATURE_BUNDLES_PROCESSED); + will(returnValue(featureBundlesProcessed)); + allowing(featureBundlesProcessed).waitForCompletion(); + allowing(featureUpdatesCompleted).setResult(with(any(Boolean.class))); + } + }); + fm.activate(mockComponentContext, new HashMap()); + } catch (Throwable t) { + outputMgr.failWithThrowable("setUp", t); + } + + fm.featureRepository = new FeatureRepository(); + fm.bundleCache = new BundleList(fm); + + fm.featureRepository.init(); + fm.bundleCache.init(); + + provisioner = new Provisioner(fm, null); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + // Clear the output generated after each method invocation, this keeps + // things sane + outputMgr.resetStreams(); + + TestUtils.recursiveClean(locSvc.getServerResource(null)); + } + + @Test(expected = NullPointerException.class) + public void testUnitializedProvisioner() { + // No provisioner, should blow up with NPE + FeatureChange featureChange = new FeatureChange(runtimeUpdateManager, ProvisioningMode.INITIAL_PROVISIONING, new String[] { "notexist" }); + featureChange.createNotifications(); + fm.updateFeatures(locSvc, null, null, featureChange, 1L); + } + + @Test(expected = IllegalStateException.class) + public void testUnitializedProvisionerWithFailOnError() { + final String m = "testUnitializedProvisionerWithFailOnError"; + try { + fm.onError = OnError.FAIL; + + context.checking(new Expectations() { + { + one(mockBundle).stop(); + } + }); + + // onError is FAIL which means we expect an + // IllegalStateException + FeatureChange featureChange = new FeatureChange(runtimeUpdateManager, ProvisioningMode.INITIAL_PROVISIONING, new String[] { "notexist" }); + featureChange.createNotifications(); + fm.updateFeatures(locSvc, null, null, featureChange, 1L); + } catch (IllegalStateException e) { + throw e; + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testUpdateFeaturesNotExistFeature() { + final String m = "testUpdateFeaturesNotExistFeature"; + try { + // This shouldn't do anything: no return to test-- make sure it doesn't + // blow up w/ NPE! + fm.onError = OnError.WARN; + + String missingFeature = "CWWKF0042E"; + + FeatureChange featureChange = new FeatureChange(runtimeUpdateManager, ProvisioningMode.INITIAL_PROVISIONING, new String[] { "notexist", "NotExist" }); + featureChange.createNotifications(); + fm.updateFeatures(locSvc, provisioner, null, featureChange, 1L); + assertTrue("An error should have been issued about the missing feature", outputMgr.checkForMessages(missingFeature)); + assertTrue("The error message should contain notexist", outputMgr.checkForMessages("notexist")); + assertFalse("The error message should not contain NotExist", outputMgr.checkForMessages("NotExist")); + + // We put notexist on there twice -- this should condense to ONE error message + // for only one missing feature + String err = outputMgr.getCapturedErr(); + int pos = err.indexOf(missingFeature); + assertTrue("Error output should contain the error message: " + pos, pos > -1); + pos = err.indexOf(missingFeature, pos + missingFeature.length()); + assertFalse("Error output should not contain a second error message: " + pos + ": " + err, pos > -1); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test(expected = IllegalStateException.class) + public void testUpdateFeaturesNotExistFeatureWithFailOnError() { + final String m = "testUpdateFeaturesNotExistFeatureWithFailOnError"; + try { + fm.onError = OnError.FAIL; + + context.checking(new Expectations() { + { + one(mockBundle).stop(); + } + }); + + // continueOnError=false means that we expect an IllegalStateException due + // to the non-existant feature 'notexist' + FeatureChange featureChange = new FeatureChange(runtimeUpdateManager, ProvisioningMode.INITIAL_PROVISIONING, new String[] { "notexist" }); + featureChange.createNotifications(); + fm.updateFeatures(locSvc, provisioner, null, featureChange, 1L); + } catch (IllegalStateException e) { + throw e; + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test(expected = IllegalStateException.class) + public void testUpdateFeaturesMixedWithFailOnError() { + final String m = "testUpdateFeaturesMixedWithFailOnError"; + try { + fm.onError = OnError.FAIL; + + final AtomicBoolean installBundlesCalled = new AtomicBoolean(false); + + Provisioner provisioner = new Provisioner(fm, null) { + /** Override installBundles to verify that it is not called in this scenario */ + @Override + public void installBundles(BundleContext bContext, + BundleList bundleList, + BundleInstallStatus installStatus, + int minStartLevel, int defaultStartLevel, int defaultInitialStartLevel, + WsLocationAdmin locSvc) { + installBundlesCalled.set(true); + } + }; + + context.checking(new Expectations() { + { + one(mockBundle).stop(); + } + }); + + // continueOnError=false means that we expect an IllegalStateException due + // to the non-existant feature 'notexist'; installBundles should not be called + // even though there is one existing feature 'good' in the list + FeatureChange featureChange = new FeatureChange(runtimeUpdateManager, ProvisioningMode.INITIAL_PROVISIONING, new String[] { "good", "notexist" }); + featureChange.createNotifications(); + fm.updateFeatures(locSvc, provisioner, null, featureChange, 1L); + assertFalse("installBundles should not have been called", installBundlesCalled.get()); + } catch (IllegalStateException e) { + throw e; + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * @param bundleList + * @return + */ + @SuppressWarnings("unchecked") + protected List getResources(BundleList bundleList) { + try { + return (List) bListResources.get(bundleList); + } catch (Exception e) { + Error err = new AssertionFailedError("Could not obtain the value of FeatureCache.resources"); + err.initCause(e); + throw err; + } + } + + /** + * Test method + */ + @Test + public void testNoEnabledFeatures() { + final String m = "testNoEnabledFeatures"; + try { + fm.onError = OnError.WARN; + FeatureChange featureChange = new FeatureChange(runtimeUpdateManager, ProvisioningMode.INITIAL_PROVISIONING, new String[0]); + featureChange.createNotifications(); + fm.updateFeatures(locSvc, new Provisioner(fm, null), null, featureChange, 1L); + + // SharedOutputMgr routing trace to standard out + assertTrue("Assert 'no enabled features' warning", outputMgr.checkForStandardOut("CWWKF0009W")); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testActivate() { + final String m = "testActivate"; + try { + context.checking(new Expectations() { + { + allowing(mockComponentContext).getBundleContext(); + will(returnValue(mockBundleContext)); + + allowing(mockBundleContext).getBundle(Constants.SYSTEM_BUNDLE_LOCATION); + will(returnValue(mockBundle)); + allowing(mockBundle).getBundleContext(); + will(returnValue(mockBundleContext)); + allowing(mockBundleContext).getBundles(); + will(returnValue(new Bundle[0])); + + one(mockBundle).adapt(FrameworkStartLevel.class); + will(returnValue(testFrameworkStartLevel)); + + allowing(executorService).execute(with(any(Runnable.class))); + one(variableRegistry).addVariable(with("feature:usr"), with("${usr.extension.dir}/lib/features/")); + + //allow mock calls from the BundleInstallOriginBundleListener + allowing(mockBundleContext).getBundle(); + will(returnValue(mockBundle)); + one(mockBundle).getDataFile("bundle.origin.cache"); + //allow the BundleInstallOriginBundleListener to get a ScheduledExecutorService + //and schedule a purge for the future + one(mockBundleContext).getServiceReference(ScheduledExecutorService.class); + will(returnValue(mockScheduledExecutorService)); + one(mockBundleContext).getService(mockScheduledExecutorService); + will(returnValue(mockScheduledExecutorService.getService())); + one(mockScheduledExecutorService.getService()).schedule(with(any(BundleInstallOriginBundleListener.class)), with(any(Integer.class)), + with(any(TimeUnit.class))); + one(mockBundleContext).ungetService(mockScheduledExecutorService); + + } + }); + + Map componentProps = new HashMap(); + + fm.activate(mockComponentContext, componentProps); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testUpdated() { + final String m = "testUpdated"; + try { + // Immediate return: no NPE + fm.updated(null); + + context.checking(new Expectations() { + { + allowing(executorService).execute(with(any(Runnable.class))); + } + }); + + Dictionary props = new Hashtable(); + props.put(OnErrorUtil.CFG_KEY_ON_ERROR, OnError.FAIL); + fm.updated(props); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testLoadFeatureInclude() { + final String m = "testLoadFeatureInclude"; + try { + BundleInstallStatus installStatus = new BundleInstallStatus(); + Result result = FeatureManager.featureResolver.resolveFeatures(fm.featureRepository, Collections.singleton("include"), Collections. emptySet(), false); + fm.reportErrors(result, Collections. emptyList(), Collections.singleton("include"), installStatus); + assertTrue("CWWKF0042E error message", outputMgr.checkForStandardErr("CWWKF0042E")); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testUpdate() { + final String m = "testUpdate"; + try { + // Add list of empty features + fm.featureChanges.add(new FeatureChange(runtimeUpdateManager, ProvisioningMode.UPDATE, new String[0])); + fm.onError = OnError.WARN; + + fm.processFeatureChanges(); + assertTrue("CWWKF0007I start audit should be in output", outputMgr.checkForMessages("CWWKF0007I")); + assertTrue("CWWKF0008I complete audit", outputMgr.checkForMessages("CWWKF0008I")); + + fm.deactivate(ComponentConstants.DEACTIVATION_REASON_BUNDLE_STOPPED); // no-op + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testFeaturesRequest() { + final String m = "testFeaturesRequest"; + try { + // Add list of empty features + fm.featureChanges.add(new FeatureChange(runtimeUpdateManager, ProvisioningMode.FEATURES_REQUEST, new String[0])); + fm.onError = OnError.WARN; + + fm.processFeatureChanges(); + assertTrue("CWWKF0007I start audit should be in output", outputMgr.checkForMessages("CWWKF0007I")); + assertTrue("CWWKF0036I finished gathering a list of required features should be in output", outputMgr.checkForMessages("CWWKF0036I")); + assertTrue("CWWKF0008I complete audit", outputMgr.checkForMessages("CWWKF0008I")); + + fm.deactivate(ComponentConstants.DEACTIVATION_REASON_BUNDLE_STOPPED); // no-op + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testInstallStatusNull() { + final String m = "testUpdate"; + try { + fm.onError = OnError.FAIL; + fm.checkInstallStatus(null); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test(expected = IllegalStateException.class) + public void testInstallStatusOtherException() { + final String m = "testInstallStatusOtherException"; + + try { + fm.onError = OnError.FAIL; + context.checking(new Expectations() { + { + one(mockBundle).stop(); + } + }); + + final BundleInstallStatus iStatus = new BundleInstallStatus(); + iStatus.addOtherException(new Throwable("some other exception")); + + fm.checkInstallStatus(iStatus); + throw new Throwable("stopFramework not called"); + } catch (IllegalStateException e) { + assertTrue("CWWKF0004E -- other exception in stderr", outputMgr.checkForStandardErr("CWWKF0004E")); + throw e; + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testMissingBundleException() { + final String m = "testMissingBundleException"; + + try { + fm.onError = OnError.FAIL; + context.checking(new Expectations() { + { + one(mockBundle).stop(); + } + }); + + final BundleInstallStatus iStatus = new BundleInstallStatus(); + iStatus.addMissingBundle(new FeatureResourceImpl("missing", Collections. emptyMap(), null, null)); + + try { + fm.checkInstallStatus(iStatus); + throw new Throwable("stopFramework not called"); + } catch (IllegalStateException e) { + } + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testInstallStatusInstallException() { + final String m = "testInstallStatusInstallException"; + + try { + fm.onError = OnError.FAIL; + context.checking(new Expectations() { + { + one(mockBundle).stop(); + } + }); + + final BundleInstallStatus iStatus = new BundleInstallStatus(); + iStatus.addInstallException("bundle", new Throwable("exception-b1")); + iStatus.addInstallException("bundle2", new Throwable("exception-b2")); + + try { + fm.checkInstallStatus(iStatus); + throw new Throwable("stopFramework not called"); + } catch (IllegalStateException e) { + assertTrue("CWWKF0003E -- install exception in stderr", outputMgr.checkForStandardErr("CWWKF0003E")); + // message should be issued once for each bundle install exception + assertTrue("exception-b1 -- install exception in stderr", outputMgr.checkForStandardErr("exception-b1")); + assertTrue("exception-b2 -- install exception in stderr", outputMgr.checkForStandardErr("exception-b2")); + } + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testBundleStatusException() { + final String m = "testBundleStatusException"; + + try { + fm.onError = OnError.FAIL; + context.checking(new Expectations() { + { + one(mockBundle).stop(); + } + }); + + final Bundle mockBundle2 = context.mock(Bundle.class, "bundle2"); + + final BundleLifecycleStatus bStatus = new BundleLifecycleStatus(); + bStatus.addStartException(mockBundle, new Throwable("terrible thing")); + bStatus.addStartException(mockBundle2, new Throwable("horrible other thing")); + + try { + fm.checkBundleStatus(bStatus); + throw new Throwable("stopFramework not called"); + } catch (IllegalStateException e) { + assertTrue("CWWKF0005E -- exception in stderr", outputMgr.checkForStandardErr("CWWKF0005E")); + + // message should be issued once for each bundle exception + assertTrue("terrible thing -- exception in stderr", outputMgr.checkForStandardErr("terrible thing")); + assertTrue("horrible other thing -- exception in stderr", outputMgr.checkForStandardErr("horrible other thing")); + } + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testLoadFeatureDefinition() { + final String m = "testLoadFeatureDefinition"; + + try { + BundleInstallStatus installStatus = new BundleInstallStatus(); + + // make sure handles just a : + Result result = FeatureManager.featureResolver.resolveFeatures(fm.featureRepository, Collections.singleton(":"), Collections. emptySet(), false); + fm.reportErrors(result, Collections. emptyList(), Collections.singleton(":"), installStatus); + assertTrue("CWWKF0001E error message", outputMgr.checkForStandardErr("CWWKF0001E:")); + assertTrue("There should be missing features", installStatus.featuresMissing()); + assertTrue("installStatus should contain : as missing feature", installStatus.getMissingFeatures().contains(":")); + outputMgr.resetStreams(); + installStatus.getMissingFeatures().clear(); + + // make sure handles nothing after : + // CWWKF0001E: A feature definition could not be found for usr: + result = FeatureManager.featureResolver.resolveFeatures(fm.featureRepository, Collections.singleton("usr:"), Collections. emptySet(), false); + fm.reportErrors(result, Collections. emptyList(), Collections.singleton("usr:"), installStatus); + assertTrue("CWWKF0001E error message", outputMgr.checkForStandardErr("CWWKF0001E:")); + assertTrue("specification of usr:", outputMgr.checkForStandardErr("usr:")); + assertTrue("installStatus shuold contain : as missing feature", installStatus.getMissingFeatures().contains("usr:")); + outputMgr.resetStreams(); + installStatus.getMissingFeatures().clear(); + + // give it one it should not find + // CWWKF0001E: A feature definition could not be found for usr:bad + result = FeatureManager.featureResolver.resolveFeatures(fm.featureRepository, Collections.singleton("usr:bad"), Collections. emptySet(), false); + fm.reportErrors(result, Collections. emptyList(), Collections.singleton("usr:bad"), installStatus); + assertTrue("CWWKF0001E error message", outputMgr.checkForStandardErr("CWWKF0001E:")); + assertTrue("specification of usr:bad", outputMgr.checkForStandardErr("usr:bad")); + assertTrue("installStatus should contain : as missing feature", installStatus.getMissingFeatures().contains("usr:bad")); + + // now test with a 'core' feature with no ':' + result = FeatureManager.featureResolver.resolveFeatures(fm.featureRepository, Collections.singleton("coreMissing-1.0"), Collections. emptySet(), false); + fm.reportErrors(result, Collections. emptyList(), Collections.singleton("coreMissing-1.0"), installStatus); + assertTrue("CWWKF0042E error message", outputMgr.checkForStandardErr("CWWKF0042E:")); + assertTrue("specification of coreMissing-1.0", outputMgr.checkForStandardErr("coreMissing-1.0")); + assertTrue("installStatus should contain : as missing feature", installStatus.getMissingFeatures().contains("coreMissing-1.0")); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + @Test + public void testReadWriteCache() throws IOException { + final String m = "testReadWriteCache"; + + WsResource cacheFile = locSvc.getServerWorkareaResource(m); + final AtomicLong id = new AtomicLong(); + + try { + context.checking(new Expectations() { + { + exactly(2).of(mockBundle).getBundleId(); + will(returnValue(id.incrementAndGet())); + } + }); + + if (cacheFile.exists()) + cacheFile.delete(); + + assertFalse("Cache file should be a unique temp file (should not exist)", cacheFile.exists()); + + InputStream is = TestUtils.createValidFeatureManifestStream("simple.feature-1.0", + "simple;version=\"[0.1,0.2)\", simpleTwo;version=\"[2.0, 2.0.100)\""); + SubsystemFeatureDefinitionImpl definitionImpl = new SubsystemFeatureDefinitionImpl("", is); + assertEquals("Subsystem should be for core repository (empty string)", "", definitionImpl.getBundleRepositoryType()); + + final BundleList list = new BundleList(cacheFile, fm); + list.addAll(definitionImpl, fm); + assertEquals("List should have 2 elements", 2, getResources(list).size()); + + list.foreach(new FeatureResourceHandler() { + @Override + public boolean handle(FeatureResource fr) { + String bundleRepositoryType = fr.getBundleRepositoryType(); + BundleRepositoryHolder bundleRepositoryHolder = fm.getBundleRepositoryHolder(bundleRepositoryType); + ContentBasedLocalBundleRepository lbr = bundleRepositoryHolder.getBundleRepository(); + + File f = lbr.selectBundle(null, fr.getSymbolicName(), fr.getVersionRange()); + WsResource resource = locSvc.asResource(f, f.isFile()); + + list.createAssociation(fr, mockBundle, resource, fr.getStartLevel()); + return true; + } + }); + + list.store(); + assertTrue("Cache file should exist after cache is stored", cacheFile.exists()); + + BundleList list2 = new BundleList(cacheFile, fm); + list2.init(); + assertEquals("List should have two elements", 2, getResources(list2).size()); + + List res1 = getResources(list); + List res2 = getResources(list2); + for (Object o1 : res1) { + boolean found = false; + for (Object o2 : res2) { + if (match((FeatureResource) o1, (FeatureResource) o2)) { + found = true; + break; + } + } + assertTrue("List read from cache should contain element from original list: " + o1, found); + } + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + private boolean match(FeatureResource o1, FeatureResource o2) { + System.out.println("o1: " + o1.toString() + " , " + o1.getMatchString() + " , " + o1.getLocation()); + System.out.println("o2: " + o2.toString() + " , " + o2.getMatchString() + " , " + o2.getLocation()); + + if (!o1.getMatchString().equals(o2.getMatchString())) + return false; + + return true; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/FeatureResolverTest.java b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/FeatureResolverTest.java new file mode 100755 index 000000000000..cb3866e7a461 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/FeatureResolverTest.java @@ -0,0 +1,801 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010, 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.internal; + +import java.io.File; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.concurrent.atomic.AtomicBoolean; + +import junit.framework.Assert; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedOutputManager; +import test.utils.TestUtils; + +import com.ibm.ws.kernel.feature.ProcessType; +import com.ibm.ws.kernel.feature.internal.subsystem.FeatureRepository; +import com.ibm.ws.kernel.feature.provisioning.ProvisioningFeatureDefinition; +import com.ibm.ws.kernel.feature.resolver.FeatureResolver; +import com.ibm.ws.kernel.feature.resolver.FeatureResolver.Chain; +import com.ibm.ws.kernel.feature.resolver.FeatureResolver.Result; +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry; + +/** + * + */ +public class FeatureResolverTest { + static final SharedOutputManager outputMgr = SharedOutputManager.getInstance().trace("*=audit=enabled:featureManager=all=enabled"); + public static final String RESOLVER_DATA_DIR = "../com.ibm.ws.kernel.feature_test/build/unittest/resolverData"; + + static final File RESOLVER_DATA_FILE = new File(RESOLVER_DATA_DIR); + static final String serverName = "FeatureResolverTest"; + static final AtomicBoolean returnAutoFeatures = new AtomicBoolean(false); + static final FeatureResolver resolver = new FeatureResolverImpl(); + static FeatureResolver.Repository repository; + static Map> overrideTolerates = new HashMap>(); + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + outputMgr.captureStreams(); + + File root = RESOLVER_DATA_FILE.getCanonicalFile(); + File lib = new File(root, "lib"); + + TestUtils.setUtilsInstallDir(root); + TestUtils.setKernelUtilsBootstrapLibDir(lib); + TestUtils.clearBundleRepositoryRegistry(); + + BundleRepositoryRegistry.initializeDefaults(serverName, true); + + final FeatureRepository repoImpl = new FeatureRepository(); + repoImpl.init(); + repository = new FeatureResolver.Repository() { + + @Override + public ProvisioningFeatureDefinition getFeature(String featureName) { + return repoImpl.getFeature(featureName); + } + + @Override + public Collection getAutoFeatures() { + if (returnAutoFeatures.get()) { + return repoImpl.getAutoFeatures(); + } + return Collections.emptyList(); + } + + @Override + public List getConfiguredTolerates(String baseSymbolicName) { + List testOverrides = overrideTolerates.get(baseSymbolicName); + if (testOverrides != null) { + return testOverrides; + } + return repoImpl.getConfiguredTolerates(baseSymbolicName); + } + }; + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + outputMgr.restoreStreams(); + + TestUtils.setUtilsInstallDir(null); + TestUtils.setKernelUtilsBootstrapLibDir(null); + TestUtils.clearBundleRepositoryRegistry(); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + // Clear the output generated after each method invocation, this keeps + // things sane + outputMgr.resetStreams(); + returnAutoFeatures.set(false); + overrideTolerates.clear(); + } + + @Test + public void testSingleFeatureResolve() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.a-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t1.a-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testSingleFeatureTwoResolve() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.b-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t1.a-1.0", "t1.b-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testSimplePreferLatestResolve() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.b-1.1"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t1.a-1.1", "t1.b-1.1")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testPreferLowestExplicitHighestResolve() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t2.x-1.0", "t2.y-1.1"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t2.x-1.0", "t2.y-1.1", "t2.z-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testSimpleAutoFeature() { + returnAutoFeatures.set(true); + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.c-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t1.a-1.0", "t1.c-1.0", "t1.auto.t1.c-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testSimpleRequireLowest() { + returnAutoFeatures.set(true); + doSimpleRequireLowest(new HashSet(Arrays.asList("t1.b-1.1", "t1.c-1.0"))); + // reverse the resolution order + doSimpleRequireLowest(new HashSet(Arrays.asList("t1.c-1.0", "t1.b-1.1"))); + } + + private void doSimpleRequireLowest(Set toResolve) { + Result result = resolver.resolveFeatures(repository, toResolve, Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t1.a-1.0", "t1.b-1.1", "t1.c-1.0", "t1.auto.t1.c-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testSimpleRootConflict() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.a-1.0", "t1.a-1.1"), Collections. emptySet(), false); + Assert.assertEquals("Wrong number of results: " + result, 0, result.getResolvedFeatures().size()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + checkConflict(result.getConflicts(), "t1.a"); + } + + @Test + public void testSimpleRootConflictAllowMultiple() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.a-1.0", "t1.a-1.1"), Collections. emptySet(), true); + Set expected = new HashSet(Arrays.asList("t1.a-1.0", "t1.a-1.1")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testAllowMultipleWithMissingPreferred() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.b-0.9"), Collections. emptySet(), true); + Set expected = new HashSet(Arrays.asList("t1.a-1.0", "t1.b-0.9")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testAllowMultipleWithMissingPreferredConflict() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.b-0.9", "t1.c-1.1"), Collections. emptySet(), true); + Set expected = new HashSet(Arrays.asList("t1.a-1.0", "t1.a-1.1", "t1.b-0.9", "t1.c-1.1")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testRootConflictWithOtherFeature() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.a-1.0", "t1.a-1.1", "t1.b-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t1.b-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + checkConflict(result.getConflicts(), "t1.a"); + } + + @Test + public void testSimplePreresolve1() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.a-1.0"), new HashSet(Arrays.asList("t1.a-1.1")), false); + Set expected = new HashSet(Arrays.asList("t1.a-1.1")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testSimplePreresolve2() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.a-1.1"), new HashSet(Arrays.asList("t1.a-1.1")), false); + Set expected = new HashSet(Arrays.asList("t1.a-1.1")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testSimplePreresolve3() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.a-1.1"), new HashSet(Arrays.asList("t1.a-1.1", "missing-1.0")), false); + Set expected = new HashSet(Arrays.asList("t1.a-1.1")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testSimplePreresolve4() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t1.a-1.0"), new HashSet(Arrays.asList("t1.a-1.1", "missing-1.0")), false); + Set expected = new HashSet(Arrays.asList("t1.a-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testPostponedDandE() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t3.a-1.0", "t3.b-1.0", "t3.c-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t3.a-1.0", "t3.b-1.0", "t3.c-1.0", "t3.d-2.0", "t3.e-2.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testPostponedDandEWithDirectConflictF() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t3.a-1.0", "t3.b-1.0", "t3.c-1.0", "t3.f-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t3.a-1.0", "t3.b-1.0", "t3.c-1.0", "t3.f-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + Map> conflicts = result.getConflicts(); + checkConflict(conflicts, "t3.d", "t3.b-1.0", "t3.f-1.0"); + checkConflict(conflicts, "t3.e", "t3.b-1.0", "t3.f-1.0"); + } + + @Test + public void testPostponedDandEWithConflictG() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t3.a-1.0", "t3.b-1.0", "t3.c-1.0", "t3.g-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t3.a-1.0", "t3.b-1.0", "t3.c-1.0", "t3.g-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + Map> conflicts = result.getConflicts(); + checkConflict(conflicts, "t3.d", "t3.c-1.0", "t3.g-1.0"); + checkConflict(conflicts, "t3.e", "t3.c-1.0", "t3.g-1.0"); + } + + @Test + public void testConflictingPreferences1() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t4.c-1.0"), Collections. emptySet(), false); + Set expected1 = new TreeSet(Arrays.asList("t4.c-1.0", "t4.a-1.0", "t4.b-1.0")); + Set expected2 = new TreeSet(Arrays.asList("t4.c-1.0", "t4.a-2.0", "t4.b-2.0")); + assertOneOf(new TreeSet(result.getResolvedFeatures()), expected1, expected2); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testConflictingPreferences2() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t4.f-1.0"), Collections. emptySet(), false); + Set expected1 = new TreeSet(Arrays.asList("t4.f-1.0", "t4.d-2.0", "t4.e-2.0")); + Set expected2 = new TreeSet(Arrays.asList("t4.f-1.0", "t4.d-1.0", "t4.e-1.0")); + assertOneOf(new TreeSet(result.getResolvedFeatures()), expected1, expected2); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + private void assertOneOf(Set actual, Set expected1, Set expected2) { + if (actual.equals(expected1) || actual.equals(expected2)) { + return; + } + Assert.fail("Actual: " + actual + " was none of the expected: " + expected1 + " -- " + expected2); + } + + @Test + public void testSimpleCycle() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t5.a-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t5.a-1.0", "t5.b-1.0", "t5.c-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testMissing() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t6.a-1.0", "missing.d-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t6.a-1.0", "t6.b-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", new HashSet(Arrays.asList("missing.a-1.0", "missing.b-1.0", "missing.c-1.0", "missing.d-1.0")), result.getMissing()); + } + + @Test + public void testComplicatedPreference() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.a-1.0", "t7.b-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.c-2.0", "t7.d-2.0", "t7.f-1.0", "t7.g-1.0", "t7.h-2.0", "t7.i-2.0", "t7.j-2.0", + "t7.k-2.0", "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", "t7.o-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testComplicatedPreferenceAllowMultiple() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.a-1.0", "t7.b-1.0"), Collections. emptySet(), true); + Set expected = new HashSet(Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.c-1.0", "t7.d-1.0", "t7.f-1.0", "t7.g-1.0", + "t7.h-1.0", "t7.h-2.0", "t7.i-1.0", "t7.i-2.0", "t7.j-1.0", "t7.j-2.0", "t7.k-1.0", "t7.k-2.0", + "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", "t7.o-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testComplicatedPreferenceWithAutoFeature() { + returnAutoFeatures.set(true); + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.a-1.0", "t7.b-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t7.auto.1-1.0", "t7.auto.3-1.0", "t7.a-1.0", "t7.b-1.0", "t7.c-2.0", "t7.d-2.0", "t7.f-1.0", "t7.g-1.0", + "t7.h-2.0", "t7.i-2.0", "t7.j-2.0", "t7.k-2.0", "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", "t7.o-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testComplicatedPreferenceWithAutoFeatureAllowMultiple() { + returnAutoFeatures.set(true); + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.p-1.0", "t7.q-1.0"), Collections. emptySet(), true); + Set expected = new HashSet(Arrays.asList("t7.auto.1-1.0", "t7.auto.2-1.0", "t7.auto.3-1.0", "t7.auto.4-1.0", "t7.auto.5-1.0", "t7.a-1.0", "t7.b-1.0", + "t7.c-1.0", "t7.d-1.0", "t7.f-1.0", "t7.g-1.0", + "t7.h-1.0", "t7.h-2.0", "t7.i-1.0", "t7.i-2.0", "t7.j-1.0", "t7.j-2.0", "t7.k-1.0", "t7.k-2.0", + "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", "t7.o-1.0", "t7.p-1.0", "t7.q-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testComplicatedPreferenceWithHardConflict() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.h-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.c-1.0", "t7.d-1.0", "t7.f-1.0", "t7.g-1.0", + "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", "t7.o-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + checkConflict(result.getConflicts(), "t7.h", ROOT, "t7.l-1.0"); + checkConflict(result.getConflicts(), "t7.i", "t7.c-1.0", "t7.m-1.0"); + checkConflict(result.getConflicts(), "t7.j", "t7.d-1.0", "t7.n-1.0"); + checkConflict(result.getConflicts(), "t7.k", "t7.d-1.0", "t7.o-1.0"); + } + + @Test + public void testComplicatedPreferenceWithHardConflictAndAutoFeatures() { + returnAutoFeatures.set(true); + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.h-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.c-1.0", "t7.d-1.0", "t7.f-1.0", "t7.g-1.0", + "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", "t7.o-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + checkConflict(result.getConflicts(), "t7.h", ROOT, "t7.l-1.0"); + checkConflict(result.getConflicts(), "t7.i", "t7.c-1.0", "t7.m-1.0"); + checkConflict(result.getConflicts(), "t7.j", "t7.d-1.0", "t7.n-1.0"); + checkConflict(result.getConflicts(), "t7.k", "t7.d-1.0", "t7.o-1.0"); + } + + @Test + public void TestComplicatedPreferenceWithAutoFeatureConflict() { + returnAutoFeatures.set(true); + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.a-1.0", "t7.p-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t7.auto.2-1.0", "t7.auto.3-1.0", "t7.auto.4-1.0", "t7.a-1.0", "t7.b-1.0", "t7.c-1.0", "t7.d-1.0", "t7.f-1.0", + "t7.g-1.0", "t7.h-1.0", "t7.i-1.0", "t7.j-1.0", "t7.k-1.0", "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", "t7.o-1.0", + "t7.p-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + checkConflict(result.getConflicts(), "t7.h", "t7.c-1.0", "t7.l-1.0"); + checkConflict(result.getConflicts(), "t7.i", "t7.c-1.0", "t7.m-1.0"); + checkConflict(result.getConflicts(), "t7.j", "t7.d-1.0", "t7.n-1.0"); + checkConflict(result.getConflicts(), "t7.k", "t7.d-1.0", "t7.o-1.0"); + } + + @Test + public void TestComplicatedPreferenceWithAutoFeatureLooping() { + returnAutoFeatures.set(true); + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.p-1.0", "t7.q-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t7.auto.1-1.0", "t7.auto.3-1.0", "t7.auto.4-1.0", "t7.auto.5-1.0", "t7.a-1.0", "t7.b-1.0", "t7.c-2.0", + "t7.d-2.0", "t7.f-1.0", "t7.g-1.0", "t7.h-2.0", "t7.i-2.0", "t7.j-2.0", "t7.k-2.0", "t7.l-1.0", "t7.m-1.0", + "t7.n-1.0", "t7.o-1.0", "t7.p-1.0", "t7.q-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testComplicatedPreferenceWithTransitiveChecks1() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.r-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.c-2.0", "t7.d-2.0", "t7.f-1.0", "t7.g-1.0", "t7.h-2.0", "t7.i-2.0", "t7.j-2.0", + "t7.k-2.0", "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", "t7.o-1.0", "t7.r-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testComplicatedPreferenceWithTransitiveChecks2() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.s-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.c-2.0", "t7.d-2.0", "t7.f-1.0", "t7.g-1.0", "t7.h-2.0", "t7.i-2.0", "t7.j-2.0", + "t7.k-2.0", "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", "t7.o-1.0", "t7.s-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testComplicatedPreferenceWithTransitiveChecks3() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.t-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.c-1.0", "t7.d-1.0", "t7.f-1.0", "t7.g-1.0", "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", + "t7.o-1.0", "t7.t-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + checkConflict(result.getConflicts(), "t7.h", "t7.c-1.0", "t7.l-1.0"); + checkConflict(result.getConflicts(), "t7.i", "t7.c-1.0", "t7.m-1.0"); + checkConflict(result.getConflicts(), "t7.j", "t7.d-1.0", "t7.n-1.0"); + checkConflict(result.getConflicts(), "t7.k", "t7.d-1.0", "t7.o-1.0"); + } + + @Test + public void testComplicatedPreferenceWithTransitiveChecks4() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.u-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.c-2.0", "t7.d-2.0", "t7.f-1.0", "t7.g-1.0", "t7.h-2.0", "t7.i-2.0", "t7.j-2.0", + "t7.k-2.0", "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", "t7.o-1.0", "t7.s-1.0", "t7.u-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testComplicatedPreferenceWithTransitiveChecks5() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t7.v-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t7.a-1.0", "t7.b-1.0", "t7.c-1.0", "t7.d-1.0", "t7.f-1.0", "t7.g-1.0", "t7.l-1.0", "t7.m-1.0", "t7.n-1.0", + "t7.o-1.0", "t7.s-1.0", "t7.v-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + checkConflict(result.getConflicts(), "t7.h", "t7.c-1.0", "t7.l-1.0"); + checkConflict(result.getConflicts(), "t7.i", "t7.c-1.0", "t7.m-1.0"); + checkConflict(result.getConflicts(), "t7.j", "t7.d-1.0", "t7.n-1.0"); + checkConflict(result.getConflicts(), "t7.k", "t7.d-1.0", "t7.o-1.0"); + } + + @Test + public void testServletExample1() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.jsp-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.servlet-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testServletExample2() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.jsp-1.0", "t8.portlet-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.servlet-1.0", "t8.portlet-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testServletExample3() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.jsp-1.0", "t8.websockets-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.servlet-2.0", "t8.websockets-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testServletExample4() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.portlet-1.0", "t8.jsp-1.0", "t8.websockets-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.websockets-1.0", "t8.portlet-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + checkConflict(result.getConflicts(), "t8.servlet", "t8.websockets-1.0", "t8.jsp-1.0"); + } + + @Test + public void testServletExample5() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.jsp-1.0", "t8.servlet-2.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.servlet-2.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testServletExample6() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.jsp-1.0", "t8.servlet-2.0", "t8.portlet-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.portlet-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + checkConflict(result.getConflicts(), "t8.servlet", ROOT, "t8.jsp-1.0"); + } + + @Test + public void testServletExample6OverrideTolerates() { + overrideTolerates.put("t8.servlet", Collections.singletonList("2.0")); + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.jsp-1.0", "t8.servlet-2.0", "t8.portlet-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.servlet-2.0", "t8.portlet-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testServletExample7() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.jsp-1.0", "t8.portlet-2.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.servlet-1.0", "t8.portlet-2.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testServletExample8() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.jsp-1.0", "t8.portlet-2.0", "t8.websockets-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.servlet-2.0", "t8.portlet-2.0", "t8.websockets-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testServletExample9() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.portlet-2.0", "t8.websockets-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.servlet-2.0", "t8.portlet-2.0", "t8.websockets-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testServletExample10() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.portlet-1.0", "t8.websockets-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.websockets-1.0", "t8.portlet-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + checkConflict(result.getConflicts(), "t8.servlet", "t8.websockets-1.0", "t8.jsp-1.0"); + } + + @Test + public void testServletExample10OverrideTolerates() { + overrideTolerates.put("t8.servlet", Collections.singletonList("2.0")); + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.portlet-1.0", "t8.websockets-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.jsp-1.0", "t8.servlet-2.0", "t8.websockets-1.0", "t8.portlet-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testServletExample11() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.x-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.x-1.0", "t8.jsp-1.0", "t8.servlet-1.0", "t8.portlet-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testServletExample12() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.websockets-1.0", "t8.x-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.x-1.0", "t8.jsp-1.0", "t8.websockets-1.0", "t8.portlet-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + checkConflict(result.getConflicts(), "t8.servlet", "t8.websockets-1.0", "t8.jsp-1.0"); + } + + @Test + public void testServletExample12OverrideTolerates() { + overrideTolerates.put("t8.servlet", Collections.singletonList("2.0")); + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.websockets-1.0", "t8.x-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.x-1.0", "t8.jsp-1.0", "t8.websockets-1.0", "t8.portlet-1.0", "t8.servlet-2.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testServletExample13() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t8.x-2.0", "t8.websockets-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t8.x-2.0", "t8.websockets-1.0", "t8.jsp-1.0", "t8.servlet-2.0", "t8.portlet-2.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testProcessTypeClient1() { + doTestContainerType1("client", ProcessType.CLIENT, true); + } + + @Test + public void testProcessTypeClient2() { + doTestContainerType2("client", ProcessType.CLIENT, true); + } + + @Test + public void testProcessTypeServer1() { + doTestContainerType1("server", ProcessType.SERVER, true); + } + + @Test + public void testProcessTypeServer2() { + doTestContainerType2("server", ProcessType.SERVER, true); + } + + @Test + public void testProcessTypeClientServer1() { + doTestContainerType1("client.server", ProcessType.SERVER, false); + } + + @Test + public void testProcessTypeClientServer2() { + doTestContainerType2("client.server", ProcessType.SERVER, false); + } + + @Test + public void testProcessTypeClientServerWithAutoServer1() { + doTestContainerTypeAuto("client.server", ProcessType.SERVER); + } + + @Test + public void testIgnoreProcessTypeClient() { + String serverFeatureA = "t9.a.server-1.0"; + String clientFeatureA = "t9.a.client-1.0"; + Collection rootFeatures = Arrays.asList(serverFeatureA, clientFeatureA); + Result result = resolver.resolveFeatures(repository, rootFeatures, Collections. emptySet(), false); + Set expected = new HashSet(rootFeatures); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertFalse("Unexpected failures.", result.hasErrors()); + } + + private void doTestContainerType1(String featureName, ProcessType processType, boolean expectFailure) { + EnumSet types1 = EnumSet.of(processType); + EnumSet types2 = EnumSet.complementOf(types1); + + String featureA = "t9.a." + featureName + "-1.0"; + + verifySuccessProcessType(Arrays.asList(featureA), types1); + if (expectFailure) { + verifyFailProcessType(Arrays.asList(featureA), types2); + } else { + verifySuccessProcessType(Arrays.asList(featureA), types2); + } + } + + private void doTestContainerType2(String featureName, ProcessType processType, boolean expectFailure) { + EnumSet types1 = EnumSet.of(processType); + EnumSet types2 = EnumSet.complementOf(types1); + + String featureA = "t9.a." + featureName + "-1.0"; + String featureB = "t9.b." + featureName + "-1.0"; + String featureC = "t9.c." + featureName + "-1.0"; + + verifySuccessProcessType(Arrays.asList(featureC, featureB, featureA), types1); + if (expectFailure) { + verifyFailProcessType(Arrays.asList(featureC, featureB, featureA), types2); + } else { + verifySuccessProcessType(Arrays.asList(featureC, featureB, featureA), types2); + } + } + + private void doTestContainerTypeAuto(String featureName, ProcessType processType) { + returnAutoFeatures.set(true); + EnumSet types1 = EnumSet.of(processType); + EnumSet types2 = EnumSet.complementOf(types1); + + String featureA = "t9.a." + featureName + "-1.0"; + String featureA_Auto = "t9.a." + featureName + ".auto." + processType.toString().toLowerCase() + "-1.0"; + + verifySuccessProcessType(Arrays.asList(featureA, featureA_Auto), types1); + // with the complement process type we expect the auto-feature to not load + verifySuccessProcessType(Arrays.asList(featureA), types2); + } + + private void verifyFailProcessType(List features, EnumSet unsupportedTypes) { + Collection rootFeatures = Arrays.asList(features.get(0)); + Result result = resolver.resolveFeatures(repository, rootFeatures, Collections. emptySet(), false, unsupportedTypes); + + Set expected = new HashSet(features); + expected.remove(features.get(features.size() - 1)); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertTrue("Expected failures.", result.hasErrors()); + Map wrongContainerTypes = result.getWrongProcessTypes(); + Assert.assertEquals("Wrong number of wrong container types.", 1, wrongContainerTypes.size()); + Assert.assertEquals("Wrong bad feature.", features.get(features.size() - 1), wrongContainerTypes.keySet().iterator().next()); + } + + private void verifySuccessProcessType(List features, EnumSet supportedTypes) { + Collection rootFeatures = Arrays.asList(features.get(0)); + Result result = resolver.resolveFeatures(repository, rootFeatures, Collections. emptySet(), false, supportedTypes); + Set expected = new HashSet(features); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertFalse("Unexpected failures.", result.hasErrors()); + } + + @Test + public void testToleratesTransitively01() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t9.a-1.0"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t9.a-1.0", "t9.b-1.1", "t9.c-1.0", "t9.d-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + Assert.assertEquals("Unexpected Conflicts.", Collections.emptyMap(), result.getConflicts()); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + @Test + public void testToleratesTransitively02() { + Result result = resolver.resolveFeatures(repository, Arrays.asList("t9.a-1.1"), Collections. emptySet(), false); + Set expected = new HashSet(Arrays.asList("t9.a-1.1", "t9.c-1.0", "t9.d-1.0")); + Assert.assertEquals("Wrong results found.", new TreeSet(expected), new TreeSet(result.getResolvedFeatures())); + checkConflict(result.getConflicts(), "t9.b", "t9.d-1.0"); + Assert.assertEquals("Unexpected missing.", Collections.emptySet(), result.getMissing()); + } + + private static String ROOT = "ROOT"; + + private static void checkConflict(Map> conflicts, String baseConflict, String... leaves) { + Collection chains = conflicts.get(baseConflict); + Assert.assertNotNull("Conflicts chains is null: " + baseConflict, conflicts.get(baseConflict)); + if (leaves.length == 0) { + // check that this is a root only change; empty + for (Chain chain : chains) { + Assert.assertEquals("Unexpected change.", Collections.emptyList(), chain.getChain()); + } + } else { + for (String leaf : leaves) { + boolean foundLeaf = false; + for (Chain chain : chains) { + List features = chain.getChain(); + if (features.isEmpty()) { + foundLeaf = leaf.equals(ROOT); + } + else { + foundLeaf = leaf.equals(features.get(features.size() - 1)); + } + if (foundLeaf) { + break; + } + } + Assert.assertTrue("Did not found source of conflict: " + leaf, foundLeaf); + } + } + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/MockServiceReference.java b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/MockServiceReference.java new file mode 100755 index 000000000000..ab683303d1d0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/MockServiceReference.java @@ -0,0 +1,60 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.internal; + +import org.osgi.framework.Bundle; +import org.osgi.framework.ServiceReference; + +/** + * + */ +public class MockServiceReference implements ServiceReference { + T service; + + public MockServiceReference(T serv) { + this.service = serv; + } + + public T getService() { + return this.service; + } + + @Override + public Object getProperty(String key) { + return null; + } + + @Override + public String[] getPropertyKeys() { + return null; + } + + @Override + public Bundle getBundle() { + return null; + } + + @Override + public Bundle[] getUsingBundles() { + return null; + } + + @Override + public boolean isAssignableTo(Bundle bundle, String className) { + return false; + } + + @Override + public int compareTo(Object reference) { + return 0; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/reference/Handler.java b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/reference/Handler.java new file mode 100755 index 000000000000..9f236e9bb923 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/reference/Handler.java @@ -0,0 +1,39 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.internal.reference; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; + +/** + * + */ +public class Handler extends URLStreamHandler { + + /** {@inheritDoc} */ + @Override + protected URLConnection openConnection(URL arg0) throws IOException { + return new URLConnection(arg0) { + @Override + public void connect() throws IOException {} + + @Override + public InputStream getInputStream() { + return null; + } + }; + } + +} diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureDefinitionUtilsTest.java b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureDefinitionUtilsTest.java new file mode 100755 index 000000000000..649e47025f1d --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureDefinitionUtilsTest.java @@ -0,0 +1,528 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.internal.subsystem; + +import static org.junit.Assert.assertFalse; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import junit.framework.Assert; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; +import test.utils.SharedConstants; + +import com.ibm.ws.kernel.feature.AppForceRestart; +import com.ibm.ws.kernel.feature.Visibility; +import com.ibm.ws.kernel.feature.internal.subsystem.FeatureDefinitionUtils.ImmutableAttributes; +import com.ibm.ws.kernel.feature.internal.subsystem.FeatureDefinitionUtils.ProvisioningDetails; +import com.ibm.ws.kernel.feature.provisioning.SubsystemContentType; +import com.ibm.ws.kernel.provisioning.VersionUtility; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; + +/** + * + */ +public class FeatureDefinitionUtilsTest { + + static final SharedOutputManager outputMgr = SharedOutputManager.getInstance().trace("*=audit=enabled:featureManager=all=enabled"); + static WsLocationAdmin locSvc; + + @Rule + public TestRule outputRule = outputMgr; + + @Rule + public TestName testName = new TestName(); + + @Test + public void testSimpleReadManifestWriteCache() throws IOException { + File featureFile = new File(SharedConstants.TEST_DATA_DIR, "com.ibm.websphere.supersededA.mf"); + + ProvisioningDetails details = new ProvisioningDetails(featureFile, null); + ImmutableAttributes iAttr = FeatureDefinitionUtils.loadAttributes("", featureFile, details); + + // --- This is the test feature (reading from a file) --- + // Manifest-Version: 1.0 + // Subsystem-SymbolicName: com.ibm.websphere.supersededA;visibility:=public; superseded=true; superseded-by="appSecurity-2.0,[servlet-3.0]" + // Subsystem-Version: 1.0.0 + // Subsystem-Type: osgi.subsystem.feature + // Subsystem-Content: notexistA;location:="lib/notexistA" + // IBM-Feature-Version: 2 + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + + FeatureDefinitionUtils.writeAttributes(iAttr, details, writer); + writer.flush(); + String result = out.toString(); + + // -- Result string should look something like this: + // com.ibm.websphere.supersededA=../com.ibm.ws.kernel.feature_test/build/unittest/test data/com.ibm.websphere.supersededA.mf;1364156286000;300;;;2;PUBLIC;NEVER;1.0.0;0000 + + String[] lines = result.split(FeatureDefinitionUtils.NL); + + Assert.assertEquals("Output should be only one line: " + result, 1, lines.length); + Assert.assertFalse("Output should not contain AutoFeature indicator: " + result, result.contains("-C:")); + Assert.assertFalse("Output should not contain API Services indicator: " + result, result.contains("-V:")); + Assert.assertFalse("Output should not contain API Packages indicator: " + result, result.contains("-A:")); + Assert.assertFalse("Output should not contain SPI Packages indicator: " + result, result.contains("-S:")); + + int pos = result.indexOf('='); + Assert.assertTrue("Output should contain an =, result: " + result, pos > 0); + Assert.assertEquals("String before the = should be the symbolic name", iAttr.symbolicName, result.substring(0, pos)); + + String[] parts = FeatureDefinitionUtils.splitPattern.split(result.substring(pos + 1).trim()); + Assert.assertEquals("There should be 10 parts in the value", 10, parts.length); + Assert.assertEquals("parts[0] should contain the absolute file path", featureFile.getAbsolutePath(), parts[0]); + + // Test parse long: lastModified and length + Assert.assertEquals("parts[1] should contain the file modified time", featureFile.lastModified(), FeatureDefinitionUtils.getLongValue(parts[1], -1)); + Assert.assertEquals("parts[2] should contain the file length", featureFile.length(), FeatureDefinitionUtils.getLongValue(parts[2], -1)); + + Assert.assertTrue("parts[3] should be empty (no short name)", parts[3].isEmpty()); + + Assert.assertEquals("parts[4] should contain the feature version", 2, FeatureDefinitionUtils.getIntegerValue(parts[4], 0)); + Assert.assertSame("parts[5] should contain the visibility string", Visibility.PUBLIC, Visibility.fromString(parts[5])); + Assert.assertSame("parts[6] should contain the app restart header value", AppForceRestart.NEVER, AppForceRestart.fromString(parts[6])); + Assert.assertSame("parts[7] should resolve to the shared version constant", VersionUtility.VERSION_1_0, VersionUtility.stringToVersion(parts[7])); + Assert.assertEquals("parts[8] should contain empty flags (no API/SPI, not autofeature)", "00000", parts[8]); + + // Check for superseded + Assert.assertTrue("Test for superseded should return true", details.isSuperseded()); + Assert.assertEquals("Test for superseded-by should return value from header", "appSecurity-2.0,[servlet-3.0]", details.getSupersededBy()); + + // Check subsystem content + Assert.assertEquals("Subsystem-Content (all) should contain one element", 1, details.getConstituents(null).size()); + Assert.assertEquals("Subsystem-Content (bundle) should contain one element", 1, details.getConstituents(SubsystemContentType.BUNDLE_TYPE).size()); + Assert.assertTrue("Subsystem-Content (boot.jar) should return no elements", details.getConstituents(SubsystemContentType.BOOT_JAR_TYPE).isEmpty()); + Assert.assertTrue("Subsystem-Content (jar) should contain one element", details.getConstituents(SubsystemContentType.JAR_TYPE).isEmpty()); + Assert.assertTrue("Subsystem-Content (file) should contain one element", details.getConstituents(SubsystemContentType.FILE_TYPE).isEmpty()); + Assert.assertTrue("Subsystem-Content (feature) should contain one element", details.getConstituents(SubsystemContentType.FEATURE_TYPE).isEmpty()); + Assert.assertTrue("Subsystem-Content (unknown) should contain one element", details.getConstituents(SubsystemContentType.UNKNOWN).isEmpty()); + } + + @Test(expected = FeatureManifestException.class) + public void testMissingSymbolicName() throws IOException { + // TODO: ADD EXPECTATION FOR ERROR MESSAGE CODE + // outputMgr.expectError("CWWKFIXME"); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + FeatureDefinitionUtils.loadAttributes("", null, details); + } + + @Test(expected = FeatureManifestException.class) + public void testInvalidSubsystemType() throws IOException { + // TODO: ADD EXPECTATION FOR ERROR MESSAGE CODE + // outputMgr.expectError("CWWKFIXME"); + + // Intentional extra trailing whitespace... + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.dummy;visibility:=protected \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + FeatureDefinitionUtils.loadAttributes("", null, details); + } + + @Test(expected = FeatureManifestException.class) + public void testMissingSubsystemVersion() throws IOException { + // TODO: ADD EXPECTATION FOR ERROR MESSAGE CODE + // outputMgr.expectError("CWWKFIXME"); + + // Intentional extra trailing whitespace... + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.dummy;visibility:=protected \n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + FeatureDefinitionUtils.loadAttributes("", null, details); + } + + @Test + public void testDownlevelFeatureVersion() throws IOException { + // Intentional extra trailing whitespace... + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.dummy;visibility:=protected \n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.write("Subsystem-Version: 1.0.0 \n"); + writer.write("IBM-Feature-Version: 1 \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + ImmutableAttributes iAttr = FeatureDefinitionUtils.loadAttributes("", null, details); + Assert.assertFalse("Attributes should indicate the feature version is not supported", iAttr.isSupportedFeatureVersion()); + } + + @Test + public void testUnspecifiedFeatureVersion() throws IOException { + // Intentional extra trailing whitespace... + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.dummy;visibility:=protected \n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.write("Subsystem-Version: 1.0.0 \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + ImmutableAttributes iAttr = FeatureDefinitionUtils.loadAttributes("", null, details); + Assert.assertEquals("IBM feature version should be 0 (unspecified)", 0, iAttr.featureVersion); + Assert.assertTrue("Feature version should be supported", iAttr.isSupportedFeatureVersion()); + } + + @Test(expected = FeatureManifestException.class) + public void testUnsupportedFeatureVersion() throws IOException { + // We expect this error code to be in the output for unsupported feature version + outputMgr.expectError("CWWKF0022E"); + + // Intentional extra trailing whitespace... + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.dummy;visibility:=protected \n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.write("Subsystem-Version: 1.0.0 \n"); + writer.write("IBM-Feature-Version: 3 \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + FeatureDefinitionUtils.loadAttributes("", null, details); + } + + @Test + public void testIBMShortNameUnspecified() throws Exception { + // IBM-ShortName not present + // Intentional extra trailing whitespace... + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.good \n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.write("Subsystem-Version: 1.0.0 \n"); + writer.write("IBM-Feature-Version: 2 \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + ImmutableAttributes iAttr = FeatureDefinitionUtils.loadAttributes("", null, details); + + Assert.assertEquals("symbolicName should return com.ibm.websphere.good", "com.ibm.websphere.good", iAttr.symbolicName); + Assert.assertNull("shortName should be null: " + iAttr.shortName, iAttr.shortName); + Assert.assertEquals("featureName should return symbolicName", iAttr.symbolicName, iAttr.featureName); + } + + @Test + public void testIBMShortNamePublic() throws Exception { + // IBM-ShortName in mf file of a public feature + // Intentional extra trailing whitespace... + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("IBM-ShortName: public-1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.public-1.0; visibility:=public \n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.write("Subsystem-Version: 1.0.0 \n"); + writer.write("IBM-Feature-Version: 2 \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + ImmutableAttributes iAttr = FeatureDefinitionUtils.loadAttributes("", null, details); + + Assert.assertEquals("symbolicName should return com.ibm.websphere.public-1.0", "com.ibm.websphere.public-1.0", iAttr.symbolicName); + Assert.assertEquals("shortName should return public-1.0", "public-1.0", iAttr.shortName); + Assert.assertEquals("featureName should return shortName", iAttr.shortName, iAttr.featureName); + } + + @Test + public void testIBMShortNameHidden() throws Exception { + // IBM-ShortName in mf file but it should be ignored because feature is not public + // Intentional extra trailing whitespace... + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("IBM-ShortName: public-1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.not.public-1.0 \n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.write("Subsystem-Version: 1.0.0 \n"); + writer.write("IBM-Feature-Version: 2 \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + ImmutableAttributes iAttr = FeatureDefinitionUtils.loadAttributes("", null, details); + + Assert.assertEquals("symbolicName should return com.ibm.websphere.public-1.0", "com.ibm.websphere.not.public-1.0", iAttr.symbolicName); + Assert.assertNull("shortName should be null", iAttr.shortName); + Assert.assertEquals("featureName should return symbolicName", iAttr.symbolicName, iAttr.featureName); + } + + @Test + public void testMismatchedSupersededFalse() throws IOException { + // We expect this error code to be in the output for mismatched superseded flags + outputMgr.expectError("CWWKF0020E"); + + // Intentional extra trailing whitespace... + // Superseded is specified false, but we say it is superseded by something... + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.supersededA;visibility:=public; superseded=false; superseded-by=\"appSecurity-2.0\" \n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.write("Subsystem-Version: 1.0.0 \n"); + writer.write("IBM-Feature-Version: 2 \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + FeatureDefinitionUtils.loadAttributes("", null, details); + assertFalse("The method isSuperseded() should return false (ignored)", details.isSuperseded()); + } + + @Test + public void testImmutableAttributeFlags() throws Exception { + // Round-trip through the cache will convert to absolute path. We need the input file to + // have also been constructed from an absolute path so it will match.. + File featureFile = new File(SharedConstants.TEST_DATA_DIR, "com.ibm.websphere.supersededA.mf").getAbsoluteFile(); + + // Intentional extra trailing whitespace... + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.supersededA; visibility:=protected \n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.write("Subsystem-Version: 1.0.0 \n"); + writer.write("IBM-Feature-Version: 2 \n"); + writer.write("IBM-App-ForceRestart: install \n"); + writer.write("IBM-API-Package: javax.servlet.annotation; type=\"spec\", \n"); + writer.write(" com.ibm.wsspi.webcontainer; type=\"internal\" \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + ImmutableAttributes iAttr = FeatureDefinitionUtils.loadAttributes("custom", featureFile, details); + Assert.assertFalse("AutoFeature flag should be false", iAttr.isAutoFeature); + Assert.assertFalse("API-service flag should be false", iAttr.hasApiServices); + Assert.assertTrue("API-package flag should be true", iAttr.hasApiPackages); + Assert.assertFalse("SPI-package flag should be false", iAttr.hasSpiPackages); + + // Do nothing that would trigger more detailed fluff up of API/SPI here.. + // Want to make sure it gets into the cache anyway.. + + // Reset the output buffer, let's flatten it for the cache.. + out.reset(); + writer = new PrintWriter(out, true); + FeatureDefinitionUtils.writeAttributes(iAttr, details, writer); + writer.flush(); + String result = out.toString(); + System.out.println(result); + + // So, now we have our shiny cache line, which should actually be two lines, kind of like this: + // com.ibm.websphere.supersededA=;xxxx;xxxx;custom;;2;PROTECTED;INSTALL;1.0.0;0010 + // -A:javax.servlet.annotation; type="spec",javax.servlet.descriptor; type="spec",com.ibm.websphere.servlet.session; type="ibm-api",com.ibm.wsspi.servlet.session; type="ibm-api",com.ibm.wsspi.webcontainer; type="internal" + + String[] lines = result.split(FeatureDefinitionUtils.NL); + Assert.assertEquals("Output should be two lines:\n" + result, 2, lines.length); + Assert.assertTrue("lines[0] should start with custom:\n" + lines[0], lines[0].startsWith("custom:")); + Assert.assertTrue("lines[0] should end with ;;2;PROTECTED;INSTALL;1.0.0;00100;SERVER\n" + lines[0], lines[0].endsWith(";;2;PROTECTED;INSTALL;1.0.0;00100;SERVER")); + Assert.assertTrue("lines[1] SHOULD startsWith API Packages indicator:\n" + lines[1], lines[1].startsWith("-A:")); + + // Now, let's read those lines back in, and make sure the resulting attributes survived + ImmutableAttributes iAttr2 = FeatureDefinitionUtils.loadAttributes(lines[0], null); + Assert.assertNotNull("Should return non-null attribtues", iAttr2); + assertAttributesEqual(ImmutableAttributes.class, iAttr, iAttr2); + Assert.assertEquals("Equals should show these as the same", iAttr, iAttr2); + Assert.assertEquals("hashCode should be the same", iAttr.hashCode(), iAttr2.hashCode()); + + // Let's just mess around with the flags now.. + String newLine = lines[0].replace("0010", "1101"); + System.out.println("Updated line: \n\t" + newLine); + iAttr2 = FeatureDefinitionUtils.loadAttributes(newLine, null); + Assert.assertNotNull("Should return non-null attribtues", iAttr2); + // Equals/hashCode are only focused on symbolic name & version: these should still be equal.. + Assert.assertEquals("Equals should show these as the same", iAttr, iAttr2); + Assert.assertEquals("hashCode should be the same", iAttr.hashCode(), iAttr2.hashCode()); + Assert.assertTrue("AutoFeature flag should be true", iAttr2.isAutoFeature); + Assert.assertTrue("API-service flag should be true", iAttr2.hasApiServices); + Assert.assertFalse("API-package flag should be false", iAttr2.hasApiPackages); + Assert.assertTrue("SPI-package flag should be true", iAttr2.hasSpiPackages); + } + + @Test + public void testProvisioningDetailsExtraLines() throws Exception { + // Round-trip through the cache will convert to absolute path. We need the input file to + // have also been constructed from an absolute path so it will match.. + File featureFile = new File(SharedConstants.TEST_DATA_DIR, "com.ibm.websphere.supersededA.mf").getAbsoluteFile(); + + // Intentional extra trailing whitespace... + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.supersededA; visibility:=public; singleton:=true \n"); + writer.write("IBM-ShortName: shortName\n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.write("Subsystem-Version: 1.0.1 \n"); + writer.write("IBM-Feature-Version: 2 \n"); + writer.write("IBM-App-ForceRestart: uninstall \n"); + // One of each magic header with extra lines .. we know the flags work from the other test, but + // but need to verify the combined parse.. + writer.write("IBM-API-Package: javax.servlet.annotation; type=\"spec\" \n"); + writer.write("IBM-SPI-Package: javax.servlet.descriptor; type=\"spec\" \n"); + writer.write("IBM-API-Service: org.apache.aries.blueprint.NamespaceHandler; service=service; service.ranking=0; osgi.service.blueprint.namespace=\"http://www.osgi.org/xmlns/blueprint/v1.0\" \n"); + writer.write("IBM-Provision-Capability: osgi.identity; filter:=\"(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.blueprint-1.0))\", \n"); + writer.write(" osgi.identity; filter:=\"(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.jpa-2.0))\" \n"); + writer.flush(); + + // Lame: round-trip through to the cache lines we need: + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + ImmutableAttributes iAttr = FeatureDefinitionUtils.loadAttributes("custom", featureFile, details); + out.reset(); + writer = new PrintWriter(out, true); + FeatureDefinitionUtils.writeAttributes(iAttr, details, writer); + writer.flush(); + + // Here it is (should we fail later..) + String result = out.toString(); + System.out.println(result); + + String[] lines = result.split(FeatureDefinitionUtils.NL); + Assert.assertEquals("Output should be 5 lines:\n" + result, 5, lines.length); + Assert.assertTrue("lines[0] should end with ;shortName;2;PUBLIC;UNINSTALL;1.0.1;11111;SERVER\n" + lines[0], + lines[0].endsWith(";shortName;2;PUBLIC;UNINSTALL;1.0.1;11111;SERVER")); + Assert.assertTrue("lines[1] SHOULD startsWith AutoFeature indicator:\n" + lines[1], lines[1].startsWith("-C:")); + Assert.assertTrue("lines[2] SHOULD startsWith API Services indicator:\n" + lines[2], lines[2].startsWith("-V:")); + Assert.assertTrue("lines[3] SHOULD startsWith API Packages indicator:\n" + lines[3], lines[3].startsWith("-A:")); + Assert.assertTrue("lines[4] SHOULD startsWith SPI Packages indicator:\n" + lines[4], lines[4].startsWith("-S:")); + + // So, we know the cache line(s) came out right-ish. Now, what happens when we try to read them in? + in = new ByteArrayInputStream(out.toByteArray()); + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + + // peel off the first line --> immutable attributes + String readLine = reader.readLine(); + ImmutableAttributes newAttr = FeatureDefinitionUtils.loadAttributes(readLine, null); + assertAttributesEqual(ImmutableAttributes.class, iAttr, newAttr); + + // Now, based on our attribute flags.. pull off the extra lines.. + ProvisioningDetails details2 = new ProvisioningDetails(reader, newAttr); + // Some fields should be equal... + assertAttributesEqual(ProvisioningDetails.class, details, details2, + "apiPackages", "apiServices", "autoFeatureCapability", "spiPackages"); + // MOST fields should be null because we avoided touching them. + assertAttributesNull(ProvisioningDetails.class, details2, false, + "apiPackages", "apiServices", "autoFeatureCapability", "spiPackages", "iAttr"); + } + + @Test + public void testInstallIsValidVisibilityDirective() throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0 \n"); + writer.write("Subsystem-SymbolicName: com.ibm.websphere.install-1.0; visibility:=install \n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.write("Subsystem-Version: 1.0.0 \n"); + writer.write("IBM-Feature-Version: 2 \n"); + writer.flush(); + + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + ProvisioningDetails details = new ProvisioningDetails(null, in); + ImmutableAttributes iAttr = FeatureDefinitionUtils.loadAttributes("", null, details); + + Assert.assertEquals("symbolicName should return com.ibm.websphere.install-1.0", "com.ibm.websphere.install-1.0", iAttr.symbolicName); + Assert.assertEquals("Visibility should return INSTALL", Visibility.INSTALL, iAttr.visibility); + } + + void assertAttributesEqual(Class c, Object o1, Object o2, String... fieldNames) throws Exception { + List fields; + if (fieldNames.length == 0) { + fields = Arrays.asList(c.getDeclaredFields()); + } else { + fields = new ArrayList(); + for (String name : fieldNames) { + fields.add(c.getDeclaredField(name)); + } + } + + for (Field f : fields) { + f.setAccessible(true); + Assert.assertEquals("Field " + f.getName() + " should be equal between the two objects", f.get(o1), f.get(o2)); + } + } + + void assertAttributesNull(Class c, Object o, boolean specifiedFieldsAreNull, String... fieldNames) throws Exception { + List fields; + if (fieldNames.length == 0 || !specifiedFieldsAreNull) { + fields = Arrays.asList(c.getDeclaredFields()); + } else { + fields = new ArrayList(); + for (String name : fieldNames) { + fields.add(c.getDeclaredField(name)); + } + } + + List names = Arrays.asList(fieldNames); + + for (Field f : fields) { + // If the names specified in the parameter list are the ones that should not be null, + // and this field is one of those.. skip it. + if (!specifiedFieldsAreNull && names.contains(f.getName())) + continue; + + // skip basic types, statics, and finals. + // --> this is obviously not an exhaustive list. + // types may have to be added when there are fields of those types.. + Class type = f.getType(); + int modifiers = f.getModifiers(); + if (type == int.class || type == boolean.class + || Modifier.isFinal(modifiers) + || Modifier.isStatic(modifiers)) + continue; + + f.setAccessible(true); + Assert.assertNull("Field " + f.getName() + " should have a null value", f.get(o)); + } + } +} diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureRepositoryTest.java b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureRepositoryTest.java new file mode 100755 index 000000000000..65befcbfc770 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureRepositoryTest.java @@ -0,0 +1,308 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.internal.subsystem; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import junit.framework.AssertionFailedError; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedLocationManager; +import test.common.SharedOutputManager; +import test.utils.SharedConstants; +import test.utils.TestUtils; + +import com.ibm.ws.kernel.feature.Visibility; +import com.ibm.ws.kernel.feature.internal.subsystem.FeatureDefinitionUtils.ImmutableAttributes; +import com.ibm.ws.kernel.feature.internal.subsystem.FeatureDefinitionUtils.ProvisioningDetails; +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry; +import com.ibm.ws.kernel.provisioning.ExtensionConstants; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; +import com.ibm.wsspi.kernel.service.location.WsResource; + +/** + * + */ +public class FeatureRepositoryTest { + + static SharedOutputManager outputMgr = SharedOutputManager.getInstance().trace("*=audit=enabled:featureManager=all=enabled"); + static WsLocationAdmin locSvc; + + static final String serverName = "FeatureRepositoryTest"; + + static Field isDirty; + + enum CacheField { + publicFeatureNameToSymbolicName(false), + cachedFeatures(false), + autoFeatures(true), + knownFeatures(true), + knownBadFeatures(true); + + final Field field; + final boolean provisioningOnly; + + CacheField(boolean provisioningOnly) { + this.provisioningOnly = provisioningOnly; + try { + field = FeatureRepository.class.getDeclaredField(this.name()); + field.setAccessible(true); + } catch (Exception e) { + e.printStackTrace(); + throw new AssertionFailedError("Unable to initialize enum for test due to exception: " + e); + } + } + + Object get(FeatureRepository o) throws Exception { + return field.get(o); + } + + Map getMap(FeatureRepository o) throws Exception { + return (Map) field.get(o); + } + + List getList(FeatureRepository o) throws Exception { + return (List) field.get(o); + } + } + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + File root = SharedConstants.TEST_DATA_FILE.getCanonicalFile(); + File lib = new File(root, "lib"); + + TestUtils.setUtilsInstallDir(root); + TestUtils.setKernelUtilsBootstrapLibDir(lib); + TestUtils.clearBundleRepositoryRegistry(); + + locSvc = (WsLocationAdmin) SharedLocationManager.createLocations(SharedConstants.TEST_DATA_DIR, serverName); + TestUtils.recursiveClean(locSvc.getServerResource(null)); + + BundleRepositoryRegistry.initializeDefaults(serverName, true); + + isDirty = FeatureRepository.class.getDeclaredField("isDirty"); + isDirty.setAccessible(true); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + TestUtils.setUtilsInstallDir(null); + TestUtils.setKernelUtilsBootstrapLibDir(null); + TestUtils.clearBundleRepositoryRegistry(); + } + + @After + public void tearDown() { + TestUtils.recursiveClean(locSvc.getServerResource(null)); + } + + @Rule + public TestRule outputRule = outputMgr; + + @Test + public void testReadWriteCache() throws Exception { + WsResource cacheRes = locSvc.getServerOutputResource("testCache"); + System.out.println(BundleRepositoryRegistry.getRepositoryHolder(ExtensionConstants.CORE_EXTENSION).getInstallDir()); + + Assert.assertFalse("The cache file should not exist: " + cacheRes, cacheRes.exists()); + Assert.assertFalse("BundleRepositoryRegistry should have been initialized", BundleRepositoryRegistry.isEmpty()); + + // Create feature repository with cache file. All provisioning caches should be unallocated + FeatureRepository repo = new FeatureRepository(cacheRes, null); + assertNullProvisioningCaches(repo); + + // Read the empty cache _AND_ the manifests based on the locations + // known to the BundleRepositoryImpl... + repo.init(); + assertInitializedProvisioningCaches(repo); + + int numCachedFeatures = CacheField.cachedFeatures.getMap(repo).size(); + int numKnownFeatures = CacheField.knownFeatures.getMap(repo).size(); + + Assert.assertTrue("There should be cached features: " + numCachedFeatures, numCachedFeatures > 0); + Assert.assertEquals("There should be the same number of known features", numCachedFeatures, numKnownFeatures); + Assert.assertEquals("There should be one known bad manifest", 1, CacheField.knownBadFeatures.getMap(repo).size()); + Assert.assertEquals("There should be one known autofeature", 1, CacheField.autoFeatures.getList(repo).size()); + Assert.assertTrue("isDirty should be true", (Boolean) isDirty.get(repo)); + + // Write to file... + repo.storeCache(); + + Assert.assertFalse("isDirty should be false after the cache is written", (Boolean) isDirty.get(repo)); + Assert.assertTrue("The cache file should exist: " + cacheRes, cacheRes.exists()); + + repo.dispose(); + assertNullProvisioningCaches(repo); + + repo.init(); + assertInitializedProvisioningCaches(repo); + + Assert.assertEquals("There should be the same number of cached features as previously", numCachedFeatures, CacheField.cachedFeatures.getMap(repo).size()); + Assert.assertEquals("There should be the same number of known features", numCachedFeatures, CacheField.knownFeatures.getMap(repo).size()); + Assert.assertEquals("There should be one known bad manifest", 1, CacheField.knownBadFeatures.getMap(repo).size()); + Assert.assertEquals("There should be one known autofeature", 1, CacheField.autoFeatures.getList(repo).size()); + Assert.assertFalse("isDirty should be false after the cache is re-read", (Boolean) isDirty.get(repo)); + + // now try a fresh repo as if we are in firstInit startup + repo = new FeatureRepository(cacheRes, null); + + repo.init(); + assertInitializedProvisioningCaches(repo); + + Assert.assertEquals("There should be the same number of cached features as previously", numCachedFeatures, CacheField.cachedFeatures.getMap(repo).size()); + Assert.assertEquals("There should be the same number of known features", numCachedFeatures, CacheField.knownFeatures.getMap(repo).size()); + Assert.assertEquals("There should be one known bad manifest", 1, CacheField.knownBadFeatures.getMap(repo).size()); + Assert.assertEquals("There should be one known autofeature", 1, CacheField.autoFeatures.getList(repo).size()); + Assert.assertFalse("isDirty should be false after the cache is re-read", (Boolean) isDirty.get(repo)); + + //Assert.fail("THE END... "); + } + + @Test + public void testLowerFeature() { + String lf = FeatureRepository.lowerFeature(null); + assertNull("null was not returned", lf); + lf = FeatureRepository.lowerFeature("A"); + assertTrue("A was not converted to lowercase: " + lf, lf.equals("a")); + lf = FeatureRepository.lowerFeature("a"); + assertTrue("a was not returned: " + lf, lf.equals("a")); + lf = FeatureRepository.lowerFeature(":"); + assertTrue(": was not returned: " + lf, lf.equals(":")); + lf = FeatureRepository.lowerFeature(":a"); + assertTrue(":a was not returned: " + lf, lf.equals(":a")); + lf = FeatureRepository.lowerFeature(":A"); + assertTrue(":a was not returned: " + lf, lf.equals(":a")); + lf = FeatureRepository.lowerFeature("P:"); + assertTrue("P: was not returned: " + lf, lf.equals("P:")); + lf = FeatureRepository.lowerFeature("p:"); + assertTrue("p: was not returned: " + lf, lf.equals("p:")); + lf = FeatureRepository.lowerFeature("P:X"); + assertTrue("P:x was not returned: " + lf, lf.equals("P:x")); + lf = FeatureRepository.lowerFeature("p:X"); + assertTrue("p:x was not returned: " + lf, lf.equals("p:x")); + lf = FeatureRepository.lowerFeature("p:x"); + assertTrue("p:x was not returned: " + lf, lf.equals("p:x")); + lf = FeatureRepository.lowerFeature("P:x"); + assertTrue("P:x was not returned: " + lf, lf.equals("P:x")); + lf = FeatureRepository.lowerFeature(" P : X "); + assertTrue("P:x was not returned: " + lf, lf.equals("P:x")); + } + + /** + * This method tests that every public feature has a corresponding OSGi Service registered for it. + * + * @throws Exception + */ + @Test + public void testLibertyFeatureOSGiServiceRegistration() throws Exception { + + MockBundleContext mockBundleContext = new MockBundleContext(); + WsResource cacheRes = locSvc.getServerOutputResource("testCache"); + + // Create feature repository with cache file. All provisioning caches should be unallocated + FeatureRepository repo = new FeatureRepository(cacheRes, mockBundleContext); + repo.init(); + + // Reflectively make the updateMaps private method usable. + Method updateMapsMethod = repo.getClass().getDeclaredMethod("updateMaps", SubsystemFeatureDefinitionImpl.class); + updateMapsMethod.setAccessible(true); + + // Create all the feature definitions and store them in a set. + Set allFeatureDefs = new HashSet(); + + allFeatureDefs.add(createSubsystemFeatureDef("publicFeatureA-1.0", "com.ibm.ws.public.featureA-1.0", "public", "bundleA")); + allFeatureDefs.add(createSubsystemFeatureDef("publicFeatureB-1.0", "com.ibm.ws.public.featureB-1.0", "public", "bundleB")); + allFeatureDefs.add(createSubsystemFeatureDef("com.ibm.ws.public.featureC-1.0", "com.ibm.ws.public.featureC-1.0", "public", "bundleC")); + allFeatureDefs.add(createSubsystemFeatureDef("com.ibm.ws.private.featureD-1.0", "com.ibm.ws.private.featureD-1.0", "private", "bundleD")); + allFeatureDefs.add(createSubsystemFeatureDef("publicFeature-e-1.0", "com.ibm.ws.public.featuree-1.0", "public", "bundleE")); + allFeatureDefs.add(createSubsystemFeatureDef("publicFeature-f-1.0", "com.ibm.ws.public.featuref-1.0", "public", "bundleF")); + allFeatureDefs.add(createSubsystemFeatureDef("com.ibm.ws.public.featureg-1.0", "com.ibm.ws.public.featureg-1.0", "private", "bundleD")); + + // Now iterate through them and run each of them through updateMaps to get them registered in the repo. We also store the public ones + // in a set to use in the checking at the end of the method. We also add all of the featureNames to the installedFeatures variable that + // we will push into the repo as well. + + Set publicFeatureNames = new HashSet(); + Set installedFeatures = new HashSet(); + for (SubsystemFeatureDefinitionImpl featureDef : allFeatureDefs) { + // Add the featureName to the installedFeatures. + installedFeatures.add(featureDef.getFeatureName()); + // If it is public add it to the list of public feature names + if (featureDef.getVisibility().equals(Visibility.PUBLIC)) + publicFeatureNames.add(featureDef.getFeatureName()); + // Run the feature through the updateMaps method + updateMapsMethod.invoke(repo, featureDef); + } + + // Store the installedFeatures + repo.setInstalledFeatures(installedFeatures, installedFeatures, false); + + // Update the services, which will register the OSGi Services. + repo.updateServices(); + + // Get the registered Services from the mocked Bundle Context. + Set registeredServices = mockBundleContext.getRegisteredServices(); + + // Ensure we have the right number of registered service, and that the correct services have been registered + assertEquals("Number of registered services doesn't match the number of public features", + publicFeatureNames.size(), registeredServices.size()); + for (String publicFeatureName : publicFeatureNames) { + assertTrue("Public feature " + publicFeatureName + " is not listed among the registered services", + registeredServices.contains(publicFeatureName)); + } + } + + private void assertNullProvisioningCaches(FeatureRepository repo) throws Exception { + for (CacheField mapField : CacheField.values()) { + if (mapField.provisioningOnly) + Assert.assertNull(mapField.name() + " should be null before call to init", mapField.get(repo)); + } + } + + private void assertInitializedProvisioningCaches(FeatureRepository repo) throws Exception { + for (CacheField mapField : CacheField.values()) { + if (mapField.provisioningOnly) + Assert.assertNotNull(mapField.name() + " should be initialized after call to init", mapField.get(repo)); + } + } + + /* + * A method to generate a SubsystemFeatureDefinition object from a subset of feature info. + */ + public static SubsystemFeatureDefinitionImpl createSubsystemFeatureDef(String shortName, String symbolicName, String visibility, String subsystemContentString) throws Exception { + ProvisioningDetails details = new ProvisioningDetails(null, TestUtils.createValidFeatureManifestStream(shortName, symbolicName + "; visibility:=" + visibility, + subsystemContentString)); + ImmutableAttributes iAttr = FeatureDefinitionUtils.loadAttributes("", null, details); + + return new SubsystemFeatureDefinitionImpl(iAttr, details); + } +} diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/subsystem/MockBundleContext.java b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/subsystem/MockBundleContext.java new file mode 100755 index 000000000000..421085cdfc17 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/src/com/ibm/ws/kernel/feature/internal/subsystem/MockBundleContext.java @@ -0,0 +1,260 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.feature.internal.subsystem; + +import java.io.File; +import java.io.InputStream; +import java.util.Collection; +import java.util.Dictionary; +import java.util.HashSet; +import java.util.Set; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; +import org.osgi.framework.BundleListener; +import org.osgi.framework.Filter; +import org.osgi.framework.FrameworkListener; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceListener; +import org.osgi.framework.ServiceObjects; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.ServiceRegistration; + +/** + * + */ +public class MockBundleContext implements BundleContext { + + Set registeredServices = new HashSet(); + + @Override + public String getProperty(String key) { + return null; + } + + @Override + public Bundle getBundle() { + return null; + } + + @Override + public Bundle installBundle(String location, InputStream input) throws BundleException { + return null; + } + + @Override + public Bundle installBundle(String location) throws BundleException { + return null; + } + + @Override + public Bundle getBundle(long id) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Bundle[] getBundles() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException { + // TODO Auto-generated method stub + + } + + @Override + public void addServiceListener(ServiceListener listener) { + // TODO Auto-generated method stub + + } + + @Override + public void removeServiceListener(ServiceListener listener) { + // TODO Auto-generated method stub + + } + + @Override + public void addBundleListener(BundleListener listener) { + // TODO Auto-generated method stub + + } + + @Override + public void removeBundleListener(BundleListener listener) { + // TODO Auto-generated method stub + + } + + @Override + public void addFrameworkListener(FrameworkListener listener) {} + + @Override + public void removeFrameworkListener(FrameworkListener listener) {} + + @Override + public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) { + this.registeredServices.add((String) properties.get("ibm.featureName")); + return null; + } + + @Override + public ServiceRegistration registerService(String clazz, Object service, Dictionary properties) { + this.registeredServices.add((String) properties.get("ibm.featureName")); + return null; + } + + @Override + public ServiceRegistration registerService(Class clazz, S service, Dictionary properties) { + this.registeredServices.add((String) properties.get("ibm.featureName")); + return null; + } + + @Override + public ServiceRegistration registerService(Class clazz, ServiceFactory factory, Dictionary properties) { + this.registeredServices.add((String) properties.get("ibm.featureName")); + return null; + } + + // Simple getter for the list of services. Probably should create serviceReferences from the generated ServiceRegistrations but + // for the FeatureRepository test, I just need to know which services were registered. + public Set getRegisteredServices() { + return this.registeredServices; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleContext#getServiceReferences(java.lang.String, java.lang.String) + */ + @Override + public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleContext#getAllServiceReferences(java.lang.String, java.lang.String) + */ + @Override + public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleContext#getServiceReference(java.lang.String) + */ + @Override + public ServiceReference getServiceReference(String clazz) { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleContext#getServiceReference(java.lang.Class) + */ + @Override + public ServiceReference getServiceReference(Class clazz) { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleContext#getServiceReferences(java.lang.Class, java.lang.String) + */ + @Override + public Collection> getServiceReferences(Class clazz, String filter) throws InvalidSyntaxException { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleContext#getService(org.osgi.framework.ServiceReference) + */ + @Override + public S getService(ServiceReference reference) { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleContext#ungetService(org.osgi.framework.ServiceReference) + */ + @Override + public boolean ungetService(ServiceReference reference) { + // TODO Auto-generated method stub + return false; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleContext#getDataFile(java.lang.String) + */ + @Override + public File getDataFile(String filename) { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleContext#createFilter(java.lang.String) + */ + @Override + public Filter createFilter(String filter) throws InvalidSyntaxException { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleContext#getBundle(java.lang.String) + */ + @Override + public Bundle getBundle(String location) { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleContext#getServiceObjects(org.osgi.framework.ServiceReference) + */ + @Override + public ServiceObjects getServiceObjects(ServiceReference reference) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/src/test/utils/SharedConstants.java b/dev/com.ibm.ws.kernel.feature_test/unittest/src/test/utils/SharedConstants.java new file mode 100755 index 000000000000..9efd21c440ed --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/src/test/utils/SharedConstants.java @@ -0,0 +1,36 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * Change activity: + * + * Issue Date Name Description + * ----------- ----------- --------- ------------------------------------ + * Initial version + */ +package test.utils; + +import java.io.File; + +/** + * + */ +public class SharedConstants { + /** + * Test data directory: note the space! always test paths with spaces. Dratted + * windows. + */ + public static final String TEST_DATA_DIR = "../com.ibm.ws.kernel.feature_test/build/unittest/test data"; + + public static final File TEST_DATA_FILE = new File(TEST_DATA_DIR); + + /** Test dist dir: where our generated sample jars live */ + public static final String TEST_DIST_DIR = "../com.ibm.ws.kernel.feature_test/build/unittest/test data/lib"; +} diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/src/test/utils/TestUtils.java b/dev/com.ibm.ws.kernel.feature_test/unittest/src/test/utils/TestUtils.java new file mode 100755 index 000000000000..ced943542ff1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/src/test/utils/TestUtils.java @@ -0,0 +1,228 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.utils; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.InputStream; +import java.io.PrintWriter; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.Collection; +import java.util.Map; + +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkListener; +import org.osgi.framework.startlevel.BundleStartLevel; +import org.osgi.framework.startlevel.FrameworkStartLevel; +import org.osgi.framework.wiring.BundleCapability; +import org.osgi.framework.wiring.BundleRevision; +import org.osgi.framework.wiring.FrameworkWiring; +import org.osgi.resource.Requirement; + +import com.ibm.ws.kernel.boot.cmdline.Utils; +import com.ibm.ws.kernel.boot.internal.KernelUtils; +import com.ibm.ws.kernel.feature.internal.RefreshBundlesListener; +import com.ibm.ws.kernel.feature.internal.StartLevelFrameworkListener; +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry; +import com.ibm.wsspi.kernel.service.location.WsResource; + +/** + * + */ +public class TestUtils { + + static Field bootLibDirField = null; + static Field utilsInstallDirField = null; + static Field bundleRepository = null; + + public static void clearBundleRepositoryRegistry() throws Exception { + if (bundleRepository == null) { + bundleRepository = BundleRepositoryRegistry.class.getDeclaredField("repositoryHolders"); + bundleRepository.setAccessible(true); + } + ((Map) bundleRepository.get(null)).clear(); + } + + /** Replace the location of the kernel lib directory (usually calculated) */ + public static void setKernelUtilsBootstrapLibDir(File bootLibDir) throws Exception { + if (bootLibDirField == null) { + bootLibDirField = KernelUtils.class.getDeclaredField("libDir"); + bootLibDirField.setAccessible(true); + } + bootLibDirField.set(null, bootLibDir); + } + + /** Replace the location of the utils install directory (usually calculated) */ + public static void setUtilsInstallDir(File installDir) throws Exception { + if (utilsInstallDirField == null) { + utilsInstallDirField = Utils.class.getDeclaredField("installDir"); + utilsInstallDirField.setAccessible(true); + } + utilsInstallDirField.set(null, installDir); + } + + /** + * Return an input stream containing a valid feature manifest + * + * @param symbolicNameString flattened symbolic name string. e.g. com.ibm.websphere.dummy;visibility:=protected + * @param subsystemContentString flattened subsystem content string (including leading whitespace and + * middle line endings if wrapped): notexist1;location:="lib/notexist1" + * @return InputStream that can be used to construct a SubsystemDefinition + */ + public static InputStream createValidFeatureManifestStream(String symbolicNameString, String subsystemContentString) { + return createValidFeatureManifestStream(null, symbolicNameString, subsystemContentString); + } + + /** + * Return an input stream containing a valid feature manifest + * + * @param shortName - the short name for the feature. + * @param symbolicNameString flattened symbolic name string. e.g. com.ibm.websphere.dummy;visibility:=protected + * @param subsystemContentString flattened subsystem content string (including leading whitespace and + * middle line endings if wrapped): notexist1;location:="lib/notexist1" + * @return InputStream that can be used to construct a SubsystemDefinition + */ + public static InputStream createValidFeatureManifestStream(String shortName, String symbolicNameString, String subsystemContentString) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out, true); + writer.write("Manifest-Version: 1.0\n"); + writer.write("Subsystem-SymbolicName: " + symbolicNameString + "\n"); + if (shortName != null) + writer.write("IBM-ShortName: " + shortName + "\n"); + writer.write("Subsystem-Type: osgi.subsystem.feature \n"); + writer.write("Subsystem-Version: 1.0.0 \n"); + writer.write("IBM-Feature-Version: 2 \n"); + writer.write("Subsystem-Content: " + subsystemContentString + "\n"); + writer.flush(); + + return new ByteArrayInputStream(out.toByteArray()); + } + + /** Trivial interface that groups Bundle & BundleStartLevel so mock can push through the adapt method */ + public static interface TestBundleStartLevel extends Bundle, BundleStartLevel {} + + /** Trivial interface that groups Bundle & BundleRevision so mock can push through the adapt method */ + public static interface TestBundleRevision extends Bundle, BundleRevision {} + + public static final class TestFrameworkStartLevel implements FrameworkStartLevel { + @Override + public Bundle getBundle() { + return null; + } + + @Override + public int getStartLevel() { + return 0; + } + + @Override + public void setStartLevel(int startlevel, FrameworkListener... listeners) { + try { + Method m = StartLevelFrameworkListener.class.getDeclaredMethod("levelReached", boolean.class); + m.setAccessible(true); + + for (FrameworkListener l : listeners) { + if (l instanceof StartLevelFrameworkListener) { + StartLevelFrameworkListener sl = (StartLevelFrameworkListener) l; + m.invoke(sl, false); + } + } + } catch (Exception t) { + throw new RuntimeException("Unexpected exception invoking StartLevelFrameworkListener.levelReached: " + t.getMessage(), t); + } + } + + @Override + public int getInitialBundleStartLevel() { + return 2; + } + + @Override + public void setInitialBundleStartLevel(int startlevel) {} + } + + public static final class TestFrameworkWiring implements FrameworkWiring { + @Override + public Bundle getBundle() { + return null; + } + + @Override + public void refreshBundles(Collection bundles, FrameworkListener... listeners) { + try { + Method m = RefreshBundlesListener.class.getDeclaredMethod("finish", boolean.class); + m.setAccessible(true); + + for (FrameworkListener l : listeners) { + if (l instanceof RefreshBundlesListener) { + RefreshBundlesListener rl = (RefreshBundlesListener) l; + m.invoke(rl, false); + } + } + } catch (Exception t) { + throw new RuntimeException("Unexpected exception invoking RefreshBundlesListener.finish: " + t.getMessage(), t); + } + } + + @Override + public boolean resolveBundles(Collection bundles) { + return false; + } + + @Override + public Collection getRemovalPendingBundles() { + return null; + } + + @Override + public Collection getDependencyClosure(Collection bundles) { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.wiring.FrameworkWiring#findProviders(org.osgi.resource.Requirement) + */ + @Override + public Collection findProviders(Requirement requirement) { + // TODO Auto-generated method stub + return null; + } + } + + public static void recursiveClean(final WsResource fileToRemove) { + recursiveClean(new File(fileToRemove.toExternalURI())); + } + + public static void recursiveClean(final File fileToRemove) { + if (fileToRemove == null) + return; + + if (!fileToRemove.exists()) + return; + + if (fileToRemove.isDirectory()) { + File[] files = fileToRemove.listFiles(); + for (File file : files) { + if (file.isDirectory()) + recursiveClean(file); + else + file.delete(); + } + } + + fileToRemove.delete(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/com.ibm.websphere.supersededA.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/com.ibm.websphere.supersededA.mf new file mode 100755 index 000000000000..dad43df56310 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/com.ibm.websphere.supersededA.mf @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Subsystem-SymbolicName: com.ibm.websphere.supersededA;visibility:=public; superseded=true; superseded-by="appSecurity-2.0,[servlet-3.0]" +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: notexistA;location:="lib/notexistA" +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/com.ibm.websphere.supersededB.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/com.ibm.websphere.supersededB.mf new file mode 100755 index 000000000000..1cfd3d62e773 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/com.ibm.websphere.supersededB.mf @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Subsystem-SymbolicName: com.ibm.websphere.supersededB;visibility:=public; superseded=false; superseded-by="appSecurity-2.0,servlet-3.0" +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: notexistA;location:="lib/notexistB" +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/dir.bundle.test/META-INF/MANIFEST.MF b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/dir.bundle.test/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..c65e274faa60 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/dir.bundle.test/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Bundle-Description dir.test, version 0.1 +Bundle-ManifestVersion 2 +Bundle-Name dir-based bundle +Bundle-SymbolicName dir.bundle.test +Bundle-Version 0.1 +Created-By 1.6.0 (IBM Corporation) +Manifest-Version 1.0 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.A.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.A.mf new file mode 100755 index 000000000000..019efecab8e0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.A.mf @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Subsystem-SymbolicName: com.ibm.websphere.A;visibility:="internal" +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: notexistA;location:="lib/notexistA" +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.B.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.B.mf new file mode 100755 index 000000000000..91b1699accbc --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.B.mf @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Subsystem-SymbolicName: com.ibm.websphere.B;visibility:="internal" +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: notexistB;location:="lib/notexistB" +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.good.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.good.mf new file mode 100755 index 000000000000..85a90ba0df11 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.good.mf @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Subsystem-SymbolicName: com.ibm.websphere.good +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: notexist1;location:="lib/notexist1", + notexist2;location:="lib/notexist2", + simple;version=1;location:="lib/simple_1.jar", + simple;version=2;location:="lib/simple_2.jar" + com.ibm.websphere.A;type="osgi.subsystem.feature", + com.ibm.websphere.B;type="osgi.subsystem.feature" +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.public.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.public.mf new file mode 100755 index 000000000000..fcf45ba57f2f --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.public.mf @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +IBM-ShortName: public-1.0 +Subsystem-SymbolicName: com.ibm.websphere.public-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.short.not.public.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.short.not.public.mf new file mode 100755 index 000000000000..7ca68c4e6457 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/com.ibm.websphere.short.not.public.mf @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +IBM-ShortName: public-1.0 +Subsystem-SymbolicName: com.ibm.websphere.short.not.public-1.0 +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/dummy.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/dummy.mf new file mode 100755 index 000000000000..2707102338e5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/dummy.mf @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Subsystem-SymbolicName: com.ibm.websphere.dummy;visibility:="internal" +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: simple; location:="lib/simple_3.jar" +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/featureA-1.0.MF b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/featureA-1.0.MF new file mode 100755 index 000000000000..db19664b9449 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/featureA-1.0.MF @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: featureA-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureA-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle1; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/featureB-1.0.MF b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/featureB-1.0.MF new file mode 100755 index 000000000000..53dc04335bf8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/featureB-1.0.MF @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:featureB-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureB-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle2; version="[1,2)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/featureE-1.0.MF b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/featureE-1.0.MF new file mode 100755 index 000000000000..bcd13f874d29 --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/featureE-1.0.MF @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:featureE-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.featureE-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: bundle5; version="[1,2)" +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureA-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureB-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/invalidSubsystemTypeFeature-1.0.mf b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/invalidSubsystemTypeFeature-1.0.mf new file mode 100755 index 000000000000..5fb996bf23ab --- /dev/null +++ b/dev/com.ibm.ws.kernel.feature_test/unittest/test data/lib/features/invalidSubsystemTypeFeature-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: InvalidSubsystemTypeFeature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureA-1.0))", + osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=com.ibm.websphere.appserver.featureB-1.0))" +IBM-Install-Policy: when-satisfied +Subsystem-Content: Bundle1; version="[1,2)" +Subsystem-Type: com.ibm.websphere.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath b/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath.gradle b/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.gitignore b/dev/com.ibm.ws.kernel.filemonitor_fat/.gitignore new file mode 100644 index 000000000000..62c58326f568 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.gitignore @@ -0,0 +1,2 @@ +dropins +/nohup.out diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.project b/dev/com.ibm.ws.kernel.filemonitor_fat/.project new file mode 100755 index 000000000000..ab03967beda5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.filemonitor_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..74d9c72c1f30 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,113 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd b/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd new file mode 100644 index 000000000000..35ef5a473ba6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.kernel.filemonitor;version=latest diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..35ef5a473ba6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.kernel.filemonitor;version=latest diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/build-test.xml b/dev/com.ibm.ws.kernel.filemonitor_fat/build-test.xml new file mode 100755 index 000000000000..4862d2787e3d --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/build-test.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.logging_test/build.nogradle b/dev/com.ibm.ws.kernel.filemonitor_fat/build.gradle similarity index 100% rename from dev/com.ibm.ws.zos.logging_test/build.nogradle rename to dev/com.ibm.ws.kernel.filemonitor_fat/build.gradle diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/delivery.sets b/dev/com.ibm.ws.kernel.filemonitor_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/AbstractNotificationTest.java b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/AbstractNotificationTest.java new file mode 100755 index 000000000000..4ab5fd623870 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/AbstractNotificationTest.java @@ -0,0 +1,291 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.junit.BeforeClass; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class AbstractNotificationTest { + + protected static final String MESSAGE_LOG = "logs/messages.log"; + private static final String BUNDLE_NAME = "com.ibm.ws.kernel.filemonitor.monitor.test.bundle_1.0.0"; + private static final String FEATURE_NAME = "monitoringPrintingFeature-1.0"; + + // Not thread-safe, but this code is unlikely to run multi-threaded, being a unit test + private static final DateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss:SSS"); + + protected static LibertyServer server; + protected static File monitoredFolder; + protected static File monitoredFile; + protected static File nonexistentFolder; + protected static File nonexistentFile; + + @BeforeClass + public static void classSetUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.kernel.filemonitor.server"); + // install our user feature + server.installUserBundle(BUNDLE_NAME); // NO HYPHENS! NO ".jar" SUFFIX! + server.installUserFeature(FEATURE_NAME); // NO UNDERSCORES! NO ".mf" SUFFIX! + server.startServer(); + + // Figure out where our test monitors are monitoring + String foldereyecatcher = "-MONITORED FOLDER-"; + String line = server.waitForStringInLog(foldereyecatcher); + assertNotNull("Our test feature should report the folder location we're monitoring.", line); + int index = line.indexOf(foldereyecatcher) + foldereyecatcher.length(); + // We create the file objects but not files on disk + monitoredFolder = new File(line.substring(index)); + + String fileeyecatcher = "-MONITORED FILE-"; + line = server.waitForStringInLog(fileeyecatcher); + assertNotNull("Our test feature should report the file location we're monitoring.", line); + index = line.indexOf(fileeyecatcher) + fileeyecatcher.length(); + // We create the file objects but not files on disk + monitoredFile = new File(line.substring(index)); + + String nonexistentfileeyecatcher = "-NONEXISTENT FILE-"; + line = server.waitForStringInLog(nonexistentfileeyecatcher); + assertNotNull("Our test feature should report the file location we're monitoring.", line); + index = line.indexOf(nonexistentfileeyecatcher) + nonexistentfileeyecatcher.length(); + // We create the file objects but not files on disk + nonexistentFile = new File(line.substring(index)); + + String nonexistentfoldereyecatcher = "-NONEXISTENT FOLDER-"; + line = server.waitForStringInLog(nonexistentfoldereyecatcher); + assertNotNull("Our test feature should report the folder location we're monitoring.", line); + index = line.indexOf(nonexistentfoldereyecatcher) + nonexistentfoldereyecatcher.length(); + // We create the folder objects but not folders on disk + nonexistentFolder = new File(line.substring(index)); + + } + + /** + * Waits for notifications to catch up after file changes that we're not especially + * interested in. This method should be used with caution since it resets + * the mark, so it should only be used when no monitor might want to see + * the changes that got notified. + */ + protected int flushNotifications(MonitorReader monitor) throws Exception { + // Wait for notifications to catch up + int count = monitor.scrapeLogsForChanges(); + monitor.clear(); + + server.setMarkToEndOfLog(); + + return count; + } + + protected void createFolder(File folder) { + assertTrue("Folder should have been created on the file system", folder.mkdirs()); + } + + /** + * Creates a file and also asserts we did actually create it + * (thus avoiding many puzzling notification failures). + */ + protected void createFile(File f) throws IOException { + assertTrue("File should have been created on the file system: " + f, f.createNewFile()); + } + + /** + * Deletes a file or folder and all its contents. + * If anything doesn't get deleted, an assertion will be failed. + */ + protected boolean deleteFile(File f) { + boolean success = false; + for (int pass = 0; !success && pass < 10; ++pass) + { + if (f.isDirectory()) { + File[] files = f.listFiles(); + for (File file : files) { + if (file.isDirectory()) { // Very minor efficiency hack, avoid last level of recursion + // Recurse + deleteFile(file); + } else { + file.delete(); // Failure here will be caught by the later f.delete. Ugly, but that's what we had. + } + } + } + success = f.delete(); + + if (!success) + { + try + { + Thread.sleep(500); + } catch (InterruptedException e) + { + // that's ok, just try it again + } + } + } + assertTrue("Should have been able to delete the file " + f, success); + return success; + } + + protected void appendSomething(File f) throws FileNotFoundException { + PrintWriter w = new PrintWriter(new FileOutputStream(f)); + w.println(new Date() + "Append some stuff\n\n"); + w.flush(); + w.close(); + } + + protected boolean updateTimestamp(File f) { + return f.setLastModified(System.currentTimeMillis() - (30 * 60 * 1000)); + } + + protected void assertNothingDeleted(final MonitorReader monitorReader) { + assertTrue( + "The following files were unexpectedly reported as deleted by the " + monitorReader.name + ":" + stringify(monitorReader.deleted), + monitorReader.deleted.isEmpty()); + } + + protected void assertNothingDeleted(String messagePrefix, final MonitorReader monitorReader) { + assertTrue(messagePrefix + + "the following files were unexpectedly reported as deleted by the " + monitorReader.name + ":" + stringify(monitorReader.deleted), + monitorReader.deleted.isEmpty()); + } + + protected void assertNothingModified(final MonitorReader monitorReader) { + assertTrue("The following files were unexpectedly reported as modified by the " + monitorReader.name + ":" + stringify(monitorReader.modified), + monitorReader.modified.isEmpty()); + } + + protected void assertNothingCreated(String messagePrefix, final MonitorReader monitorReader) { + assertTrue(messagePrefix + + "the following files were unexpectedly reported as created by the " + monitorReader.name + ":" + stringify(monitorReader.created), + monitorReader.created.isEmpty()); + } + + protected void assertNothingCreated(final MonitorReader monitorReader) { + assertTrue( + "The following files were unexpectedly reported as created by the " + monitorReader.name + ":" + stringify(monitorReader.created), + monitorReader.created.isEmpty()); + } + + protected void assertModified(final MonitorReader monitorReader, File... files) { + + final Collection collected = new ArrayList(); + for (File file : files) { + collected.add(file); + } + + assertNothingCreated(monitorReader); + assertNothingDeleted(monitorReader); + + assertFalse("A file should have been reported as modified by the " + monitorReader.name + ". \nGave up searching at " + DATE_FORMAT.format(monitorReader.lastSearchTime) + + ".", monitorReader.modified.isEmpty()); + assertEqualsOrderless("The wrong file was reported as modified by the " + monitorReader.name, collected, monitorReader.modified); + } + + protected void assertDeleted(final MonitorReader monitorReader, File... files) { + + final Collection collected = new ArrayList(); + for (File file : files) { + collected.add(file); + } + + assertNothingModified(monitorReader); + assertNothingCreated(monitorReader); + + assertFalse("A file should have been reported as deleted by the " + monitorReader.name + ". \nGave up searching at " + DATE_FORMAT.format(monitorReader.lastSearchTime) + + ".", monitorReader.deleted.isEmpty()); + assertEqualsOrderless("The wrong file was reported as deleted by the " + monitorReader.name, collected, monitorReader.deleted); + } + + protected void assertCreated(final MonitorReader monitorReader, File... files) { + + final Collection collected = new ArrayList(); + for (File file : files) { + collected.add(file); + } + + assertNothingModified(monitorReader); + assertNothingDeleted(monitorReader); + + assertFalse("A file should have been reported as created by the " + monitorReader.name + ". \nGave up searching at " + DATE_FORMAT.format(monitorReader.lastSearchTime) + + ".", monitorReader.created.isEmpty()); + assertEqualsOrderless("The wrong file was reported as created by the " + monitorReader.name, collected, monitorReader.created); + } + + protected void assertEqualsOrderless(String message, File[] expected, Collection actual) { + assertEqualsOrderless(message, Arrays.asList(expected), actual); + } + + /** + * Compares two collections for equality, ignoring the original order of elements + */ + private void assertEqualsOrderless(String message, Collection expected, Collection actual) { + // Compare by sorting before comparing + + // Put into a set to eliminate duplicates (we'll check for those in a moment) + Set actualSet = convertToSet(actual); + Set expectedSet = convertToSet(expected); + + // Convert to a list so we get ordering + List expectedList = convertToSortedList(expectedSet); + List actualList = convertToSortedList(actualSet); + + assertEquals(message, expectedList, actualList); + + // Now check for duplicates (unless we had the same duplicates in the expected list) + assertEquals("Although we were notified about the correct files, the same file was unexpectedly included multiple times in the list of changed files.", + convertToSortedList(expectedList), + convertToSortedList(actual)); + + } + + private String stringify(Collection list) { + return Arrays.toString(list.toArray()); + } + + private List convertToSortedList(Collection collection) { + List list = new ArrayList(); + list.addAll(collection); + Collections.sort(list); + + return list; + } + + private Set convertToSet(Collection collection) { + Set set = new HashSet(); + set.addAll(collection); + return set; + } +} diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FATSuite.java b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FATSuite.java new file mode 100755 index 000000000000..cc2f711d5a4f --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FATSuite.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * + */ +@RunWith(Suite.class) +@SuiteClasses( { FileMonitorTest.class, FileNotificationMBeanTest.class }) +public class FATSuite { + +} diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileMonitorTest.java b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileMonitorTest.java new file mode 100755 index 000000000000..4117cc1c7c6c --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileMonitorTest.java @@ -0,0 +1,1022 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; + +import org.junit.After; +import org.junit.Test; + +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; + +/** + * + */ +public class FileMonitorTest extends AbstractNotificationTest { + + /** + * Cut-and-pasted from the test feature. No direct compile-time or run-time + * communication is possible, so we're fragile. + */ + private static final MonitorReader fileMonitor = new MonitorReader("-FILETESTMONITOROUTPUT-", "file monitor"); + private static final MonitorReader nonexistentFileMonitor = new MonitorReader("-FILENONEXISTENTTESTMONITOROUTPUT-", "file monitor for file which doesn't exist"); + private static final MonitorReader confusedFileMonitor = new MonitorReader("-FILEBUTACTUALLYMONITORINGDIRECTORYTESTMONITOROUTPUT-", "file monitor for a file which is actually a folder"); + private static final MonitorReader recursiveMonitor = new MonitorReader("-RECURSIVETESTMONITOROUTPUT-", "recursive folder monitor"); + private static final MonitorReader nonexistentFolderMonitor = new MonitorReader("-NONEXISTENTFOLDERTESTMONITOROUTPUT-", "folder monitor for folder which doesn't exist"); + private static final MonitorReader confusedFolderMonitor = new MonitorReader("-RECURSIVEBUTACTUALLYMONITORINGFILETESTMONITOROUTPUT-", "folder monitor for a folder which is actually a file"); + private static final MonitorReader filterMonitor = new MonitorReader("-FILTEREDTESTMONITOROUTPUT-", "filtered folder monitor"); + private static final MonitorReader filefilterMonitor = new MonitorReader("-FILEFILTERTESTMONITOROUTPUT-", "only-files filtered folder monitor"); + private static final MonitorReader directoryfilterMonitor = new MonitorReader("-DIRECTORYFILTERTESTMONITOROUTPUT-", "only-directories filtered folder monitor"); + private static final MonitorReader nonRecursiveMonitor = new MonitorReader("-NONRECURSINGTESTMONITOROUTPUT-", "non-recursive folder monitor"); + private static final MonitorReader nonRecursiveMonitorSelfMonitor = new MonitorReader("-NONRECURSEMONITORSELFTESTMONITOROUTPUT-", "non-recursive self-monitoring folder monitor"); + private static final MonitorReader monitorSelfMonitor = new MonitorReader("-MONITORSELFTESTMONITOROUTPUT-", "self-monitoring folder monitor"); + + @After + public void tearDown() throws Exception { + // Clear up after any tests which may have deleted the monitored folder + if (!monitoredFolder.exists()) { + monitoredFolder.mkdirs(); + // Get rid of any notifications from reinstating the folder + // This flush assumes that the monitor self monitor works + flushNotifications(monitorSelfMonitor); + } + + // Get rid of any dangling notifications from tests, using the monitor most likely to catch something + flushNotifications(recursiveMonitor); + + } + + @Test + public void testBaselineIsReported() throws Exception { + + recursiveMonitor.scrapeLogsForBaseline(); + + assertFalse("The baseline should not be empty", recursiveMonitor.baseline.isEmpty()); + // We're not monitoring the directory itself, so it won't get included in the baseline + } + + @Mode(TestMode.FULL) + @Test + public void testBaselineIncludesNestedFolders() throws Exception { + File baseline = new File(monitoredFolder, "baseline"); + File baseline1 = new File(monitoredFolder, "baseline1"); + File nested = new File(monitoredFolder, "nestedBaselineFolder"); + File nestedFile = new File(nested, "nestedBaselineFile"); + + recursiveMonitor.scrapeLogsForBaseline(); + + assertFalse("The baseline should not be empty", recursiveMonitor.baseline.isEmpty()); + assertEqualsOrderless("The baseline didn't have the expected files in it.", new File[] { baseline, baseline1, nested, nestedFile }, recursiveMonitor.baseline); + } + + @Test + public void testBaselineDoesNotIncludeNestedFoldersInNonRecursiveCase() throws Exception { + File baseline = new File(monitoredFolder, "baseline"); + File baseline1 = new File(monitoredFolder, "baseline1"); + File nested = new File(monitoredFolder, "nestedBaselineFolder"); + + nonRecursiveMonitor.scrapeLogsForBaseline(); + + assertFalse("The baseline should not be empty", nonRecursiveMonitor.baseline.isEmpty()); + assertEqualsOrderless("The baseline didn't have the expected files in it.", new File[] { baseline, baseline1, nested }, nonRecursiveMonitor.baseline); + } + + @Test + public void testBaselineIncludesSelfInSelfDirectoryCase() throws Exception { + File baseline = new File(monitoredFolder, "baseline"); + File baseline1 = new File(monitoredFolder, "baseline1"); + File nested = new File(monitoredFolder, "nestedBaselineFolder"); + File nestedFile = new File(nested, "nestedBaselineFile"); + + // Set the mark to the beginning of the log, since the baseline will happen at the beginning but + // this test could run in any order + // This will reset the marks, too + server.resetLogOffsets(); + monitorSelfMonitor.scrapeLogsForBaseline(); + + assertFalse("The baseline should not be empty", monitorSelfMonitor.baseline.isEmpty()); + assertEqualsOrderless("The baseline didn't have the expected files in it.", new File[] { monitoredFolder, baseline, baseline1, nested, nestedFile }, + monitorSelfMonitor.baseline); + } + + @Mode(TestMode.FULL) + @Test + public void testBaselineIncludesSelfInSelfNonRecursiveDirectoryCase() throws Exception { + File baseline = new File(monitoredFolder, "baseline"); + File baseline1 = new File(monitoredFolder, "baseline1"); + File nested = new File(monitoredFolder, "nestedBaselineFolder"); + + nonRecursiveMonitorSelfMonitor.scrapeLogsForBaseline(); + + assertFalse("The baseline should not be empty", nonRecursiveMonitorSelfMonitor.baseline.isEmpty()); + assertEqualsOrderless("The baseline didn't have the expected files in it.", new File[] { monitoredFolder, baseline, baseline1, nested }, + nonRecursiveMonitorSelfMonitor.baseline); + } + + @Test + public void testBaselineIsEmptyForNonExistentFile() throws Exception { + nonexistentFileMonitor.scrapeLogsForBaseline(); + + assertEquals("A baseline should have been reported, and been empty.", 0, nonexistentFileMonitor.baseline.size()); + } + + @Test + public void testFileCreationIsNotified() throws Exception { + // Don't assume test ordering + if (monitoredFile.exists()) { + assertTrue(monitoredFile.delete()); + flushNotifications(fileMonitor); + } + createFile(monitoredFile); + + fileMonitor.scrapeLogsForChanges(); + + assertCreated(fileMonitor, monitoredFile); + } + + @Test + public void testFileModificationIsNotified() throws Exception { + + // Make the file to modify + if (!monitoredFile.exists()) { + createFile(monitoredFile); + fileMonitor.scrapeLogsForChanges(); + server.setMarkToEndOfLog(); + } + + appendSomething(monitoredFile); + + fileMonitor.scrapeLogsForChanges(); + assertModified(fileMonitor, monitoredFile); + } + + @Test + public void testFileCreationAndModificationIsNotifiedAsCreation() throws Exception { + + // Don't assume test ordering + if (monitoredFile.exists()) { + assertTrue(monitoredFile.delete()); + fileMonitor.scrapeLogsForChanges(); + server.setMarkToEndOfLog(); + } + + createFile(monitoredFile); + appendSomething(monitoredFile); + + fileMonitor.scrapeLogsForChanges(); + assertCreated(fileMonitor, monitoredFile); + } + + @Mode(TestMode.FULL) + @Test + public void testTimestampChanging() throws Exception { + // Make a file to delete (and make sure we noticed it) + if (!monitoredFile.exists()) { + createFile(monitoredFile); + fileMonitor.scrapeLogsForChanges(); + server.setMarkToEndOfLog(); + } + + // Make it a lot older (~30min) than it is (should still be considered modified) + monitoredFile.setLastModified(System.currentTimeMillis() - (30 * 60 * 1000)); + + fileMonitor.scrapeLogsForChanges(); + assertModified(fileMonitor, monitoredFile); + + } + + @Test + public void testFileDeletionIsNotified() throws Exception { + // Make a file to delete (and make sure we noticed it) + if (!monitoredFile.exists()) { + createFile(monitoredFile); + fileMonitor.scrapeLogsForChanges(); + server.setMarkToEndOfLog(); + } + + // Delete the file: it should be added to the 'deleted' list + assertTrue("File should be deleted on the filesystem", monitoredFile.delete()); + fileMonitor.scrapeLogsForChanges(); + assertDeleted(fileMonitor, monitoredFile); + + } + + /** + * An easy test, as a sanity baseline. + */ + @Test + public void testNoNotificationsHappenWhenNothingChanges() throws Exception { + // Do nothing :) + int count = recursiveMonitor.scrapeLogsForChanges(); + // Sanity check - we didn't see anything, right? + assertEquals("We didn't change any files so we shouldn't have had any monitoring activity.", 0, count); + assertNothingCreated(recursiveMonitor); + assertNothingDeleted(recursiveMonitor); + assertNothingModified(recursiveMonitor); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderCreationIsNotified() throws Exception { + File f = new File(monitoredFolder, "monitoredFile"); + createFile(f); + + recursiveMonitor.scrapeLogsForChanges(); + + assertCreated(recursiveMonitor, f); + } + + @Test + public void testMultipleFileCreationInFolderIsNotified() throws Exception { + File f1 = new File(monitoredFolder, "testMultipleFileCreationIsNotified1"); + File f2 = new File(monitoredFolder, "testMultipleFileCreationIsNotified2"); + createFile(f1); + createFile(f2); + + recursiveMonitor.scrapeLogsForChanges(); + + assertCreated(recursiveMonitor, f1, f2); + } + + @Test + public void testFileCreationInNestedFoldersIsNotifiedDependingOnRecursionSetting() throws Exception { + File folder = new File(monitoredFolder, "nestedFolder"); + createFolder(folder); + File f = new File(folder, "testFileCreationInNestedFoldersIsNotifiedDependingOnRecursionSetting"); + createFile(f); + + nonRecursiveMonitor.scrapeLogsForChanges(); + recursiveMonitor.scrapeLogsForChanges(); + + assertCreated(recursiveMonitor, folder, f); + // The non-recursive monitor should only see the folder, not its contents + assertCreated(nonRecursiveMonitor, folder); + + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderModificationIsNotified() throws Exception { + + // Make a file to modify (and make sure we noticed it) + File f = new File(monitoredFolder, "testFileModificationIsNotified"); + createFile(f); + flushNotifications(recursiveMonitor); + + appendSomething(f); + + recursiveMonitor.scrapeLogsForChanges(); + assertModified(recursiveMonitor, f); + } + + @Test + public void testFileInNestedFolderModificationIsNotifiedDependingOnRecursionSettings() throws Exception { + + // Make a file to modify (and make sure we noticed it) + // Make a file to delete (and make sure we noticed it) + File folder = new File(monitoredFolder, "nestedFolderForModification"); + createFolder(folder); + File f = new File(folder, "testFileInNestedFolderModificationIsNotifiedDependingOnRecursionSettings"); + createFile(f); + assertTrue("We should find a created notification to flush", flushNotifications(recursiveMonitor) > 0); + flushNotifications(nonRecursiveMonitor); + + appendSomething(f); + + recursiveMonitor.scrapeLogsForChanges(); + nonRecursiveMonitor.scrapeLogsForChanges(); + + assertModified(recursiveMonitor, f); + assertNothingModified(nonRecursiveMonitor); + + } + + @Test + public void testFileInNestedFolderCreationIsNotNotifiedWhenFileDoesNotMatchFilter() throws Exception { + + File folder = new File(monitoredFolder, "nestedFolderForFilteredCreation"); + createFolder(folder); + + File f = new File(folder, "testFileInNestedFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + + filterMonitor.scrapeLogsForChanges(); + assertNothingCreated(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingModified(filterMonitor); + + // Now check other files do get past the filter + File excluded = new File(folder, "testFileInNestedFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(folder, "testFileInNestedFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + + filterMonitor.scrapeLogsForChanges(); + assertCreated(filterMonitor, passed); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderModficationIsNotNotifiedWhenFileDoesNotMatchFilter() throws Exception { + + File folder = new File(monitoredFolder, "nestedFolderForFilteredModification"); + createFolder(folder); + + File f = new File(folder, "testFileInNestedFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + File excluded = new File(folder, "testFileInNestedFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(folder, "testFileInNestedFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + flushNotifications(filterMonitor); + + appendSomething(f); + filterMonitor.scrapeLogsForChanges(); + assertNothingModified(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingModified(filterMonitor); + + // Now check other files do get past the filter + appendSomething(excluded); + appendSomething(passed); + filterMonitor.scrapeLogsForChanges(); + assertModified(filterMonitor, passed); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderDeletionIsNotNotifiedWhenFileDoesNotMatchFilter() throws Exception { + + File folder = new File(monitoredFolder, "nestedFolderForFilteredDeletion"); + createFolder(folder); + + File f = new File(folder, "testFileInNestedFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + File excluded = new File(folder, "testFileInNestedFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(folder, "testFileInNestedFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + flushNotifications(filterMonitor); + + deleteFile(f); + filterMonitor.scrapeLogsForChanges(); + assertNothingDeleted(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingDeleted(filterMonitor); + + // Now check other files do get past the filter + deleteFile(excluded); + deleteFile(passed); + filterMonitor.scrapeLogsForChanges(); + assertDeleted(filterMonitor, passed); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderCreationIsNotNotifiedWhenNeitherFolderNorFileMatchFilter() throws Exception { + + File includedFolder = new File(monitoredFolder, "includedNestedFolderForFilteredCreation"); + File excludedFolder = new File(monitoredFolder, "excludedNestedFolderForFilteredCreation"); + createFolder(includedFolder); + createFolder(excludedFolder); + + filterMonitor.scrapeLogsForChanges(); + // We should get told about only one of the folders + assertCreated(filterMonitor, includedFolder); + + // Update any marks so we don't see that notification again + flushNotifications(filterMonitor); + + // We should still be monitoring in both folders + File iif = new File(includedFolder, "testFileInNestedFolderCreationIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(iif); + File ief = new File(includedFolder, "testFileInNestedFolderCreationIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(ief); + + File eif = new File(excludedFolder, "testFileInNestedFolderCreationIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(eif); + File eef = new File(excludedFolder, "testFileInNestedFolderCreationIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(eef); + + filterMonitor.scrapeLogsForChanges(); + // We should get told about everything whose base name matches the filter + assertCreated(filterMonitor, iif, eif); + } + + @Test + public void testFileInNestedFolderModificationIsNotNotifiedWhenNeitherFolderNorFileMatchFilter() throws Exception { + + File includedFolder = new File(monitoredFolder, "includedNestedFolderForFilteredModification"); + File excludedFolder = new File(monitoredFolder, "excludedNestedFolderForFilteredModification"); + createFolder(includedFolder); + createFolder(excludedFolder); + + // We should still be monitoring in both folders + File iif = new File(includedFolder, "testFileInNestedFolderModificationIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(iif); + File ief = new File(includedFolder, "testFileInNestedFolderModificationIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(ief); + + File eif = new File(excludedFolder, "testFileInNestedFolderModificationIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(eif); + File eef = new File(excludedFolder, "testFileInNestedFolderModificationIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(eef); + + flushNotifications(filterMonitor); + + appendSomething(iif); + appendSomething(ief); + appendSomething(eif); + appendSomething(eef); + + filterMonitor.scrapeLogsForChanges(); + // We should get told about everything whose base name matches the filter + assertModified(filterMonitor, iif, eif); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderDeletionIsNotNotifiedWhenNeitherFolderNorFileMatchFilter() throws Exception { + + File includedFolder = new File(monitoredFolder, "includedNestedFolderForFilteredDeletion"); + File excludedFolder = new File(monitoredFolder, "excludedNestedFolderForFilteredDeletion"); + createFolder(includedFolder); + createFolder(excludedFolder); + + // We should still be monitoring in both folders + File iif = new File(includedFolder, "testFileInNestedFolderDeletionIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(iif); + File ief = new File(includedFolder, "testFileInNestedFolderDeletionIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(ief); + + File eif = new File(excludedFolder, "testFileInNestedFolderDeletionIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(eif); + File eef = new File(excludedFolder, "testFileInNestedFolderDeletionIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(eef); + + flushNotifications(filterMonitor); + + deleteFile(iif); + deleteFile(ief); + deleteFile(eif); + deleteFile(eef); + + filterMonitor.scrapeLogsForChanges(); + // We should get told about everything whose base name matches the filter + assertDeleted(filterMonitor, iif, eif); + } + + @Test + public void testFileInNestedFolderCreationIsNotNotifiedForDirectoryTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderCreationIsNotNotifiedForDirectoryTypeFilter"); + createFolder(folder); + flushNotifications(directoryfilterMonitor); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + directoryfilterMonitor.scrapeLogsForChanges(); + // We should get told about every directory + assertCreated(directoryfilterMonitor, childFolder); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderCreationIsNotNotifiedForFileTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderCreationIsNotNotifiedForFileTypeFilter"); + createFolder(folder); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + filefilterMonitor.scrapeLogsForChanges(); + // We should get told about every directory + assertCreated(filefilterMonitor, childFile); + } + + @Test + public void testFileInNestedFolderModificationIsNotNotifiedForDirectoryTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderModificationIsNotNotifiedForDirectoryTypeFilter"); + createFolder(folder); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + flushNotifications(directoryfilterMonitor); + + appendSomething(childFile); + + // We don't check timestamps on folders, so these notifications should have no effect + updateTimestamp(folder); + updateTimestamp(childFolder); + // We're including self, so we expect to get notified about the root folder, too + updateTimestamp(monitoredFolder); + + directoryfilterMonitor.scrapeLogsForChanges(); + // We should get told about every directory + assertNothingModified(directoryfilterMonitor); + } + + @Test + public void testFileInNestedFolderModificationIsNotifiedForFileTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderModificationIsNotNotifiedForFileTypeFilter"); + createFolder(folder); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + flushNotifications(filefilterMonitor); + + appendSomething(childFile); + updateTimestamp(folder); + updateTimestamp(childFolder); + updateTimestamp(monitoredFolder); + + filefilterMonitor.scrapeLogsForChanges(); + // We should get told about every directory + assertModified(filefilterMonitor, childFile); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderDeletionIsNotifiedForDirectoryTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderDeletionIsNotNotifiedForDirectoryTypeFilter"); + // Get rid of any clutter we don't know about in the monitored folder (we want to make sure we notice it being deleted) + deleteFile(monitoredFolder); + createFolder(monitoredFolder); + createFolder(folder); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + flushNotifications(directoryfilterMonitor); + + deleteFile(childFile); + deleteFile(childFolder); + deleteFile(folder); + deleteFile(monitoredFolder); + + directoryfilterMonitor.scrapeLogsForChanges(); + // We should get told about every directory, but not the file + assertDeleted(directoryfilterMonitor, monitoredFolder, folder, childFolder); + } + + @Test + public void testFileInNestedFolderDeletionIsNotifiedForFileTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderDeletionIsNotifiedForFileTypeFilter"); + createFolder(folder); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + flushNotifications(filefilterMonitor); + + // deleteFile(childFile); + deleteFile(childFolder); + deleteFile(folder); + + filefilterMonitor.scrapeLogsForChanges(); + // We should get told about every file (but no folders) + assertDeleted(filefilterMonitor, childFile); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderCreationAndModificationIsNotifiedAsCreation() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderCreationAndModificationIsNotifiedAsCreation"); + createFile(f); + appendSomething(f); + + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderCreationAndDeletionIsNotNotifiedAtAll() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderCreationAndDeletionIsNotifiedAsCreation"); + createFile(f); + deleteFile(f); + + recursiveMonitor.scrapeLogsForChanges(); + assertNothingCreated(recursiveMonitor); + assertNothingDeleted(recursiveMonitor); + assertNothingModified(recursiveMonitor); + } + + @Test + public void testFileInFolderCreationAndThenModificationAndThenDeletionIsNotNotifiedAtAll() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderCreationAndDeletionIsNotifiedAsCreation"); + createFile(f); + appendSomething(f); + deleteFile(f); + + recursiveMonitor.scrapeLogsForChanges(); + assertNothingCreated(recursiveMonitor); + assertNothingDeleted(recursiveMonitor); + assertNothingModified(recursiveMonitor); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderCreationIsNotNotifiedWhenItDoesNotMatchFilter() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + + filterMonitor.scrapeLogsForChanges(); + assertNothingCreated(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingModified(filterMonitor); + + // Now check other files do get past the filter + File excluded = new File(monitoredFolder, "testFileInFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(monitoredFolder, "testFileInFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + + filterMonitor.scrapeLogsForChanges(); + assertCreated(filterMonitor, passed); + } + + @Test + public void testFileInFolderModficationIsNotNotifiedWhenItDoesNotMatchFilter() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + File excluded = new File(monitoredFolder, "testFileInFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(monitoredFolder, "testFileInFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + flushNotifications(filterMonitor); + + appendSomething(f); + filterMonitor.scrapeLogsForChanges(); + assertNothingModified(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingModified(filterMonitor); + + // Now check other files do get past the filter + appendSomething(excluded); + appendSomething(passed); + filterMonitor.scrapeLogsForChanges(); + assertModified(filterMonitor, passed); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilter() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + File excluded = new File(monitoredFolder, "testFileInFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(monitoredFolder, "testFileInFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + flushNotifications(filterMonitor); + + deleteFile(f); + filterMonitor.scrapeLogsForChanges(); + assertNothingDeleted(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingDeleted(filterMonitor); + + // Now check other files do get past the filter + deleteFile(excluded); + deleteFile(passed); + filterMonitor.scrapeLogsForChanges(); + assertDeleted(filterMonitor, passed); + } + + @Test + public void testMonitoringOfFileAsADirectoryDoesNotProduceNotifications() throws Exception { + + appendSomething(monitoredFile); + confusedFolderMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFolderMonitor); + assertNothingModified(confusedFolderMonitor); + assertNothingDeleted(confusedFolderMonitor); + + flushNotifications(confusedFolderMonitor); + deleteFile(monitoredFile); + confusedFolderMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFolderMonitor); + assertNothingModified(confusedFolderMonitor); + assertNothingDeleted(confusedFolderMonitor); + + flushNotifications(confusedFolderMonitor); + createFile(monitoredFile); + confusedFolderMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFolderMonitor); + assertNothingModified(confusedFolderMonitor); + assertNothingDeleted(confusedFolderMonitor); + } + + @Test + public void testMonitoringOfDirectoryAsAFileDoesNotProduceNotifications() throws Exception { + + File file = new File(monitoredFolder, "testMonitoringOfDirectoryAsAFileDoesNotProduceNotifications"); + createFile(file); + confusedFileMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFileMonitor); + assertNothingModified(confusedFileMonitor); + assertNothingDeleted(confusedFileMonitor); + + flushNotifications(confusedFileMonitor); + deleteFile(file); + confusedFileMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFileMonitor); + assertNothingModified(confusedFileMonitor); + assertNothingDeleted(confusedFileMonitor); + + flushNotifications(confusedFileMonitor); + createFile(file); + confusedFileMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFileMonitor); + assertNothingModified(confusedFileMonitor); + assertNothingDeleted(confusedFileMonitor); + } + + @Mode(TestMode.FULL) + @Test + public void testFileCreationIsNotifiedWhenMonitoredFileDoesNotInitiallyExist() throws Exception { + + // Don't assume test ordering + if (nonexistentFile.exists()) { + deleteFile(nonexistentFile); + flushNotifications(nonexistentFileMonitor); + } + createFile(nonexistentFile); + nonexistentFileMonitor.scrapeLogsForChanges(); + assertCreated(nonexistentFileMonitor, nonexistentFile); + } + + @Mode(TestMode.FULL) + @Test + public void testFileModificationIsNotifiedWhenMonitoredFileDoesNotInitiallyExist() throws Exception { + // Don't assume test ordering + if (!nonexistentFile.exists()) { + createFile(nonexistentFile); + flushNotifications(nonexistentFileMonitor); + } + + appendSomething(nonexistentFile); + nonexistentFileMonitor.scrapeLogsForChanges(); + assertModified(nonexistentFileMonitor, nonexistentFile); + } + + @Test + public void testFileDeletionIsNotifiedWhenMonitoredFileDoesNotInitiallyExist() throws Exception { + // Don't assume test ordering + if (!nonexistentFile.exists()) { + createFile(nonexistentFile); + flushNotifications(nonexistentFileMonitor); + } + deleteFile(nonexistentFile); + nonexistentFileMonitor.scrapeLogsForChanges(); + assertDeleted(nonexistentFileMonitor, nonexistentFile); + } + + @Test + public void testFolderCreationIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist() throws Exception { + + // Don't assume test ordering + if (!nonexistentFolder.exists()) { + createFolder(nonexistentFolder); + flushNotifications(nonexistentFolderMonitor); + } + File file = new File(nonexistentFolder, "testFolderCreationIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist"); + createFile(file); + nonexistentFolderMonitor.scrapeLogsForChanges(); + assertCreated(nonexistentFolderMonitor, file); + } + + @Mode(TestMode.FULL) + @Test + public void testFolderModificationIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist() throws Exception { + // Don't assume test ordering + if (!nonexistentFolder.exists()) { + createFolder(nonexistentFolder); + flushNotifications(nonexistentFolderMonitor); + } + + File file = new File(nonexistentFolder, "testFolderModificationIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist"); + createFile(file); + flushNotifications(nonexistentFolderMonitor); + + appendSomething(file); + nonexistentFolderMonitor.scrapeLogsForChanges(); + assertModified(nonexistentFolderMonitor, file); + } + + @Mode(TestMode.FULL) + @Test + public void testFolderDeletionIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist() throws Exception { + // Don't assume test ordering + if (!nonexistentFolder.exists()) { + createFolder(nonexistentFolder); + flushNotifications(nonexistentFolderMonitor); + } + + File file = new File(nonexistentFolder, "testFolderDeletionIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist"); + createFile(file); + flushNotifications(nonexistentFolderMonitor); + + deleteFile(file); + nonexistentFolderMonitor.scrapeLogsForChanges(); + assertDeleted(nonexistentFolderMonitor, file); + } + + @Test + public void testFileInFolderTimestampChanging() throws Exception { + // Make a file to delete (and make sure we noticed it) + File f = new File(monitoredFolder, "testFileInFolderTimestampChanging"); + createFile(f); + flushNotifications(recursiveMonitor); + + // Make it a lot older than it is (should still be considered modified) + updateTimestamp(f); + + recursiveMonitor.scrapeLogsForChanges(); + assertModified(recursiveMonitor, f); + + } + + @Test + public void testFileInFolderDeletionIsNotified() throws Exception { + // Make a file to delete (and make sure we noticed it) + File f = new File(monitoredFolder, "testFileInFolderDeletionIsNotified"); + createFile(f); + flushNotifications(recursiveMonitor); + + // Delete the file: it should be added to the 'deleted' list + assertTrue("File should be deleted on the filesystem", f.delete()); + recursiveMonitor.scrapeLogsForChanges(); + assertDeleted(recursiveMonitor, f); + + } + + @Test + public void testAllContentsAreIncludedForFileInFolderDeletion() throws Exception { + // Make a file to delete (and make sure we noticed it) + File folder = new File(monitoredFolder, "testFileInFolderDeletionIsNotified"); + createFolder(folder); + File f = new File(folder, "childFile"); + createFile(f); + flushNotifications(recursiveMonitor); + + // Delete the folder: it and its contents should be added to the 'deleted' list + deleteFile(folder); + recursiveMonitor.scrapeLogsForChanges(); + assertDeleted(recursiveMonitor, f, folder); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderDeletionIsNotified() throws Exception { + // Make a file to delete (and make sure we noticed it) + File folder = new File(monitoredFolder, "nestedFolderForDeletion"); + createFolder(folder); + File f = new File(folder, "testFileInNestedFolderDeletionIsNotified"); + createFile(f); + flushNotifications(recursiveMonitor); + flushNotifications(nonRecursiveMonitor); + + // Delete the file: it should be added to the 'deleted' list + deleteFile(f); + recursiveMonitor.scrapeLogsForChanges(); + nonRecursiveMonitor.scrapeLogsForChanges(); + assertDeleted(recursiveMonitor, f); + assertNothingDeleted(nonRecursiveMonitor); + + } + + @Test + public void testFileInNestedFolderFolderDeletionIsNotified() throws Exception { + File bfolder = new File(monitoredFolder, "testFileInNestedFolderFolderDeletionIsNotified"); + // Get rid of any clutter we don't know about in the monitored folder (we want to make sure we notice it being deleted) + // But don't assume test ordering -- don't try to delete if it doesn't exist! + if (monitoredFolder.exists()) + deleteFile(monitoredFolder); + createFolder(monitoredFolder); + createFolder(bfolder); + + File bchildFile = new File(bfolder, "childFile"); + createFile(bchildFile); + File bchildFolder = new File(bfolder, "childFolder"); + createFolder(bchildFolder); + + flushNotifications(recursiveMonitor); + + deleteFile(bchildFile); + deleteFile(bchildFolder); + deleteFile(bfolder); + deleteFile(monitoredFolder); + + recursiveMonitor.scrapeLogsForChanges(); + // We should get told about every directory + assertDeleted(recursiveMonitor, bfolder, bchildFolder, bchildFile); + + // Make a file to delete (and make sure we noticed it) + File folder = new File(monitoredFolder, "testFileInNestedFolderFolderDeletionIsNotified"); + createFolder(folder); + File childFolder = new File(folder, "testFileInNestedFolderDeletionIsNotified"); + createFile(childFolder); + flushNotifications(recursiveMonitor); + flushNotifications(nonRecursiveMonitor); + + // Delete the folder: it and its contents should be added to the 'deleted' list + deleteFile(childFolder); + deleteFile(folder); + recursiveMonitor.scrapeLogsForChanges(); + nonRecursiveMonitor.scrapeLogsForChanges(); + assertDeleted(recursiveMonitor, folder, childFolder); + assertDeleted(nonRecursiveMonitor, folder); + + } + + @Test + public void testCreationOfMonitoredFolderIsNotifiedOnlyWhenIgnoreSelfIsTrue() throws Exception { + // Get rid of anything in the monitored folder so we can make it again + deleteFile(monitoredFolder); + flushNotifications(recursiveMonitor); + flushNotifications(monitorSelfMonitor); + + monitoredFolder.mkdirs(); + recursiveMonitor.scrapeLogsForChanges(); + monitorSelfMonitor.scrapeLogsForChanges(); + assertNothingCreated(recursiveMonitor); + assertCreated(monitorSelfMonitor, monitoredFolder); + + // Now wait and make sure we don't get told again about the deleted file + flushNotifications(recursiveMonitor); + flushNotifications(monitorSelfMonitor); + recursiveMonitor.scrapeLogsForChanges(); + monitorSelfMonitor.scrapeLogsForChanges(); + assertNothingCreated(recursiveMonitor); + assertNothingCreated("After an initial (correct) creation report, ", monitorSelfMonitor); + + } + + @Mode(TestMode.FULL) + @Test + public void testDeletionOfMonitoredFolderIsNotifiedOnlyWhenIgnoreSelfIsTrue() throws Exception { + // Get rid of anything in the monitored folder so we can safely delete it (by deleting it) + deleteFile(monitoredFolder); + // Now make the actual folder back (so when we delete it we know what notification to expect) + monitoredFolder.mkdirs(); + flushNotifications(recursiveMonitor); + flushNotifications(monitorSelfMonitor); + + deleteFile(monitoredFolder); + // Delete the whole folder: it should be added to the 'deleted' list + recursiveMonitor.scrapeLogsForChanges(); + monitorSelfMonitor.scrapeLogsForChanges(); + assertNothingDeleted(recursiveMonitor); + assertDeleted(monitorSelfMonitor, monitoredFolder); + + // Now wait and make sure we don't get told again about the deleted file + flushNotifications(recursiveMonitor); + flushNotifications(monitorSelfMonitor); + recursiveMonitor.scrapeLogsForChanges(); + monitorSelfMonitor.scrapeLogsForChanges(); + assertNothingDeleted(recursiveMonitor); + assertNothingDeleted("After an initial (correct) deletion report, ", monitorSelfMonitor); + + } +} diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileNotificationMBeanTest.java b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileNotificationMBeanTest.java new file mode 100755 index 000000000000..6a2f28272734 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileNotificationMBeanTest.java @@ -0,0 +1,778 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.fat; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.UndeclaredThrowableException; +import java.net.ConnectException; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import javax.management.JMX; +import javax.management.MBeanServerConnection; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.filemonitor.FileNotificationMBean; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; + +/** + * + */ +public class FileNotificationMBeanTest extends AbstractNotificationTest { + + /** Used for sanity checks of changes in the timed scan case */ + private static final MonitorReader recursiveMonitor = new MonitorReader("-RECURSIVETESTMONITOROUTPUT-", "recursive folder monitor"); + private static final MonitorReader manualMonitor = new MonitorReader("-MANUALMONITOROUTPUT-", "externally triggered folder monitor"); + + private static JMXConnector jmxConnector; + private static FileNotificationMBean mbean; + + /** + * JUnit guarantees that this gets run after the static set up in the superclass (as long as the names are different). + */ + @BeforeClass + public static void jmxSetUp() throws Exception { + + // Wait for the JMX server to be started + assertNotNull("The application 'IBMJMXConnectorREST' did not report it was started", + server.waitForStringInLog("CWWKT0016I.*IBMJMXConnectorREST")); + // Wait for secure port to be ready + assertNotNull("SSL port is not ready", + server.waitForStringInLog("CWWKO0219I.*ssl")); + assertNotNull("The server is not ready to run a smarter planet", + server.waitForStringInLog("CWWKF0011I")); + assertNotNull("The security service is not ready", + server.waitForStringInLog("CWWKS0008I")); + + trustEverything(); + + Map fileTransferConfig = new HashMap(); + fileTransferConfig.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + fileTransferConfig.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + fileTransferConfig.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + fileTransferConfig.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + + JMXServiceURL jmxServiceUrl = new JMXServiceURL("REST", server.getHostname(), server + .getHttpDefaultSecurePort(), "/IBMJMXConnectorREST"); + long connectTime = System.currentTimeMillis(); + try { + jmxConnector = JMXConnectorFactory.connect(jmxServiceUrl, fileTransferConfig); + + MBeanServerConnection mbeanConn = jmxConnector.getMBeanServerConnection(); + final ObjectName name = new ObjectName(com.ibm.ws.kernel.filemonitor.FileNotificationMBean.INSTANCE_NAME); + mbean = JMX.newMBeanProxy(mbeanConn, name, + FileNotificationMBean.class); + + assertNotNull("We should have got access to the FileNotificationMBean", mbean); + } catch (ConnectException e) { + DateFormat formatter = new SimpleDateFormat("dd/MMM/yyyy HH:mm:ss:SSS z"); + String timestamp = formatter.format(new Date(connectTime)); + fail("Could not get a connection to the JMX server using URL " + jmxServiceUrl + ".\n Tried at " + timestamp + ".\n The exception was " + e); + } + + } + + /** + * Adjusts our SSL code so that it doesn't complain when we connect to servers using untrusted + * certificates. + * + * @throws NoSuchAlgorithmException + * @throws KeyManagementException + */ + private static void trustEverything() throws NoSuchAlgorithmException, KeyManagementException { + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + + } + + @AfterClass + public static void classTearDown() throws MalformedObjectNameException, NullPointerException, IOException { + if (jmxConnector != null) { + jmxConnector.close(); + } + } + + @Before + public void setUp() throws Exception { + + } + + @After + public void tearDown() throws Exception { + // Clear up after any tests which may have deleted the monitored folder + if (!monitoredFolder.exists()) { + monitoredFolder.mkdirs(); + // Nothing we're using is monitoring the folder itself + } + + // Get rid of any dangling notifications from tests + flushNotifications(recursiveMonitor); + flushNotifications(); + + } + + @Test + public void testFileInFolderCreationIsNotNotifiedWithoutMBeanRequest() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderModificationIsNotNotifiedWithoutMBeanRequest"); + createFile(f); + + manualMonitor.scrapeLogsForChanges(); + // We shouldn't be told about anything, since we haven't triggered the scan + assertNothingCreated(manualMonitor); + assertNothingDeleted(manualMonitor); + assertNothingModified(manualMonitor); + + // Sanity check - the recursive monitor should have noticed + HashSet created = new HashSet(); + created.add(f); + recursiveMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(recursiveMonitor, f); + } + + @Test + public void testFileInFolderCreationIsNotNotifiedForMBeanRequestOnUnrelatedFile() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderCreationIsNotNotifiedForMBeanRequestOnUnrelatedFile"); + createFile(f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + + Collection wrongFileSet = new HashSet(); + wrongFileSet.add(monitoredFile.getAbsolutePath()); + + try { + // Notify changes, but for the wrong file + mbean.notifyFileChanges(wrongFileSet, null, null); + manualMonitor.scrapeLogsForChanges(); + // We shouldn't be told about anything since we passed through the wrong file + assertNothingCreated(manualMonitor); + assertNothingDeleted(manualMonitor); + assertNothingModified(manualMonitor); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInFolderCreationIsNotNotifiedForMBeanRequestOfWrongChangeType() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderCreationIsNotNotifiedForMBeanRequestOfWrongChangeType"); + createFile(f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + + Collection wrongFileSet = new HashSet(); + wrongFileSet.add(monitoredFile.getAbsolutePath()); + + try { + // Now request a notification, but of modification, so the wrong type + mbean.notifyFileChanges(null, fileSet, null); + manualMonitor.scrapeLogsForChanges(); + // We shouldn't be told about anything, since we have the right file but the wrong type + assertNothingCreated(manualMonitor); + assertNothingDeleted(manualMonitor); + assertNothingModified(manualMonitor); + + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + /** + * In the externally triggered case, we need to be specific about what we think might have changed. + * If we have a recursive monitor, and we pass the parent folder as the parameter on the mbean call, + * we won't get told about things inside that folder which have changed. + */ + @Mode(TestMode.FULL) + @Test + public void testFileInFolderModificationIsNotNotifiedWhenWePassBackTheParentFolder() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderModificationIsNotNotifiedWhenWePassBackTheParentFolder"); + createFile(f); + + Collection folderSet = new HashSet(); + folderSet.add(monitoredFolder.getAbsolutePath()); + Collection created = new HashSet(); + created.add(monitoredFolder); + + try { + mbean.notifyFileChanges(folderSet, null, null); + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertNothingCreated(manualMonitor); + assertNothingDeleted(manualMonitor); + assertNothingModified(manualMonitor); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInFolderCreationIsNotifiedAfterRequest() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderCreationIsNotifiedAfterRequest"); + createFile(f); + + // Sanity check - the recursive monitor should have noticed + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + + try { + // Ok, let's actually get our notification now + mbean.notifyFileChanges(fileSet, null, null); + //manualMonitor.scrapeLogsForChanges(); + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, f); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInFolderModificationIsNotifiedAfterRequest() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderModificationIsNotifiedAfterRequest"); + createFile(f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection changed = new HashSet(); + changed.add(f); + + try { + // Setup for test + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(changed, null, null); + assertCreated(manualMonitor, f); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + + //////// Actual test + // Now let's make a change and get that notification + appendSomething(f); + mbean.notifyFileChanges(null, fileSet, null); + manualMonitor.scrapeLogsForExpectedChanges(null, changed, null); + assertModified(manualMonitor, f); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInFolderDeletionIsNotifiedAfterRequest() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderDeletionIsNotifiedAfterRequest"); + createFile(f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection deleted = new HashSet(); + deleted.add(f); + + try { + // Setup for test + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(deleted, null, null); + assertCreated(manualMonitor, f); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + + // Now let's make a change and get that notification + deleteFile(f); + mbean.notifyFileChanges(null, null, fileSet); + manualMonitor.scrapeLogsForExpectedChanges(null, null, deleted); + assertDeleted(manualMonitor, f); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderCreationIsNotifiedAfterRequestAboutFolder() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderCreationIsNotifiedAfterRequestAboutFolder"); + createFolder(folder); + + File f = new File(folder, "childFile"); + createFile(f); + + // Sanity check - the recursive monitor should have noticed + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f, folder); + + Collection fileSet = new HashSet(); + fileSet.add(folder.getAbsolutePath()); + Collection created = new HashSet(); + created.add(folder); + + try { + // Ok, let's actually get our notification now + mbean.notifyFileChanges(fileSet, null, null); + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, folder); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderModificationIsNotNotifiedAfterRequestAboutFolder() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderModificationIsNotifiedAfterRequestAboutFolder"); + createFolder(folder); + + File f = new File(folder, "childFile"); + createFile(f); + + // Sanity check - the recursive monitor should have noticed + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f, folder); + + Collection fileSet = new HashSet(); + fileSet.add(folder.getAbsolutePath()); + + try { + flushNotifications(); + + // Now let's make a change and get that notification + appendSomething(f); + updateTimestamp(folder); + mbean.notifyFileChanges(null, fileSet, null); + manualMonitor.scrapeLogsForChanges(); + // We could only get told about the folder modification, and we don't tend to generate those + // events except for delete-create cycles + assertNothingModified(manualMonitor); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderDeletionIsNotifiedAfterRequestAboutFolder() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderDeletionIsNotifiedAfterRequestAboutFolder"); + + createFolder(folder); + Collection fileSet = new HashSet(); + Collection files = new HashSet(); + fileSet.add(folder.getAbsolutePath()); + files.add(folder); + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + + try { + + // Setup for test + // Create folder + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + // Create nested file + File f = new File(folder, "childFile"); + createFile(f); + Collection fileSet2 = new HashSet(); + fileSet2.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + mbean.notifyFileChanges(fileSet2, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, f); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + + // Now let's make a change and get that notification + deleteFile(folder); + mbean.notifyFileChanges(null, null, fileSet); + manualMonitor.scrapeLogsForExpectedChanges(null, null, created); + assertDeleted(manualMonitor, folder); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderCreationIsNotifiedAfterRequestAboutFile() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderCreationIsNotifiedAfterRequestAboutFile"); + createFolder(folder); + + File f = new File(folder, "childFile"); + createFile(f); + + // Sanity check - the recursive monitor should have noticed + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f, folder); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + created.add(folder); + + try { + // Ok, let's actually get our notification now + mbean.notifyFileChanges(fileSet, null, null); + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + // defect 87702 requires that we generate events for parent directories of paths that we found files for + // even if the external scan has not requested them. + assertCreated(manualMonitor, f, folder); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderModificationIsNotifiedAfterRequestAboutFile() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderModificationIsNotifiedAfterRequestAboutFile"); + createFolder(folder); + Collection fileSet = new HashSet(); + Collection files = new HashSet(); + fileSet.add(folder.getAbsolutePath()); + files.add(folder); + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + + try { + + // Setup for test + // Create folder + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + // Create nested file + File f = new File(folder, "childFile"); + createFile(f); + Collection fileSet2 = new HashSet(); + fileSet2.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + mbean.notifyFileChanges(fileSet2, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, f); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + + // Actual test + // Now let's make a change and get that notification + appendSomething(f); + updateTimestamp(folder); + mbean.notifyFileChanges(null, fileSet2, null); + manualMonitor.scrapeLogsForChanges(); + // defect 87702 requires that we generate events for parent directories of paths that we found files for + // even if the external scan has not requested them, but only for deletion and creation, not modification + assertModified(manualMonitor, f); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderDeletionIsNotifiedAfterRequestAboutFile() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderDeletionIsNotifiedAfterRequestAboutFile"); + createFolder(folder); + Collection fileSet = new HashSet(); + Collection files = new HashSet(); + fileSet.add(folder.getAbsolutePath()); + files.add(folder); + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + + try { + + // Setup for test + // Create folder + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + flushNotifications(); + // Create nested file + File f = new File(folder, "childFile"); + createFile(f); + + // We're only interested in changes to the file, not the folder + // This file: + Collection fileSet2 = new HashSet(); + fileSet2.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + mbean.notifyFileChanges(fileSet2, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, f); + flushNotifications(); + + // Now let's make a change and get that notification + deleteFile(folder); + mbean.notifyFileChanges(null, null, fileSet2); + manualMonitor.scrapeLogsForChanges(); + // defect 87702 requires that we generate events for parent directories of paths that we found files for + // even if the external scan has not requested them. + assertDeleted(manualMonitor, f, folder); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + private void flushNotifications() throws Exception { + flushNotifications(manualMonitor); + } + + /* + * The FileNotificationMbean method for notifyFileChanges will now + * cache unrequested/unnotified file changes, so that they can be requested on + * later calls. However, this means that certain unrequested options + * can become invalid based on later filesystem changes. + */ + + // State change loop to track the status of changed files. + // D = Delete, C = Create, M = modified, - = not in any list, X = not possible + // Example, "CM = C" would mean create followed by a modify would + // result in the file being in the create list + // C = C + // D = D + // M = M + // CC = X + // CD = - // testPersistedNotificationCaseCD() + // CM = C // testPersistedNotificationCaseCM() + // DC = M // testPersistedNotificationCaseCM() + // DD = X + // DM = X + // MC = X + // MD = D // testPersistedNotificationCaseMD() + // MM = M + + @Test + public void testPersistedNotificationCaseCD() throws Throwable { + + File folder = new File(monitoredFolder, "testPersistedNotificationCaseCD"); + + try { + + createFolder(folder); + File f = new File(folder, "childFile1"); + createFile(f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + created.add(folder); + + mbean.notifyFileChanges(null, null, null); // Does not notify of a new file create + assertNothingChanged(manualMonitor); + deleteFile(folder); // Now remove this new file from the filesystem + mbean.notifyFileChanges(fileSet, null, null); // Now ask to create the file, but its gone + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testPersistedNotificationCaseCM() throws Throwable { + + File folder = new File(monitoredFolder, "testPersistedNotificationCaseCM"); + + try { + + createFolder(folder); + File f = new File(folder, "childFile1"); + createFile(f); + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + created.add(folder); + mbean.notifyFileChanges(null, null, null); // Does not notify of a new file create + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + appendSomething(f); // Modify this new file + mbean.notifyFileChanges(null, fileSet, null); // Notify of a modify, but we didn't request create yet + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + mbean.notifyFileChanges(fileSet, null, null); // Notify of a create now, this is valid + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, folder, f); // Should be shown as created now. + + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Mode(TestMode.FULL) + @Test + public void testPersistedNotificationCaseMD() throws Throwable { + + File folder = new File(monitoredFolder, "testPersistedNotificationCaseMD"); + + try { + + createFolder(folder); + File f = new File(folder, "childFile1"); + createFile(f); + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + created.add(folder); + mbean.notifyFileChanges(fileSet, null, null); // Create a new file + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, folder, f); // Should be shown as created now. + flushNotifications(); + appendSomething(f); // Modify this new file + mbean.notifyFileChanges(null, null, null); // Don't notify of the modify + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + flushNotifications(); + deleteFile(f); // Remove the file that has a pending create being stored in monitorholder + mbean.notifyFileChanges(fileSet, null, null); // Now try to notify of a create + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); // The create is no longer valid, so nothing should change + mbean.notifyFileChanges(null, null, fileSet); // Now ask for the delete + manualMonitor.scrapeLogsForExpectedChanges(null, null, created); + assertDeleted(manualMonitor, f); + + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Mode(TestMode.FULL) + @Test + public void testPersistedNotificationCaseDC() throws Throwable { + + File folder = new File(monitoredFolder, "testPersistedNotificationCaseDC"); + + try { + + createFolder(folder); + File f = new File(folder, "childFile1"); + createFile(f); + // Sanity check - the recursive monitor should have noticed + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f, folder); + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + created.add(folder); + mbean.notifyFileChanges(fileSet, null, null); // Create a new file + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, folder, f); // Should be shown as created now. + flushNotifications(); + deleteFile(f); // Remove the file that has a pending create being stored in monitorholder + mbean.notifyFileChanges(null, null, null); // Don't notify of the delete + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + flushNotifications(); + createFile(f); // Now recreate this file on the filesystem again + // Now try to notify of a create, but the only valid option + // is a modify, because we never notified of a delete + mbean.notifyFileChanges(fileSet, null, null); + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); // Nothing should have changed + // Let's ask for a delete too, this was once a valid option + mbean.notifyFileChanges(null, null, fileSet); + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + flushNotifications(); + // Now notify for a modify, this is the only valid option + mbean.notifyFileChanges(null, fileSet, null); + manualMonitor.scrapeLogsForExpectedChanges(null, created, null); + assertModified(manualMonitor, f); + + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + /** + * @param manualMonitor + */ + private void assertNothingChanged(MonitorReader manualMonitor) { + assertNothingModified(manualMonitor); + assertNothingCreated(manualMonitor); + assertNothingDeleted(manualMonitor); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/MonitorReader.java b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/MonitorReader.java new file mode 100755 index 000000000000..b8836c047e00 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/MonitorReader.java @@ -0,0 +1,223 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +class MonitorReader { + /** + * The interval on the monitors is 150ms. Allow a big multiple of that, since we also have to wait + * for the LibertyServer to poll the log for changes, and it only checks every 300ms. As the number + * of monitors we have increases, it also takes longer for each notification to get into the log. + * (I've counted intervals of 1s from the first notification to the last one.) + * + * However, since we're waiting for updates to stop, we would prefer that this timeout not be too long, + * since it sets a minimum delay for the last "no more changes" cycle. We *could* add onScanStart() and + * onScanEnd() events, but by the design of the monitors there's no promise that all results come in + * during a single scan. + * + * Inherently fragile, if net or server runs slower than expected. + * + * Better solution is to avoid relying on it -- use scrapeLogsForExpectedChanges. + */ + static final int TIMEOUT = 2410; + + // Not thread-safe, but this code is unlikely to run multi-threaded, being a test helper + private static final DateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss:SSS"); + + final String name; + + final Collection baseline = new ArrayList(); + final List created = new ArrayList(); + final List modified = new ArrayList(); + final List deleted = new ArrayList(); + + // When we gave up scraping the log for a string + long lastSearchTime; + + private final String baselineMarker; + private final Pattern baselineRegexp; + private final String changeMarker; + private final Pattern changeRegexp; + + MonitorReader(String eyeCatcher, String name) { + this.name = name; + baselineMarker = eyeCatcher + "onBaseline"; + baselineRegexp = Pattern.compile(baselineMarker + "\\[(.*)\\]"); + changeMarker = eyeCatcher + "onChange"; + changeRegexp = Pattern.compile(changeMarker + "\\[(.*)\\]\\[(.*)\\]\\[(.*)\\]"); + } + + void clear() { + baseline.clear(); + created.clear(); + modified.clear(); + deleted.clear(); + } + + /** + * The only way we have of communicating with our monitor running in the server is by the logs. + * (Well, unless we write a restful API for it, but that introduces dependencies into the test + * that I don't think we want.) + * + * This method (unlike the scrapeLogsForChanges methods) will reset all marks to the + * beginning of the log, since that's where baselines live. + * + * It also assumes (and asserts) that a baseline will always be present. + */ + void scrapeLogsForBaseline() throws Exception { + + // Set the mark to the beginning of the log, since the baseline will happen at the beginning but + // the calling test could run in any order + // This will reset the marks, too + FileMonitorTest.server.resetLogOffsets(); + + int count = 0; + clear(); + + // Assume we'll only get one baseline + String line = FileMonitorTest.server.waitForStringInLogUsingMark(baselineMarker); + if (line != null) { + Matcher matcher = baselineRegexp.matcher(line); + boolean matches = matcher.find(); + if (matches) { + count++; + baseline.addAll(parseArray(matcher.group(1))); + } + } + assertTrue("A baseline should have been reported on the " + baselineMarker + " monitor. Stopped searching at " + DATE_FORMAT.format(System.currentTimeMillis()), count > 0); + assertEquals("A baseline should have been reported on the " + baselineMarker + " monitor.", 1, count); + } + + /** + * This method must *not* set marks since multiple readers may read the same log. + * + * @param whether a change is atomic. A large write or multi-stage changes are not atomic. + * Non-atomic changes may receive more than one notification, and we want to notice + * them all. + * @return Number of matched lines scraped from the log. Not really useful. + * @throws Exception + * @see scrapeLogsForExpectedChanges + */ + int scrapeLogsForChanges() throws Exception { + int count = 0; + clear(); + + // We are trying to test timeliness of notification, so do specify a timeout + // WARNING: That timeout may be overoptimistic on today's + String line = FileMonitorTest.server.waitForStringInLogUsingMark(changeMarker, TIMEOUT); + while (line != null) { + Matcher matcher = changeRegexp.matcher(line); + boolean matches = matcher.find(); + if (matches) { + count++; + created.addAll(parseArray(matcher.group(1))); + modified.addAll(parseArray(matcher.group(2))); + deleted.addAll(parseArray(matcher.group(3))); + } + + // If a change isn't atomic, a single change by a test could be split across two + // notifications, so give a chance for a straggling split notification to limp in + // Since we're waiting for "no more", this slows us down but avoids intermittent failures. + // See scrapeLogsForExpectedChanges(), which instead exits once conditions are met + line = FileMonitorTest.server.waitForStringInLogUsingLastOffset(changeMarker, TIMEOUT); + + } + lastSearchTime = FileMonitorTest.server.searchStopTime; + + return count; + } + + /** + * This method must *not* set marks since multiple readers may read the same log. + * + * Unlike scrapeLogsForChanges(), this method exits as soon as the "expected" file alterations have been detected. + * This avoids the "loop until no more changes seen" approach, which permits a longer wait (less sensitive to timing + * problems) without significantly slowing down the test except in the failure case. + * + * The main risk is that it may not report _unexpected_ changes which arrive late... but we don't seem to be doing + * a lot of "and only these" tests right now. It also won't report error if the response is slow, but given that + * our current test platform's performance is variable, and that this is supposed to be a functional test rather than + * a performance test, that should be acceptable. + * + * @param whether a change is atomic. A large write or multi-stage changes are not atomic. + * Non-atomic changes may receive more than one notification, and we want to notice + * them all. + * @return Number of matched lines scraped from the log. Not really useful. + * @throws Exception + * @see scrapeLogsForChanges + */ + int scrapeLogsForExpectedChanges(Collection expectedCreates, Collection expectedModifies, Collection expectedDeletes) throws Exception { + int count = 0; + clear(); + + // We were trying to test timeliness of notification, so we specified timeouts + // Unfortunately our current test platform sometimes introduces long delays + // Hence we've switched back to default (longish) timeouts for functional test, + // and advised that performance should be tested separately. + String line = FileMonitorTest.server.waitForStringInLogUsingMark(changeMarker); + while (line != null) { + Matcher matcher = changeRegexp.matcher(line); + boolean matches = matcher.find(); + if (matches) { + count++; + created.addAll(parseArray(matcher.group(1))); + modified.addAll(parseArray(matcher.group(2))); + deleted.addAll(parseArray(matcher.group(3))); + } + + if ((expectedCreates == null || created.containsAll(expectedCreates)) && + (expectedModifies == null || modified.containsAll(expectedModifies)) && + (expectedDeletes == null || deleted.containsAll(expectedDeletes))) + { + line = null; // We found what we expected. We really don't care if there's more. Stop scanning. + } + else + { + // If a change isn't atomic, a single change by a test could be split across two + // notifications, so give a chance for a straggling split notification to limp in + // (this shouldn't slow things down if the expected info DOES eventually arrive) + line = FileMonitorTest.server.waitForStringInLogUsingLastOffset(changeMarker); + } + } + lastSearchTime = FileMonitorTest.server.searchStopTime; + + return count; + } + + /** + * @param group + * @return + */ + private List parseArray(String group) { + List files = new ArrayList(); + String[] names = group.split(","); + for (String name : names) { + if (name.trim().length() > 0) { + files.add(new File(name.trim())); + } + } + + return files; + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/publish/.gitignore b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/.gitignore new file mode 100644 index 000000000000..0968b1bceb64 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/publish/features/monitoringPrintingFeature-1.0.mf b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/features/monitoringPrintingFeature-1.0.mf new file mode 100755 index 000000000000..6c43b6a8132b --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/features/monitoringPrintingFeature-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: monitoringPrintingFeature-1.0 +Subsystem-SymbolicName: com.ibm.ws.kernel.filemonitor.monitoringfeature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.kernel.filemonitor.monitor.test.bundle; version="[1,1.0.100)", +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/bootstrap.properties b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/server.xml b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/server.xml new file mode 100755 index 000000000000..8201a2072a50 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/server.xml @@ -0,0 +1,15 @@ + + + + + + + usr:monitoringPrintingFeature-1.0 + restConnector-1.0 + + + + + + + diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/bnd.bnd b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/bnd.bnd new file mode 100755 index 000000000000..8b1b7f5d3a2f --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/bnd.bnd @@ -0,0 +1,14 @@ +Bundle-Vendor: IBM +bVersion=1.0.0 +Bundle-Version: 1.0.0 +Bundle-Name: Feature which uses the file monitor SPI +Bundle-SymbolicName: com.ibm.ws.kernel.filemonitor.monitor.test.bundle + +Private-Package: \ + com.ibm.ws.kernel.filemonitor.monitor.test + +Service-Component: \ + com.ibm.ws.kernel.filemonitor.test.bundle.monitor; \ + implementation:=com.ibm.ws.kernel.filemonitor.monitor.test.FileMonitorRegistrationHandler; \ + immediate:=true + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorPrintingImplementation.java b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorPrintingImplementation.java new file mode 100755 index 000000000000..3d84befc597d --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorPrintingImplementation.java @@ -0,0 +1,56 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.monitor.test; + +import java.io.File; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Collection; + +import com.ibm.wsspi.kernel.filemonitor.FileMonitor; + +public class FileMonitorPrintingImplementation implements FileMonitor { + // Not thread-safe, so keep as an instance variable + private final DateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss:SSS"); + + private static final String EOR = ""; + private final String eyecatcher; + + public FileMonitorPrintingImplementation(String eyecatcher) { + this.eyecatcher = eyecatcher; + } + + @Override + public void onBaseline(Collection baseline) { + System.out.println(timestamp() + "onBaseline" + toString(baseline) + EOR); + + } + + @Override + public void onChange(Collection createdFiles, + Collection modifiedFiles, Collection deletedFiles) { + System.out.println(timestamp() + "onChange" + toString(createdFiles) + toString(modifiedFiles) + toString(deletedFiles) + EOR); + } + + private String toString(Collection files) { + return Arrays.toString(files.toArray()); + } + + /** + * @return + */ + private String timestamp() { + return DATE_FORMAT.format(System.currentTimeMillis()) + eyecatcher; + } + +} diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorRegistrationHandler.java b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorRegistrationHandler.java new file mode 100755 index 000000000000..d697f9b8b8ac --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorRegistrationHandler.java @@ -0,0 +1,204 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.monitor.test; + +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.HashSet; +import java.util.Hashtable; + +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import com.ibm.wsspi.kernel.filemonitor.FileMonitor; + +public class FileMonitorRegistrationHandler { + + private final long monitorInterval = 150; + + public void activate(ComponentContext cc) throws IOException { + System.out.println("FAT test code is registering FileMonitor implementations."); + + File tmpFile = File.createTempFile(FileMonitorRegistrationHandler.class.getName(), "file"); + + // Make a temporary folder to monitor + File tmpFolder = File.createTempFile(FileMonitorRegistrationHandler.class.getName(), "folder"); + tmpFolder.delete(); + tmpFolder.mkdirs(); + + File nonExistentFile = File.createTempFile(FileMonitorRegistrationHandler.class.getName(), "nonexistentfile"); + nonExistentFile.delete(); + + // Make a temporary folder to monitor + File nonExistentFolder = File.createTempFile(FileMonitorRegistrationHandler.class.getName(), "nonexistentfolder"); + nonExistentFolder.delete(); + + // We need to make baseline files before we register + File baseline = new File(tmpFolder, "baseline"); + baseline.createNewFile(); + File baseline1 = new File(tmpFolder, "baseline1"); + baseline1.createNewFile(); + File nestedFolder = new File(tmpFolder, "nestedBaselineFolder"); + nestedFolder.mkdirs(); + File nestedFile = new File(nestedFolder, "nestedBaselineFile"); + nestedFile.createNewFile(); + + // This output is important to the FAT test + System.out.println("-MONITORED FOLDER-" + tmpFolder.getAbsolutePath()); + System.out.println("-MONITORED FILE-" + tmpFile.getAbsolutePath()); + System.out.println("-NONEXISTENT FOLDER-" + nonExistentFolder.getAbsolutePath()); + System.out.println("-NONEXISTENT FILE-" + nonExistentFile.getAbsolutePath()); + + BundleContext bundleContext = cc.getBundleContext(); + + Collection folderSet = new HashSet(); + folderSet.add(tmpFolder.getAbsolutePath()); + + Collection fileSet = new HashSet(); + fileSet.add(tmpFile.getAbsolutePath()); + + Collection nonExistentFolderSet = new HashSet(); + nonExistentFolderSet.add(nonExistentFolder.getAbsolutePath()); + + Collection nonExistentFileSet = new HashSet(); + nonExistentFileSet.add(nonExistentFile.getAbsolutePath()); + + registerRecursiveMonitor(bundleContext, "-RECURSIVETESTMONITOROUTPUT-", folderSet); + registerRecursiveMonitor(bundleContext, "-NONEXISTENTFOLDERTESTMONITOROUTPUT-", nonExistentFolderSet); + // Register something monitoring a directory, where there's actually a file in that spot + registerRecursiveMonitor(bundleContext, "-RECURSIVEBUTACTUALLYMONITORINGFILETESTMONITOROUTPUT-", fileSet); + + // Also register a monitor with filters + registerRegexFilteredFileMonitor(bundleContext, folderSet); + registerFileFilteredFileMonitor(bundleContext, folderSet); + registerDirectoryFilteredFileMonitor(bundleContext, folderSet); + + // Also register a non-recursive monitor + registerNonRecursiveMonitor(bundleContext, folderSet); + + // Also register a monitor which isn't watching its own folder + registerMonitorSelfMonitor(bundleContext, folderSet); + registerNonRecursiveMonitorSelfMonitor(bundleContext, folderSet); + + // Also register a monitor watching a file + registerFileMonitor(bundleContext, "-FILETESTMONITOROUTPUT-", fileSet); + registerFileMonitor(bundleContext, "-FILENONEXISTENTTESTMONITOROUTPUT-", nonExistentFileSet); + // Register something monitoring a directory, where there's actually a file in that spot + registerFileMonitor(bundleContext, "-FILEBUTACTUALLYMONITORINGDIRECTORYTESTMONITOROUTPUT-", folderSet); + + // Register an externally driven monitor watching a folder + registerManualMonitor(bundleContext, folderSet); + + } + + /** + * A monitor which really is of file-type to monitor just files (not folders). + */ + private void registerFileMonitor(BundleContext bundleContext, String fileEyecatcher, Collection fileSet) { + final Hashtable fileMonitorProps = new Hashtable(); + fileMonitorProps.put(FileMonitor.MONITOR_FILES, fileSet); + fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(fileEyecatcher), fileMonitorProps); + } + + private void registerMonitorSelfMonitor(BundleContext bundleContext, Collection folderSet) { + String monitorSelfEyecatcher = "-MONITORSELFTESTMONITOROUTPUT-"; + final Hashtable monitorSelfFileMonitorProps = new Hashtable(); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, folderSet); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, true); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_RECURSE, true); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(monitorSelfEyecatcher), monitorSelfFileMonitorProps); + } + + private void registerNonRecursiveMonitorSelfMonitor(BundleContext bundleContext, Collection folderSet) { + String monitorSelfEyecatcher = "-NONRECURSEMONITORSELFTESTMONITOROUTPUT-"; + final Hashtable monitorSelfFileMonitorProps = new Hashtable(); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, folderSet); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, true); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_RECURSE, false); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(monitorSelfEyecatcher), monitorSelfFileMonitorProps); + } + + private void registerNonRecursiveMonitor(BundleContext bundleContext, Collection folderSet) { + // Avoid overlap with the eyecatcher for the recursive monitor to avoid regexp horribleness + String nonRecursiveEyecatcher = "-NONRECURSINGTESTMONITOROUTPUT-"; + final Hashtable nonRecursiveFileMonitorProps = new Hashtable(); + nonRecursiveFileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, folderSet); + nonRecursiveFileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, false); + nonRecursiveFileMonitorProps.put(FileMonitor.MONITOR_RECURSE, false); + nonRecursiveFileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(nonRecursiveEyecatcher), nonRecursiveFileMonitorProps); + } + + /** + * A monitor which monitors a folder recursively (but doesn't include itself). + */ + private void registerRecursiveMonitor(BundleContext bundleContext, String recursiveEyecatcher, Collection fileSet) { + final Hashtable recursiveFileMonitorProps = new Hashtable(); + recursiveFileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, fileSet); + recursiveFileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, false); + recursiveFileMonitorProps.put(FileMonitor.MONITOR_RECURSE, true); + recursiveFileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(recursiveEyecatcher), recursiveFileMonitorProps); + } + + private void registerRegexFilteredFileMonitor(BundleContext bundleContext, Collection fileSet) { + final Hashtable fileMonitorProps = new Hashtable(); + fileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, fileSet); + fileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, false); + fileMonitorProps.put(FileMonitor.MONITOR_RECURSE, true); + fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + // Use the middle of the file's name as a filter + String filter = ".*include.*"; + fileMonitorProps.put(FileMonitor.MONITOR_FILTER, filter); + String eyecatcher = "-FILTEREDTESTMONITOROUTPUT-"; + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(eyecatcher), fileMonitorProps); + } + + private void registerFileFilteredFileMonitor(BundleContext bundleContext, Collection fileSet) { + final Hashtable fileMonitorProps = new Hashtable(); + fileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, fileSet); + fileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, false); + fileMonitorProps.put(FileMonitor.MONITOR_RECURSE, true); + fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + fileMonitorProps.put(FileMonitor.MONITOR_FILTER, FileMonitor.MONITOR_FILTER_FILES_ONLY); + String eyecatcher = "-FILEFILTERTESTMONITOROUTPUT-"; + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(eyecatcher), fileMonitorProps); + } + + private void registerDirectoryFilteredFileMonitor(BundleContext bundleContext, Collection fileSet) { + final Hashtable fileMonitorProps = new Hashtable(); + fileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, fileSet); + fileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, true); + fileMonitorProps.put(FileMonitor.MONITOR_RECURSE, true); + fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + fileMonitorProps.put(FileMonitor.MONITOR_FILTER, FileMonitor.MONITOR_FILTER_DIRECTORIES_ONLY); + String eyecatcher = "-DIRECTORYFILTERTESTMONITOROUTPUT-"; + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(eyecatcher), fileMonitorProps); + } + + private void registerManualMonitor(BundleContext bundleContext, Collection fileSet) { + final Hashtable monitorProps = new Hashtable(); + monitorProps.put(FileMonitor.MONITOR_DIRECTORIES, fileSet); + monitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, true); + monitorProps.put(FileMonitor.MONITOR_RECURSE, true); + monitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + monitorProps.put(FileMonitor.MONITOR_TYPE, FileMonitor.MONITOR_TYPE_EXTERNAL); + + String eyecatcher = "-MANUALMONITOROUTPUT-"; + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(eyecatcher), monitorProps); + } + +} diff --git a/dev/com.ibm.ws.kernel.filemonitor_test/.classpath b/dev/com.ibm.ws.kernel.filemonitor_test/.classpath index 829a3c577ea4..bd880329225d 100755 --- a/dev/com.ibm.ws.kernel.filemonitor_test/.classpath +++ b/dev/com.ibm.ws.kernel.filemonitor_test/.classpath @@ -1,12 +1,7 @@ - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.kernel.filemonitor_test/.classpath.gradle b/dev/com.ibm.ws.kernel.filemonitor_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.filemonitor_test/.project b/dev/com.ibm.ws.kernel.filemonitor_test/.project index fb124379964d..d5cef0f2da11 100755 --- a/dev/com.ibm.ws.kernel.filemonitor_test/.project +++ b/dev/com.ibm.ws.kernel.filemonitor_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.kernel.filemonitor_test/bnd.bnd b/dev/com.ibm.ws.kernel.filemonitor_test/bnd.bnd new file mode 100755 index 000000000000..ac22430e4471 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_test/bnd.bnd @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/jmock/2.6.0/hamcrest-all-1.3.jar;version=file, \ + ../build.sharedResources/lib/jmock/2.6.0/jmock-junit4-2.6.0.jar;version=file, \ + ../build.sharedResources/lib/jmock/2.6.0/jmock-2.6.0.jar;version=file, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.ws.kernel.filemonitor;version=latest diff --git a/dev/com.ibm.ws.kernel.filemonitor_test/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.filemonitor_test/bnd.bnd.gradle new file mode 100755 index 000000000000..ac22430e4471 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_test/bnd.bnd.gradle @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/jmock/2.6.0/hamcrest-all-1.3.jar;version=file, \ + ../build.sharedResources/lib/jmock/2.6.0/jmock-junit4-2.6.0.jar;version=file, \ + ../build.sharedResources/lib/jmock/2.6.0/jmock-2.6.0.jar;version=file, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.ws.kernel.filemonitor;version=latest diff --git a/dev/wlp.lib.extract_test/build.nogradle b/dev/com.ibm.ws.kernel.filemonitor_test/build.gradle similarity index 100% rename from dev/wlp.lib.extract_test/build.nogradle rename to dev/com.ibm.ws.kernel.filemonitor_test/build.gradle diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath b/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath new file mode 100755 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath.gradle b/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.gitignore b/dev/com.ibm.ws.kernel.metatype.helper_fat/.gitignore new file mode 100644 index 000000000000..5d00910f3a6a --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.gitignore @@ -0,0 +1 @@ +/coverage.ec diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.project b/dev/com.ibm.ws.kernel.metatype.helper_fat/.project new file mode 100755 index 000000000000..c91b986c5aac --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.metatype.helper_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..72a0b4c067ca --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,281 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c92277a371a9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd b/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd new file mode 100644 index 000000000000..0822f646bcfb --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd @@ -0,0 +1,12 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.kernel.metatype.helper;version=latest diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..0822f646bcfb --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd.gradle @@ -0,0 +1,12 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.kernel.metatype.helper;version=latest diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/build-test.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/build-test.xml new file mode 100755 index 000000000000..c82e346aeece --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/build-test.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/build.gradle b/dev/com.ibm.ws.kernel.metatype.helper_fat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/delivery.sets b/dev/com.ibm.ws.kernel.metatype.helper_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/fat/src/com/ibm/ws/kernel/metatype/helper/fat/FATTest.java b/dev/com.ibm.ws.kernel.metatype.helper_fat/fat/src/com/ibm/ws/kernel/metatype/helper/fat/FATTest.java new file mode 100755 index 000000000000..144ab84c85bb --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/fat/src/com/ibm/ws/kernel/metatype/helper/fat/FATTest.java @@ -0,0 +1,370 @@ +package com.ibm.ws.kernel.metatype.helper.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.LibertyServerUtils; + +public class FATTest { + + private static final LibertyServer server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.kernel.metatype.helperServer"); + private static final String baseURL = "http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + + "/fileset"; + private final Class c = FATTest.class; + + // Servlet Strings + private static final String BASE = "This is Fileset servlet."; + private static final String BASE_ERROR = "The servlet was not available or did not return the expected content"; + private static final String SERVICE = "Found 1 fileset service."; + private static final String SERVICE_ERROR = "The Fileset service was not found, or too many were found."; + private static final String FILES = "Fileset contained file: "; + private static final String FILES_ERROR = "The fileset retrieved by the servlet did not match that expected."; + + private static final String TEST_FOLDER = "usr/shared/resources/fileset_test_bundles"; + private static final String GEN_JAR_NAME = "test3.jar"; + private static final String GEN_JAR_PATH = TEST_FOLDER + "/" + GEN_JAR_NAME; + + private static final String INIT_MSG_RE = "FileMonitor init completed for fileset"; + private static final String SCAN_MSG_RE = "FileMonitor scan completed for fileset"; + + // default to timeout after 5 seconds for the servlet content to be what we expect + // and for log/trace messages we are waiting for to appear + private static final int CONTENT_TIMEOUT = 5; + + @BeforeClass + public static void setUp() throws Exception { + // clean up from any failed runs + cleanUpGeneratedFiles(); + } + + @Rule + public TestName name = new TestName(); + + public String testName = ""; + public String currentLog = ""; + + @Before + public void setServerConfig() throws Exception { + // set the current test name + testName = name.getMethodName(); + + Log.info(c, testName, "=== Preparing for test " + testName + " ==="); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/filesetfatlibertyinternals-1.0.mf"); + + server.startServer(testName + "_console.log"); + Log.info(c, testName, "===== Starting test " + testName + " ====="); + } + + @After + public void cleanUpAfter() throws Exception { + Log.info(c, testName, "=== Cleaning up from test " + testName + " ==="); + + cleanUpGeneratedFiles(); + + //stop the server and collect the logs + server.stopServer(true); + + // switch back to the monitored_fileset/server.xml after each test + setConfigurationFile("monitored_fileset"); + } + + private static void cleanUpGeneratedFiles() throws Exception { + server.deleteFileFromLibertyInstallRoot(GEN_JAR_PATH); + } + + @AfterClass + public static void cleanUpSharedFolder() throws Exception { + server.deleteFileFromLibertyInstallRoot(TEST_FOLDER); + } + + @Test + public void testServlet() throws Exception { + String[] expected = new String[] { BASE }; + + verifyContent("", expected, BASE_ERROR); + } + + @Test + public void testFilesetService() throws Exception { + String[] expected = new String[] { BASE, SERVICE }; + + verifyContent("Service", expected, SERVICE_ERROR); + } + + @Test + public void testFilesetFiles() throws Exception { + + verifyJarsOneAndTwo(); + } + + @Test + public void testFilesetFilesUpdatedByMonitor() throws Exception { + + // check the fileset has only one and two + verifyJarsOneAndTwo(); + + // now copy three into place + copyTestJar(); + + // wait for the scan complete message + waitForTraceMessage(SCAN_MSG_RE); + + // verify that the fileset has jars one, two and three + verifyJarsOneTwoThree(); + } + + @Test + public void testFilesetFilesMonitorDisabled() throws Exception { + + // hack to give time for setup to copy files over since monitor will be disabled. This + // should ensure the server gets a snapshot of the directory after the setup copy + // has completed. Ideally it would be good to have some mechanism to detect when setup has + // completed but since the problem is occurring frequently the tactical hack + // was opted for to try and keep the builds green. + try { + Thread.sleep(1000); + } catch (Exception ex) { + } + + // change the configuration to disable monitoring and wait for the + // update trace + setConfigurationFileAndWait("unmonitored_fileset"); + + // verify that the fileset contains jars one and two + verifyJarsOneAndTwo(); + + // move the test3.jar into the fileset location + copyTestJar(); + + // check that the test3.jar has not appeared in the list of fileset + // files because we are not monitoring + verifyJarsOneAndTwo(); + + // since we are not scanning there aren't really any messages we can + // check for + // instead we'll just verify again that the third jar hasn't appeared + verifyJarsOneAndTwo(); + } + + @Test + public void testFilesetFilesMonitorReenabled() throws Exception { + + // disable the monitor and check for jars one and two + setConfigurationFileAndWait("unmonitored_fileset"); + verifyJarsOneAndTwo(); + + // update the config to re-enable the monitor + setConfigurationFileAndWait("monitored_fileset"); + + // move the test3.jar into the fileset location + copyTestJar(); + + //we should see two init complete messages, one from when the server came up + //and a second for when monitoring was re-enabled. + waitForTraceToMatchExpression(".*" + INIT_MSG_RE + ".*" + INIT_MSG_RE + ".*"); + + // check that the fileset has been updated + verifyJarsOneTwoThree(); + + } + + @Test + public void testCommaSeparatedFiles() throws Exception { + + // move the test3.jar into the fileset location + copyTestJar(); + + //verify that fileset can be specified with comma separated jar files + setConfigurationFileAndWait("fileset_list"); + verifyJarsOneTwoThree(); + } + + @Test + // recursion is no longer supported + @Ignore + public void testFilesetFilesUpdatedByConfig() throws Exception { + + // set the modified server.xml to be the server configuraiton + setConfigurationFileAndWait("config_change_fileset"); + + // now check that the fileset returns jars one, two and four + String[] expected = new String[] { BASE, FILES + "test1.jar", FILES + "test2.jar", FILES + "test4.jar" }; + + verifyContent("Files", expected, FILES_ERROR); + } + + private void copyTestJar() throws Exception { + // process to get a new jar into the resource folder + // use the FAT utility to copy the test3.jar to the install root + server.copyFileToLibertyInstallRoot(GEN_JAR_NAME); + // copy form the install root to the resources location + RemoteFile jarDest = new RemoteFile(server.getMachine(), LibertyServerUtils.makeJavaCompatible(server + .getInstallRoot() + + "/" + GEN_JAR_PATH)); + RemoteFile rootJar = server.getFileFromLibertyInstallRoot(GEN_JAR_NAME); + assertTrue("Copy of the generated jar file failed, the test will fail.", rootJar.copyToDest(jarDest)); + // now delete the original in the install root + if (rootJar.exists()) + rootJar.delete(); + + // now sleep for a second to allow the FileMonitor to run (it is set to + // run every 500ms) + Thread.sleep(1000); + } + + private List getContent(String urlQuerySuffix) throws Exception { + String logMsg = "getContent - " + testName; + String suffix = ("".equals(urlQuerySuffix)) ? "" : "?" + urlQuerySuffix; + URL url = new URL(baseURL + suffix); + Log.info(c, logMsg, "Calling servlet URL=" + url.toString()); + + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + + // read the page contents + String line = br.readLine(); + List lines = new ArrayList(); + while (line != null) { + lines.add(line); + line = br.readLine(); + } + con.disconnect(); + Log.info(c, logMsg, "Retrieved content: " + lines); + return lines; + } + + private void verifyContent(String urlQuerySuffix, String[] expect, String message) throws Exception { + + List actualContent = null; + Collection expectedContent = Arrays.asList(expect); + + long timeout = System.currentTimeMillis() + (CONTENT_TIMEOUT * 1000); + while (!!!expectedContent.equals(actualContent) && System.currentTimeMillis() < timeout) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + /* ignore */ + } + actualContent = getContent(urlQuerySuffix); + } + + assertEquals(message, expectedContent, actualContent); + } + + private void verifyJarsOneAndTwo() throws Exception { + String[] expected = new String[] { BASE, FILES + "test1.jar", FILES + "test2.jar" }; + + verifyContent("Files", expected, FILES_ERROR); + } + + private void verifyJarsOneTwoThree() throws Exception { + String[] expected = new String[] { BASE, FILES + "test1.jar", FILES + "test2.jar", FILES + "test3.jar" }; + + verifyContent("Files", expected, FILES_ERROR); + } + + private void setConfigurationFile(String serverxmlPathPrefix) throws Exception { + // set the server configuration file + server.setServerConfigurationFile(serverxmlPathPrefix + "/server.xml"); + } + + private void setConfigurationFileAndWait(String serverxmlPathPrefix) throws Exception { + setConfigurationFile(serverxmlPathPrefix); + + //wait 5 seconds for the config updated or config didn't change messages + server.waitForStringInLog("CWWKG0017|CWWKG0018", 5000); + } + + private RemoteFile getTraceFile() throws Exception { + // first wait up to 5 seconds for the log file to appear + RemoteFile logFile = null; + long timeout = System.currentTimeMillis() + 5000; + while (logFile == null && System.currentTimeMillis() < timeout) { + logFile = server.getMatchingLogFile("trace.*"); + if (logFile == null) { + Thread.sleep(500); + } + } + return logFile; + } + + private void waitForTraceMessage(String msgToWaitFor) throws Exception { + // search the trace log to check for the update + String found = server.waitForStringInLog(msgToWaitFor, 5000, getTraceFile()); + if (found == null) { + Log.warning(c, "Did not find the string \"" + msgToWaitFor + "\" in the log"); + } else { + Log.info(c, "waitForTraceMessage", "Found message " + msgToWaitFor); + } + } + + private void waitForTraceToMatchExpression(String regEx) throws Exception { + + RemoteFile traceFile = getTraceFile(); + + StringBuilder traceContent = new StringBuilder(); + + BufferedReader reader = new BufferedReader(new InputStreamReader(traceFile.openForReading())); + try { + long timeout = System.currentTimeMillis() + (CONTENT_TIMEOUT * 1000); + boolean matched = false; + Pattern p = Pattern.compile(regEx); + while (System.currentTimeMillis() < timeout) { + String nextLine = reader.readLine(); + if (nextLine != null) { + traceContent.append(nextLine); + } else { + //if we reached the end of the file we should wait a while before looping again + Thread.sleep(100); + } + Matcher m = p.matcher(traceContent.toString()); + if (m.matches()) { + matched = true; + break; + } + } + + // search the trace log to check for the update + if (!!!matched) { + Log.warning(c, "Did not find the expression \"" + regEx + "\" in the log"); + } else { + Log.info(c, "waitForTraceMessages", "Found expression " + regEx); + } + } finally { + reader.close(); + } + } + +} diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/config_change_fileset/server.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/config_change_fileset/server.xml new file mode 100755 index 000000000000..8b6fbc0f317c --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/config_change_fileset/server.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/fileset_list/server.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/fileset_list/server.xml new file mode 100755 index 000000000000..f8402002d669 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/fileset_list/server.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/internalFeatureForFat/filesetfatlibertyinternals-1.0.mf b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/internalFeatureForFat/filesetfatlibertyinternals-1.0.mf new file mode 100755 index 000000000000..1cf06cdf6f49 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/internalFeatureForFat/filesetfatlibertyinternals-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: filesetfatlibertyinternals-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +IBM-API-Package: com.ibm.wsspi.config; type="internal", + org.osgi.framework; type="spec" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/monitored_fileset/server.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/monitored_fileset/server.xml new file mode 100755 index 000000000000..c599ced1ecc2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/monitored_fileset/server.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/test3.jar b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/test3.jar new file mode 100755 index 000000000000..1e1ca9e87dd1 Binary files /dev/null and b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/test3.jar differ diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/unmonitored_fileset/server.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/unmonitored_fileset/server.xml new file mode 100755 index 000000000000..4e3f3950ad21 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/unmonitored_fileset/server.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/.gitignore b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/.gitignore new file mode 100644 index 000000000000..383c36189fb9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/.gitignore @@ -0,0 +1,2 @@ +/dropins +/server.xml diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/bootstrap.properties b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/bootstrap.properties new file mode 100755 index 000000000000..9af719cbc7aa --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/bootstrap.properties @@ -0,0 +1,5 @@ +bootstrap.include=../testports.properties +# Trace format (basic or enhanced or advanced) +com.ibm.ws.logging.trace.format=advanced +# Trace settings string - this string enables all trace +com.ibm.ws.logging.trace.specification=*=info:com.ibm.ws.kernel.metatype.helper.internal.FilesetImpl=all=enabled:com.ibm.ws.kernel.filemonitor.internal.CoreServiceImpl=all=enabled:com.ibm.ws.kernel.filemonitor.internal.MonitorHolder=all=enabled:logservice=all=enabled \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/config/com.ibm.ws.kernel.metatype.helperServer.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/config/com.ibm.ws.kernel.metatype.helperServer.xml new file mode 100755 index 000000000000..2a8534bc0a4f --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/config/com.ibm.ws.kernel.metatype.helperServer.xml @@ -0,0 +1,12 @@ + + + + + + servlet-3.0 + filesetfatlibertyinternals-1.0 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/repo.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/repo.xml new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test.txt b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test.txt new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test1.jar b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test1.jar new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test2.jar b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test2.jar new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test_subfolder/test4.jar b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test_subfolder/test4.jar new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/resources/WEB-INF/web.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..b942041fd656 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/resources/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + + fileset + This is a servlet designed to exercise Fileset functionality. + + + + Fileset Servlet + Fileset Servlet + + com.ibm.ws.kernel.metatype.helper.test.app.FilesetTestServlet + + + + + + Fileset Servlet + /* + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/src/com/ibm/ws/kernel/metatype/helper/test/app/FilesetTestServlet.java b/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/src/com/ibm/ws/kernel/metatype/helper/test/app/FilesetTestServlet.java new file mode 100755 index 000000000000..737225d94342 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/src/com/ibm/ws/kernel/metatype/helper/test/app/FilesetTestServlet.java @@ -0,0 +1,82 @@ +package com.ibm.ws.kernel.metatype.helper.test.app; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; + +import javax.servlet.Servlet; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; + +import com.ibm.wsspi.config.Fileset; + +public class FilesetTestServlet extends HttpServlet { + + private static final long serialVersionUID = 2268417347748420049L; + + // Hacky way to get a BundleContext so we can check and use services... ick! + BundleContext context = FrameworkUtil.getBundle(Servlet.class).getBundleContext(); + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + PrintWriter writer = resp.getWriter(); + resp.setStatus(HttpServletResponse.SC_OK); + resp.setContentType("text/plain"); + writer.println("This is Fileset servlet."); + + String test = req.getQueryString(); + + try { + if (test != null) { + if (test.equals("Service")) { + testFilesetServiceRegistered(writer); + } else if (test.equals("Files")) { + printFilesetFiles(writer); + } + } + } catch (Exception e) { + e.printStackTrace(writer); + } finally { + writer.flush(); + writer.close(); + } + } + + private void testFilesetServiceRegistered(PrintWriter writer) throws Exception { + Collection> filesets = context.getServiceReferences(Fileset.class, "(id=testFileset)"); + + // output how many filesets we found + writer.println("Found " + filesets.size() + " fileset service."); + } + + private void printFilesetFiles(PrintWriter writer) throws Exception { + Collection> filesets = context.getServiceReferences(Fileset.class, "(id=testFileset)"); + for (ServiceReference filesetRef : filesets) { + Fileset fset = null; + try { + fset = context.getService(filesetRef); + Collection files = fset.getFileset(); + ArrayList sortedFileNames = new ArrayList(files.size()); + for (File f : files) { + sortedFileNames.add(f.getName()); + } + Collections.sort(sortedFileNames); + for (String name : sortedFileNames) { + writer.println("Fileset contained file: " + name); + } + } finally { + if (fset != null) + context.ungetService(filesetRef); + } + } + } +} diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath b/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath.gradle b/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.gitignore b/dev/com.ibm.ws.kernel.metatype.helper_test/.gitignore new file mode 100644 index 000000000000..5d00910f3a6a --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.gitignore @@ -0,0 +1 @@ +/coverage.ec diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.project b/dev/com.ibm.ws.kernel.metatype.helper_test/.project new file mode 100755 index 000000000000..b4e6457ec4df --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.metatype.helper_test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..72a0b4c067ca --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,281 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c92277a371a9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd b/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd new file mode 100755 index 000000000000..3d59e7ca35fc --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest, \ + com.ibm.websphere.appserver.spi.kernel.filemonitor;version=latest,\ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.ws.kernel.metatype.helper;version=latest diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd.gradle new file mode 100755 index 000000000000..3d59e7ca35fc --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd.gradle @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest, \ + com.ibm.websphere.appserver.spi.kernel.filemonitor;version=latest,\ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.ws.kernel.metatype.helper;version=latest diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/build-unittest.xml b/dev/com.ibm.ws.kernel.metatype.helper_test/build-unittest.xml new file mode 100755 index 000000000000..20cf72888c1b --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/build-unittest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/build.gradle b/dev/com.ibm.ws.kernel.metatype.helper_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/delivery.sets b/dev/com.ibm.ws.kernel.metatype.helper_test/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/AbstractFilesetTestHelper.java b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/AbstractFilesetTestHelper.java new file mode 100755 index 000000000000..2bfb468024f6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/AbstractFilesetTestHelper.java @@ -0,0 +1,187 @@ +package com.ibm.wsspi.config.internal; + +import java.io.File; +import java.net.URI; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import junit.framework.Assert; + +import com.ibm.wsspi.config.Fileset; +import com.ibm.wsspi.config.internal.FilesetImpl; +import com.ibm.wsspi.config.internal.ConfigTypeConstants.FilesetAttribute; +import com.ibm.wsspi.kernel.filemonitor.FileMonitor; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; +import com.ibm.wsspi.kernel.service.location.WsResource; + +public class AbstractFilesetTestHelper { + + static protected void setLocationService(FilesetImpl fset) { + fset.setLocationAdmin(new WsLocationAdmin() { + + @Override + public WsResource addLocation(String fileName, String symbolicName) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource asResource(File file, boolean isFile) { + // TODO Auto-generated method stub + return null; + } + + @Override + public File getBundleFile(Object caller, String relativeBundlePath) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource getRuntimeResource(String relativeRuntimePath) { + // TODO Auto-generated method stub + return null; + } + + @Override + public UUID getServerId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getServerName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource getServerOutputResource(String relativeServerPath) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource getServerResource(String relativeServerPath) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource getServerWorkareaResource(String relativeServerWorkareaPath) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Iterator matchResource(String resourceGroupName, String resourceRegex, int limit) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String printLocations(boolean useLineBreaks) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource resolveResource(String resourceURI) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource resolveResource(URI resourceURI) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String resolveString(String string) { + // TODO Auto-generated method stub + return ""; + } + + }); + } + + static Map getDefaultAttributes() { + return getAttributes(null, null, null, null, null); + } + + protected static Map getAttributes(String dir, Boolean sensitive, String includes, + String excludes, Long scanInterval) { + Map attrs = new HashMap(); + attrs.put("id", "FilesetID"); + if (dir == null) + dir = "."; + attrs.put(FilesetAttribute.dir.toString(), dir); + if (sensitive == null) + sensitive = true; + attrs.put(FilesetAttribute.caseSensitive.toString(), sensitive); + if (includes == null) + includes = "*"; + attrs.put(FilesetAttribute.includes.toString(), includes); + if (excludes == null) + excludes = ""; + attrs.put(FilesetAttribute.excludes.toString(), excludes); + + if (scanInterval != null) { + attrs.put(FilesetAttribute.scanInterval.toString(), scanInterval); + } + return attrs; + } + + static void setAttributes(FilesetImpl fset, String dir, Boolean sensitive, String includes, String excludes) { + setAttributes(fset, dir, sensitive, includes, excludes, null); + } + + static void setAttributes(FilesetImpl fset, String dir, Boolean sensitive, String includes, String excludes, Long scanInterval) { + Map props = fset.modified(getAttributes(dir, sensitive, includes, excludes, scanInterval)); + Collection dirs = (Collection) props.get(FileMonitor.MONITOR_DIRECTORIES); + Assert.assertEquals("wrong size", 1, dirs.size()); + Assert.assertEquals("wrong dir", fset.getDir(), dirs.iterator().next()); + + Object interval = props.get(FileMonitor.MONITOR_INTERVAL); + if (scanInterval == null || scanInterval.equals(FilesetImpl.MONITOR_OFF)) { + Assert.assertNull("interval present: " + interval, interval); + } else { + Assert.assertEquals("wrong interval", scanInterval, interval); + } + + Collection files = Collections.emptyList(); + Collection emptyFiles = Collections.emptyList(); + fset.onBaseline(emptyFiles); + File dirFile = new File(dir); + if (dirFile.exists()) { + files = recursivelyListFiles(dirFile); + } + // mock the effect of the FileMonitor + // call initComplete with the + // files we found in the dir + fset.onBaseline(files); + } + + static void setDefaultAttributes(Fileset fset) { + ((FilesetImpl) fset).modified(getDefaultAttributes()); + } + + static Collection recursivelyListFiles(File dir) { + Collection files = new ArrayList(); + for (File f : dir.listFiles()) { + if (f.isDirectory()) { + files.addAll(recursivelyListFiles(f)); + } else { + files.add(f); + } + } + return files; + } + +} diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetNameFilterTest.java b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetNameFilterTest.java new file mode 100755 index 000000000000..1ac276530888 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetNameFilterTest.java @@ -0,0 +1,346 @@ +package com.ibm.wsspi.config.internal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FilenameFilter; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import com.ibm.wsspi.config.internal.FilesetImpl; +import com.ibm.wsspi.config.internal.FilesetImpl.FilterType; + +/** + * The fileset configuration element uses include and exclude filters to provide + * a set of file names. This class provides tests to check the behaviour of the + * filters is correct for many different cases. + * + * The implementation of the {@link FilenameFilter} is a private class inside + * the {@link FilesetImpl} so reflection is used to access the methods required + * to test them, primarily the accept method. + */ +public class FilesetNameFilterTest extends AbstractFilesetTestHelper { + + // the basedir we will use + private static final File DIR = new File("test" + File.separator + "path"); + // a sub directory of basedir + private static final File SUB_DIR = new File(DIR, "sub"); + // another level of sub directory + private static final File SUB2_DIR = new File(SUB_DIR, "sub2"); + // an alternate dir to test files from a different dir + private static final File ALT_DIR = new File("some" + File.separator + "otherpath"); + + // create a Fileset with the default attributes as we will set them as + // required in the tests + static FilesetImpl fset = new FilesetImpl(); + + // The reflective filter which delegates to the real (private) object + // inside the FilesetImpl + private static ReflectiveFilter filter; + + private final Mockery context = new JUnit4Mockery(); + private ComponentContext mockComponentContext; + + @BeforeClass + public static void setupReflectiveFields() throws Exception { + Field filterField = fset.getClass().getDeclaredField("filter"); + filterField.setAccessible(true); + filter = new ReflectiveFilter(filterField.get(fset)); + + } + + @Before + public void setup() throws Exception { + setLocationService(fset); + // clear the filters before each test + filter.clearFilters(); + // set the dir on the fileset + mockComponentContext = context.mock(ComponentContext.class); + fset.activate(mockComponentContext, getAttributes(DIR.toString(), null, null, null, null)); + + final BundleContext mockBundleContext = context.mock(BundleContext.class); + context.checking(new Expectations() { + { + allowing(mockComponentContext).getBundleContext(); + will(returnValue(mockBundleContext)); + allowing(mockComponentContext).getProperties(); + ignoring(mockBundleContext); + } + }); + + } + + @Test + public void testDefaultAccept() throws Exception { + // the default include is "*" which applies to anything in the same + // directory, we have to add it here even though it is the default, + // because we are just testing a filter object not a Fileset one + filter.addFilter(FilterType.INCLUDE, "*"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(DIR, "testFile2")); + assertTrue(filter.accept(DIR, "anything")); + // if the directory is different it shouldn't be included + assertFalse(filter.accept(ALT_DIR, "anything")); + // even a sub folder shouldn't be accepted + assertFalse(filter.accept(SUB_DIR, "anything")); + } + + @Test + public void testDotEscape() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile.txt"); + // check that we get true for a file name with a . + assertTrue(filter.accept(DIR, "testFile.txt")); + // check that we get false for a file name with another + // character in place of the . (because regex . is any character) + assertFalse(filter.accept(DIR, "testFile,txt")); + } + + @Test + public void testCaseSensitiveDefault() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testfile"); + // lower case OK + assertTrue(filter.accept(DIR, "testfile")); + // upper case F should fail + assertFalse(filter.accept(DIR, "testFile")); + } + + @Test + public void testCaseInsensitive() throws Exception { + try { + setAttributes(fset, DIR.toString(), false, null, null); + filter.addFilter(FilterType.INCLUDE, "testfile"); + // lower case OK + assertTrue(filter.accept(DIR, "testfile")); + // upper case F should pass + assertTrue(filter.accept(DIR, "testFile")); + } finally { + // return back to the default for other tests + setAttributes(fset, DIR.toString(), true, null, null); + } + } + + @Test + public void testWildcardIncludeAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "*"); + // should get anything in the dir + assertTrue(filter.accept(DIR, "testFile")); + // should not get a file from the sub dir + assertFalse(filter.accept(SUB_DIR, "testFile")); + } + + @Test + public void testNameIncludeAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile"); + assertTrue(filter.accept(DIR, "testFile")); + } + + @Test + public void testFullpathIncludeAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "sub/testFile"); + assertTrue(filter.accept(SUB_DIR, "testFile")); + } + + @Test + public void testWildcardExcludeAccept() throws Exception { + filter.addFilter(FilterType.EXCLUDE, "*"); + assertFalse(filter.accept(DIR, "testFile")); + } + + @Test + public void testNameExcludeAccept() throws Exception { + filter.addFilter(FilterType.EXCLUDE, "testFile"); + assertFalse(filter.accept(DIR, "testFile")); + } + + @Test + public void testFullpathExcludeAccept() throws Exception { + filter.addFilter(FilterType.EXCLUDE, "sub/testFile"); + assertFalse(filter.accept(SUB_DIR, "testFile")); + } + + @Test + public void testSpaceSeparatedAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile testFile2"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(DIR, "testFile2")); + } + + @Test + public void testCommaSeparatedAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile,testFile2"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(DIR, "testFile2")); + } + + @Test + public void testCommaAndSpaceSeparatedAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile , testFile2"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(DIR, "testFile2")); + } + + @Test + public void testCommaAndSpaceSeparatedAccept2() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile , testFile2"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(DIR, "testFile2")); + } + + @Test + public void testExcessSpacesAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, " testFile "); + assertTrue(filter.accept(DIR, "testFile")); + } + + @Test + public void testIncludeAndExcludeAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile"); + filter.addFilter(FilterType.EXCLUDE, "testFile2"); + assertTrue(filter.accept(DIR, "testFile")); + assertFalse(filter.accept(DIR, "testFile2")); + } + + @Test + public void testNameEmbeddedWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "test*"); + assertTrue(filter.accept(DIR, "testFile")); + assertFalse(filter.accept(DIR, "filetestFile")); + assertFalse(filter.accept(DIR, "")); + } + + @Test + public void testNameLeadingWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "*TestFile"); + assertTrue(filter.accept(DIR, "fileTestFile")); + // require at least one character for star + assertFalse(filter.accept(DIR, "TestFile")); + // check that path boundaries aren't crossed + assertFalse(filter.accept(SUB_DIR, "fileTestFile")); + assertFalse(filter.accept(SUB2_DIR, "fileTestFile")); + assertFalse(filter.accept(DIR, "filetestFile")); + } + + @Test + public void testPathEmbeddedWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "./*/testFile"); + // /test/path/testFile (will be false because there is no folder between + // . and testFile + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + assertFalse(filter.accept(SUB2_DIR, "testFile")); + } + + @Test + public void testLeadingPathEmbeddedWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "*/testFile"); + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + assertFalse(filter.accept(SUB2_DIR, "testFile")); + } + + @Test + public void testMultiplePathEmbeddedWildCards() throws Exception { + filter.addFilter(FilterType.INCLUDE, "./*/*/testFile"); + assertFalse(filter.accept(DIR, "testFile")); + assertFalse(filter.accept(SUB_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + assertTrue(filter.accept(SUB2_DIR, "testFile")); + } + + @Test + public void testPathAndNameEmbeddedWildCards() throws Exception { + filter.addFilter(FilterType.INCLUDE, "./*/test*"); + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertFalse(filter.accept(DIR, "filetestFile")); + assertFalse(filter.accept(SUB_DIR, "filetestFile")); + } + + @Test + public void testRecursiveWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "./**/testFile"); + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertTrue(filter.accept(SUB2_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + } + + @Test + public void testLeadingRecursiveWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "**/testFile"); + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertTrue(filter.accept(SUB2_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + } + + @Test + public void testOnlyRecursiveWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "**"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertTrue(filter.accept(SUB2_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + } + + @Test + public void testComplexWildCards() throws Exception { + filter.addFilter(FilterType.INCLUDE, "**/some/**/path/*/*test*.*"); + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(new File("test/path/sub1/sub2/some/sub3/sub4/sub5/path/dir"), "AtestfileB.txt")); + assertFalse(filter.accept(new File("test/path/sub1/sub2/some/sub3/sub4/sub5/path/dir"), "testfileB")); + assertFalse(filter.accept(new File("test/path/sub1/sub2/some/sub3/sub4/sub5/path/dir"), "AtestfileB")); + assertFalse(filter.accept(new File("some/path/dir"), "AtestfileB.txt")); + assertFalse(filter.accept(new File("test/path/sub1/sub2/some/sub3/sub4/sub5/path"), "AtestfileB.txt")); + } + + /** + * This class uses reflection to delegate to the real filter Object which is + * privately constructed and used inside the FilesetImpl. + * + */ + private static final class ReflectiveFilter { + private final Object realFilter; + private final Method clearFiltersMethod; + private final Method addFilterMethod; + private final Method acceptMethod; + + ReflectiveFilter(Object realFilter) throws SecurityException, NoSuchMethodException { + this.realFilter = realFilter; + clearFiltersMethod = realFilter.getClass().getDeclaredMethod("clearFilters", new Class[0]); + clearFiltersMethod.setAccessible(true); + addFilterMethod = realFilter.getClass().getDeclaredMethod("addFilter", FilterType.class, String.class); + addFilterMethod.setAccessible(true); + acceptMethod = realFilter.getClass().getDeclaredMethod("accept", File.class, String.class); + acceptMethod.setAccessible(true); + + } + + public void clearFilters() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { + clearFiltersMethod.invoke(realFilter, new Object[0]); + } + + public void addFilter(FilterType type, String filter) throws IllegalArgumentException, IllegalAccessException, + InvocationTargetException { + addFilterMethod.invoke(realFilter, type, filter); + } + + public boolean accept(File dir, String name) throws IllegalArgumentException, IllegalAccessException, + InvocationTargetException { + return (Boolean) acceptMethod.invoke(realFilter, dir, name); + } + } +} diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetTest.java b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetTest.java new file mode 100755 index 000000000000..527753b9b49f --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetTest.java @@ -0,0 +1,238 @@ +package com.ibm.wsspi.config.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import com.ibm.wsspi.config.internal.FilesetImpl; + +public class FilesetTest extends AbstractFilesetTestHelper { + + // the basedir we will use + private static final File DIR = new File("./test"); + private static final File NODIR = new File("./notADir"); + private static final File TEST_FILE = new File(DIR, "testfile.txt"); + private static final File TEST_FILE_2 = new File(DIR, "testfile2"); + private static final Collection TEST_FILES = new ArrayList(); + private static final Collection EMPTY_FILESET = Collections.emptySet(); + + static { + TEST_FILES.add(TEST_FILE); + TEST_FILES.add(TEST_FILE_2); + } + + // create a Fileset with no attributes as we will set them as required in + // the tests + FilesetImpl fset; + + private final Mockery context = new JUnit4Mockery(); + private ComponentContext mockComponentContext; + + private static void recursiveDelete(File dir) { + if (dir.exists()) { + for (File f : dir.listFiles()) { + if (f.isDirectory()) { + recursiveDelete(f); + } else { + f.delete(); + } + } + dir.delete(); + } + } + + @BeforeClass + public static void setUpFiles() throws Exception { + // clean up first, just in case clean up failed + // or was interrupted previously + cleanUpFiles(); + // set up a directory with some test files in + DIR.mkdir(); + for (File test_file : TEST_FILES) { + test_file.createNewFile(); + } + } + + @AfterClass + public static void cleanUpFiles() throws Exception { + // recursively remove the test directory + recursiveDelete(DIR); + } + + @Before + public void setUp() throws Exception { + fset = new FilesetImpl(); + setLocationService(fset); + mockComponentContext = context.mock(ComponentContext.class); + final BundleContext mockBundleContext = context.mock(BundleContext.class); + context.checking(new Expectations() { + { + allowing(mockComponentContext).getBundleContext(); + will(returnValue(mockBundleContext)); + allowing(mockComponentContext).getProperties(); + ignoring(mockBundleContext); + } + }); + + fset.activate(mockComponentContext, getAttributes(DIR.getName(), null, null, null, null)); + setAttributes(fset, DIR.getName(), null, null, null); +// fset.initComplete(Collections.singleton(DIR)); + } + + private String getFilterFromCollection(Collection collection) { + Collection names = new ArrayList(collection.size()); + for (File f : collection) { + names.add(f.getName()); + } + + // turn the names collection into a ", " separated String + String filter = names.toString(); + // trim the [ and ] from the String + filter = filter.substring(1, filter.length() - 1); + return filter; + } + + private Collection getResolvedAndSortedNames(Collection files) throws Exception { + List fileAbsolutePaths = new ArrayList(files.size()); + for (File f : files) { + fileAbsolutePaths.add(f.getCanonicalPath()); + } + Collections.sort(fileAbsolutePaths); + return fileAbsolutePaths; + } + + private void assertFilesetsEqual(String msg, File expected, Collection actual) throws Exception { + assertFilesetsEqual(msg, Arrays.asList(new File[] { expected }), actual); + } + + private void assertFilesetsEqual(String msg, Collection expected, Collection actual) throws Exception { + assertEquals("Unexpected files returned", getResolvedAndSortedNames(expected), + getResolvedAndSortedNames(actual)); + } + + @Test + public void testSetDir() throws Exception { + // check that setDir has an effect and returns the expected files + setAttributes(fset, DIR.getName(), null, null, null); + assertFilesetsEqual("Unexpected files returned", TEST_FILES, fset.getFileset()); + // check that changing setDir changes the returned collection + setAttributes(fset, NODIR.getName(), null, null, null); + assertFilesetsEqual("Unexpected files returned", EMPTY_FILESET, fset.getFileset()); + } + + @Test + public void testSetCaseSensitive() throws Exception { + // the default filter is *, which isn't going to be case sensitive + // either way + // so set the includes filter to be the list of TEST_FILES + setAttributes(fset, DIR.getName(), true, getFilterFromCollection(TEST_FILES), null); + // check that it works as is + assertFilesetsEqual("Unexpected files returned", TEST_FILES, fset.getFileset()); + Collection wrongcaseFiles = Arrays.asList(new File[] { new File(DIR, "testFile.txt"), + new File(DIR, "testFile2") }); + // apply the wrong case filter + setAttributes(fset, DIR.getName(), true, getFilterFromCollection(wrongcaseFiles), null); + // check that no files come back for the wrong case + assertFilesetsEqual("Was not case sensitive when should have been", EMPTY_FILESET, fset.getFileset()); + // make it insensitive and check result + setAttributes(fset, DIR.getName(), false, getFilterFromCollection(wrongcaseFiles), null); + assertFilesetsEqual("Was case sensitive when should not have been", TEST_FILES, fset.getFileset()); + // return to sensitive and check + setAttributes(fset, DIR.getName(), true, getFilterFromCollection(wrongcaseFiles), null); + assertFilesetsEqual("Was not case sensitive when should have been", EMPTY_FILESET, fset.getFileset()); + } + + @Test + public void testSetIncludesAttribute() throws Exception { + setAttributes(fset, DIR.getName(), null, TEST_FILE.getName(), null); + assertFilesetsEqual("Inlcude filter was incorrectly applied", TEST_FILE, fset.getFileset()); + } + + @Test + public void testSetExcludesAttribute() throws Exception { + setAttributes(fset, DIR.getName(), null, null, TEST_FILE.getName()); + assertFilesetsEqual("Exlcude filter was incorrectly applied", TEST_FILE_2, fset.getFileset()); + } + + @Test + public void testGetFileset() throws Exception { + Collection files = fset.getFileset(); + assertNotNull(files); + assertFilesetsEqual("Unexpected files returned", TEST_FILES, fset.getFileset()); + } + + @Test + public void testNotifyFileChanged() throws Exception { + // check that nothing is returned for testfile3 + setAttributes(fset, DIR.getName(), null, "testfile3", null); + Collection retrieved = fset.getFileset(); + assertFilesetsEqual("No files should have been returned", EMPTY_FILESET, retrieved); + // change the contents of the DIR and notify that it was changed + File testFile3 = new File(DIR, "testfile3"); + testFile3.createNewFile(); + // when the disk contents change the FileMonitor service will call + // scanComplete(...) + // mock that call here with a new listing of the files in the DIR and + // remove the existing retrieved files + fset.onChange(recursivelyListFiles(new File(DIR.getName())), retrieved, EMPTY_FILESET); + // check that the fileset now contains the new file + /* + * assertNotSame("The cached fileset should have been refreshed", + * EMPTY_FILESET, fset.getFileset()); + */ + retrieved = fset.getFileset(); + assertFilesetsEqual("The new file should have been returned", testFile3, retrieved); + + testFile3.setLastModified(testFile3.lastModified() + 5000); + fset.onChange(EMPTY_FILESET, retrieved, EMPTY_FILESET); + retrieved = fset.getFileset(); + assertFilesetsEqual("The same file should have been returned", testFile3, retrieved); + + testFile3.delete(); + fset.onChange(EMPTY_FILESET, EMPTY_FILESET, retrieved); + retrieved = fset.getFileset(); + assertFilesetsEqual("No files should have been returned", EMPTY_FILESET, retrieved); + } + + @Test + public void testRecursion() throws Exception { + try { + File sub = new File(DIR, "some/sub/dir"); + sub.mkdirs(); + File subFile = new File(sub, "subfile.txt"); + subFile.createNewFile(); + + setAttributes(fset, DIR.getName(), null, "**/subfile.txt", null); + + assertFilesetsEqual("The sub directory file should have been returned", subFile, fset.getFileset()); + + } finally { + // delete the file we made so it doesn't influence + // other tests + recursiveDelete(new File(DIR, "some")); + } + } + + @Test + public void verifyProperties() { + setAttributes(fset, DIR.getName(), null, null, null, 0L); + setAttributes(fset, DIR.getName(), null, null, null, 1L); + setAttributes(fset, DIR.getName(), null, null, null, -5L); + } +} diff --git a/dev/com.ibm.ws.kernel.service/bnd.bnd b/dev/com.ibm.ws.kernel.service/bnd.bnd index 0d943ba0e3c5..18fc5cab35f9 100755 --- a/dev/com.ibm.ws.kernel.service/bnd.bnd +++ b/dev/com.ibm.ws.kernel.service/bnd.bnd @@ -14,7 +14,8 @@ Export-Package: \ com.ibm.websphere.kernel.server;provide:=true, \ com.ibm.wsspi.kernel.service.location, \ com.ibm.wsspi.kernel.service.utils;provide:=true, \ - com.ibm.ws.kernel.service.util;provide:=true + com.ibm.ws.kernel.service.util;provide:=true, \ + com.ibm.ws.common.internal.encoder;provide:=true Private-Package: \ com.ibm.ws.kernel.server.internal, \ @@ -33,6 +34,7 @@ instrument.classesExcludes: com/ibm/ws/kernel/service/utils/resources/*.class com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0;version=latest,\ + com.ibm.ws.common.encoder;version=latest,\ com.ibm.ws.kernel.boot.core;version=latest,\ com.ibm.ws.kernel.security.thread;version=latest,\ com.ibm.ws.logging.core;version=latest, \ diff --git a/dev/com.ibm.ws.kernel.service/build-spi.xml b/dev/com.ibm.ws.kernel.service/build-spi.xml index 0fa2fa67e1a3..45c059be5bdf 100755 --- a/dev/com.ibm.ws.kernel.service/build-spi.xml +++ b/dev/com.ibm.ws.kernel.service/build-spi.xml @@ -30,7 +30,7 @@ org.osgi.util.tracker"/> - + - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.kernel.service_bvt/.classpath.gradle b/dev/com.ibm.ws.kernel.service_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.kernel.service_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.service_bvt/.project b/dev/com.ibm.ws.kernel.service_bvt/.project index fabbb595546d..e5a4845a70aa 100755 --- a/dev/com.ibm.ws.kernel.service_bvt/.project +++ b/dev/com.ibm.ws.kernel.service_bvt/.project @@ -11,13 +11,13 @@ - com.ibm.ws.rasplugin.RASValidationBuilder + bndtools.core.bndbuilder org.eclipse.jdt.core.javanature - com.ibm.ws.rasplugin.RASValidationNature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.kernel.service_bvt/bnd.bnd b/dev/com.ibm.ws.kernel.service_bvt/bnd.bnd new file mode 100755 index 000000000000..b69e4abb7eb4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.service_bvt/bnd.bnd @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +instrument.disabled: true + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.kernel.service;version=latest diff --git a/dev/com.ibm.ws.kernel.service_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.service_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..b69e4abb7eb4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.service_bvt/bnd.bnd.gradle @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +instrument.disabled: true + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.kernel.service;version=latest diff --git a/dev/com.ibm.ws.kernel.service_bvt/build.gradle b/dev/com.ibm.ws.kernel.service_bvt/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.kernel.service_test/.classpath b/dev/com.ibm.ws.kernel.service_test/.classpath index 5da791b66736..bd880329225d 100644 --- a/dev/com.ibm.ws.kernel.service_test/.classpath +++ b/dev/com.ibm.ws.kernel.service_test/.classpath @@ -1,13 +1,7 @@ - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.kernel.service_test/.classpath.gradle b/dev/com.ibm.ws.kernel.service_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.kernel.service_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.service_test/.project b/dev/com.ibm.ws.kernel.service_test/.project index f8eef779d2ac..64dd1a0f86cb 100755 --- a/dev/com.ibm.ws.kernel.service_test/.project +++ b/dev/com.ibm.ws.kernel.service_test/.project @@ -11,13 +11,13 @@ - com.ibm.ws.rasplugin.RASValidationBuilder + bndtools.core.bndbuilder org.eclipse.jdt.core.javanature - com.ibm.ws.rasplugin.RASValidationNature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.kernel.service_test/bnd.bnd b/dev/com.ibm.ws.kernel.service_test/bnd.bnd new file mode 100755 index 000000000000..32ebc90af562 --- /dev/null +++ b/dev/com.ibm.ws.kernel.service_test/bnd.bnd @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/jmockit/1.25/jmockit.jar;version=file, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.kernel.service;version=latest diff --git a/dev/com.ibm.ws.kernel.service_test/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.service_test/bnd.bnd.gradle new file mode 100755 index 000000000000..32ebc90af562 --- /dev/null +++ b/dev/com.ibm.ws.kernel.service_test/bnd.bnd.gradle @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/jmockit/1.25/jmockit.jar;version=file, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.kernel.service;version=latest diff --git a/dev/com.ibm.ws.kernel.service_test/build.gradle b/dev/com.ibm.ws.kernel.service_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.logging.hpel/bnd.bnd b/dev/com.ibm.ws.logging.hpel/bnd.bnd index 2737bc2e79aa..6836a6086e98 100755 --- a/dev/com.ibm.ws.logging.hpel/bnd.bnd +++ b/dev/com.ibm.ws.logging.hpel/bnd.bnd @@ -13,6 +13,8 @@ Export-Package: \ com.ibm.websphere.logging.hpel.writer.*;provide:=true, \ com.ibm.ws.logging.hpel.config.* +Import-Package: !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * + Private-Package: \ com.ibm.ejs.ras.hpel.*, \ !com.ibm.ws.logging.hpel.osgi.*, \ diff --git a/dev/com.ibm.ws.logging.hpel_bvt/.classpath b/dev/com.ibm.ws.logging.hpel_bvt/.classpath index 3d45b34aaebd..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.logging.hpel_bvt/.classpath +++ b/dev/com.ibm.ws.logging.hpel_bvt/.classpath @@ -1,12 +1,7 @@ - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.logging.hpel_bvt/.classpath.gradle b/dev/com.ibm.ws.logging.hpel_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_bvt/.project b/dev/com.ibm.ws.logging.hpel_bvt/.project index 794bf8cc865c..abac512dc45f 100755 --- a/dev/com.ibm.ws.logging.hpel_bvt/.project +++ b/dev/com.ibm.ws.logging.hpel_bvt/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.logging.hpel_bvt/bnd.bnd b/dev/com.ibm.ws.logging.hpel_bvt/bnd.bnd new file mode 100755 index 000000000000..4e10d9df49a2 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_bvt/bnd.bnd @@ -0,0 +1,17 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest, \ + com.ibm.ws.logging.hpel;version=latest diff --git a/dev/com.ibm.ws.logging.hpel_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.logging.hpel_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..4e10d9df49a2 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_bvt/bnd.bnd.gradle @@ -0,0 +1,17 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest, \ + com.ibm.ws.logging.hpel;version=latest diff --git a/dev/com.ibm.ws.logging.hpel_bvt/build.gradle b/dev/com.ibm.ws.logging.hpel_bvt/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.logging.hpel_fat/.classpath b/dev/com.ibm.ws.logging.hpel_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/.classpath.gradle b/dev/com.ibm.ws.logging.hpel_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/.gitignore b/dev/com.ibm.ws.logging.hpel_fat/.gitignore new file mode 100644 index 000000000000..27e131e35a6b --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.logging.hpel_fat/.project b/dev/com.ibm.ws.logging.hpel_fat/.project new file mode 100755 index 000000000000..ff567ad067ef --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.logging.hpel_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c92277a371a9 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd b/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd new file mode 100644 index 000000000000..fd6aab88c9db --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/httpunit/1.7/lib/httpunit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + lib/fat.harness.jar;version=file, \ + lib/phased.junit.jar;version=file, \ + com.ibm.ws.logging.hpel;version=latest diff --git a/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd.gradle b/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..fd6aab88c9db --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd.gradle @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/httpunit/1.7/lib/httpunit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + lib/fat.harness.jar;version=file, \ + lib/phased.junit.jar;version=file, \ + com.ibm.ws.logging.hpel;version=latest diff --git a/dev/com.ibm.ws.logging.hpel_fat/build-test.xml b/dev/com.ibm.ws.logging.hpel_fat/build-test.xml new file mode 100755 index 000000000000..600e17237a66 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/build-test.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/build.gradle b/dev/com.ibm.ws.logging.hpel_fat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.logging.hpel_fat/delivery.sets b/dev/com.ibm.ws.logging.hpel_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/setup/HpelSetup.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/setup/HpelSetup.java new file mode 100755 index 000000000000..7972cd831c0e --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/setup/HpelSetup.java @@ -0,0 +1,281 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * -------------------------------------------------------------------------------- + * F000896.23216 8.0 06/11/2010 shighbar Add in removal of excess servers in topology to conserve resources & keep more legacy log history for legacy test cases PD. + * 681388 8.0 12/07/2010 shighbar Override startup of server resources to correct issues seen in z/OS and make bucket efficient. + */ +package com.ibm.ws.fat.hpel.setup; + +import java.util.List; +import java.util.Vector; + +import junit.framework.Test; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Cell; +import com.ibm.websphere.simplicity.Node; +import com.ibm.websphere.simplicity.Server; +import com.ibm.websphere.simplicity.Topology; +import com.ibm.websphere.simplicity.WebSphereVersion; +import com.ibm.ws.fat.ExpensiveTestSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; +import com.ibm.ws.fat.util.CommonActions; + +/** + * Setups key resources for HPEL test cases. + * + * @author Scott Highbarger + * + */ +public class HpelSetup extends ExpensiveTestSetup { + + /** + * The name of the server configured by this fixture + */ + public static final String SERVER_NAME = "HpelServer"; + public static final String SERVER2_NAME = "HpelServer2"; + + /** + * The name of the application configured by this fixture + */ + public static final String APP_NAME = "HpelFat"; + + /** + * The name of the EAR file for the application. + */ + public static final String EAR_NAME = "HpelFatEAR.ear"; + + /** + * Required for compatibility with JUnit/Phased JUnit/command-line invocation of TestSetup. + * + * @param test + * The Test or TestSuite to enclose with this test fixture + */ + public HpelSetup(Test test) { + super(test); + } + + /** + * The amount of nodes the the cell must have for this test bucket to execute. + * + */ + @Override + public int requiredNodesPerCell() { + return 1; + } + + /** + * Provides the amount of time that the harness waits before starting tests. The harness will wait this long to allow the environment to settle. + * + */ + @Override + public long getStartUpWaitTime() { + return TWENTY_SECONDS; + } + + /** + * Setup resources which the test bucket requires, including the creation of application servers and installation of test applications. + * + */ + @Override + public void setUpResources() throws Exception { + // Simplicity in Liberty at the moment sets up just one server located in publish/servers + Topology.init(); + +// // initialize common variables +// WsadminLib wsadminlib = new WsadminLib(getCellUnderTest()); +// +// ApplicationServer server = CommonActions.removeAndCreateApplicationServer(wsadminlib, getNodeUnderTest(), SERVER_NAME); +// SimpleApplication hpelApp = new SimpleApplication(); +// hpelApp.setName(APP_NAME); +// hpelApp.setEar(new File(Props.getProperty(Props.DIR_BUILD_EARS), EAR_NAME)); +// hpelApp.install(server); +// +// //Some test cases will require two servers. +// ApplicationServer server2 = CommonActions.removeAndCreateApplicationServer(wsadminlib, getNodeUnderTest(), SERVER2_NAME); +// SimpleApplication hpelApp2 = new SimpleApplication(); +// hpelApp2.setName(APP_NAME + "2"); +// hpelApp2.setEar(new File(Props.getProperty(Props.DIR_BUILD_EARS), EAR_NAME)); +// hpelApp2.install(server2); +// +// // Remove other servers in topology to conserve resources. +// Set keepServers = new HashSet(); +// keepServers.add(server); +// keepServers.add(server2); +// CommonTasks.removeUnusedServers(getCellUnderTest(), keepServers); +// +// //Expand the number of historical logs to keep for legacy server side tests. +// wsadminlib.setServerSysout(server.getNodeName(), server.getName(), 5, 25); +// +// // save and synchronize changes +// wsadminlib.save(); + } + + /** + * Intended to return a list of all the servers which are being tested. At this time this method will only return a + * single server, and it equivalent to calling the getServerUnderTest() method. + * + */ + @Override + public List getServersUnderTest() throws Exception { + Vector myServers = new Vector(0, 1); + myServers.addElement(getServerUnderTest()); + Server secondServer = getServer2UnderTest(); + if (secondServer != null) { + myServers.addElement(secondServer); // the 2nd server configured by setUpResources + } + return myServers; + } + + /** + * Clean up resources created by the test bucket. + * + */ + @Override + public void tearDownResources() throws Exception { + super.tearDownResources(); + // WsadminLib wsadminlib = new WsadminLib(getCellUnderTest()); + // CommonActions.deleteServer(wsadminlib, getNodeUnderTest(), SERVER_NAME); + // wsadminlib.save(); + } + + /** + * Override the default requiredWebSphereVersion as HPEL currently requires and is only supported on WAS version 8. + * + */ + @Override + public WebSphereVersion requiredWebSphereVersion() { + return new WebSphereVersion("8.0"); + } + + /** + * Retrieve a reference to the Cell configured by this test fixture. + * + * @return a reference to the Cell chosen for configuration of this test fixture + * @throws Exception + * if a Simplicity error occurs + */ + public static Cell getCellUnderTest() throws Exception { + return Topology.getCells().get(0); // first cell in bootstrapping.properties + } + + /** + * Retrieve a reference to the Node configured by this test fixture. + * + * @return a reference to the Node chosen for configuration of this test fixture + * @throws Exception + * if a Simplicity error occurs + */ + public static Node getNodeUnderTest() throws Exception { + Cell cell = getCellUnderTest(); + return CommonActions.getSortedDefaultNodes(cell).get(0); // first Node by alphabetized name + } + + /** + * Retrieve a reference to the ApplicationServer configured by this test fixture. + * + * @return a reference to the server named SERVER_NAME + * @throws Exception + * if a Simplicity error occurs + */ + public static ApplicationServer getServerUnderTest() throws Exception { + Node node = getNodeUnderTest(); + Server server = node.getServerByName(SERVER_NAME); + return server == null ? null : new HPELApplicationServer(server); // the server configured by setUpResources + } + + /** + * Retrieve a reference to the ApplicationServer configured by this test fixture. + * + * @return a reference to the server named SERVER_NAME + * @throws Exception + * if a Simplicity error occurs + */ + public static ApplicationServer getServer2UnderTest() throws Exception { + Node node = getNodeUnderTest(); + Server server = node.getServerByName(SERVER2_NAME); + return server == null ? null : new HPELApplicationServer(server); // the 2nd server configured by setUpResources + } + + @Override + public boolean skipTest() { + /* + * May want to look into using this method, or calling super.skipTest() and overriding some of these methods: + * requiredCells() requiredNodesPerCells() requiredWebSphereVersion() requiredWebSphereEdition() + * requiredOperatingSystems() + * + * etc. so that certain tests are only ran on z/OS or certain levels etc. as needed. + */ + // There's not MixedCell topologies in Liberty yet. + return false; + +// // HpelSetup is not able to work on MixedCell topologies at this time. +// CommonTasks.writeLogMsg(Level.INFO, "Checking if we should skip HpelSetup or not."); +// try { +// return MixedCellTopologyHelper.isTopologyMixed(); +// } catch (Exception e) { +// e.printStackTrace(); +// return true; // Don't execute if we can't tell what topology we are on. +// } + } + + /** + * Ensures that all the resources needed by your test fixture are running. + * This step typically involves starting a series of servers, so the + * "getServersUnderTest" method aims to accommodate this step. By default, + * the startResources method calls getServersUnderTest to find a list of + * servers, and then it starts that list of servers. + * + * @throws Exception If a anything goes wrong + */ + @Override + public void startResources() throws Exception { + // We don't want to start resources, they will need to be bounced in legacy setup anyways. + // Also see issues trying to start both back to back using standard harness framework methods on slower z/OS + // systems. + } + + /** + * Version of HPELApplicationServer which copies log records into logs/messages.log file to + * be recognized as a started server. + */ + private static class HPELApplicationServer extends ApplicationServer { + + protected HPELApplicationServer(Server delegate) throws Exception { + super(delegate.getBackend(), delegate.getNode()); + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.ApplicationServer#start() + */ + @Override + public void start() throws Exception { + // If HPEL is enabled we need start a thread copying log messages from repository into messages.log + if (CommonTasks.isHpelEnabled(this)) { + //88513 - Reading HPEL logs (HpelSetup.TextCopyThread code) get intermixed with the thread deleting 'logs' directory + //before starting the server (LibertyServer.preStartServerLogsTidy() code executed when we call super.start() in HpelSetup.start() method). + //To avoid such problem its better to delete 'logs' directory ourself in HpelSetup.start() method before starting our reading thread. + //This way LibertyServer.preStartServerLogsTidy() will notice that 'logs' directory is gone already and won't do anything at all. + getBackend().deleteFileFromLibertyServerRoot("logs"); + } + super.start(); + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.ApplicationServer#start(int) + */ + @Override + public void start(int mbeanWaitDuration) throws Exception { + this.start(); + } + + } + +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/suites/FATSuite.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/suites/FATSuite.java new file mode 100755 index 000000000000..6949534ad293 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/suites/FATSuite.java @@ -0,0 +1,105 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------------------------------- + * F017049-21927 8.0 01/28/2010 shighbar Add testcase for trace to memory buffer by wsadmin + * 635940 8.0 01/25/2010 spaungam Add testcase for testing *=all + * F017049-19395 8.0 07/21/2010 shighbar Add remote reader test on HPEL mBean via JMX. + * F017049-33795 8.0 11/02/2010 shighbar Add SSFAT test HpelClassificationOnlyTraceSSFAT. + * F004749-35525 8.0 12/07/2010 shighbar Add SSFAT test HpelRawTraceListSSFAT. + * 682506 8.0 12/15/2010 shighbar Add RAS Raw Trace Filter test cases. + * 688984 8.0 02/10/2011 shighbar Add HpelMBeanOp tests. + * F017049-41948 8.0 03/30/2011 shighbar Add VerifyServiceLogConfig test case. + * 699970 8.0 04/05/2011 shighbar Add HpelInternalTrace test case. + * 711532 8.0 07/21/2011 shighbar Remove StartServerWithVerboseLogging from DR suite. + * 703214 8.0 07/22/2011 shighbar Add Internal trace guard RawTraceSpecVerifier / MBeanOpTest test. + * 714823 8.0 08/29/2011 shighbar Reorder to avoid logViewer monitor hang from impacting follow on tests. + * 702533 8.0 09/03/2011 olteamh Add HpelDeleteEmptyDirectories test case. + * PM48157 8.0 10/03/2011 shighbar HPEL TextLog retention policy does not remove previous server instances logs. + * F1344-49496 8.0 10/29/2011 belyi Add TestLogRecordContextSSFAT test + * F1344-56880 8.5 01/14/2012 belyi Add VerifyJmxLogNotification test + * 95518 8.5.5 03/07/2012 dbourne remove text log tests + */ +package com.ibm.ws.fat.hpel.suites; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.hpel.tests.BinaryLogExec; +import com.ibm.ws.fat.hpel.tests.BinaryLogRecordContextTest; +import com.ibm.ws.fat.hpel.tests.ConcurrentLoggingAccuracyTest; +import com.ibm.ws.fat.hpel.tests.HpelDeleteEmptyDirectories; +import com.ibm.ws.fat.hpel.tests.TraceSpecificationSetToAllTest; +import com.ibm.ws.fat.hpel.tests.VerifyRepositoryAccuracy; + +/** + * Packages all our HPEL FAT tests + */ +public class FATSuite { + + /** + * Builds a TestSuite of HPEL Functional Acceptance tests + * + * @return a JUnit TestSuite + */ + public static Test suite() { + TestSuite suite = new TestSuite("Hpel FAT suite"); + +/* + * The RasServerSideUnitTestSuite is not really related to HPEL at all, but had to be included here in the HPEL + * suite instead of being called directly by the Full Regression because it makes use of FAT resources such as + * HpelSetup.getServerUnderTest(). Until we refactor the setup of the servers etc. out of HpelSetup and into + * RASSetup etc. It must be called from here. + */ + // server side ras legacy test suite +// suite.addTest(RasServerSideUnitTestSuite.suite()); +// +// // ========== RAS FAT test cases ======== +// suite.addTestSuite(com.ibm.ws.fat.ras.tests.AttributeSetTestingByWsadmin.class); +// suite.addTestSuite(com.ibm.ws.fat.ras.tests.TraceServiceTestingByWsAdmin.class); +// suite.addTestSuite(MBeanOpTest.class); +// suite.addTestSuite(VerifyServiceLogConfig.class); +// +// // ========== FAT test cases ============ +// suite.addTestSuite(EnableHPELByWsadmin.class); + suite.addTestSuite(BinaryLogRecordContextTest.class); + suite.addTestSuite(VerifyRepositoryAccuracy.class); + suite.addTestSuite(BinaryLogExec.class); +// suite.addTestSuite(EnableTextLogByWsadmin.class); +// suite.addTestSuite(EnableRuntimeTraceSpecByWsadmin.class); +// suite.addTestSuite(ChangeRepositoryDirectoryByWsAdmin.class); + suite.addTestSuite(ConcurrentLoggingAccuracyTest.class); +// suite.addTestSuite(LogViewerFormatValidation.class); +// suite.addTestSuite(MergedRepositories.class); +// suite.addTestSuite(com.ibm.ws.fat.hpel.tests.AttributeSetTestingByWsadmin.class); +// suite.addTestSuite(ControlTraceMemoryByWsadmin.class); +// suite.addTestSuite(DisableHPELByWsadmin.class); +// suite.addTestSuite(HpelRemoteReaderMBeanByJMX.class); +// suite.addTestSuite(VerifyJmxLogNotification.class); +// suite.addTestSuite(TestOwnershipVerification.class); +// suite.addTestSuite(RawTraceSpecVerifier.class); + suite.addTestSuite(HpelDeleteEmptyDirectories.class); +// suite.addTestSuite(HpelTextLogRetention.class); +// +// // =========== FAT Server Side test cases ========== +// suite.addTestSuite(HpelMBeanOpSSFAT.class); +// suite.addTestSuite(HpelLogEventNotificationsSSFAT.class); +// suite.addTestSuite(HpelMemoryBufferSSFAT.class); +// suite.addTestSuite(HpelReadWriteSSFAT.class); +// suite.addTestSuite(HpelClassificationOnlyTraceSSFAT.class); +// suite.addTestSuite(HpelRetentionSSFAT.class); +// suite.addTestSuite(HpelLogManResetSSFAT.class); +// suite.addTestSuite(HpelRawTraceListSSFAT.class); +// suite.addTestSuite(HpelInternalTraceSSFAT.class); +// suite.addTestSuite(TestLogRecordContextSSFAT.class); +// suite.addTestSuite(LogViewerSSFAT.class); + suite.addTestSuite(TraceSpecificationSetToAllTest.class); +// removing temporarily for defect 158844 suite.addTestSuite(HpelPurgeMaxSizeIgnoreTest_2.class); +// removing temporarily for defect 158844 suite.addTestSuite(HpelPurgeMaxSizeIgnoreTest_1.class); + + return new HpelSetup(suite); + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogExec.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogExec.java new file mode 100755 index 000000000000..9b53db127cd9 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogExec.java @@ -0,0 +1,496 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * + * IBM Confidential OCO Source Material + * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 2002 + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 95263 8.5.5 06/13/2013 sumam Fixed the test case for binaryLog utility command + * + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Random; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Node; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; +import com.ibm.ws.logging.hpel.FormatSet; + +public class BinaryLogExec extends VerboseTestCase { + + private static final Logger thisLogger = Logger.getLogger(BinaryLogExec.class.getName()); + private final String outFileName = this.getName() + "_" + new Date().getTime() + ".lv_out.log"; + RemoteFile rOutLog = null; + RemoteFile rProfRootDir = null; + RemoteFile rProfBinFile = null; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public BinaryLogExec(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.restart(); + this.logStepCompleted(); + } + + // Liberty profile root is the install root. + rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getServerUnderTest().getBackend().getInstallRoot()); +// rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getNodeUnderTest().getProfileDir()); + rProfBinFile = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), rProfRootDir, "bin"); + // Setting the bootstrap with trace specification to get the trace logs. + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.logging.trace.specification", "*=fine=enabled"); + appServ.stop(); + appServ.start(); + + } + + /** + * Tests that binaryLog correctly report an invalid option when one is passed to it. e.g. binaryLog -invalidAction + * + * @throws Exception + */ + public void testbinaryLogInvalidOption() throws Exception { + this.logStep("executing binaryLog on " + HpelSetup.getNodeUnderTest().getProfileName()); + // generate a random option that is between 3 and 15 characters long starting with "bad". + String alphabet = "abcdefghijklmnopqrstuvwxyz"; + StringBuffer invalidOption = new StringBuffer(); + invalidOption.append("-bad"); // need the option flag first. + Random rnd = new Random(); + for (int i = 1; i <= rnd.nextInt(12); i++) { + invalidOption.append(alphabet.charAt(rnd.nextInt(alphabet.length()))); + } + + StringBuffer expectedResponse = new StringBuffer(); + // (WI 234118) We cannot check for message text that gets translated, because it causes the test to fail in non-English locales. + // Updating this match to only use the non-translated words and argument in the message text. + // expectedResponse.append("The specified action "); + // expectedResponse.append(invalidOption); + // expectedResponse.append(" is not valid."); + // expectedResponse.append("\\s+"); //match as a regular expression + // expectedResponse.append("For usage information use binaryLog help."); + expectedResponse.append(".*" + invalidOption + ".*\\s+"); + expectedResponse.append(".*binaryLog help.*"); + ProgramOutput lvPrgmOut = exeBinaryLog(new String[] { invalidOption.toString() }); + this.logVerificationPoint("Verifying binaryLog std out/err and status return code."); + logMsg(" === BinaryLog's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLogs's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + + assertTrue("Failed assertion that logViewer exited with an error return code", (lvPrgmOut.getReturnCode() != 0)); + assertTrue("Failed assertion that logViewer reported invalid option. Where //s is any number of spaces, expected=" + + expectedResponse.toString().trim() + ". result=" + lvPrgmOut.getStdout().trim(), + Pattern.matches(expectedResponse.toString(), lvPrgmOut.getStdout().trim())); + + this.logVerificationPassed(); + this.logStepCompleted(); + } + + /** + * Tests that binaryLog copy action works as expected. + * Steps: + * 1. Create log entries and than use copy action to move the logs file to new location with minDate and maxDate specified. + * 2. view the log entries again with minDate and maxDate specified + * 3. Both isoDateFormat and the default dateFormat are tested for minDate and maxDate + * + * @throws Exception + */ + public void testbinaryLogCopyExecutes() throws Exception { + // need to have messages for the binaryLog to process. + long entry1Time = System.currentTimeMillis(); + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), BinaryLogExec.class.getName(), "Some Msg goes here", null, 50, CommonTasks.LOGS, -1); + long entry2Time = System.currentTimeMillis(); + + Date minDate = new Date(entry1Time); + Date maxDate = new Date(entry2Time); + + DateFormat formatterISO = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); + DateFormat formatterDefault = FormatSet.customizeDateFormat(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM)); + + Node node = HpelSetup.getNodeUnderTest(); + rOutLog = new RemoteFile(node.getMachine(), node.getMachine().getTempDir(), outFileName); + + this.logStep("executing binaryLog on " + node.getProfileName()); + + String arg1 = "copy"; + String arg2 = rOutLog.getAbsolutePath(); + String arg3 = "--minDate=" + formatterDefault.format(minDate); + String arg4 = "--maxDate=" + formatterISO.format(maxDate); + + ProgramOutput lvPrgmOut; + + lvPrgmOut = exeBinaryLog(new String[] { arg1, CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath(), arg2, arg3, arg4 }); + this.logVerificationPoint("Verifying binaryLog std out/err and status return code."); + logMsg(" === BinaryLog's stdout: === return code is : " + lvPrgmOut.getReturnCode()); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLog's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); // Test that output returns Success Code (0) + assertTrue("Failed assertion that binaryLog did produce an output file", rOutLog.exists()); // Test output repository exists + + ProgramOutput lvPrgmOut2 = exeBinaryLog(new String[] { "view", arg2, arg3, arg4 }); + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut2.getReturnCode() == 0)); + assertTrue("Failed assertion that binaryLog did produce an output file", lvPrgmOut2.getStdout().contains("Some Msg goes here")); + this.logVerificationPassed(); + this.logStepCompleted(); + + } + + /** + * Tests that binaryLog view action works as expected. + * Steps: + * 1. Create log entries and than use view action to view the contents of log in text format. + * 2. View the log entries again using --isoDateFormat option + * + * @throws Exception + */ + public void testbinaryLogViewExecutes() throws Exception { + // need to have messages for the binaryLog to process. + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), BinaryLogExec.class.getName(), "Some Msg goes here", null, 25, CommonTasks.LOGS, -1); + + Node node = HpelSetup.getNodeUnderTest(); + rOutLog = new RemoteFile(node.getMachine(), node.getMachine().getTempDir(), outFileName); + + this.logStep("executing binaryLog on " + node.getProfileName()); + + String arg1 = "view"; + String arg2 = "--isoDateFormat"; + + ProgramOutput lvPrgmOut; + + lvPrgmOut = exeBinaryLog(new String[] { arg1, CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() + "/logdata" }); + + this.logVerificationPoint("Verifying binaryLog std out/err and status return code."); + logMsg(" === BinaryLog's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLog's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + + Pattern p1 = Pattern.compile("\\d{1,2}/\\d{1,2}/\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}:\\d\\d\\d"); + Matcher m1 = p1.matcher(lvPrgmOut.getStdout()); + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); + assertTrue("Failed assertion that binaryLog did produce an output file", lvPrgmOut.getStdout().contains("Some Msg goes here")); + assertTrue("Failed assertion that binaryLog displayed default date format", m1.find()); + + lvPrgmOut = exeBinaryLog(new String[] { arg1, CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() + "/logdata", arg2 }); + logMsg(" === BinaryLog's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLog's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + + Pattern p2 = Pattern.compile("\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d\\d\\d"); + Matcher m2 = p2.matcher(lvPrgmOut.getStdout()); + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); + assertTrue("Failed assertion that binaryLog did produce an output file", lvPrgmOut.getStdout().contains("Some Msg goes here")); + assertTrue("Failed assertion that binaryLog displayed default date format", m2.find()); + this.logVerificationPassed(); + this.logStepCompleted(); + + } + + /** + * Tests that binaryLog view action works as expected. + * Steps: + * 1.Create log entries and then use listInstances action to view instances of the binary logs. + * 2.use listInstances again with --isoDateFormat option + * + * @throws Exception + */ + public void testbinaryLogListInstancesExecutes() throws Exception { + // need to have messages for the binaryLog to process. + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), BinaryLogExec.class.getName(), "Some Msg goes here", null, 25, CommonTasks.LOGS, -1); + + Node node = HpelSetup.getNodeUnderTest(); + rOutLog = new RemoteFile(node.getMachine(), node.getMachine().getTempDir(), outFileName); + + this.logStep("executing binaryLog on " + node.getProfileName()); + + String arg1 = "listInstances"; + String arg2 = "--isoDateFormat"; + + ProgramOutput lvPrgmOut; + + lvPrgmOut = exeBinaryLog(new String[] { arg1, CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() + "/logdata" }); + + this.logVerificationPoint("Verifying binaryLog std out/err and status return code."); + logMsg(" === BinaryLog's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLog's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + + Pattern p1 = Pattern.compile("\\d{1,2}/\\d{1,2}/\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}:\\d\\d\\d"); + Matcher m1 = p1.matcher(lvPrgmOut.getStdout()); + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); + // (WI 234118) We cannot perform this check because "Instance ID" is translated, which causes the test to fail in non-English locales. There is no ID or + // non-translated portion of the message to even try to match. + // assertTrue("Failed assertion that binaryLog did produce an output file", lvPrgmOut.getStdout().contains("Instance ID ")); + assertTrue("Failed assertion that binaryLog displayed default date format", m1.find()); + + lvPrgmOut = exeBinaryLog(new String[] { arg1, CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() + "/logdata", arg2 }); + logMsg(" === BinaryLog's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLog's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + Pattern p2 = Pattern.compile("\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d\\d\\d"); + Matcher m2 = p2.matcher(lvPrgmOut.getStdout()); + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); + // (WI 234118) We cannot perform this check because "Instance ID" is translated, which causes the test to fail in non-English locales. There is no ID or + // non-translated portion of the message to even try to match. + // assertTrue("Failed assertion that binaryLog did produce an output file", lvPrgmOut.getStdout().contains("Instance ID ")); + assertTrue("Failed assertion that binaryLog displayed default date format", m2.find()); + this.logVerificationPassed(); + this.logStepCompleted(); + + } + + /** + * Testing the listInstances action of BinaryLog command. Also testing --includeInstance Filter option of View. + * + * @throws Exception + */ + public void testHeaderProcessName() throws Exception { + this.logStep("get instance list from " + HpelSetup.getNodeUnderTest().getProfileName()); + + ProgramOutput lvPrgmOut = exeBinaryLog(new String[] { "listInstances", CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() }); + String out = lvPrgmOut.getStdout(); + + // (WI 234118) We cannot rely on matching "Instance ID" as the header because that message is translated when running in non-English locales, causing this + // test to fail. Instead, match the lines starting with a number assuming those are the instance IDs. + // Collect IDs belonging to the current instance run. + int indx; + String controllerID = null; + ArrayList ids = new ArrayList(); + for (String outLine : out.split("\\r?\\n")) { + Pattern p = Pattern.compile("^\\s*(\\d+(?:/\\S+)?)\\s"); + Matcher m = p.matcher(outLine); + if (m.find()) { + String newID = m.group(1); + logMsg("Processing instance id " + newID); + indx = newID.indexOf('/'); + String newControllerID = indx < 0 ? newID : newID.substring(0, indx); + logMsg("It belongs to controller " + newControllerID); + if (controllerID == null || !controllerID.equals(newControllerID)) { + // It's a new controller's instance, reset the list of IDs. + logMsg("It's a new controller, reset list of instances"); + ids.clear(); + controllerID = newControllerID; + } + ids.add(newID); + } + } + + assertFalse("No instance IDs found", ids.isEmpty()); + this.logStepCompleted(); + + this.logStep("Verify procName and procId for each retrieved instance"); + + boolean isZOS = HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS); + boolean hasController = false; + boolean hasServant = false; + ApplicationServer server = HpelSetup.getServerUnderTest(); + for (String id : ids) { + this.logVerificationPoint("Verifying instance " + id); + + // c:\sumam\Liberty\workspace3\build.image\wlp\bin>binaryLog view server1 --includeInstance=latest + + lvPrgmOut = exeBinaryLog(new String[] { "view", CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath(), "--includeInstance=" + id }); + + out = lvPrgmOut.getStdout(); + this.logMsg("id ouptut : " + out); + // Should be okay matching the English text here because this is not a translated message. + int indx1 = out.indexOf(" running with process name "); + int indx2 = out.indexOf(" and process id ", indx1); + assertTrue("Instance with ID " + id + " does not have proper header", indx1 > 0 && indx2 > indx1); + String procName = out.substring(indx1 + 27, indx2); + String procId = out.substring(indx2 + 16).split("\\s*\\n\\s*", 2)[0]; + String expProcName; + String expProcId; + if (isZOS) { + indx = id.indexOf("/"); + if (indx < 0) { + // This is controller, take name values from Simplicity, can't verify jobID this way though + expProcName = server.getShortName(); + hasController = true; + } else { + // This is servant, take values from instance ID. + indx1 = id.indexOf("-", indx); + indx2 = id.indexOf("_", indx1); + assertTrue("Instance ID " + id + " is incorrectly formatted", indx1 > indx && indx2 > indx1); + expProcName = id.substring(indx1 + 1, indx2); + expProcId = id.substring(indx2 + 1); + hasServant = true; + assertEquals("Process ID is incorrect", expProcId, procId); + } + } else { + // On Liberty procName is just the server name. + expProcName = server.getBackend().getServerName(); +// expProcName = server.getCellName() + "\\" + server.getNodeName() + "\\" + server.getName(); + // Don't verify process Id since it is not available in Liberty FAT +// expProcId = server.getProcessIdString(); +// assertEquals("Process ID is incorrect", expProcId, procId); + } + assertEquals("Process Name is incorrect", expProcName, procName); + + this.logVerificationPassed(); + } + + this.logVerificationPoint("Verifying completeness of the test"); + if (isZOS) { + if (!hasController && !hasServant) { + fail("Test on zOS is missing both controller and servant instances"); + } + if (!hasController) { + fail("Test on zOS is missing controller instance"); + } + if (!hasServant) { + fail("Test on zOS is missing at least one servant instance"); + } + } else if (ids.size() == 0) { + fail("Test on distributed has no instances to verify"); + } + this.logVerificationPassed(); + + this.logStepCompleted(); + } + + /** + * A method to drive the execution of the binaryLog tool on the remote machine/server that is being tested. + * + * @throws Exception + */ + private ProgramOutput exeBinaryLog(String[] cmdLineOptions) throws Exception { + // make platform agnostic to handle .sh and .bat + String exeExt = ""; + final String BINARY_LOG = "binaryLog"; + + //if non-iSeries +// if (!HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ISERIES)){ + if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.WINDOWS)) { + exeExt = ".bat"; +// } else { +// exeExt = ".sh"; + } + + StringBuilder cmd = new StringBuilder(100); + cmd.append(rProfBinFile.getAbsolutePath()).append(HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator()); + cmd.append(BINARY_LOG).append(exeExt).append(" "); + + for (String cmdOption : cmdLineOptions) { + if (!cmdOption.isEmpty()) { + cmd.append("\"" + cmdOption + "\" "); + } + } + + logMsg("executing: " + cmd.toString()); +// logMsg("executing: " + rProfBinFile.getAbsolutePath() + HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator() + cmd.toString()); +// return HpelSetup.getNodeUnderTest().getMachine().execute(LOG_VIEWER + exeExt, cmdLineOptions, rProfBinFile.getAbsolutePath()); + return HpelSetup.getNodeUnderTest().getMachine().execute(cmd.toString(), rProfBinFile.getAbsolutePath()); + +// } +// //iSeries LogViewer needs to be executed in the shell qsh +// else{ +// return HpelSetup.getNodeUnderTest().getMachine().executeQSH(LOG_VIEWER, cmdLineOptions, rProfBinFile.getAbsolutePath(), null); +// } + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + + /** + * Determine if we should or should not execute this test. Returns true if the test should NOT be ran. + **/ + @Override + public boolean skipTest() { + // Test does not do any good on z/OS since TextLog is for Controller only - so we can't generate logs to fill up + // TextLog repository. This may need to be revisited if we implement TextLog for servant. + try { + return HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS); + } catch (Exception e) { + CommonTasks.writeLogMsg(Level.SEVERE, "Unable to determine if we are on z/OS or not. Not skipping test"); + e.printStackTrace(System.err); + } + return false; + } + + /** + * A simple method used to log messages from this test case to the test case's logs + */ + public void logMsg(String msg) { + if (thisLogger.isLoggable(Level.INFO)) { + thisLogger.info(msg); + } + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogRecordContextTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogRecordContextTest.java new file mode 100755 index 000000000000..537709500964 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogRecordContextTest.java @@ -0,0 +1,151 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.ProtocolException; +import java.net.URL; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * + */ +public class BinaryLogRecordContextTest extends VerboseTestCase { + private ApplicationServer appServ = null; + RemoteFile rProfRootDir = null; + RemoteFile rProfBinFile = null; + String localLogsRepositoryPath = null; + String extension1 = "userName=[hpel]"; + String extension2 = "productId=[liberty]"; + + /** + * @param name + */ + public BinaryLogRecordContextTest(String name) { + super(name); + // TODO Auto-generated constructor stub + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.restart(); + this.logStepCompleted(); + } + + // Liberty profile root is the install root. + rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getServerUnderTest().getBackend().getInstallRoot()); +// rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getNodeUnderTest().getProfileDir()); + rProfBinFile = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), rProfRootDir, "bin"); + // Setting the bootstrap with trace specification to get the trace logs. + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.test", "*=all=enabled"); + appServ.stop(); + appServ.start(); + + } + + /** + * This method creates a connection to a webpage and then reutrns the connection + * + * @param url The Http Address to connect to + * @return The connection to the http address + */ + private HttpURLConnection getHttpConnection(URL url) throws IOException, ProtocolException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + return con; + } + + public void testBinaryLogRecordExtension() throws Exception { + System.out.println("----------testLogRecordServer starts 2-------------"); + String arg1 = "view"; + + //Access the application + URL url = new URL("http://" + appServ.getBackend().getHostname() + ":" + appServ.getBackend().getHttpDefaultPort() + "/LogFat?userName=hpel&productId=liberty"); + System.out.println("appServ.getBackend().getHttpDefaultPort() :" + appServ.getBackend().getHttpDefaultPort()); + HttpURLConnection con = getHttpConnection(url); + System.out.println("URL :" + url); + System.out.println("Response Code :" + con.getResponseCode()); + Thread.sleep(TWENTY_SECONDS); + ProgramOutput lvPrgmOut = exeBinaryLog(new String[] { arg1, appServ.getBackend().getServerName(), "--format=advanced", "--includeInstance=latest" }); + System.out.println("appServ.getBackend().getServerName() :" + appServ.getBackend().getServerName()); + String out = lvPrgmOut.getStdout(); + System.out.println("Log view server --format=advanced :" + out); + assertTrue("Extensions are added to LogRecordContext", out.contains(extension1) && out.contains(extension2)); + } + + /** + * A method to drive the execution of the binaryLog tool on the remote machine/server that is being tested. + * + * @throws Exception + */ + private ProgramOutput exeBinaryLog(String[] cmdLineOptions) throws Exception { + // make platform agnostic to handle .sh and .bat + String exeExt = ""; + final String BINARY_LOG = "binaryLog"; + + //if non-iSeries +// if (!HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ISERIES)){ + if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.WINDOWS)) { + exeExt = ".bat"; +// } else { +// exeExt = ".sh"; + } + rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getServerUnderTest().getBackend().getInstallRoot()); +// rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getNodeUnderTest().getProfileDir()); + rProfBinFile = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), rProfRootDir, "bin"); + StringBuilder cmd = new StringBuilder(100); + cmd.append(rProfBinFile.getAbsolutePath()).append(HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator()); + cmd.append(BINARY_LOG).append(exeExt).append(" "); + + for (String cmdOption : cmdLineOptions) { + if (!cmdOption.isEmpty()) { + cmd.append("\"" + cmdOption + "\" "); + } + } + + System.out.println("executing: " + cmd.toString()); +// logMsg("executing: " + rProfBinFile.getAbsolutePath() + HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator() + cmd.toString()); +// return HpelSetup.getNodeUnderTest().getMachine().execute(LOG_VIEWER + exeExt, cmdLineOptions, rProfBinFile.getAbsolutePath()); + return HpelSetup.getNodeUnderTest().getMachine().execute(cmd.toString(), rProfBinFile.getAbsolutePath()); + +// } +// //iSeries LogViewer needs to be executed in the shell qsh +// else{ +// return HpelSetup.getNodeUnderTest().getMachine().executeQSH(LOG_VIEWER, cmdLineOptions, rProfBinFile.getAbsolutePath(), null); +// } + } + + @Override + public void tearDown() throws Exception { + super.tearDown(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/ConcurrentLoggingAccuracyTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/ConcurrentLoggingAccuracyTest.java new file mode 100755 index 000000000000..2eec3c51676e --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/ConcurrentLoggingAccuracyTest.java @@ -0,0 +1,277 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * F017049-18796.1 8.0 01/08/2010 spaungam Update test to support subdirectories + * F000896.23216 1.6 06/14/2010 shighbar Update test case for z/OS support. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.util.Date; +import java.util.logging.Level; + +import com.ibm.websphere.logging.hpel.reader.RepositoryLogRecord; +import com.ibm.websphere.logging.hpel.reader.RepositoryReaderImpl; +import com.ibm.websphere.logging.hpel.reader.ServerInstanceLogRecordList; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.Props; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Tests that more than one thread can correctly write to a single repository at the same time. + * + */ +public class ConcurrentLoggingAccuracyTest extends VerboseTestCase { + int loggerCount = 40; + int iterations = 40; + int secondsToSleep = 169; // milliseconds + int totalCount = loggerCount * iterations; + private final String[] loggers = new String[loggerCount]; + String localLogsRepositoryPath = null; + String localTraceRepositoryPath = null; + String uniqueLoggerID_Tag; + String loggerName = "ConAccLogger"; + final String TRACE_SPECIFICATION = "ConAccLogger*=all"; // trace spec needed for this test case. + + public ConcurrentLoggingAccuracyTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(HpelSetup.getServerUnderTest())) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + HpelSetup.getServerUnderTest().getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(HpelSetup.getServerUnderTest(), true); + // if HPEL was not enabled, make sure trace spec is not valid to ensure restart below. + CommonTasks.setHpelTraceSpec(HpelSetup.getServerUnderTest(), null); + this.logStepCompleted(); + } + + /* + * Since we have multiple test methods in this test case, we will only restart if the spec is not already set to + * what we need. This will avoid extra server restarts which adds to the bucket execution time. + */ + this.logStep("Checking the HPEL trace spec for " + this.getName()); + if (!CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest()).equals(TRACE_SPECIFICATION)) { + // The current spec is not what we need for this test - update spec and bounce server to take effect + this.logStep("Updating the hpel trace spec to " + TRACE_SPECIFICATION + " as part of setup for " + this.getName()); + CommonTasks.setHpelTraceSpec(HpelSetup.getServerUnderTest(), TRACE_SPECIFICATION); + + // need to restart the application server now + // Stop Server first. + this.logStep("Bouncing server for new spec to take effect. Stopping application server"); + HpelSetup.getServerUnderTest().stop(); + this.logStepCompleted(); + + Thread.sleep(10000); // stop operation blocks, but want short pause before restarting. + + // Start Server + this.logStep("Restarting the application server"); + HpelSetup.getServerUnderTest().start(); + + this.logStep("Checking the trace spec post app server restart: " + + CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest())); + assertTrue("Failed assertion that HPEL trace specification is set to " + TRACE_SPECIFICATION, TRACE_SPECIFICATION + .equals(CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest()))); + this.logStepCompleted(); + } + } + + private void setupLoggers() { + // setup a new unique identifier for the logger name + Date d = new Date(); + for (int i = 0; i < loggers.length; i++) { + loggers[i] = loggerName + d + "_" + i; + } + } + + /** + * A utility method to get all of the repository logs as well as the trace logs. + */ + private void getLogsFromServer() throws Exception { + RemoteFile remoteLogsDir = CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()); + RemoteFile localLogsResultsDir = new RemoteFile(Machine.getLocalMachine(), Props.getFileProperty(Props.DIR_LOG) + .getCanonicalPath() + + File.separator + ConcurrentLoggingAccuracyTest.class.getSimpleName()); + + // Save off the path of the repository log files directory + localLogsRepositoryPath = localLogsResultsDir.getAbsolutePath(); + + localLogsResultsDir.copyFromSource(remoteLogsDir, true, true); + } + + /** + * Tests that HPEL accurately reports the number of logs records entered. Assumes that HPEL is enabled on the active + * server + */ + public void testConcurrentLoggingAccuracyCheck() throws Exception { + this.logStep("Creating logger name"); + setupLoggers(); + this.logStepCompleted(); + + this.logStep("Creating the log entries"); + createLogEntries(); + this.logStepCompleted(); + + Thread.sleep(10000); // wait to ensure logs are written out. Default flash is 10 secs. + + // Get the logs from the server to check what is in them + this.logStep("Getting the message logs from the server"); + getLogsFromServer(); + this.logStepCompleted(); + + // Go read the repository and see if it has what we are looking for + this.logStep("Use API to read HPEL repository"); + + // Go read the repository and see if it has what we are looking for + RepositoryReaderImpl logRepository = new RepositoryReaderImpl(localLogsRepositoryPath); + ServerInstanceLogRecordList CurrentProcessLogList = logRepository.getLogListForCurrentServerInstance(); + // record list is the list of records we will compare against. Assume it's the currentServerInstance list by + // default. + Iterable recordList = CurrentProcessLogList; + + /* + * Note, if we are on z/OS the CurrentProcessLogList represents only the controller's logs. Our test log entries + * will be written by servant though. Will setup a Merged repository to include all the logs from sub-process + * instances. + */ + //The problem is with how test counts records on zOS. HPEL allows server to have a parent process (controller) with a set of child processes (servants). + //For such servers result for a server instance has none empty result from getChildren() call. The test problem is that it assumes that logs recorded by an application on zOS can be found _only_ in children processes. + //On Liberty that is not the case since even on zOS server consists of a single process processing all the requests. + + //The problem can be solved in two ways. 1. Remove 'if zOS' condition since the test is maintained separately on Liberty. + //2. Adjust test to do merge between parent and children logs for all OSs. Following the first solution here. + + //if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS)) { + //this.logStep("Since this is z/OS - using a MergedRepository representing all the servant and adjunct sub-processes"); + //recordList = new MergedRepository(CurrentProcessLogList.getChildren().values()); + //} + + this.logStep("Counting log records by level"); + int severe = 0; + int warning = 0; + int info = 0; + int fine = 0; + int finer = 0; + int finest = 0; + for (RepositoryLogRecord record : recordList) { + // process a record + if (record.getLoggerName().startsWith((loggerName))) { + switch (record.getLevel().intValue()) { + case 1000: // SEVERE == 1000 + severe++; + break; + case 900: // WARNING == 900 + warning++; + break; + case 800: // INFO == 800 + info++; + break; + case 500: // FINE == 500 + fine++; + break; + case 400: // FINER == 400 + finer++; + break; + case 300: // FINEST == 300 + finest++; + break; + } + } + } + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository log (Level.SEVERE) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.SEVERE {counted:wrote} {" + severe + + ":" + totalCount + "}", severe == totalCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository log (Level.WARNING) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.WARNING {counted:wrote} {" + warning + + ":" + totalCount + "}", warning == totalCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository log (Level.INFO) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.INFO {counted:wrote} {" + info + ":" + + totalCount + "}", info == totalCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository trace count (Level.FINE) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINE {counted:wrote} {" + fine + ":" + + totalCount + "}", fine == totalCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository trace count (Level.FINER) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINER {counted:wrote} {" + finer + + ":" + totalCount + "}", finer == totalCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository trace count (Level.FINEST) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINEST {counted:wrote} {" + finest + + ":" + totalCount + "}", finest == totalCount); + this.logVerificationPassed(); + } + + /** + * Driver method for executing all the LoggerThread instances. This method will not return until all the Loggers + * have completed writing their records. + * + */ + public void createLogEntries() throws Exception { + LoggerThread[] lt = new LoggerThread[loggerCount]; + + for (int i = 0; i < loggers.length; i++) { + lt[i] = new LoggerThread(loggers[i]); + } + + for (int i = 0; i < lt.length; i++) { + lt[i].start(); + } + + // cycle thru all the threads until each one has finished + for (int i = 0; i < lt.length; i++) { + while (lt[i].isAlive()) { + try { + Thread.sleep(500); + } catch (InterruptedException ie) { + // do nothing in this case. + } + } + } + } + + /** + * Thread definition that will be writing to the repository. + * + * @author schleus + * + */ + class LoggerThread extends Thread { + private String loggerName = null; + + public LoggerThread(String name) { + this.loggerName = name; + } + + @Override + public void run() { + try { + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), loggerName, "Hi from logger " + loggerName + " in this thread", Level.ALL, iterations, + CommonTasks.LOGS_TRACE, secondsToSleep); + } catch (Exception e) { + // nothing for now + } + } + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELDataDirFalsePositiveWarningTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELDataDirFalsePositiveWarningTest.java new file mode 100755 index 000000000000..992733943dfb --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELDataDirFalsePositiveWarningTest.java @@ -0,0 +1,129 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 91932 8.5.5 13/06/2013 sumam Test case for defect 91932. + * + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.util.List; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 91932: HPEL gives false positive warning on disk space after changing dataDirectory + * Test Scenario: Start the server by logDirectory as logs → modify it to logX and delete the old directory (logs) , no warning message should be generated. + * + */ + +public class HPELDataDirFalsePositiveWarningTest extends VerboseTestCase { + + private final static String loggerName = HPELDataDirFalsePositiveWarningTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static String MESSAGE_LOG = "logs/console.log"; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HPELDataDirFalsePositiveWarningTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELDeleteLogDirectory_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test that HPEL's logDirectory change does not give any warning message. + * Start the server with logDirectory as "LogX1", during the runtime change the logDirectory to "logX2" and delete the old directory i.e. logX1, + * No warning message should be created for deleting the old unused directory + * + **/ + public void testLogDirectoryChange() throws Exception { + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELDeleteLogDirectory_2.xml")); + this.logStepCompleted(); + + // Deleting the old directory and checking for the warning message. + + this.logStep(" Deleting the logs directory to check the warning message"); + appServ.getBackend().deleteFileFromLibertyServerRoot("logX1"); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying no warning message generated for old log directory deleted ."); + logger.info("The console.log should not have a error message HPEL0161W "); + checkWarningMessageForDirectoryDelete(); + this.logVerificationPassed(); + + } + + //Check we dont have any warning message for old directory deleted. + protected void checkWarningMessageForDirectoryDelete() throws Exception { + List lines = appServ.getBackend().findStringsInFileInLibertyServerRoot("HPEL0161W", MESSAGE_LOG); + assertEquals("Message HPEL0161W appeared in the console file", 0, lines.size()); + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELLogDirectoryPurgeMaxSizeTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELLogDirectoryPurgeMaxSizeTest.java new file mode 100755 index 000000000000..d592d0059923 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELLogDirectoryPurgeMaxSizeTest.java @@ -0,0 +1,146 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 91930 8.5.5 13/06/2013 sumam Test case for defect 91930. + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 91930: HPEL log ignores purgeMaxSize after dataDirectory is changed. + * While changing the path of logDirectory to new location it should use the should follow the same purgeMaxSize property. + * Testing scenario: Start the server with logDirectory as logs and purgeMaxSize = 29 → during runtime change the logDirectory as logX and check for the purgeMaxSize property for + * the new repository, it should not exceed 29 MB. + * + */ + +public class HPELLogDirectoryPurgeMaxSizeTest extends VerboseTestCase { + + private final static String loggerName = HpelLogDirectoryChangeTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 30; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HPELLogDirectoryPurgeMaxSizeTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelDirChangePurgeMaxTest_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test that logs generated are retaining the purgeMaxSize value for new location. + * Start the server with logDirectory as logs and purgeMaxSize as 29 MB, during runtime change the logDirectory to logx and run quick log + * the new repository should not exceed size more than 29 MB. + **/ + public void testLogDirectoryChange() throws Exception { + RemoteFile binaryLogDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelDirChangePurgeMaxTest_2.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS, 0); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size for new location is same as old"); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logx/logdata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 29 MB ", + binaryLogSize < (29 * 1024 * 1024) && binaryLogSize > ((MAX_DEFAULT_PURGE_SIZE - 5) * 1024 * 1024)); + this.logVerificationPassed(); + + } + + /** + * Returns the total size of log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + long totalgRepositorySize = 0; + RemoteFile[] allLogFiles = dirToCheck.list(true); + for (RemoteFile i : allLogFiles) { + totalgRepositorySize += i.length(); + } + return totalgRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELPurgeMaxSizeErrorTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELPurgeMaxSizeErrorTest.java new file mode 100755 index 000000000000..c871f8af582c --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELPurgeMaxSizeErrorTest.java @@ -0,0 +1,116 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 91947 8.5.5 13/06/2013 sumam Test case for defect 91947. + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.util.List; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 91947 : HPEL purgeMaxSize/purgeMinTime should follow convention for min value from logging + * Test scenario: Set the server.xml purgeMaxSize = -1 and start the server warning message should be generated + */ + +public class HPELPurgeMaxSizeErrorTest extends VerboseTestCase { + + private final static String loggerName = HPELPurgeMaxSizeErrorTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static String MESSAGE_LOG = "logs/console.log"; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HPELPurgeMaxSizeErrorTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + // Setting the server.xml with purgeMaxSize = -1 + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeInvalid.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test that server gives error message for setting purgeMaxSize = -1 + * Set the purgeMaxSize property = -1 in server.xml for both and , start the server and check for the warning message for invalid purgeMaxSize. + **/ + public void testPurgeMaxSizeProperty() throws Exception { + + this.logVerificationPoint(" Verifying the console.log should have a error message for invalid purgeMaxSize property "); + logger.info(" The console.log should have a error message CWWKG0075E for setting purgeMaxSize property to -1 "); + checkErrorMessageForInvalidPurgeMaxSizeExists(); + this.logVerificationPassed(); + + } + + //Check if we have one Error Message for invalid purgeMaxSize property. + protected void checkErrorMessageForInvalidPurgeMaxSizeExists() throws Exception { + List lines = appServ.getBackend().findStringsInFileInLibertyServerRoot("CWWKG0075E", MESSAGE_LOG); + assertTrue(" Message CWWKG0075E did not appear in console.log ", lines.size() > 0); + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelDeleteEmptyDirectories.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelDeleteEmptyDirectories.java new file mode 100755 index 000000000000..8a2ed23cac22 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelDeleteEmptyDirectories.java @@ -0,0 +1,312 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * COMPONENT_NAME: WAS.ras.fvt + * + * ORIGINS: 27 (used for IBM originated files) + * + * IBM Confidential OCO Source Material + * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 2002 + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * @author olteamh + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 702533 8.0 09/01/2011 olteamh Check that empty hpel instance directories are deleted. + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.util.ArrayList; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 702533: Hpel leaves empty instance repositories behind + * + * @author olteamh + * + */ + +public class HpelDeleteEmptyDirectories extends VerboseTestCase { + + private final static String loggerName = HpelDeleteEmptyDirectories.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static String tempTraceSpec = "*=info:" + loggerName + "*=all"; // trace spec needed for this test case. + String defaultTraceSpec = null; // original trace spec + boolean defaultLogPurgeEnabled; // original purgeBySize + boolean defaultTracePurgeEnabled; // original purgeBySize + int defaultLogPurgeSize; + int defaultTracePurgeSize; + + RemoteFile backup = null; + + public HpelDeleteEmptyDirectories(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + ApplicationServer appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelDeleteEmptyDirectories.xml")); + +// ConfigObject logChild = CommonTasks.getBinaryLogChild(appServ); +// defaultLogPurgeEnabled = logChild.getAttributeByName("purgeBySizeEnabled").getValueAsBoolean(); +// // Test requires that purgeBySize be enabled. +// logChild.getAttributeByName("purgeBySizeEnabled").setValue(true); +// defaultLogPurgeSize = logChild.getAttributeByName("purgeMaxSize").getValueAsInt(); +// // Speed up test by setting purge size to minimum possible +// logChild.getAttributeByName("purgeMaxSize").setValue(10); +// +// ConfigObject traceChild = CommonTasks.getBinaryTraceChild(appServ); +// defaultTracePurgeEnabled = traceChild.getAttributeByName("purgeBySizeEnabled").getValueAsBoolean(); +// // Test requires that purgeBySize be enabled. +// traceChild.getAttributeByName("purgeBySizeEnabled").setValue(true); +// defaultTracePurgeSize = traceChild.getAttributeByName("purgeMaxSize").getValueAsInt(); +// // Speed up test by setting purge size to minimum possible +// traceChild.getAttributeByName("purgeMaxSize").setValue(10); + + defaultTraceSpec = CommonTasks.getHpelTraceSpec(appServ); + CommonTasks.setHpelTraceSpec(appServ, tempTraceSpec); + + // Sync changes before restarting the server. + HpelSetup.getCellUnderTest().getWorkspace().saveAndSync(); + + // stop the server + if (appServ.getBackend().isStarted()) { +// if (appServ.getServerStatus().equals(ProcessStatus.RUNNING)) { + // The server is running. + this.logStep("The server is running, attempting to stop."); + appServ.stop(); + this.logStepCompleted(); + } + + // restart the server + if (!appServ.getBackend().isStarted()) { +// if (!appServ.getServerStatus().equals(ProcessStatus.RUNNING)) { + // The server is not running. + this.logStep("The server is not running, attempting to start."); + appServ.start(); + this.logStepCompleted(); + } + } + + /** + * This test writes enough entries to cause HPEL to delete the .wbl files from the + * previous server instance and checks that the parent directories are deleted when empty + **/ + public void testHPELDeleteEmptyInstanceDirectories() throws Exception { + String repositoryDirString = null; + int logPurgeMaxSize = 0; + int tracePurgeMaxSize = 0; + int logLoopsToDo = 0; + int traceLoopsToDo = 0; + ApplicationServer appServ = null; + RemoteFile serverLogdataDir = null; + RemoteFile serverTracedataDir = null; + Machine remoteMachine = null; + + this.logStep("Building parameters"); + appServ = HpelSetup.getServerUnderTest(); + remoteMachine = appServ.getNode().getMachine(); + + RemoteFile repositoryDir = CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()); + repositoryDirString = repositoryDir.getAbsolutePath(); + + serverLogdataDir = new RemoteFile(remoteMachine, repositoryDir, "logdata"); + serverTracedataDir = new RemoteFile(remoteMachine, repositoryDir, "tracedata"); + + logPurgeMaxSize = 10; //CommonTasks.getBinaryLogChild(appServ).getAttributeByName("purgeMaxSize").getValueAsInt(); + tracePurgeMaxSize = 10; //CommonTasks.getBinaryTraceChild(appServ).getAttributeByName("purgeMaxSize").getValueAsInt(); + logger.log(Level.INFO, "HPEL trace spec is: " + CommonTasks.getHpelTraceSpec(appServ)); + logger.log(Level.INFO, "Running the test case for repository directory: " + repositoryDirString); + logger.log(Level.INFO, "Running the test case for logdata directory: " + serverLogdataDir); + logger.log(Level.INFO, "Running the test case for tracedata directory: " + serverTracedataDir); + logger.log(Level.INFO, "Running the test case with trace purge size: " + tracePurgeMaxSize); + logger.log(Level.INFO, "Running the test case with log purge size: " + logPurgeMaxSize); + logger.log(Level.INFO, "Application server is named: " + appServ.getName()); + + //Make sure the arguments are valid + assertNotNull("The repository directory is null", repositoryDirString); + assertNotNull("The repository log directory is null", serverLogdataDir); + assertNotNull("The repository tracedirectory is null", serverTracedataDir); + + //Get list of all directories in repository before the test starts + RemoteFile[] preLogDirs = listInstanceDirectories(serverLogdataDir); + RemoteFile[] preTraceDirs = listInstanceDirectories(serverTracedataDir); + + //all empty instance repository dirs should have been deleted when the server starts + for (int m = 0; m < preLogDirs.length; m++) { + assertTrue("An empty log instance directory " + preLogDirs[m] + " has been found after server start up", preLogDirs[m].list(true).length != 0); + } + + for (int m = 0; m < preTraceDirs.length; m++) { + assertTrue("An empty trace instance directory " + preTraceDirs[m] + " has been found after server start up", preTraceDirs[m].list(true).length != 0); + } + + // Calculate number of loops of logging to perform + int logBytesToGo = (logPurgeMaxSize * 1024 * 1024); // bytes remaining before max + int traceBytesToGo = (tracePurgeMaxSize * 1024 * 1024); + logLoopsToDo = (logBytesToGo / 100); + traceLoopsToDo = (traceBytesToGo / 100); + logger.log(Level.INFO, "Maximum log iterations: " + logLoopsToDo); + logger.log(Level.INFO, "Maximum trace iterations: " + traceLoopsToDo); + + // Log messages on application server. + this.logStep("Creating log messages."); + + // Write some log records to have a reference point for the big loop bellow. + CommonTasks.createLogEntries(appServ, loggerName, "Initial log record for delete empty instance repositories test.", + null, 10, CommonTasks.LOGS, 0); + + RemoteFile logFile = getMostRecentLog(serverLogdataDir); + assertNotNull("Did not find any WBL files in log directory " + serverLogdataDir, logFile); + for (int i = 0; i < logLoopsToDo; i += 100) { + CommonTasks.createLogEntries(appServ, loggerName, "Log record for delete empty instance repositories test.", + null, 100, CommonTasks.LOGS, 0); + // Keep logging until all files we had before the test are purged + if (!logFile.exists()) { + logger.log(Level.INFO, "Exiting writting log records after {0} loops", i); + break; + } + } + + // Write some trace records to have a reference point for the big loop bellow. + CommonTasks.createLogEntries(appServ, loggerName, "Initial trace record for delete empty instance repositories test.", + null, 10, CommonTasks.TRACE, 0); + + RemoteFile traceFile = getMostRecentLog(serverTracedataDir); + assertNotNull("Did not find any WBL files in trace directory " + serverTracedataDir, traceFile); + for (int i = 0; i < traceLoopsToDo; i += 100) { + CommonTasks.createLogEntries(appServ, loggerName, "Trace record for delete empty instance repositories test.", + null, 100, CommonTasks.TRACE, 0); + // Keep logging until all files we had before the test are purged + if (!traceFile.exists()) { + logger.log(Level.INFO, "Exiting writting trace records after {0} loops", i); + break; + } + } + + this.logStepCompleted(); + + // Short pause to ensure that any deletes HPEL did are processed before we recalculate. + Thread.sleep(2500); + + RemoteFile[] postLogDirs = listInstanceDirectories(serverLogdataDir); + RemoteFile[] postTraceDirs = listInstanceDirectories(serverTracedataDir); + + //Check that there are no empty instance directories at the end of the test + for (int m = 0; m < postLogDirs.length; m++) { + assertTrue("An empty log instance directory has been found", postLogDirs[m].list(true).length != 0); + + } + for (int m = 0; m < postTraceDirs.length; m++) { + assertTrue("An empty trace instance directory has been found", postTraceDirs[m].list(true).length != 0); + } + + } + + @Override + public void tearDown() throws Exception { + ApplicationServer appServ = HpelSetup.getServerUnderTest(); + + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + +// ConfigObject logChild = CommonTasks.getBinaryTraceChild(appServ); +// logChild.getAttributeByName("purgeBySizeEnabled").setValue(defaultLogPurgeEnabled); +// logChild.getAttributeByName("purgeMaxSize").setValue(defaultLogPurgeSize); +// +// ConfigObject traceChild = CommonTasks.getBinaryTraceChild(appServ); +// traceChild.getAttributeByName("purgeBySizeEnabled").setValue(defaultTracePurgeEnabled); +// traceChild.getAttributeByName("purgeMaxSize").setValue(defaultTracePurgeSize); + + CommonTasks.setHpelTraceSpec(appServ, defaultTraceSpec); + + HpelSetup.getCellUnderTest().getWorkspace().saveAndSync(); + + // No need to restart server in Liberty if it's not bootstrap.properties changes. +// this.logStep("Restarting server " + appServ.getName() + " to enable settings available before the test."); +// appServ.stop(); +// appServ.start(); +// this.logStepCompleted(); + + // call the super + super.tearDown(); + } + + // Find most recent WBL file in the repository + private RemoteFile getMostRecentLog(RemoteFile repositoryBase) throws Exception { + assertNotNull("RepositoryBase was unexpectedly null", repositoryBase); + assertTrue(repositoryBase + " does not exist", repositoryBase.exists()); + assertTrue(repositoryBase + " is not a directory", repositoryBase.isDirectory()); + RemoteFile[] fileArray = repositoryBase.list(true); + assertNotNull("Failed to list files in " + repositoryBase, fileArray); + RemoteFile result = null; + long timestamp = -1; + for (RemoteFile curFile : fileArray) { + String name = curFile.getName(); + if (curFile.isFile() && name.endsWith(".wbl")) { + long otherTimestamp = Long.parseLong(name.substring(0, name.length() - 4)); + if (otherTimestamp > timestamp) { + result = curFile; + timestamp = otherTimestamp; + } + } + } + return result; + } + + private RemoteFile[] listInstanceDirectories(RemoteFile repositoryBase) throws Exception { + assertNotNull("RepositoryBase was unexpectedly null", repositoryBase); + ArrayList curFiles = new ArrayList(); + + assertTrue(repositoryBase + " does not exist", repositoryBase.exists()); + assertTrue(repositoryBase + " is not a directory", repositoryBase.isDirectory()); + RemoteFile[] fileArray = repositoryBase.list(true); + assertNotNull("Failed to list files in " + repositoryBase, fileArray); + // recursive=true cause all files and directories return from the call, so no need to make calls in subdirectories. + for (RemoteFile curFile : fileArray) { + if (curFile.isDirectory()) { + curFiles.add(curFile); + } + } + + logger.log(Level.INFO, "Listing " + repositoryBase + " found " + curFiles.size() + " directories"); + return curFiles.toArray(new RemoteFile[curFiles.size()]); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLogDirectoryChangeTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLogDirectoryChangeTest.java new file mode 100755 index 000000000000..29fb3485132b --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLogDirectoryChangeTest.java @@ -0,0 +1,149 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 98216 8.5.5 13/06/2013 sumam Test case for defect 98216. + * + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 98216 : HPEL doesn't change location of logdata/tracedata when logDirectory changes. + * While changing the logDirectory attribute of element, the new logs were going inside the old directory. + * Test Scenario -> Start the server with logDirectory as logs → during runtime change the logDirectory to logX and run quick log, new logs should be generated under the logx + * repository. + * + */ + +public class HpelLogDirectoryChangeTest extends VerboseTestCase { + + private final static String loggerName = HpelLogDirectoryChangeTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 30; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HpelLogDirectoryChangeTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + + this.logStepCompleted(); + } + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + // Setting the log directory of logs + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogDirectoryChange_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Testing the logDirectory attribute by changing to new location and running the quick logs. + * Start the server with logDirectory as logs, during runtime change the value of logDirectory to logx, run quick logs + * and check the location where logs are getting stored. + **/ + public void testLogDirectoryChange() throws Exception { + RemoteFile binaryLogDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + this.logStep("Configuring server for test case by setting the logDirectory to logx"); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogDirectoryChange_2.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository used for log is new location (logx)."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logx/logdata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository should be the new location logx ", + binaryLogSize > ((MAX_DEFAULT_PURGE_SIZE - 5) * 1024 * 1024) && binaryLogSize < (50 * 1024 * 1024)); + this.logVerificationPassed(); + + } + + /** + * Returns the total size of log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + long totalgRepositorySize = 0; + RemoteFile[] allLogFiles = dirToCheck.list(true); + for (RemoteFile i : allLogFiles) { + totalgRepositorySize += i.length(); + } + return totalgRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLoggingElementDeleteTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLoggingElementDeleteTest.java new file mode 100755 index 000000000000..4140ca33ba3f --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLoggingElementDeleteTest.java @@ -0,0 +1,212 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 91946 8.5.5 13/06/2013 sumam Test case for defect 91946. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 91946 : HPEL configuration value doesn't revert to default when cleared from server.xml + * While deleting the element purgeMaxSize property is not set to default value. + * Test scenario + * 1. Bootstrap = 91 , server.xml= 201 for Trace remove the entire element Trace = 91 and Log = 50 + * 2. server.xml= 201 for Trace remove the entire element Trace = 50 and Log = 50 + */ + +public class HpelLoggingElementDeleteTest extends VerboseTestCase { + + private final static String loggerName = HpelLoggingElementDeleteTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 100; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HpelLoggingElementDeleteTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + // Setting the bootstrap with trace specification to get the trace logs. + + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.logging.trace.specification", "*=fine=enabled"); + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogElementDelete_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test 1. Set server.xml Trace = 201, during runtime remove the entire element, + * run quick log and check for the repository size, both logdata and tracedata should not exceed more than 50 MB. + **/ + + public void testLoggingElementDelete_1() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + + NumberFormat nf = NumberFormat.getInstance(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogElementDelete_2.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size after deleting the logging element."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize > (45 * 1024 * 1024) && binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should be less than 50 MB ", + binaryTraceSize > (45 * 1024 * 1024) && binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Test 1. Bootstrap Trace = 91 ,in server.xml Trace = 201, during runtime remove the entire element + * and run quick log, check the size of the repository it should not exceed more than 91 MB for trace data and 50 MB for log data. + **/ + public void testLoggingElementDelete_2() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + CommonTasks.addBootstrapProperty(appServ, "com.ibm.hpel.trace.purgeMaxSize", "90"); + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogElementDelete_1.xml")); + this.logStepCompleted(); + + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogElementDelete_2.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size after deleting the logging element ."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize > (45 * 1024 * 1024) && binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should be less than 91 MB ", + binaryTraceSize > (85 * 1024 * 1024) && binaryTraceSize < (91 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Returns the total size of log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + + long totalBinaryLogRepositorySize = 0; + RemoteFile[] allBinaryLogFiles = dirToCheck.list(true); + for (RemoteFile i : allBinaryLogFiles) { + totalBinaryLogRepositorySize += i.length(); +// } + } + return totalBinaryLogRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeBackupFileTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeBackupFileTest.java new file mode 100755 index 000000000000..7f87628208b1 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeBackupFileTest.java @@ -0,0 +1,195 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 98078 8.5.5 13/06/2013 sumam Test case for defect 98078. + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 98078 : HPEL purgeMinTime default setting causes all backup log/trace files to be deleted + * Test scenario + * 1. Start the server with purgeMaxSize as 0 for Trace and Log, run quick log Log directory size should be unlimited + * 2. Change the size of purgeMaxSize to 10 for Log and Trace Log directory should be purged to 10MB + * 3. Run quick log again Log directory should remain within 10 MB + */ + +public class HpelPurgeMaxSizeBackupFileTest extends VerboseTestCase { + + private final static String loggerName = HpelLogDirectoryChangeTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 50; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HpelPurgeMaxSizeBackupFileTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + // Setting the bootstrap with trace specification to get the trace logs. + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.logging.trace.specification", "*=fine=enabled"); + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMinTimeTest_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test that HPEL's TextLog size based retention policy works. Both within a single server instance and across + * server restarts. + **/ + public void testPurgeMinTime() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + // write enough records to log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should have logs created", + binaryLogSize > ((MAX_DEFAULT_PURGE_SIZE - 2) * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should have logs created", + binaryTraceSize > ((MAX_DEFAULT_PURGE_SIZE - 2) * 1024 * 1024)); + + this.logVerificationPassed(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMinTimeTest_2.xml")); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository used for log is new location."); + binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should have logs created", + binaryLogSize > (5 * 1024 * 1024) && binaryLogSize < (10 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should have logs created", + binaryTraceSize > (5 * 1024 * 1024) && binaryTraceSize < (10 * 1024 * 1024)); + + this.logVerificationPassed(); + + this.logStep("Writting log records to fill binary log repository."); + loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 600; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size for new logs generated"); + binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should have logs created", + binaryLogSize > (5 * 1024 * 1024) && binaryLogSize < (10 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should have logs created", + binaryTraceSize > (5 * 1024 * 1024) && binaryTraceSize < (10 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Returns the total size of log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + + long totalBinaryLogRepositorySize = 0; + RemoteFile[] allBinaryLogFiles = dirToCheck.list(true); + for (RemoteFile i : allBinaryLogFiles) { + totalBinaryLogRepositorySize += i.length(); +// } + } + return totalBinaryLogRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_1.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_1.java new file mode 100755 index 000000000000..61c4d34b02d5 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_1.java @@ -0,0 +1,501 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 97932 8.5.5 13/06/2013 sumam Test case for defect 97932. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 97932 : HPEL ignores purgeMaxSize + * Test scenario + * 1. Bootstrap = 91 , server.xml= 201 for Trace Trace = 201, Log = 50 + * 2. No Config specified Trace = 50, Log = 50 + * 3. Bootstrap = 91 for Trace Trace = 91 and Log = 50 + * 4. Server.xml= 55 for Log Trace = 50 and Log = 55 + * 5. Server.xml= 1024 for Trace ( Used 200 for trace instead of 1024 ) Trace = 1024 and Log = 50 + * 6. Server start without any settings -> during run time, add purgeMaxSize for log to 100 Trace = 50 and Log = 100 + * 7. Server start with log settings as 100 -> during run time, remove the attribute Trace = 50 and Log = 50 + * 8. Server start with log settings as 100 -> during run time, remove entire element (binaryLog) Trace = 50 and Log = 50 + * 9. Server start with log settings as 100 -> during run time, remove entire element (logging) Trace = 50 and Log = 50 + * + */ + +public class HpelPurgeMaxSizeIgnoreTest_1 extends VerboseTestCase { + + private final static String loggerName = HpelLogDirectoryChangeTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 50; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HpelPurgeMaxSizeIgnoreTest_1(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + // Setting the bootstrap with trace specification to get the trace logs. + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.logging.trace.specification", "*=fine=enabled"); + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); +// backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); +// if (!backup.exists()) { +// backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); +// } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogDirectoryChange_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test No config specified. Run quick log and check the size of repository. Both Tracedata and Logdata should not exceed 50 MB. + **/ + + public void testPurgeMaxSize_1() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + this.logStep("Setting server configuration to default.."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogDirectoryChange_1.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Test In Server.xml set log = 55. Run quick log and check the size of repository. + * Trace data should not exceed more than 50 MB and Log data should not exceed more than 55 MB. + **/ + + public void testPurgeMaxSize_2() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_1.xml")); + appServ.stop(); + appServ.start();; + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 55 MB ", + binaryLogSize < (55 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Test In server.xml set Trace = 200MB. Start the server and run quick log and check the repository size. + * Trace data size should not exceed more than 200 MB and log data size should not exceed more than 50 MB. + **/ + public void testPurgeMaxSize_3() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_2.xml")); + appServ.stop(); + appServ.start(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (200 * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + 200 + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 200 MB ", + binaryTraceSize < (200 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Server start without any setting -> during runtime add purgeMaxSize for log to 100 and run the quick log. + * Check the size of repository, it should not exceed 100 MB for log and 50 MB for trace. + */ + + public void testPurgeMaxSize_4() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_3.xml")); + appServ.stop(); + appServ.start(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_4.xml")); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (100 * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + 100 + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 100 MB ", + binaryLogSize < (100 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Server start with log settings as 100 -> during run time, remove the attribute "purgeMaxSize" from element. + * Run the quick log and check the size of the repository, it should not exceed 50 MB for tracedata and logdata. + **/ + public void testPurgeMaxSize_5() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_4.xml")); + appServ.stop(); + appServ.start(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_5.xml")); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Server start with log settings as 100 -> during run time, remove entire element (binaryLog) from server.xml + * run the quick log and check the size of the repository it should not exceed 50 MB for both logdata and tracedata. + **/ + public void testPurgeMaxSize_6() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_4.xml")); + appServ.stop(); + appServ.start(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_6.xml")); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (50 * 1024 * 1024) / 50; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Server start with log settings as 100 -> during run time, remove entire element (logging) + * Run the quick log and check the size of the repository, it should not exceed 50 MB for both logdata and tracedata. + **/ + public void testPurgeMaxSize_7() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_4.xml")); + appServ.stop(); + appServ.start(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_7.xml")); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (50 * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + 50 + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Set Bootstrap Trace = 91 , server.xml Trace = 201, run the quick log and check the size of the repository. + * It should not exceed 201 MB for tracedata and 50 MB for logdata. + **/ + public void testPurgeMaxSize_8() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + CommonTasks.addBootstrapProperty(appServ, "com.ibm.hpel.trace.purgeMaxSize", "91"); + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogElementDelete_1.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (201 * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + 201 + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size ."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB", + binaryLogSize > (45 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should be less than 201 MB", + binaryTraceSize > (190 * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Set Bootstrap Trace = 91 and run the quick log and check the size of the repository. + * It should not exceed 91 MB for tracedata and 50 MB for logdata + **/ + public void testPurgeMaxSize_9() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + CommonTasks.addBootstrapProperty(appServ, "com.ibm.hpel.trace.purgeMaxSize", "91"); + appServ.stop(); + appServ.start(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (91 * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + 91 + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size ."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB", + binaryLogSize > (45 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should be less than 91 MB", + binaryTraceSize > (85 * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Returns the total size of Log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + + long totalBinaryLogRepositorySize = 0; + RemoteFile[] allBinaryLogFiles = dirToCheck.list(true); + for (RemoteFile i : allBinaryLogFiles) { + totalBinaryLogRepositorySize += i.length(); +// } + } + return totalBinaryLogRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() +// this.logStep("Resetting configuration to pre test values."); +// if (backup != null && backup.exists()) { +// appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); +// } +// this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_2.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_2.java new file mode 100755 index 000000000000..25153140f84f --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_2.java @@ -0,0 +1,168 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 97932 8.5.5 13/06/2013 sumam Test case for defect 97932. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 97932 : HPEL ignores purgeMaxSize + * Test scenario + * 10. Server start without any settings -> during run time, add purgeMaxSize for log to 100, stop server, remove purgeMaxSize attribute, start server --> expect output: trace=50, + * log=50 + * + */ + +public class HpelPurgeMaxSizeIgnoreTest_2 extends VerboseTestCase { + + private final static String loggerName = HpelLogDirectoryChangeTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 50; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HpelPurgeMaxSizeIgnoreTest_2(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + // Setting the bootstrap with trace specification to get the trace logs. + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.logging.trace.specification", "*=fine=enabled"); + appServ.stop(); + appServ.start(); + + } + + /** + * Test Server start without any settings -> during run time, add purgeMaxSize for log to 100, stop server, remove purgeMaxSize attribute, start server --> expect output: + * trace=50, + * log=50 + **/ + public void testPurgeMaxSize_10() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_4.xml")); + appServ.stop(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_5.xml")); + appServ.start(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Returns the total size of log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + + long totalBinaryLogRepositorySize = 0; + RemoteFile[] allBinaryLogFiles = dirToCheck.list(true); + for (RemoteFile i : allBinaryLogFiles) { + totalBinaryLogRepositorySize += i.length(); +// } + } + return totalBinaryLogRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + + /** + * Determine if we should or should not execute this test. Returns true if the test should NOT be ran. + * **/ + @Override + public boolean skipTest() { + // Test does not do any good on z/OS since TextLog is for Controller only - so we can't generate logs to fill up + // TextLog repository. This may need to be revisited if we implement TextLog for servant. + try { + return HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS); + } catch (Exception e) { + CommonTasks.writeLogMsg(Level.SEVERE, "Unable to determine if we are on z/OS or not. Not skipping test"); + e.printStackTrace(System.err); + } + return false; + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelTextLogRetention.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelTextLogRetention.java new file mode 100755 index 000000000000..517a1f5cf1d4 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelTextLogRetention.java @@ -0,0 +1,213 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * COMPONENT_NAME: WAS.ras.fvt + * + * ORIGINS: 27 (used for IBM originated files) + * + * IBM Confidential OCO Source Material + * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 2002 + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * PM48157 8.0 10/03/2011 shighbar HPEL TextLog retention policy does not remove previous server instances logs. + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect PM48157 : Hpel TextLog files retention policy not working. The retention policy was previously + * working per server instance but not across multiple instances. As a result the size of the total TextLogs was able to + * grow by up to purgeMaxSize each time there was a new instance (server bounce). Test case needs to check for retention + * not only in a single run but across multiple runs to cover this case. + * + */ + +public class HpelTextLogRetention extends VerboseTestCase { + + private final static String loggerName = HpelTextLogRetention.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_TEXTLOG_PURGE_SIZE = 10; + private ApplicationServer appServ = null; + + boolean default_TextPurgeEnabled; // original purgeBySize for TextLog + int default_TextPurgeSize; + String default_outOfSpaceAction; + + RemoteFile backup = null; + + public HpelTextLogRetention(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.restart(); + this.logStepCompleted(); + } + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelTextLogRetention.xml")); + + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } +// ConfigObject textChild = CommonTasks.getTextLogChild(appServ); +// default_TextPurgeEnabled = textChild.getAttributeByName("purgeBySizeEnabled").getValueAsBoolean(); +// // Test requires that purgeBySize be enabled. +// textChild.getAttributeByName("purgeBySizeEnabled").setValue(true); +// default_TextPurgeSize = textChild.getAttributeByName("purgeMaxSize").getValueAsInt(); +// // Speed up test by setting purge size to minimum possible +// textChild.getAttributeByName("purgeMaxSize").setValue(MAX_TEXTLOG_PURGE_SIZE); +// // Check that outOfSpaceAction is set to PurgeOld +// default_outOfSpaceAction = textChild.getAttributeByName("outOfSpaceAction").getValueAsString(); +// textChild.getAttributeByName("outOfSpaceAction").setValue("PurgeOld"); +// +// // Sync changes before restarting the server. +// HpelSetup.getCellUnderTest().getWorkspace().saveAndSync(); + this.logStepCompleted(); + + // restart the server +// this.logStep("Starting/restarting application server to apply config changes."); +// appServ.stop(); +// appServ.start(); +// this.logStepCompleted(); + + } + + /** + * Test that HPEL's TextLog size based retention policy works. Both within a single server instance and across + * server restarts. + **/ + public void testHPELTextLogSizeRetention() throws Exception { + RemoteFile TextLogDir = CommonTasks.getTextLogDir(appServ); + NumberFormat nf = NumberFormat.getInstance(); + + // write enough records to force size based retention policy to kick in. + // there is ~600 bytes per log record. Using 200 to allow buffer. + this.logStep("Writting log records to fill TextLog repository."); + long loopsPerFullRepository = (MAX_TEXTLOG_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_TEXTLOG_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS, 0); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying that repository has not grown above max purge size."); + long logsSize = getSizeOfTextLogs(TextLogDir); + logger.info("The current size of TextLog files in " + TextLogDir.getAbsolutePath() + " is " + nf.format(logsSize)); + assertTrue("TextLog Repository size shouldn't be larger than purgeMaxSize", + logsSize <= (MAX_TEXTLOG_PURGE_SIZE * 1024 * 1024)); + this.logVerificationPassed(); + + this.logStep("Restarting Server in preperation to check that retention policy spans server instances"); + appServ.stop(); + appServ.start(); + + this.logStep("Writting log records to repository"); + // We don't have to fill the repository - half the repository size will work fine. + logger.info("writting " + nf.format((int) (loopsPerFullRepository / 2)) + " log loops to produce " + MAX_TEXTLOG_PURGE_SIZE + / 2 + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) (loopsPerFullRepository / 2), CommonTasks.LOGS, 0); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying that the repository size is still below max purge size."); + logsSize = getSizeOfTextLogs(TextLogDir); + logger.info("The current size of TextLog files in " + TextLogDir.getAbsolutePath() + " is " + nf.format(logsSize)); + assertTrue("TextLog Repository size shouldn't be larger than purgeMaxSize after server restart.", + logsSize <= (MAX_TEXTLOG_PURGE_SIZE * 1024 * 1024)); + this.logVerificationPassed(); + } + + /** + * Returns the total size of TextLog files in the given directory + * + * @throws Exception + **/ + private long getSizeOfTextLogs(RemoteFile dirToCheck) throws Exception { + long TotalTextRepositorySize = 0; + RemoteFile[] AllTextLogFiles = dirToCheck.list(false); + for (RemoteFile i : AllTextLogFiles) { + if (i.getName().startsWith("TextLog_")) { + // counting this as a valid TextLog log file. + TotalTextRepositorySize += i.length(); + } + } + return TotalTextRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } +// ConfigObject textChild = CommonTasks.getTextLogChild(appServ); +// textChild.getAttributeByName("purgeBySizeEnabled").setValue(default_TextPurgeEnabled); +// textChild.getAttributeByName("purgeMaxSize").setValue(default_TextPurgeSize); +// textChild.getAttributeByName("outOfSpaceAction").setValue(default_outOfSpaceAction); +// +// HpelSetup.getCellUnderTest().getWorkspace().saveAndSync(); + this.logStepCompleted(); + + // No need to restart server in Liberty if it's not bootstrap.properties changes. +// this.logStep("Restarting server " + appServ.getName() + " to enable settings available before the test."); +// appServ.stop(); +// appServ.start(); +// this.logStepCompleted(); + + // call the super + super.tearDown(); + } + + /** + * Determine if we should or should not execute this test. Returns true if the test should NOT be ran. + * **/ + @Override + public boolean skipTest() { + // Test does not do any good on z/OS since TextLog is for Controller only - so we can't generate logs to fill up + // TextLog repository. This may need to be revisited if we implement TextLog for servant. + try { + return HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS); + } catch (Exception e) { + CommonTasks.writeLogMsg(Level.SEVERE, "Unable to determine if we are on z/OS or not. Not skipping test"); + e.printStackTrace(System.err); + } + return false; + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/LogViewerExec.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/LogViewerExec.java new file mode 100755 index 000000000000..9ff6ce72bb14 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/LogViewerExec.java @@ -0,0 +1,347 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * F000896.23216 8.0 08/25/2010 shighbar Update test case for z/OS support. + * 653858 8.0 09/08/2010 spaungam Invalid option test doesn't work in CT + * 677722 8.0 11/05/2010 mcasile msgid key removed from logviewer nls + * 677210 8.0 11/05/2010 spaungam logviewer script is missing from iSeries + * 690576 8.0 02/16/2011 spaungam use qsh shell on iSeries with new simplicity + * 695788 8.0 03/09/2011 shighbar Always set repositoryDir param to avoid LV hang on user input. + * 712273 8.0 09/16/2011 belyi Add test for process name in the header. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.util.ArrayList; +import java.util.Random; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.Node; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.Props; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * This task is to read from an active servers HPEL repository in basic format and to verify there are no errors and to + * check for key output. + * + * + */ +public class LogViewerExec extends VerboseTestCase { + + private static final Logger thisLogger = Logger.getLogger(LogViewerExec.class.getName()); + private final String outFileName = this.getName() + ".lv_out.log"; + RemoteFile rOutLog = null; + RemoteFile rProfRootDir = null; + RemoteFile rProfBinFile = null; + + /** + * Constructs a single instance of this Test (one test method). + * + * @param name + * The name of the test method to run + */ + public LogViewerExec(String name) { + super(name); + } + + /** + * Configures instance resources to initialize this TestCase. + * + * @throws Exception + * if a problem happens while configuring the test fixture. + */ + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(HpelSetup.getServerUnderTest())) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + HpelSetup.getServerUnderTest().getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(HpelSetup.getServerUnderTest(), true); + // HpelSetup.getServerUnderTest().restart(); Bug# 17199 + HpelSetup.getServerUnderTest().stop(); + HpelSetup.getServerUnderTest().start(); + this.logStepCompleted(); + } + + assertTrue("Failed assertion that HPEL is enabled", CommonTasks.isHpelEnabled(HpelSetup.getServerUnderTest())); + + // Liberty profile root is the install root. + rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getServerUnderTest().getBackend().getInstallRoot()); +// rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getNodeUnderTest().getProfileDir()); + rProfBinFile = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), rProfRootDir, "bin"); + + } + + /** + * A method to drive the execution of the logViewer tool on the remote machine/server that is being tested. + * + * @throws Exception + */ + private ProgramOutput exeLogViewer(String[] cmdLineOptions) throws Exception { + // make platform agnostic to handle .sh and .bat + String exeExt = ""; + final String LOG_VIEWER = "logViewer"; + + //if non-iSeries +// if (!HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ISERIES)){ + if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.WINDOWS)) { + exeExt = ".bat"; +// } else { +// exeExt = ".sh"; + } + + StringBuilder cmd = new StringBuilder(100); + cmd.append(rProfBinFile.getAbsolutePath()).append(HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator()); + cmd.append(LOG_VIEWER).append(exeExt).append(" "); + + for (String cmdOption : cmdLineOptions) { + if (!cmdOption.isEmpty()) { + cmd.append("\"" + cmdOption + "\" "); + } + } + logMsg("executing: " + cmd.toString()); +// logMsg("executing: " + rProfBinFile.getAbsolutePath() + HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator() + cmd.toString()); +// return HpelSetup.getNodeUnderTest().getMachine().execute(LOG_VIEWER + exeExt, cmdLineOptions, rProfBinFile.getAbsolutePath()); + return HpelSetup.getNodeUnderTest().getMachine().execute(cmd.toString(), rProfBinFile.getAbsolutePath()); +// } +// //iSeries LogViewer needs to be executed in the shell qsh +// else{ +// return HpelSetup.getNodeUnderTest().getMachine().executeQSH(LOG_VIEWER, cmdLineOptions, rProfBinFile.getAbsolutePath(), null); +// } + } + + /** + * Tests that LogViewer can be executed on the target machine and that no error's are thrown. If the repositories + * are in the default location - logViewer will execute against default values; i.e. against the log and trace data + * located in the profile's log directory etc. If the configuration shows that the logdata is being written to + * another location; that location will be passed to logViewer. In the case where the log data is being written to + * another location, only the log data will be ran against. + * + * @throws Exception + */ + public void testLogViewerExecutes() throws Exception { + // need to have messages for the logViewer to process. + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), LogViewerExec.class.getName(), "Some Msg goes here", null, 25, CommonTasks.LOGS, -1); + + Node node = HpelSetup.getNodeUnderTest(); + rOutLog = new RemoteFile(node.getMachine(), node.getMachine().getTempDir(), outFileName); + + this.logStep("executing logViewer on " + node.getProfileName()); + + String arg1 = "-outLog"; + String arg2 = rOutLog.getAbsolutePath(); + + ProgramOutput lvPrgmOut; + + lvPrgmOut = exeLogViewer(new String[] { arg1, arg2, "-repositoryDir", CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() }); + + this.logVerificationPoint("Verifying logViewer std out/err and status return code."); + logMsg(" === LogViewer's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === LogViewer std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + assertTrue("Failed assertion that logViewer exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); + + assertTrue("Failed assertion that logViewer did produce an output file", rOutLog.exists()); + this.logVerificationPassed(); + this.logStepCompleted(); + + // pull the resulting text based log over to test machine. + this.logStep("Pulling logViewer output file ( " + outFileName + " ) to results dir"); + RemoteFile lResultsDir = new RemoteFile(Machine.getLocalMachine(), Props.getFileProperty(Props.DIR_LOG).getCanonicalPath()); + RemoteFile lOutLog = new RemoteFile(Machine.getLocalMachine(), lResultsDir, outFileName); + + lOutLog.copyFromSource(rOutLog, true); // Even though file is text we are getting transfer exceptions that + // appear to be because logViewer output is UTF8 or contains other + // special characters. Transferring in binary seems to correct this. + this.logStepCompleted(); + } + + /** + * Tests that logViewer correctly report an invalid option when one is passed to it. + * + * @throws Exception + */ + public void testLogViewerInvalidOption() throws Exception { + this.logStep("executing logViewer on " + HpelSetup.getNodeUnderTest().getProfileName()); + // generate a random option that is between 3 and 15 characters long starting with "bad". + String alphabet = "abcdefghijklmnopqrstuvwxyz"; + StringBuffer invalidOption = new StringBuffer(); + invalidOption.append("-bad"); // need the option flag first. + Random rnd = new Random(); + for (int i = 1; i <= rnd.nextInt(12); i++) { + invalidOption.append(alphabet.charAt(rnd.nextInt(alphabet.length()))); + } + + StringBuffer expectedResponse = new StringBuffer(); + expectedResponse.append("Unknown Argument: "); + expectedResponse.append(invalidOption); + expectedResponse.append("\\s+"); //match as a regular expression + expectedResponse.append("Use option -help for usage information."); + + ProgramOutput lvPrgmOut = exeLogViewer(new String[] { invalidOption.toString() }); + this.logVerificationPoint("Verifying logViewer std out/err and status return code."); + logMsg(" === LogViewer's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === LogViewer std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + + assertTrue("Failed assertion that logViewer exited with an error return code", (lvPrgmOut.getReturnCode() != 0)); + assertTrue("Failed assertion that logViewer reported invalid option. Where //s is any number of spaces, expected=" + + expectedResponse.toString().trim() + ". result=" + lvPrgmOut.getStdout().trim(), + Pattern.matches(expectedResponse.toString(), lvPrgmOut.getStdout().trim())); + + this.logVerificationPassed(); + this.logStepCompleted(); + } + + public void testHeaderProcessName() throws Exception { + this.logStep("get instance list from " + HpelSetup.getNodeUnderTest().getProfileName()); + + ProgramOutput lvPrgmOut = exeLogViewer(new String[] { "-listInstances", "-repositoryDir", CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() }); + String out = lvPrgmOut.getStdout(); + + // (WI 234118) We cannot rely on matching "Instance ID" as the header because that message is translated when running in non-English locales, causing this + // test to fail. Instead, match the lines starting with a number assuming those are the instance IDs. + // Collect IDs belonging to the current instance run. + int indx; + String controllerID = null; + ArrayList ids = new ArrayList(); + for (String outLine : out.split("\\r?\\n")) { + Pattern p = Pattern.compile("^\\s*(\\d+(?:/\\S+)?)\\s"); + Matcher m = p.matcher(outLine); + if (m.find()) { + String newID = m.group(1); + logMsg("Processing instance id " + newID); + indx = newID.indexOf('/'); + String newControllerID = indx < 0 ? newID : newID.substring(0, indx); + logMsg("It belongs to controller " + newControllerID); + if (controllerID == null || !controllerID.equals(newControllerID)) { + // It's a new controller's instance, reset the list of IDs. + logMsg("It's a new controller, reset list of instances"); + ids.clear(); + controllerID = newControllerID; + } + ids.add(newID); + } + } + + assertFalse("No instance IDs found", ids.isEmpty()); + this.logStepCompleted(); + + this.logStep("Verify procName and procId for each retrieved instance"); + + boolean isZOS = HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS); + boolean hasController = false; + boolean hasServant = false; + ApplicationServer server = HpelSetup.getServerUnderTest(); + for (String id : ids) { + this.logVerificationPoint("Verifying instance " + id); + + lvPrgmOut = exeLogViewer(new String[] { "-instance", id, "-repositoryDir", CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() }); + out = lvPrgmOut.getStdout(); + // Should be okay matching the English text here because this is not a translated message. + int indx1 = out.indexOf(" running with process name "); + int indx2 = out.indexOf(" and process id ", indx1); + assertTrue("Instance with ID " + id + " does not have proper header", indx1 > 0 && indx2 > indx1); + String procName = out.substring(indx1 + 27, indx2); + String procId = out.substring(indx2 + 16).split("\\s*\\n\\s*", 2)[0]; + String expProcName; + String expProcId; + if (isZOS) { + indx = id.indexOf("/"); + if (indx < 0) { + // This is controller, take name values from Simplicity, can't verify jobID this way though + expProcName = server.getShortName(); + hasController = true; + } else { + // This is servant, take values from instance ID. + indx1 = id.indexOf("-", indx); + indx2 = id.indexOf("_", indx1); + assertTrue("Instance ID " + id + " is incorrectly formatted", indx1 > indx && indx2 > indx1); + expProcName = id.substring(indx1 + 1, indx2); + expProcId = id.substring(indx2 + 1); + hasServant = true; + assertEquals("Process ID is incorrect", expProcId, procId); + } + } else { + // On Liberty procName is just the server name. + expProcName = server.getBackend().getServerName(); +// expProcName = server.getCellName() + "\\" + server.getNodeName() + "\\" + server.getName(); + // Don't verify process Id since it is not available in Liberty FAT +// expProcId = server.getProcessIdString(); +// assertEquals("Process ID is incorrect", expProcId, procId); + } + assertEquals("Process Name is incorrect", expProcName, procName); + + this.logVerificationPassed(); + } + + this.logVerificationPoint("Verifying completeness of the test"); + if (isZOS) { + if (!hasController && !hasServant) { + fail("Test on zOS is missing both controller and servant instances"); + } + if (!hasController) { + fail("Test on zOS is missing controller instance"); + } + if (!hasServant) { + fail("Test on zOS is missing at least one servant instance"); + } + } else if (ids.size() == 0) { + fail("Test on distributed has no instances to verify"); + } + this.logVerificationPassed(); + + this.logStepCompleted(); + } + + /** + * Clean up instance resources to initialize this TestCase. + * + * @throws Exception + * if a problem happens while configuring the test fixture. + */ + @Override + public void tearDown() throws Exception { + // delete the output log on the remote machine. + if ((rOutLog != null) && (rOutLog.exists())) + rOutLog.delete(); + + // call the super + super.tearDown(); + } + + /** + * A simple method used to log messages from this test case to the test case's logs + */ + public void logMsg(String msg) { + if (thisLogger.isLoggable(Level.INFO)) { + thisLogger.info(msg); + } + } + +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/TraceSpecificationSetToAllTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/TraceSpecificationSetToAllTest.java new file mode 100755 index 000000000000..28cc7a15ea17 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/TraceSpecificationSetToAllTest.java @@ -0,0 +1,150 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.BufferedReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; +import componenttest.topology.utils.HttpUtils; + +/** + * This FAT test is written against RTC defect 137645 and 99171 + */ +public class TraceSpecificationSetToAllTest extends VerboseTestCase { + +// private static LibertyServer server = LibertyServerFactory.getLibertyServer("HpelServer"); + private ApplicationServer server = null; + private static final int CONN_TIMEOUT = 60; + private final Class c = TraceSpecificationSetToAllTest.class; + + RemoteFile rProfRootDir = null; + RemoteFile rProfBinFile = null; + + private static final String traceSpecification = "com.ibm.ws.logging.*=all"; + + public TraceSpecificationSetToAllTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + server = HpelSetup.getServerUnderTest(); + + if (!CommonTasks.isHpelEnabled(server)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + server.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(HpelSetup.getServerUnderTest(), true); + // if HPEL was not enabled, make sure trace spec is not valid to ensure restart below. + this.logStepCompleted(); + } + + CommonTasks.setHpelTraceSpec(HpelSetup.getServerUnderTest(), traceSpecification); + + CommonTasks.addBootstrapProperty(server, "com.ibm.ws.logging.trace.specification", "com.ibm.ws.logging.*=all:com.ibm.ws.org.*=all=enabled"); + + this.logStep("Bouncing server for new spec to take effect. Stopping application server"); + HpelSetup.getServerUnderTest().stop(); + this.logStepCompleted(); + + // Start Server + this.logStep("Starting the application server"); + HpelSetup.getServerUnderTest().start(); + this.logStepCompleted(); + + this.logStep("Checking the trace spec post app server restart: " + + CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest())); + this.logStepCompleted(); + assertTrue("Failed assertion that HPEL trace specification is set to " + traceSpecification, + traceSpecification.contains(CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest()))); + } + + /** + * This fat test ensures that if we set trace specification as "com.ibm.ws.logging.trace.specification=*=all" + * and write the entry, exit level messages then servlet request goes well and + * server does not throw StackOverflow exception. + * + * RTC WI : 137645 + * + * @throws Exception + */ + public void testResourceInjectionWorkNotGivingStackOverflow() throws Exception { + String arg1 = "view"; + String compareString; + + String txt = "http://" + server.getBackend().getHostname() + ":" + server.getBackend().getHttpDefaultPort() + "/HpelFat/WritingCustomLogServlet"; + URL url = new URL(txt); + Log.info(c, "testResourceInjectionWorkNotGivingStackOverflow", "Calling customLogger Application with URL=" + url.toString()); + + HttpURLConnection con = HttpUtils.getHttpConnection(url, HttpURLConnection.HTTP_OK, CONN_TIMEOUT); + BufferedReader br = HttpUtils.getConnectionStream(con); + String line = br.readLine(); + assertTrue("The response did not contain \'Servlet successfullly completed\' it's content was: " + line, + line.contains("Servlet successfullly completed")); + + compareString = "StackOverFlow"; + ProgramOutput lvPrgmOut = exeBinaryLog(new String[] { arg1, server.getBackend().getServerName(), "--includeInstance=latest" }); + Log.info(c, "testResourceInjectionWorkNotGivingStackOverflow", "Server Name : " + server.getBackend().getServerName()); + + String out = lvPrgmOut.getStdout(); + assertFalse(compareString, out.contains(compareString)); + + /** + * This assert verify RTC WI : 99171 + * Defect says that HPEL logs does not matches with text log. And comparison string used was + * "Event:org.osgi.framework.BundleEvent[source=com.ibm.ws.logging.osgi" + * We have replicated the same scenario here. + */ + compareString = "BundleEvent STARTING"; + assertTrue(compareString, out.contains(compareString)); + + compareString = "Event:org.osgi.framework.BundleEvent[source=com.ibm.ws.logging.osgi"; + assertTrue(compareString, out.contains(compareString)); + } + + /** + * A method to drive the execution of the binaryLog tool on the remote machine/server that is being tested. + * + * @throws Exception + */ + private ProgramOutput exeBinaryLog(String[] cmdLineOptions) throws Exception { + // make platform agnostic to handle .sh and .bat + String exeExt = ""; + final String BINARY_LOG = "binaryLog"; + + if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.WINDOWS)) { + exeExt = ".bat"; + } + rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getServerUnderTest().getBackend().getInstallRoot()); + rProfBinFile = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), rProfRootDir, "bin"); + StringBuilder cmd = new StringBuilder(100); + cmd.append(rProfBinFile.getAbsolutePath()).append(HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator()); + cmd.append(BINARY_LOG).append(exeExt).append(" "); + + for (String cmdOption : cmdLineOptions) { + if (!cmdOption.isEmpty()) { + cmd.append("\"" + cmdOption + "\" "); + } + } + + Log.info(c, "exeBinaryLog", "executing: " + cmd.toString()); + return HpelSetup.getNodeUnderTest().getMachine().execute(cmd.toString(), rProfBinFile.getAbsolutePath()); + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/VerifyRepositoryAccuracy.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/VerifyRepositoryAccuracy.java new file mode 100755 index 000000000000..671b73a37bd9 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/VerifyRepositoryAccuracy.java @@ -0,0 +1,337 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * F017049-18796.1 8.0 1/08/2010 spaungam Update test to support subdirectories + * F000896.23216 8.0 06/10/2010 shighbar Update to work on z/OS requires support for reading servants. Refactored initialize method into setup to reduce restarts which was impacting test on z/OS. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.util.Date; + +import com.ibm.websphere.logging.hpel.reader.RepositoryLogRecord; +import com.ibm.websphere.logging.hpel.reader.RepositoryReaderImpl; +import com.ibm.websphere.logging.hpel.reader.ServerInstanceLogRecordList; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.Props; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * This test is about verifying that HPEL is accurately reporting the number of messages sent to it. + * + * The test outline is as follows: 1: Create an HTTP client to the LogCreator JSP that logs messages (use the + * CommonTasks object) 2: Enable tracing so a tracedata directory and repository is created 3: Call the HTTP client with + * a known number of logging entries 4: Get the log records from the repository and count them 5: Do they match? Yes, + * pass, No, fail + * + */ +public class VerifyRepositoryAccuracy extends VerboseTestCase { + String localLogsRepositoryPath = null; + String localTraceRepositoryPath = null; + String uniqueLoggerID_Tag; + String loggerName = "VRAccuracyLogger"; + String logMessage = "VRAccuracy Message for FAT testing"; + final String TRACE_SPECIFICATION = "VRAccuracyLogger*=all"; // trace spec needed for this test case. + int logCount = 49; + boolean loggerSetup = false; + + public VerifyRepositoryAccuracy(String name) { + super(name); + } + + /** + * Configures instance resources to initialize this TestCase. + * + * @throws Exception + * if a problem happens while configuring the test fixture. + */ + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(HpelSetup.getServerUnderTest())) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + HpelSetup.getServerUnderTest().getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(HpelSetup.getServerUnderTest(), true); + // if HPEL was not enabled, make sure trace spec is not valid to ensure restart below. + CommonTasks.setHpelTraceSpec(HpelSetup.getServerUnderTest(), null); + this.logStepCompleted(); + } + + /* + * Since we have multiple test methods in this test case, we will only restart if the spec is not already set to + * what we need. This will avoid extra server restarts which adds to the bucket execution time. + */ + this.logStep("Checking the HPEL trace spec for " + this.getName()); + if (!CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest()).equals(TRACE_SPECIFICATION)) { + // The current spec is not what we need for this test - update spec and bounce server to take effect + this.logStep("Updating the hpel trace spec to " + TRACE_SPECIFICATION + " as part of setup for " + this.getName()); + CommonTasks.setHpelTraceSpec(HpelSetup.getServerUnderTest(), TRACE_SPECIFICATION); + + // need to restart the application server now + // Stop Server first. + this.logStep("Bouncing server for new spec to take effect. Stopping application server"); + HpelSetup.getServerUnderTest().stop(); + this.logStepCompleted(); + + Thread.sleep(10000); // stop operation blocks, but want short pause before restarting. + + // Start Server + this.logStep("Restarting the application server"); + HpelSetup.getServerUnderTest().start(); + + this.logStep("Checking the trace spec post app server restart: " + + CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest())); + assertTrue("Failed assertion that HPEL trace specification is set to " + TRACE_SPECIFICATION, TRACE_SPECIFICATION + .equals(CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest()))); + this.logStepCompleted(); + + } + } + + private void setupLogger() { + if (!loggerSetup) { + // setup a new unique identifier for the logger name + Date d = new Date(); + loggerName = loggerName + d.getTime(); + this.logStep("Creating a new logger named: " + loggerName); + this.logStepCompleted(); + loggerSetup = true; + } + } + + /* + * Tests that HPEL accurately reports the number of logs records entered. Assumes that HPEL is enabled on the active + * server + */ + public void testLogRecordCountAccuracyCheck() throws Exception { + // Create the following log entries in the repository + // Levels: All (pass null) + // LoggerName: com.ibm.ws.fat.hpel.tests.VRAccuracy + uniqueLoggerID_Tag + // Log Message: VRAccuracy Message for FAT testing + // Iterations: 49 (just picked a random number) + + setupLogger(); + + this.logStep("Creating the log entries"); + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), loggerName, logMessage, null, logCount, CommonTasks.LOGS, -1); + this.logStepCompleted(); + + Thread.sleep(10 * 1000); // sleep for 10 seconds + + // Get the logs from the server to check what is in them + this.logStep("Getting the message logs from the server"); + getLogsFromServer(CommonTasks.LOGS); + this.logStepCompleted(); + + // Go read the repository and see if it has what we are looking for + RepositoryReaderImpl logRepository = new RepositoryReaderImpl(localLogsRepositoryPath); + ServerInstanceLogRecordList CurrentProcessLogList = logRepository.getLogListForCurrentServerInstance(); + // record list is the list of records we will compare against. Assume it's the currentServerInstance list by + // default. + Iterable recordList = CurrentProcessLogList; + + /* + * Note, if we are on z/OS the CurrentProcessLogList represents only the controller's logs. Our test log entries + * will be written by servant though. Will setup a Merged repository to include all the logs from sub-process + * instances. + */ + //The problem is with how test counts records on zOS. HPEL allows server to have a parent process (controller) with a set of child processes (servants). + //For such servers result for a server instance has none empty result from getChildren() call. The test problem is that it assumes that logs recorded by an application on zOS can be found _only_ in children processes. + //On Liberty that is not the case since even on zOS server consists of a single process processing all the requests. + + //The problem can be solved in two ways. 1. Remove 'if zOS' condition since the test is maintained separately on Liberty. + //2. Adjust test to do merge between parent and children logs for all OSs. Following the first solution here. + + //if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS)) { + //this.logStep("Since this is z/OS - using a MergedRepository representing all the servant and adjunct sub-processes"); + //recordList = new MergedRepository(CurrentProcessLogList.getChildren().values()); + //} + + this.logStep("Counting log records by level"); + int severe = 0; + int warning = 0; + int info = 0; + for (RepositoryLogRecord record : recordList) { + // process a record + if (record.getLoggerName().equals(loggerName)) { + switch (record.getLevel().intValue()) { + case 1000: // SEVERE == 1000 + severe++; + break; + case 900: // WARNING == 900 + warning++; + break; + case 800: // INFO == 800 + info++; + break; + } + } + } + this.logStepCompleted(); + + // Verify the results + this.logVerificationPoint("Verifying the repository log (Level.SEVERE) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.SEVERE {counted:wrote} {" + severe + + ":" + logCount + "}", severe == logCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository log (Level.WARNING) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.WARNING {counted:wrote} {" + warning + + ":" + logCount + "}", warning == logCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository log (Level.INFO) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.INFO {counted:wrote} {" + info + ":" + + logCount + "}", info == logCount); + this.logVerificationPassed(); + } + + /* + * Tests that HPEL accurately reports the number of logs records entered. Assumes that HPEL is enabled on the active + * server + */ + public void testTraceRecordCountAccuracyCheck() throws Exception { + // Create the following log entries in the repository + // Levels: All (pass null) + // LoggerName: com.ibm.ws.fat.hpel.tests.VRAccuracy + uniqueLoggerID_Tag + // Log Message: VRAccuracy Message for FAT testing + // Iterations: 476 (just picked a random number) + + setupLogger(); + + this.logStep("Creating the trace entries"); + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), loggerName, logMessage, null, logCount, CommonTasks.TRACE, -1); + this.logStepCompleted(); + + Thread.sleep(10 * 1000); // sleep for 10 seconds + + // Get the logs from the server to check what is in them + this.logStep("Getting the trace logs from the server"); + getLogsFromServer(CommonTasks.TRACE); + this.logStepCompleted(); + + // =================================== + + // Go read the repository and see if it has what we are looking for + RepositoryReaderImpl logRepository = new RepositoryReaderImpl(localTraceRepositoryPath); + ServerInstanceLogRecordList CurrentProcessLogList = logRepository.getLogListForCurrentServerInstance(); + // record list is the list of records we will compare against. Assume it's the currentServerInstance list by + // default. + Iterable recordList = CurrentProcessLogList; + + /* + * Note, if we are on z/OS the CurrentProcessLogList represents only the controller's logs. Our test log entries + * will be written by servant though. Will setup a Merged repository to include all the logs from sub-process + * instances. + */ + //The problem is with how test counts records on zOS. HPEL allows server to have a parent process (controller) with a set of child processes (servants). + //For such servers result for a server instance has none empty result from getChildren() call. The test problem is that it assumes that logs recorded by an application on zOS can be found _only_ in children processes. + //On Liberty that is not the case since even on zOS server consists of a single process processing all the requests. + + //The problem can be solved in two ways. 1. Remove 'if zOS' condition since the test is maintained separately on Liberty. + //2. Adjust test to do merge between parent and children logs for all OSs. Following the first solution here. + + //if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS)) { + //this.logStep("Since this is z/OS - using a MergedRepository representing all the servant and adjunct sub-processes"); + //recordList = new MergedRepository(CurrentProcessLogList.getChildren().values()); + //} + + this.logStep("Counting log records by level"); + int fine = 0; + int finer = 0; + int finest = 0; + for (RepositoryLogRecord record : recordList) { + // process a record + if (record.getLoggerName().equals(loggerName)) { + switch (record.getLevel().intValue()) { + case 500: // FINE == 500 + fine++; + break; + case 400: // FINER == 400 + finer++; + break; + case 300: // FINEST == 300 + finest++; + break; + default: + System.out.println("loggerName expected: " + loggerName); + System.out.println("loggerName found: " + record.getLoggerName()); + System.out.println("level: " + record.getLevel()); + System.out.println("level in value: " + record.getLevel().intValue()); + } + } + } + this.logStepCompleted(); + + // Verify the results + this.logVerificationPoint("Verifying the repository trace count (Level.FINE) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINE {counted:wrote} {" + fine + ":" + + logCount + "}", fine == logCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository trace count (Level.FINER) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINER {counted:wrote} {" + finer + + ":" + logCount + "}", finer == logCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository trace count (Level.FINEST) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINEST {counted:wrote} {" + finest + + ":" + logCount + "}", finest == logCount); + this.logVerificationPassed(); + + } + + /* + * This is a utility method to get all of the repository logs as well as the trace logs. + * + * @ param filesToGet This is a switch for which files to get. Options are CommonTasks.LOGS or CommonTasks.TRACE, + */ + private void getLogsFromServer(String filesToGet) throws Exception { + if (filesToGet.equals(CommonTasks.LOGS)) { + // Set up the Simplicity objects to the remote files + RemoteFile remoteLogsDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), CommonTasks.getBinaryLogDir(HpelSetup + .getServerUnderTest()), "logdata"); + + // Set up the Simplicity object to the local results directory + RemoteFile localLogsResultsDir = new RemoteFile(Machine.getLocalMachine(), Props.getFileProperty(Props.DIR_LOG) + .getCanonicalPath() + + File.separator + VerifyRepositoryAccuracy.class.getSimpleName() + File.separator + "logs"); + + // Save off the path of the repository log files directory + localLogsRepositoryPath = localLogsResultsDir.getAbsolutePath(); + localLogsResultsDir.copyFromSource(remoteLogsDir, true, true); + } else if (filesToGet.equals(CommonTasks.TRACE)) { + RemoteFile remoteTraceDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), CommonTasks + .getBinaryTraceDir(HpelSetup.getServerUnderTest()), "tracedata"); + RemoteFile localTraceResultsDir = new RemoteFile(Machine.getLocalMachine(), Props.getFileProperty(Props.DIR_LOG) + .getCanonicalPath() + + File.separator + VerifyRepositoryAccuracy.class.getSimpleName() + File.separator + + "trace"); + + // Save off the path of the repository trace files directory + localTraceRepositoryPath = localTraceResultsDir.getAbsolutePath(); + localTraceResultsDir.copyFromSource(remoteTraceDir, true, true); + } + } + + @Override + public void tearDown() throws Exception { + /* + * Not disabling the spec in tearDown because we would only re-enable for the second test Method. By not + * disabling it we avoid the extra bounce. We assume that any future test cases will update the spec if + * required. + */ + + // call the super + super.tearDown(); + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/ras/util/CommonTasks.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/ras/util/CommonTasks.java new file mode 100755 index 000000000000..af0a3ddcd996 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/ras/util/CommonTasks.java @@ -0,0 +1,1036 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * F017049-28712 8.0 06/29/2010 shighbar Updates for SSFAT test cases and new useful methods in prep for z/OS support. + * F17049-32205 8.0 10/04/2010 shighbar Generalize common methods to support additional ServerTypes. + * 681388 8.0 12/07/2010 shighbar Add method to start server with non-standard mBean timeout. + * 689639.fvt 8.0 02/09/2011 spaungam sensitive filtering needs to be enabled earlier + * 695538 8.0 03/08/2011 shighbar testMergedRepositories failures on z/OS. + * 707366 8.0 06/01/2011 shighbar Hpel Internal Trace failures / test case expansion + * PM41930 8.0 08/23/2011 spaungam FFDC loggers to be asynchronous + * 721541 8.0 10/26/2011 spaungam Ensure exceptions appear with logging + */ +package com.ibm.ws.fat.ras.util; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.util.Properties; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.xml.sax.SAXException; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Cell; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.Node; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.Server; +import com.ibm.websphere.simplicity.ServerType; +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import com.ibm.websphere.simplicity.runtime.ProcessStatus; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.util.CommonActions; +import com.ibm.ws.fat.util.StopWatch; +import com.meterware.httpunit.PostMethodWebRequest; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.WebResponse; +import componenttest.topology.impl.LibertyServer; + +/** + * Holding class for driving common logic across multiple test cases/drivers + * + */ +public class CommonTasks { + + public static final String HPEL_APP_CONTEXT_ROOT = "HpelFat"; + public static final String HPEL_APP_GENLOG_JSP = "ivtLogSleep.jsp"; + public static final String HPEL_APP_CREATE_LOG_JSP = "LogCreator.jsp"; + public static final String RAS_ZIPPER_UTIL_JSP = "RasZipper.jsp"; + public static final String LOGS = "Logs"; + public static final String TRACE = "Trace"; + public static final String LOGS_TRACE = "LogsAndTrace"; + + public static enum zOSProcessType { + Control, Adjunct, Servant + } + + private static final int SERVER_START_MBEAN_TIMEOUT = 240; + +// private static final String JYTHON_RAS_RAWTRACE_SWITCH = "RasConfigEnableRawTrace.jy"; + + /** + * Makes use of the ivtLogSleep.jsp in the sample application to drive creation of log records. + * + * @param numCycles + * How many iterations to run (each iteration generates multiple log records, one of each level). Must be + * a positive integer, or else only onecycle will be ran + * + * @param cycleDelay + * The delay you want between each cycle in seconds. Useful for having steady stream of log entries + * created. If not a positive number, zero will be used. + * @throws Exception + * @throws SAXException + * @throws IOException + * @throws MalformedURLException + */ +// @Deprecated +// public static void genLogEntries(int numCycles, int cycleDelay) throws MalformedURLException, IOException, SAXException, Exception { +// if (numCycles <= 0) { +// numCycles = 1; +// } +// if (cycleDelay <= 0) { +// cycleDelay = 0; +// } +// +// String jsp = "/" + HPEL_APP_CONTEXT_ROOT + "/" + HPEL_APP_GENLOG_JSP; +// String jspParams = "?ActionParm=trace&NumberOfIterations=" + Integer.toString(numCycles) + "&CycleDelay=" +// + Integer.toString(cycleDelay); +// +// WebConversation wc = new WebConversation(); +// writeLogMsg(Level.INFO, " Getting URL: " + CommonActions.getUrl(HpelSetup.getServerUnderTest(), jsp + jspParams, false)); +// WebResponse response = wc.getResponse(CommonActions.getUrl(HpelSetup.getServerUnderTest(), jsp + jspParams, false)); +// +// int rc = response.getResponseCode(); +// writeLogMsg(Level.INFO, " Response Code for jsp is: " + Integer.toString(rc)); +// +// } + + /** + * @Deprecated A shortcut to createLogEntries(ApplicationServer appServer, String loggerName, String message, Level + * level, int iterations, String repository, int sleepTime) with no sleep time and assuming executing + * against the default application server for the test bucket. + */ +// @Deprecated +// public static WebResponse createLogEntries(String loggerName, String message, Level level, int iterations, String repository) +// throws MalformedURLException, IOException, SAXException, Exception { +// return createLogEntries(loggerName, message, level, iterations, repository, -1); +// } + + /** + * @Deprecated A shortcut to createLogEntries(ApplicationServer appServer, String loggerName, String message, Level + * level, int iterations, String repository, int sleepTime) without the requirement to pass in + * application server. + */ +// @Deprecated +// public static WebResponse createLogEntries(String loggerName, String message, Level level, int iterations, String repository, +// int sleepTime) throws MalformedURLException, IOException, SAXException, Exception { +// return createLogEntries(HpelSetup.getServerUnderTest(), loggerName, message, level, iterations, repository, sleepTime); +// } + + /** + * Makes use of the LogCreator.jsp in the RAS sample application to drive creation of log records. + * + * @param appServer + * The application server on which the log entries should be created. + * @param loggerName + * The name of the logger the JSP is to use. Default loggerName: Default_HPELTestLogger + * @param message + * The message the logger is to log. Default message: Default HPEL Message + * @param level + * The level of message to be logged. Choices are ALL, SEVERE, WARNING, INFO, FINE, FINER, FINEST Default + * value: ALL + * @param iterations + * How many iterations to run (each iteration generates multiple log records, one of each level). Must be + * a positive integer. Default value: 49 + * @param repository + * The repository to create the messages into. There are 3 choices, CommonTasks.LOGS, CommonTasks.TRACE + * or CommonTasks.LOGS_TRACE Default value: CommonTasks.LOGS + * @param sleepTime + * The time between iterations in milliseconds. + * @param async + * Value of the logger's (if it is a WAS WsLogger) async value to be set to. + * + * @return WebResponse + * + * @throws Exception + * @throws SAXException + * @throws IOException + * @throws MalformedURLException + */ + public static WebResponse createLogEntries(ApplicationServer appServer, String loggerName, String message, Level level, + int iterations, String repository, int sleepTime, boolean async) throws MalformedURLException, IOException, SAXException, Exception { + String jspParams = "?ActionParam="; + String jsp = "/" + HPEL_APP_CONTEXT_ROOT + "/" + HPEL_APP_CREATE_LOG_JSP; + String actionParam = CommonTasks.LOGS; + + // make the generation of both messages and logs the default + if (repository != null) { + actionParam = repository; + } + jspParams += actionParam + "&"; + + // check to see if anything was passed, if nothing was, all of the JSP's defaults can be used + if ((loggerName != null) || (message != null) || (level != null) || (iterations > 0)) { + String s1, s2, s3, s4, s5 = null, s6; + + if (loggerName != null) { + s1 = "LoggerName=" + loggerName; + } else { + s1 = "LoggerName=Default_HPELTestLogger"; + } + if (message != null) { + s2 = "Message=" + message; + } else { + s2 = "Message='Default HPEL Message'"; + } + if (level != null) { + s3 = "Level=" + level.getName(); + } else { + s3 = "Level=ALL"; + } + if (iterations > 0) { + s4 = "Iterations=" + Integer.toString(iterations); + } else { + s4 = "Iterations=49"; + } + + if (sleepTime > -1) + s5 = "Sleep=" + sleepTime; + + s6 = async ? "Async=true" : "Async=false"; + + jspParams += s1 + "&" + s2 + "&" + s3 + "&" + s4 + "&" + s5 + "&" + s6; + } + + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse(CommonActions.getUrl(appServer, jsp + jspParams, false)); + + return response; + } + + /** + * Makes use of the LogCreator.jsp in the RAS sample application to drive creation of log records. + * + * @param appServer + * The application server on which the log entries should be created. + * @param loggerName + * The name of the logger the JSP is to use. Default loggerName: Default_HPELTestLogger + * @param message + * The message the logger is to log. Default message: Default HPEL Message + * @param level + * The level of message to be logged. Choices are ALL, SEVERE, WARNING, INFO, FINE, FINER, FINEST Default + * value: ALL + * @param iterations + * How many iterations to run (each iteration generates multiple log records, one of each level). Must be + * a positive integer. Default value: 49 + * @param repository + * The repository to create the messages into. There are 3 choices, CommonTasks.LOGS, CommonTasks.TRACE + * or CommonTasks.LOGS_TRACE Default value: CommonTasks.LOGS + * @param sleepTime + * The time between iterations in milliseconds. + * + * @return WebResponse + * + * @throws Exception + * @throws SAXException + * @throws IOException + * @throws MalformedURLException + */ + public static WebResponse createLogEntries(ApplicationServer appServer, String loggerName, String message, Level level, + int iterations, String repository, int sleepTime) throws MalformedURLException, IOException, SAXException, Exception { + + return createLogEntries(appServer, loggerName, message, level, iterations, repository, sleepTime, false); + } + + /** + * Returns a ConfigObject representing the RAS Logging Service configuration in the model. + * + * @param aServer + * aServer The server you want the RAS Logging Service ConfigObject for + * + * @return ulsConfigObj + */ +// public static ConfigObject getLegacyLoggingService(Server aServer) throws Exception { +// ConfigObject ulsConfigObj = ConfigObject.getConfigObject(aServer, aServer.getConfigId(), "RASLoggingService"); +// return ulsConfigObj; +// } + + /** + * Returns a ConfigObject representing the HPEL configuration in the model. + * + * @param aServer + * aServer The server you want the HPEL ConfigObject for + * + * @return ulsConfigObj + */ +// public static ConfigObject getUnifiedLoggingService(Server aServer) throws Exception { +// ConfigObject ulsConfigObj = ConfigObject.getConfigObject(aServer, aServer.getConfigId(), "HighPerformanceExtensibleLogging"); +// return ulsConfigObj; +// } + + /** + * Returns a ConfigObject representing the child HPEL configuration in the model. + * + * @param aServer + * The server you want the child HPEL ConfigObject for. + * @param childName + * The name of the child configuration object you want to retrieve. + * + * @return ulsConfigObj + */ +// private static ConfigObject getUnifiedLoggingServiceChild(Server aServer, String childName) throws Exception { +// // this fails due to bug in Simplicity. +// // return ConfigObject.getConfigObject(HpelSetup.getServerUnderTest(), +// // getUnifiedLoggingService().getConfigIdentifier(), childName); +// +// List binChild1 = getUnifiedLoggingService(aServer).getChildObjectListByName(childName); +// if (binChild1.iterator().hasNext()) +// return binChild1.iterator().next(); // We should only get one child back. +// else +// return null; +// } + + /** + * Returns a ConfigObject representing the HPEL Binary Log configuration in the model. + * + * @param aServer + * The server you want the HPEL Binary Log ConfigObject for. + * + * @return The ConfigObject for the HPEL Binary Log. + */ +// public static ConfigObject getBinaryLogChild(Server aServer) throws Exception { +// return getUnifiedLoggingServiceChild(aServer, "HPELLog"); +// } + + /** + * Returns a ConfigObject representing the HPEL Binary Trace configuration in the model. + * + * @param aServer + * The server you want the HPEL Binary Trace ConfigObject for. + * + * @return The ConfigObject for the HPEL Binary Trace. + */ +// public static ConfigObject getBinaryTraceChild(Server aServer) throws Exception { +// return getUnifiedLoggingServiceChild(aServer, "HPELTrace"); +// } + + /** + * Returns a ConfigObject representing the HPEL Text Log configuration in the model. + * + * @param aServer + * The server you want the HPEL Text Log ConfigObject for. + * + * @return The ConfigObject for the HPEL Text Log. + */ +// public static ConfigObject getTextLogChild(Server aServer) throws Exception { +// return getUnifiedLoggingServiceChild(aServer, "HPELTextLog"); +// } + +// @Deprecated +// public static boolean isHpelEnabled() throws Exception { +// return isHpelEnabled(HpelSetup.getServerUnderTest()); +// } + + public static boolean isHpelEnabled(Server aServer) throws Exception { + LibertyServer server = aServer.getBackend(); + RemoteFile bootstrapFile = server.getServerBootstrapPropertiesFile(); + if (bootstrapFile == null || !bootstrapFile.exists()) { + return false; + } + Properties bootstrapProps = new Properties(); + bootstrapProps.load(bootstrapFile.openForReading()); + String logProvider = bootstrapProps.getProperty("websphere.log.provider"); + return logProvider != null && logProvider.startsWith("binaryLogging-"); +// if (getUnifiedLoggingService(aServer) == null) { +// // For backward compatibility - we assume if HPEL config object is null then server.xml is not updated and +// // therefore HPEL must not be enabled since the ConfigObject is returning null. +// writeLogMsg(Level.SEVERE, "isHpelEnabled method got null back from UnifiedLoggingService"); +// if (aServer == null) { +// writeLogMsg(Level.SEVERE, "The application server passed to isHpelEnabled is null"); +// } +// return false; +// } +// boolean tempresult = (getUnifiedLoggingService(aServer).getAttributeByName("enable").getValueAsBoolean() && !getLegacyLoggingService( +// aServer).getAttributeByName("enable").getValueAsBoolean()); +// return tempresult; + } + + public static boolean isHpelSensitiveTraceEnabled(Server aServer) throws Exception { + //if in hpel mode, get HighPerformanceExtensibleLogging +// ConfigObject configObj = getUnifiedLoggingService(aServer).getAttributeByName("rawTraceFilterEnabled"); +// +// if (configObj != null) { +// return configObj.getValueAsBoolean(); +// } +// +// writeLogMsg(Level.INFO, "isHpelSensitiveTraceEnabled configObj is null"); + return false; + } + + public static boolean setHpelSensitiveTraceEnabled(Server aServer, boolean enable) throws Exception { + if (enable == isHpelSensitiveTraceEnabled(aServer)) { + // the server is already set to the value we are trying to set. So do nothing. + return false; + } + + throw new UnsupportedOperationException("SensitiveTrace is not supported yet"); +// Workspace tempWorkSpace = HpelSetup.getCellUnderTest().getWorkspace(); +// getUnifiedLoggingService(aServer).getAttributeByName("rawTraceFilterEnabled").setValue(enable); +// tempWorkSpace.saveAndSync(); +// return true; + } + + public static boolean isRasSensitiveTraceEnabled() throws Exception { + throw new UnsupportedOperationException("SensitiveTrace is not supported yet"); +// String[] scriptArgs = null; +// scriptArgs = new String[3]; +// scriptArgs[0] = HpelSetup.getCellUnderTest().getName(); +// scriptArgs[1] = HpelSetup.getNodeUnderTest().getName(); +// scriptArgs[2] = HpelSetup.getServerUnderTest().getName(); + +// String result = RASWsadminScripts.exeJythonScript(JYTHON_RAS_RAWTRACE_SWITCH, scriptArgs); +// writeLogMsg(Level.INFO, "isRasSensitiveTraceEnabled result of wsadmin: " + result); +// +// return "true".equalsIgnoreCase(result); + } + + public static boolean setRasSensitiveTraceEnabled(boolean enable) throws Exception { + if (enable == isRasSensitiveTraceEnabled()) { + // the server is already set to the value we are trying to set. So do nothing. + return false; + } + + throw new UnsupportedOperationException("SensitiveTrace is not supported yet"); +// String[] scriptArgs = null; +// scriptArgs = new String[5]; +// scriptArgs[0] = HpelSetup.getCellUnderTest().getName(); +// scriptArgs[1] = HpelSetup.getNodeUnderTest().getName(); +// scriptArgs[2] = HpelSetup.getServerUnderTest().getName(); +// scriptArgs[3] = "set"; +// scriptArgs[4] = Boolean.toString(enable); +// +// String result = RASWsadminScripts.exeJythonScript(JYTHON_RAS_RAWTRACE_SWITCH, scriptArgs); +// writeLogMsg(Level.INFO, "setRasSensitiveTraceEnabled result of wsadmin: " + result); +// +// return true; + + } + + /** + * Sets if HPEL is enabled or not in the configuration. + * + * @param aServer + * The server you want to enable or disable HPEL on. + * + * @return True if changes were needed / made. False no changes were required, as in the configuration already matched what was requested. + */ + public static boolean setHpelEnabled(Server aServer, boolean enable) throws Exception { + if (enable == isHpelEnabled(aServer)) { + // the server is already set to the value we are trying to set. So do nothing. + return false; + } + LibertyServer server = aServer.getBackend(); + RemoteFile bootstrapFile = server.getServerBootstrapPropertiesFile(); + if (bootstrapFile == null) { + return false; + } + Properties bootstrapProps = new Properties(); + bootstrapProps.setProperty("websphere.log.provider", "binaryLogging-1.0"); + bootstrapProps.store(bootstrapFile.openForWriting(true), null); + return true; +// Workspace tempWorkSpace = HpelSetup.getCellUnderTest().getWorkspace(); +// getUnifiedLoggingService(aServer).getAttributeByName("enable").setValue(enable); +// getLegacyLoggingService(aServer).getAttributeByName("enable").setValue(!enable); +// tempWorkSpace.saveAndSync(); +// return true; + + // TODO Enabling or disabling HPEL requires us to bounce the server - don't know if we should do that here or + // not though? for now that is the caller's responsibility as they may not want it restarted and or have other + // changes they are making before the restart. + } + + /** + * Sets if HPEL is enabled or not in the configuration, and bounces the application server if needed. + * + * @param aServer + * The server you want to enable or disable HPEL on. The server will only be bounced if the configuration does not already match what was requested. + * + * @return True if changes were needed/made, and the server was bounced. False - no changes were required, as in the configuration already matched what was requested. + */ + public static boolean setHpelEnabledAndBounce(Server aServer, boolean enable) throws Exception { + if (setHpelEnabled(aServer, enable)) { + aServer.stop(); + aServer.start(); + return true; + } + return false; + } + + public static boolean isTextLogEnabled(Server aServer) throws Exception { + LibertyServer server = aServer.getBackend(); + BufferedReader config = new BufferedReader(new InputStreamReader(server.getServerConfigurationFile().openForReading())); + String line; + boolean result = false; + boolean inLogging = false; + while ((line = config.readLine()) != null) { + int index = 0; + if (!inLogging) { + int index1 = line.indexOf("= 0) { + inLogging = true; + index = index1; + } + } + if (inLogging) { + if (!result) { + int index2 = line.indexOf("= 0) { + result = true; + index = index2; + } + } + int index2 = line.indexOf("", index); + if (index2 >= 0) { + inLogging = false; + } + } + } + return result; +// return (getTextLogChild(aServer).getAttributeByName("enabled").getValueAsBoolean()); + } + + public static String getHpelTraceSpec(Server aServer) throws Exception { + LibertyServer server = aServer.getBackend(); + String traceSpec = server.getServerConfiguration().getLogging().getTraceSpecification(); + return traceSpec == null ? "" : traceSpec; +// return (getUnifiedLoggingService(aServer).getAttributeByName("startupTraceSpec").getValueAsString()); + } + + /** + * Sets the HPEL trace specification in the application server's configurations. Changes to the trace specification + * with this method will not take effect until after the application server is bounced. + * + * @param aServer + * The server you want the new trace specification applied to. + * @param newTraceSpec + * The new trace specification, such as 'com.ibm.myClass*=all' etc. Passing a null String is equivalent + * to specifying a trace string of '*=info' + * + * @throws Exception + */ + public static void setHpelTraceSpec(Server aServer, String newTraceSpec) throws Exception { + if (null == newTraceSpec) { + // null spec is equivalent to default no trace spec. + newTraceSpec = "*=info"; + } + + // check if we need to update the spec or if it's already set to what we want. + if (getHpelTraceSpec(aServer).equals(newTraceSpec)) { + writeLogMsg(Level.FINE, "HPEL Trace Spec already set to " + newTraceSpec + ". No change needed."); + return; + } else { + LibertyServer server = aServer.getBackend(); + ServerConfiguration config = server.getServerConfiguration(); + config.getLogging().setTraceSpecification(newTraceSpec); + server.updateServerConfiguration(config); +// writeLogMsg(Level.FINE, "Setting the HPEL Trace Spec to " + newTraceSpec); +// Workspace tmpWS = HpelSetup.getCellUnderTest().getWorkspace(); +// getUnifiedLoggingService(aServer).getAttributeByName("startupTraceSpec").setValue(newTraceSpec); +// tmpWS.saveAndSync(); + } + + } + + public static RemoteFile getBinaryLogDir(Server aServer) throws Exception { + String logDir = aServer.getBackend().getServerConfiguration().getLogging().getLogDirectory(); + return logDir == null ? aServer.getBackend().getFileFromLibertyServerRoot("logs") : + new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), logDir); +// return new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), aServer.expandString(getBinaryLogChild(aServer) +// .getAttributeByName("dataDirectory").getValueAsString())); + } + + public static RemoteFile getBinaryTraceDir(Server aServer) throws Exception { + String logDir = aServer.getBackend().getServerConfiguration().getLogging().getLogDirectory(); + return logDir == null ? aServer.getBackend().getFileFromLibertyServerRoot("logs") : + new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), logDir); +// return new RemoteFile(aServer.getNode().getMachine(), aServer.expandString(getBinaryTraceChild(aServer) +// .getAttributeByName("dataDirectory").getValueAsString())); + } + + public static RemoteFile getTextLogDir(Server aServer) throws Exception { + String logDir = aServer.getBackend().getServerConfiguration().getLogging().getLogDirectory(); + return logDir == null ? aServer.getBackend().getFileFromLibertyServerRoot("logs") : + new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), logDir); +// return new RemoteFile(aServer.getNode().getMachine(), aServer.expandString(getTextLogChild(aServer).getAttributeByName( +// "dataDirectory").getValueAsString())); + } + + /** + * A utility method to get log repository from a remote application server. The entire log repository will be copied + * to the location specified. + * + * @param aServer + * The Application Server from which to retrieve the log repository from. + * + * @param destinationDir + * A RemoteFile handle to the directory where you want the log repository copied to. + * + * @return true if the copy was successful. + */ + public static boolean getLogRepositoryFromServer(Server aServer, RemoteFile destinationDir) throws Exception { + RemoteFile remoteLogsDir = CommonTasks.getBinaryLogDir(aServer); + RemoteFile remoteLogRepository = new RemoteFile(remoteLogsDir.getMachine(), remoteLogsDir, "logdata"); + + return destinationDir.copyFromSource(remoteLogRepository, true, true); + } + + /** + * A utility method to get a compressed log repository from a remote application server. The entire log repository + * will be copied to the location specified. + * + * @param aServer + * The Application Server from which to retrieve the log repository from. + * + * @param destinationZipFile + * A RemoteFile handle to the zip file where you want the zipped log repository copied to to. Note if the + * file already exists it will be overwritten. + * + * @return true if the copy was successful. + */ + public static boolean getZippedLogRepositoryFromServer(Server aServer, RemoteFile destinationZipFile) throws Exception { + return zipAndCopyARepositoryFromServer(aServer, destinationZipFile, CommonTasks.LOGS); + } + + /** + * A utility method to get trace repository from a remote application server. The entire trace repository will be + * copied to the location specified. + * + * @param aServer + * The Application Server from which to retrieve the trace repository from. + * + * @param destinationDir + * A RemoteFile handle to the directory where you want the trace repository copied to. + * + * @return true if the copy was successful. + */ + public static boolean getTraceRepositoryFromServer(Server aServer, RemoteFile destinationDir) throws Exception { + RemoteFile remoteTraceDir = CommonTasks.getBinaryTraceDir(aServer); + RemoteFile remoteTraceRepository = new RemoteFile(remoteTraceDir.getMachine(), remoteTraceDir, "tracedata"); + + return destinationDir.copyFromSource(remoteTraceRepository, true, true); + } + + /** + * A utility method to get a compressed trace repository from a remote application server. The entire trace repository + * will be copied to the location specified. + * + * @param aServer + * The Application Server from which to retrieve the log repository from. + * + * @param destinationZipFile + * A RemoteFile handle to the zip file where you want the zipped log repository copied to to. Note if the + * file already exists it will be overwritten. + * + * @return true if the copy was successful. + */ + public static boolean getZippedTraceRepositoryFromServer(Server aServer, RemoteFile destinationZipFile) throws Exception { + return zipAndCopyARepositoryFromServer(aServer, destinationZipFile, CommonTasks.TRACE); + } + + private static boolean zipAndCopyARepositoryFromServer(Server aServer, RemoteFile destinationZipFile, String repositoryType) throws Exception { + RemoteFile remoteRepositoryDir = null; + String repositorySubDirName = "logdata"; // default is logs + if (repositoryType.equals(CommonTasks.TRACE)) { + remoteRepositoryDir = CommonTasks.getBinaryTraceDir(aServer); + repositorySubDirName = "tracedata"; + } else + remoteRepositoryDir = CommonTasks.getBinaryLogDir(aServer); + + Machine rMachine = remoteRepositoryDir.getMachine(); + RemoteFile remoteRepository = new RemoteFile(rMachine, remoteRepositoryDir, repositorySubDirName); + + String tmpZipFileName = ".tmp_" + Thread.currentThread().getId() + "_" + System.currentTimeMillis() + ".zip"; + RemoteFile rProfileLogsDir = new RemoteFile(rMachine, aServer.getNode().getProfileDir() + rMachine.getOperatingSystem().getFileSeparator() + "logs"); + RemoteFile tmpZipFile = new RemoteFile(rMachine, rProfileLogsDir, tmpZipFileName); + + // 1. Have the files zipped up on the server. + // Build the URL to this test case + String URLsuffix = "/" + HPEL_APP_CONTEXT_ROOT + "/" + RAS_ZIPPER_UTIL_JSP; + String URL = CommonActions.getUrl((ApplicationServer) aServer, URLsuffix, false); + + writeLogMsg(Level.FINE, "Calling RazZipper to compress remote files"); + writeLogMsg(Level.FINE, "URL: " + URL); + writeLogMsg(Level.FINE, "inputFile: " + remoteRepository.getAbsolutePath()); + writeLogMsg(Level.FINE, "outputZipArchive: " + tmpZipFile.getAbsolutePath()); + + WebRequest request = new PostMethodWebRequest(URL); + request.setParameter("inputFile", remoteRepository.getAbsolutePath()); + request.setParameter("outputZipArchive", tmpZipFile.getAbsolutePath()); + // request.setParameter("archiveComment", "" ); + + WebConversation wc = new WebConversation(); + WebResponse response = null; + response = wc.getResponse(request); + if (response == null) + writeLogMsg(Level.WARNING, "The response from RasZipper is null"); + if (response.getResponseCode() != 200) + writeLogMsg(Level.WARNING, "Unxpected response code from RasZipper. Recieved response code of: " + + response.getResponseCode()); + + // 2. Copy the zip file to the destination + boolean returneCode = destinationZipFile.copyFromSource(tmpZipFile, true, true); + if (!tmpZipFile.delete()) // clean up our tmp file. + writeLogMsg(Level.WARNING, "Could not delete tmp zip file " + tmpZipFile.getAbsolutePath()); + return returneCode; + } + + /** + * A utility method to get log and trace repository from a remote application server. The entire repository will be + * copied to the location specified. + * + * @param aServer + * The Application Server from which to retrieve the repository from. + * + * @param destinationDir + * A RemoteFile handle to the directory where you want the repository copied to. + * + * @return true if the copy was successful. + */ + public static boolean getRepositoryFromServer(Server aServer, RemoteFile destinationDir) throws Exception { + RemoteFile rRepLogDataDir = new RemoteFile(aServer.getNode().getMachine(), CommonTasks.getBinaryLogDir(aServer), "logdata"); + RemoteFile rRepTraceDataDir = new RemoteFile(aServer.getNode().getMachine(), CommonTasks.getBinaryTraceDir(aServer), + "tracedata"); + boolean logCopyResult = false; + boolean traceCopyResult = false; + if (rRepLogDataDir.exists()) { + // copy the logdata dir + RemoteFile destLogDataDir = new RemoteFile(destinationDir.getMachine(), destinationDir, "logdata"); + logCopyResult = destLogDataDir.copyFromSource(rRepLogDataDir, true, true); + } + if (rRepTraceDataDir.exists()) { + // copy the logdata dir + RemoteFile destTraceDataDir = new RemoteFile(destinationDir.getMachine(), destinationDir, "tracedata"); + traceCopyResult = destTraceDataDir.copyFromSource(rRepTraceDataDir, true, true); + } + + return (logCopyResult && traceCopyResult); + } + + /** + * A simple method used to log messages to the output.txt log + * + * @param logLevel + * The level you want the message written as. If null will default to INFO + * + * @param msg + * The message to log. + */ + public static void writeLogMsg(Level logLevel, String msg) { + // default to INFO if level is null + if (logLevel == null) + logLevel = Level.INFO; + // determine who called me + StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); + StackTraceElement element = stackTraceElements[3]; // get the latest entry after the calls to get stracktrace + Logger bucketLogger = Logger.getLogger(element.getClassName()); + bucketLogger.logp(logLevel, element.getClassName(), element.getMethodName(), msg); + } + + /** + * A simple method used to log messages to the output.txt log + * + * @param logLevel + * The level you want the message written as. If null will default to INFO + * + * @param msg + * The message to log. + * @param thrown + * Throwable to be logged + */ + public static void writeLogMsg(Level logLevel, String msg, Throwable thrown) { + // default to INFO if level is null + if (logLevel == null) + logLevel = Level.INFO; + // determine who called me + StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); + StackTraceElement element = stackTraceElements[3]; // get the latest entry after the calls to get stracktrace + Logger bucketLogger = Logger.getLogger(element.getClassName()); + bucketLogger.logp(logLevel, element.getClassName(), element.getMethodName(), msg, thrown); + } + + /** + * Stops and removes all Application Servers, Web Servers, and Proxy Servers in the specified cell, except for those + * specified in the excludes set + * + * @param cell + * The cell where you want to remove servers. + * @param excludedServers + * The Set of servers you want to keep. + * @throws Exception + * Thrown if any server can't be removed + */ + public static void removeUnusedServers(Cell cell, Set excludedServers) throws Exception { + if (cell == null) { + return; + } + try { + Set allServers = cell.getServers(); + for (Server server : allServers) { + ServerType type = server.getServerType(); + if (ServerType.PROXY_SERVER.equals(type) || ServerType.WEB_SERVER.equals(type) + || ServerType.APPLICATION_SERVER.equals(type)) { + if (!excludedServers.contains(server)) { + writeLogMsg(Level.INFO, "Removing the server " + server.getName()); + remove(server); + } + } + } + } catch (Exception e) { + throw new Exception("Unable to remove unused Servers in the Cell named " + cell.getName(), e); + } + } + + /** + * Removes a Server from the WebSphere configuration (and Simplicity object model) using Simplicity. If the server + * is currently running, it will be stopped before it's removed. + * + * @param server + * The Server you wish to remove. + * @throws Exception + * If Simplicity fails to remove the server. + */ + public static void remove(Server server) throws Exception { + if (server == null) { + return; // nothing to do + } + Level logAtlevel = Level.INFO; + writeLogMsg(logAtlevel, "Removing a Server..."); + ProcessStatus status = server.getServerStatus(); + String serverName = server.getName(); + + writeLogMsg(logAtlevel, " Type: " + server.getServerType().toString()); + writeLogMsg(logAtlevel, " Name: " + serverName); + Node node = server.getNode(); + if (node == null) { + writeLogMsg(logAtlevel, " Node: null"); + } else { + writeLogMsg(logAtlevel, " Node: " + node.getName()); + Cell cell = node.getCell(); + if (cell == null) { + writeLogMsg(logAtlevel, " Cell: null"); + } else { + writeLogMsg(logAtlevel, " Cell: " + cell.getName()); + } + } + writeLogMsg(logAtlevel, " Status: " + server.getName()); + + StopWatch timer = new StopWatch(); + timer.start(); + if (ProcessStatus.RUNNING.equals(status)) { + writeLogMsg(logAtlevel, "Since the server is currently running, it will be stopped and then removed."); + server.stop(); + } + server.getNode().deleteServer(serverName); + timer.stop(); + + writeLogMsg(logAtlevel, "The Server was removed after: " + timer.getTimeElapsedAsString()); + + } + + /** + * Starts a server and explicitly sets the timeout value for the mBean start operation. On slower systems, + * especially z/OS where the server startup takes longer use of this start method may be needed. Using this method + * uses a higher timeout value when starting the application server. + * + * @param serverToStart + * The Server you wish to start. + * @throws Exception + * If Simplicity fails to start the server. + */ + public static void startServer(Server serverToStart) throws Exception { + serverToStart.start(SERVER_START_MBEAN_TIMEOUT); + } + + /** + * To add new properties to bootstrap file + * + * @param appServer + * @param propertyName + * @param propertyValue + * @throws Exception + */ + public static void addBootstrapProperty(Server appServer, String propertyName, String propertyValue) throws Exception { + + LibertyServer server = appServer.getBackend(); + RemoteFile bootstrapFile = server.getServerBootstrapPropertiesFile(); + Properties bootstrapProps = new Properties(); + bootstrapProps.setProperty(propertyName, propertyValue); + bootstrapProps.store(bootstrapFile.openForWriting(true), null); + + } + + /** + * Returns a ConfigObject representing the JVMEntries for an Application Server. The JVMEntries is a child object of + * processDefinition. It's useful for getting at the systemProperties / customProperties configured for an + * application server. + * + * @param appServ + * The Server you want the JVMEntries ConfigObject for. + * @param procType + * Optional. Specifies which zOSProcessType type for this server you want to get the JVMEntries for. If + * the value is null, then Servant is used as a default. This parameter is ignored on non z/OS platforms. + * + * @throws Exception + */ +// public static ConfigObject getJVMEntries(Server appServ, zOSProcessType procType) throws Exception { +// if (procType == null) +// procType = zOSProcessType.Servant; +// +// ConfigObject jvmProcessDefCfgObj = null; +// if (appServ.getNode().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS)) { +// // We are on z/OS. Need to get the process def for the procType. +// CommonTasks.writeLogMsg(Level.INFO, "z/OS detected. Getting the Process Definition ConfigObject for " + procType.toString()); +// List jvmProcessDefCfgObjList = ConfigObject.getConfigObjectList(appServ, appServ.getConfigId(), +// "JavaProcessDef"); +// for (ConfigObject cfgObj : jvmProcessDefCfgObjList) { +// if (cfgObj.getAttributeByName("processType").getValueAsString().equals(procType.toString())) { +// // We have the zOSProcessType process def. +// CommonTasks.writeLogMsg(Level.INFO, "Found the " + procType + " Process Definition."); +// jvmProcessDefCfgObj = cfgObj; +// break; // no need to complete the for loop +// } else { +// CommonTasks.writeLogMsg(Level.INFO, "Found the Process Definition for " +// + cfgObj.getAttributeByName("processType").getValueAsString()); +// } +// } +// } else { +// // distributed systems have only one JavaProcessDef configObject +// CommonTasks.writeLogMsg(Level.INFO, "Getting the Process Definition ConfigObject"); +// jvmProcessDefCfgObj = ConfigObject.getConfigObject(appServ, appServ.getConfigId(), "JavaProcessDef"); +// } +// if (jvmProcessDefCfgObj == null) +// CommonTasks.writeLogMsg(Level.WARNING, "Warning Process Definition ConfigObject is null."); +// ConfigObject jvmEntriesCfgObj = ConfigObject.getConfigObject(appServ, jvmProcessDefCfgObj.getConfigIdentifier(), +// "JavaVirtualMachine"); +// return jvmEntriesCfgObj; +// } + + /** + * Sets JVM system property / custom JVM property. + * + * @param theServer + * The application server on which to set the JVM system property. + * @param zProcType + * The zOSProcessType to use if on z/OS platform. Determine which process type updated on z/OS. + * @param propertyName + * The property name. + * @param propertyValue + * The value to set the property to. If the value passed in is null, and a property already exists in the + * config, the property will be removed from the config. + * @param requiredProp + * A boolean representing if the property is required or not. + * @return boolean Boolean value of true if changes to the configuration were required, false if no changes were + * needed. + * */ +// public static boolean setCustomJVMPropertyInConfig(ApplicationServer theServer, CommonTasks.zOSProcessType zProcType, +// String propertyName, String propertyValue, boolean requiredProp) throws Exception { +// CommonTasks.writeLogMsg(Level.INFO, "Setting custom property " + propertyName + " with a value of " + propertyValue); +// Workspace tmpWS = theServer.getNode().getCell().getWorkspace(); +// ConfigObject jvmEntriesCfgObj = CommonTasks.getJVMEntries(theServer, zProcType); +// if (null == jvmEntriesCfgObj) +// throw new Exception("Could not obtain Process JVMEntries"); +// +// // Check if and entry for propertyName already exists +// ConfigObject aProperty = null; +// List jvmCustomProps = jvmEntriesCfgObj.getChildObjects(); +// if (null == jvmCustomProps) +// throw new Exception("Could not obtain JVM Properties"); +// +// for (ConfigObject i : jvmCustomProps) { +// // check if we have an existing matching property. +// if ((i.getName().equals("systemProperties")) +// && i.getAttributeByName("name").getValueAsString().equalsIgnoreCase(propertyName)) { +// CommonTasks.writeLogMsg(Level.INFO, "Found system Propery " + propertyName + " in config with a value of " +// + i.getAttributeByName("value").getValueAsString()); +// aProperty = i; +// break; +// } +// } +// +// if (aProperty != null) { +// // The property already exists in the configuration. +// if (null == propertyValue) { // remove the property since the value passed in was null. +// CommonTasks.writeLogMsg(Level.FINE, "Removing the systemPropery " + propertyName + " since set value is null."); +// jvmCustomProps.remove(aProperty); +// } else { +// if ((propertyValue.equals(aProperty.getAttributeByName("value").getValueAsString())) +// && (requiredProp == aProperty.getAttributeByName("required").getValueAsBoolean())) { +// // The property is already set to what we want. Do nothing. +// CommonTasks.writeLogMsg(Level.INFO, "The property " + propertyName + " already set to " + propertyValue +// + ". No changes were made."); +// return false; // return that no changes were needed. +// } else { +// // The property is not set to what we want. Change the value. +// aProperty.getAttributeByName("value").setValue(propertyValue); +// aProperty.getAttributeByName("required").setValue(requiredProp); +// CommonTasks.writeLogMsg(Level.INFO, "Updated JVM custom property " + propertyName + " with a value of " +// + propertyValue); +// } +// } +// } else { +// if (null != propertyValue) { // don't create if propertyValue was null +// // The property does not already exist. +// CommonTasks.writeLogMsg(Level.FINE, "The property " + propertyName + " does not exists."); +// +// // we need to create the property and set it's value. +// CommonTasks.writeLogMsg(Level.INFO, "Creating the new JVM custom / System property " + propertyName); +// ConfigObject newJvmProperty = ConfigObject.createConfigObject(theServer, "Property", jvmEntriesCfgObj); +// CommonTasks.writeLogMsg(Level.FINE, "Setting attributes / name and value for new JVM custom property"); +// newJvmProperty.getAttributeByName("name").setValue(propertyName); +// newJvmProperty.getAttributeByName("value").setValue(propertyValue); +// newJvmProperty.getAttributeByName("required").setValue("false"); +// } +// } +// +// // if we have not already returned false, then we changed something and need to save & sync before we return +// // true that we have changed the configuration. +// CommonTasks.writeLogMsg(Level.FINE, "Calling saveAndSync() on the workspace to persist changes."); +// tmpWS.saveAndSync(); +// return true; +// } + + /** + * Gets the value as a String of a JVM system property / custom JVM property. If the property does not exist a value + * of null is returned. + * + * @param theServer + * The application server on which to set the JVM system property. + * @param zProcType + * The zOSProcessType to use if on z/OS platform. Determine which process type updated on z/OS. + * @param propertyName + * The property name. + * @return propertyValue The value to set the property to. Returns null if property is not found. + * */ +// public String getCustomJVMPropertyInConfig(ApplicationServer theServer, CommonTasks.zOSProcessType zProcType, String propertyName) +// throws Exception { +// CommonTasks.writeLogMsg(Level.INFO, "Getting custom property " + propertyName); +// ConfigObject jvmEntriesCfgObj = CommonTasks.getJVMEntries(theServer, zProcType); +// if (null == jvmEntriesCfgObj) +// throw new Exception("Could not obtain Process JVMEntries"); +// +// // Check if and entry for propertyName already exists +// List jvmCustomProps = jvmEntriesCfgObj.getChildObjects(); +// if (null == jvmCustomProps) +// throw new Exception("Could not obtain JVM Properties"); // there may not be any child props but there should +// // be child objects still. +// +// for (ConfigObject i : jvmCustomProps) { +// // check if we have an existing property. +// if ((i.getName().equals("systemProperties")) +// && i.getAttributeByName("name").getValueAsString().equalsIgnoreCase(propertyName)) { +// CommonTasks.writeLogMsg(Level.INFO, "Found system Propery " + propertyName + " in config with a value of " +// + i.getAttributeByName("value").getValueAsString()); +// return i.getAttributeByName("value").getValueAsString(); +// } +// } +// return null; +// } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/lib/fat.harness.jar b/dev/com.ibm.ws.logging.hpel_fat/lib/fat.harness.jar new file mode 100755 index 000000000000..7656962e7570 Binary files /dev/null and b/dev/com.ibm.ws.logging.hpel_fat/lib/fat.harness.jar differ diff --git a/dev/com.ibm.ws.logging.hpel_fat/lib/htmlunit-2.4.jar b/dev/com.ibm.ws.logging.hpel_fat/lib/htmlunit-2.4.jar new file mode 100755 index 000000000000..8a5bb3cff125 Binary files /dev/null and b/dev/com.ibm.ws.logging.hpel_fat/lib/htmlunit-2.4.jar differ diff --git a/dev/com.ibm.ws.logging.hpel_fat/lib/phased.junit.jar b/dev/com.ibm.ws.logging.hpel_fat/lib/phased.junit.jar new file mode 100755 index 000000000000..168280556614 Binary files /dev/null and b/dev/com.ibm.ws.logging.hpel_fat/lib/phased.junit.jar differ diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_1.xml new file mode 100755 index 000000000000..96ca53fe151d --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_1.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_2.xml new file mode 100755 index 000000000000..3001d33bb9b6 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_2.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeInvalid.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeInvalid.xml new file mode 100755 index 000000000000..fa0ff63a17f1 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeInvalid.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_1.xml new file mode 100755 index 000000000000..7afb6ad18dcc --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_1.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_2.xml new file mode 100755 index 000000000000..a5aee2c82e52 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_2.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_3.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_3.xml new file mode 100755 index 000000000000..9e2e53c5ed9d --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_3.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_4.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_4.xml new file mode 100755 index 000000000000..427e7cad0476 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_4.xml @@ -0,0 +1,13 @@ + + + jsp-2.2 + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_5.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_5.xml new file mode 100755 index 000000000000..10d2f6784e65 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_5.xml @@ -0,0 +1,14 @@ + + + jsp-2.2 + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_6.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_6.xml new file mode 100755 index 000000000000..2656bcc6e179 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_6.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_7.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_7.xml new file mode 100755 index 000000000000..767564cbe877 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_7.xml @@ -0,0 +1,11 @@ + + + jsp-2.2 + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_1.xml new file mode 100755 index 000000000000..f6c503a3be0c --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_1.xml @@ -0,0 +1,14 @@ + + + jsp-2.2 + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_2.xml new file mode 100755 index 000000000000..e1b2e9b159d7 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_2.xml @@ -0,0 +1,13 @@ + + + jsp-2.2 + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDeleteEmptyDirectories.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDeleteEmptyDirectories.xml new file mode 100755 index 000000000000..8c79c52b470a --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDeleteEmptyDirectories.xml @@ -0,0 +1,14 @@ + + + jsp-2.2 + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_1.xml new file mode 100755 index 000000000000..45c04395a5ed --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_1.xml @@ -0,0 +1,13 @@ + + + jsp-2.2 + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_2.xml new file mode 100755 index 000000000000..f700afe75aef --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_2.xml @@ -0,0 +1,13 @@ + + + jsp-2.2 + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_1.xml new file mode 100755 index 000000000000..98fce4b1e73a --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_1.xml @@ -0,0 +1,11 @@ + + + jsp-2.2 + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_2.xml new file mode 100755 index 000000000000..f86da35d1297 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_2.xml @@ -0,0 +1,11 @@ + + + jsp-2.2 + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_1.xml new file mode 100755 index 000000000000..180e0f092d49 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_1.xml @@ -0,0 +1,14 @@ + + + jsp-2.2 + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_2.xml new file mode 100755 index 000000000000..2925c7ac0318 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_2.xml @@ -0,0 +1,11 @@ + + + jsp-2.2 + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelTextLogRetention.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelTextLogRetention.xml new file mode 100755 index 000000000000..a39050a34c5c --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelTextLogRetention.xml @@ -0,0 +1,13 @@ + + + jsp-2.2 + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-TraceSpecificationSetToAllTest.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-TraceSpecificationSetToAllTest.xml new file mode 100755 index 000000000000..b1eb87a21a7f --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-TraceSpecificationSetToAllTest.xml @@ -0,0 +1,9 @@ + + + + jsp-2.2 + servlet-3.0 + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/.gitignore b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/.gitignore new file mode 100644 index 000000000000..f3f483d82c07 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/.gitignore @@ -0,0 +1 @@ +/dropins diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/bootstrap.properties b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/bootstrap.properties new file mode 100755 index 000000000000..98a6db1b7691 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/bootstrap.properties @@ -0,0 +1,3 @@ +bootstrap.include=../testports.properties +websphere.log.provider=binaryLogging-1.0 +com.ibm.ws.logging.console.log.level=INFO diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/server.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/server.xml new file mode 100755 index 000000000000..179455eb2d86 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/server.xml @@ -0,0 +1,9 @@ + + + jsp-2.2 + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/LogCreator.jsp b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/LogCreator.jsp new file mode 100755 index 000000000000..fca0089a9401 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/LogCreator.jsp @@ -0,0 +1,136 @@ + + +HPEL Function Test JSP + + +<%@page + import="java.util.*, java.io.*, com.ibm.ejs.ras.*, java.security.*" +%> +

+
Date: <%= new java.util.Date() %> +

+ +<% +String actionToPerform = request.getParameter( "ActionParam" ); +//make the default action Logs +if (actionToPerform == null) actionToPerform = "Logs"; + +if (actionToPerform.equals("Help")) { + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println("
Parmeters:  
IterationsDefault: 50Will log the message iterations times"); + out.println("
LoggerNameDefault: com.ibm.ws.fat.hpel.tests.Default_HPELTestLoggerWill create a logger with the specificed name"); + out.println("
LevelDefault: ALLWill log messages Only to the specificed level [SEVERE, WARNING, INFO, FINE, FINER, FINEST]"); + out.println("
MessageDefault: Default HPEL MessageWill log the message passed to the JSP
SleepDefault: -1No sleep delay between logging
"); +} else { + String parmStr = request.getParameter("Iterations") ; + int numIterations = (parmStr == null) ? 49 : Integer.parseInt(parmStr) ; + + parmStr = request.getParameter("Message"); + String logMessage = (parmStr == null) ? "Default HPEL Message" : parmStr; + + parmStr = request.getParameter("LoggerName"); + String loggerName = (parmStr == null) ? "com.ibm.ws.fat.hpel.tests.Default_HPELTestLogger" : parmStr; + + parmStr = request.getParameter("Level"); + String level = (parmStr == null) ? "ALL" : parmStr; + + parmStr = request.getParameter("Sleep"); + int secondsToSleep = (parmStr == null) ? -1 : Integer.parseInt(parmStr); + + java.util.logging.Level passedLevel = null; + if (!level.equals("ALL")) { + if (level.toLowerCase().equals("severe")) passedLevel = java.util.logging.Level.SEVERE; + else if (level.toLowerCase().equals("warning")) passedLevel = java.util.logging.Level.WARNING; + else if (level.toLowerCase().equals("info")) passedLevel = java.util.logging.Level.INFO; + else if (level.toLowerCase().equals("fine")) passedLevel = java.util.logging.Level.FINE; + else if (level.toLowerCase().equals("finer")) passedLevel = java.util.logging.Level.FINER; + else if (level.toLowerCase().equals("finest")) passedLevel = java.util.logging.Level.FINEST; + } + + out.println("

Start time of JSP load: " + new java.util.Date() + "

"); + + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println("
Name Value
******Parms specific to this run******
Iterations " + numIterations + "
LoggerName " + loggerName + "
Level " + level + "
Message " + logMessage + "
Action " + actionToPerform + "
Sleep " + secondsToSleep + " milliseconds
") ; + + java.util.logging.Logger logger = java.util.logging.Logger.getLogger(loggerName); + + out.println("Action to perform: " + actionToPerform); + if (actionToPerform.equals("Logs")) { + out.println("Action performed: Logs"); + if (level.equals("ALL")) { + out.println("Level: ALL"); + for (int j = 0; j < numIterations; j++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(java.util.logging.Level.SEVERE, loggerName, "Method.Severe", logMessage); + logger.logp(java.util.logging.Level.WARNING, loggerName, "Method.Warning", logMessage); + logger.logp(java.util.logging.Level.INFO, loggerName, "Method.Info", logMessage); + } + } else { + out.println("Level: " + passedLevel); + for (int i = 0; i < numIterations; i++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(passedLevel, loggerName, passedLevel.getName(), logMessage); + } + } + } else if (actionToPerform.equals("Trace")) { + out.println("Action performed: Trace"); + if (level.equals("ALL")) { + out.println("Level: ALL"); + for (int j = 0; j < numIterations; j++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(java.util.logging.Level.FINE, loggerName, "Method.Fine", logMessage); + logger.logp(java.util.logging.Level.FINER, loggerName, "Method.Finer", logMessage); + logger.logp(java.util.logging.Level.FINEST, loggerName, "Method.Finest", logMessage); + } + } else { + out.println("Level: " + passedLevel); + for (int i = 0; i < numIterations; i++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(passedLevel, loggerName, passedLevel.getName(), logMessage); + } + } + } else if (actionToPerform.equals("LogsAndTrace")) { + out.println("Action performed: LogsAndTrace"); + if (level.equals("ALL")) { + out.println("Level: ALL"); + for (int j = 0; j < numIterations; j++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(java.util.logging.Level.FINE, loggerName, "Method.Fine", logMessage); + logger.logp(java.util.logging.Level.FINER, loggerName, "Method.Finer", logMessage); + logger.logp(java.util.logging.Level.FINEST, loggerName, "Method.Finest", logMessage); + logger.logp(java.util.logging.Level.SEVERE, loggerName, "Method.Severe", logMessage); + logger.logp(java.util.logging.Level.WARNING, loggerName, "Method.Warning", logMessage); + logger.logp(java.util.logging.Level.INFO, loggerName, "Method.Info", logMessage); + } + } else { + out.println("Level: " + passedLevel); + for (int i = 0; i < numIterations; i++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(passedLevel, loggerName, passedLevel.getName(), logMessage) ; + } + } + } else { + out.println("Action performed: NOTHING"); + } + out.println("

End time of JSP load: " + new java.util.Date() + "

"); +} +%> + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/META-INF/permissions.xml b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..2ec4e2c6204c --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/META-INF/permissions.xml @@ -0,0 +1,14 @@ + + + + + java.util.logging.LoggingPermission + control + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/WEB-INF/web.xml b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..4427dd030b0b --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + + HpelFatWAR + This is a servlet designed to test autoInstall. + + + + WritingCustomLogServlet + WritingCustomLogServlet + Write to custom log ... that's it!. + com.ibm.ws.logging.hpel_fat.WritingCustomLogServlet + + + + + + WritingCustomLogServlet + /* + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel/handlers/MyCustomHandler.java b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel/handlers/MyCustomHandler.java new file mode 100755 index 000000000000..3cf7d6d6ac88 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel/handlers/MyCustomHandler.java @@ -0,0 +1,11 @@ +package com.ibm.ws.logging.hpel.handlers; + +import java.io.IOException; +import java.util.logging.FileHandler; + +public class MyCustomHandler extends FileHandler { + public MyCustomHandler(String pattern, int limit, int count, boolean append) + throws SecurityException, IOException { + super(pattern, limit, count, append); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel_fat/WritingCustomLogServlet.java b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel_fat/WritingCustomLogServlet.java new file mode 100755 index 000000000000..e857d3e1060d --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel_fat/WritingCustomLogServlet.java @@ -0,0 +1,80 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.hpel_fat; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.logging.SimpleFormatter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.ibm.ws.logging.hpel.handlers.MyCustomHandler; + +/** + * This is a servlet to write logs to a custom file + */ +public class WritingCustomLogServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + private final Logger logger = Logger.getLogger(getClass().getPackage() + .getName()); + + @Override + public void init() throws ServletException { + logger.setLevel(Level.ALL); + try { + MyCustomHandler handler = new MyCustomHandler("customlog.log", 50000, 10, true); + handler.setLevel(Level.ALL); + handler.setFormatter(new SimpleFormatter()); + logger.addHandler(handler); + } catch (Exception e) { + logger.severe("FileHanler initilization failed:" + + e.toString()); + e.printStackTrace(); + } + } + + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + logger.finest("Entering in to the doGet() method."); + logger.info("doGet method of WritingCustomLogServlet called and now calling the doService"); + doService(request, response); + logger.finest("Exiting from the doGet() method."); + } + + @Override + protected void doPost(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + logger.finest("Entering in to the doPost() method."); + logger.info("doPost method of WritingCustomLogServlet is called and now calling the doService"); + doService(request, response); + logger.finest("Exiting from the doPost() method."); + } + + protected void doService(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + logger.finest("Entering in to the doService() method."); + logger.fine("This is Fine message in doGet()"); + logger.finer("This is Finer message in doGet()"); + logger.config("This is config message in doGet()"); + + PrintWriter pw = response.getWriter(); + pw.println("Servlet successfullly completed"); + + this.logger.finest("Exiting from doService() method."); + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/META-INF/permissions.xml b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..2ec4e2c6204c --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/META-INF/permissions.xml @@ -0,0 +1,14 @@ + + + + + java.util.logging.LoggingPermission + control + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/WEB-INF/web.xml b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..11f8c9b6f4ca --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/WEB-INF/web.xml @@ -0,0 +1,30 @@ + + + + + LRC + LRC servlet + + + LogDecoratorFilter + com.ibm.ws.test.LogDecoratorFilter + + IncludeParameter + userName productId + + + + LogDecoratorFilter + /* + + + + LogServlet + com.ibm.ws.logging.hpel.LRCServlet + + + LogServlet + /* + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/logging/hpel/LRCServlet.java b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/logging/hpel/LRCServlet.java new file mode 100755 index 000000000000..0824021a1327 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/logging/hpel/LRCServlet.java @@ -0,0 +1,39 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.hpel; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + */ +public class LRCServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException + { + PrintWriter out = res.getWriter(); + res.setContentType("text/html"); + out.println("LRC Servlet"); + out.println("LRC Servlet"); + System.out.println("LRC Servlet doGet Method stars"); + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/LogDecoratorFilter.java b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/LogDecoratorFilter.java new file mode 100755 index 000000000000..e503d427a0d1 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/LogDecoratorFilter.java @@ -0,0 +1,145 @@ +/* + * This program may be used, executed, copied, modified and distributed + * without royalty for the purpose of developing, using, marketing, or distributing. + */ + +package com.ibm.ws.test; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import com.ibm.websphere.logging.hpel.LogRecordContext; + +/** + * This servlet filter adds configured request query parameters to the + * LogRecordContext + * + * Sample content to add to web.xml deployment descriptor to configure this + * servlet filter to add the userName and productId request query parameters to + * the LogRecordContext: + * + * + * LogDecoratorFilter + * com.test.LogDecoratorFilter + * + * IncludeParameter + * userName productId + * + * + * + * LogDecoratorFilter + * /* + * + * + */ +public class LogDecoratorFilter implements Filter { + + private static Logger logger = Logger.getLogger("com.ibm.ws.test.LogDecoratorFilter"); + + private ThreadLocalStringExtension[] extensions; + private String[] extensionNames; + + /** + * Default constructor. + */ + public LogDecoratorFilter() {} + + /** + * @see Filter#destroy() + */ + @Override + public void destroy() { + logger.info("LogDecoratorFilter - destroy"); + for (String extensionName : extensionNames) { + LogRecordContext.unregisterExtension(extensionName); + } + } + + /** + * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) + */ + @Override + public void doFilter(ServletRequest servletRequest, + ServletResponse servletResponse, + FilterChain filterChain) + throws IOException, ServletException { + logger.info("LogDecoratorFilter - doFilter"); + + // set values we want to log + for (int i = 0; i < extensionNames.length; i++) { + String value = servletRequest.getParameter(extensionNames[i]); + extensions[i].setValue(value); + logger.info(extensionNames[i] + " set to: " + value); + } + + // pass the request along the filter chain + filterChain.doFilter(servletRequest, servletResponse); + + // unset the values so they don't leak to other threads + for (int i = 0; i < extensionNames.length; i++) { + extensions[i].setValue(null); + logger.info(extensionNames[i] + " set to: " + null); + } + } + + /** + * @see Filter#init(FilterConfig) + */ + @Override + public void init(FilterConfig filterConfig) throws ServletException { + logger.info("LogDecoratorFilter - init"); + + // get names from deployment descriptor + List names = getIncludeParameters(filterConfig); + + // set up an extension for each name + extensionNames = new String[names.size()]; + extensions = new ThreadLocalStringExtension[names.size()]; + Map extns = new HashMap(); + for (int i = 0; i < names.size(); i++) { + extensionNames[i] = names.get(i); + extensions[i] = new ThreadLocalStringExtension(); + LogRecordContext.registerExtension(extensionNames[i], extensions[i]); + LogRecordContext.getExtensions(extns); + logger.info("LogRecordContextExtensions ::" + extns); + } + logger.info("LogDecoratorFilter - init -Ends"); + } + + private List getIncludeParameters(FilterConfig filterConfig) { + + List names = new ArrayList(); + + { + Enumeration initParameterNames = filterConfig.getInitParameterNames(); + while (initParameterNames.hasMoreElements()) { + String name = initParameterNames.nextElement(); + if (!name.equals("IncludeParameter")) { + logger.info("unrecognized [" + name + "]. Only IncludeParameter accepted"); + } + else { + String combinedValue = filterConfig.getInitParameter(name); + String[] splitValue = combinedValue.split(" "); + for (String value : splitValue) { + logger.info("init parm: " + value); + names.add(value); + } + } + } + } + + return names; + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/ThreadLocalStringExtension.java b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/ThreadLocalStringExtension.java new file mode 100755 index 000000000000..8ba4a6f308da --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/ThreadLocalStringExtension.java @@ -0,0 +1,30 @@ +/* + * This program may be used, executed, copied, modified and distributed + * without royalty for the purpose of developing, using, marketing, or distributing. + */ + +package com.ibm.ws.test; + +import java.util.logging.Logger; + +import com.ibm.websphere.logging.hpel.LogRecordContext; + +public class ThreadLocalStringExtension implements LogRecordContext.Extension { + private static Logger logger = Logger.getLogger("com.ibm.ws.test.ThreadLocalStringExtension"); + + public ThreadLocalStringExtension() {} + + private final ThreadLocal threadLocalString = new ThreadLocal(); + + public void setValue(String string) { + threadLocalString.set(string); + logger.info("setValue - new value: [" + string + "] for thread " + Thread.currentThread().getName()); +// System.out.println("setValue - new value: [" + string + "] for thread " + Thread.currentThread().getName()); + } + + @Override + public String getValue() { + return threadLocalString.get(); + // don't log here or you will get a recursion + } +} diff --git a/dev/com.ibm.ws.logging.hpel_test/.classpath b/dev/com.ibm.ws.logging.hpel_test/.classpath index 31a7e51b6f78..bd880329225d 100755 --- a/dev/com.ibm.ws.logging.hpel_test/.classpath +++ b/dev/com.ibm.ws.logging.hpel_test/.classpath @@ -1,12 +1,7 @@ - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.logging.hpel_test/.classpath.gradle b/dev/com.ibm.ws.logging.hpel_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_test/.project b/dev/com.ibm.ws.logging.hpel_test/.project index f90d1b90319b..0c78f03a16b6 100755 --- a/dev/com.ibm.ws.logging.hpel_test/.project +++ b/dev/com.ibm.ws.logging.hpel_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.logging.hpel_test/bnd.bnd b/dev/com.ibm.ws.logging.hpel_test/bnd.bnd new file mode 100755 index 000000000000..22c1d910f4f6 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_test/bnd.bnd @@ -0,0 +1,17 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.logging;version=latest, \ + com.ibm.ws.logging.hpel;version=latest diff --git a/dev/com.ibm.ws.logging.hpel_test/bnd.bnd.gradle b/dev/com.ibm.ws.logging.hpel_test/bnd.bnd.gradle new file mode 100755 index 000000000000..22c1d910f4f6 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_test/bnd.bnd.gradle @@ -0,0 +1,17 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.logging;version=latest, \ + com.ibm.ws.logging.hpel;version=latest diff --git a/dev/com.ibm.ws.logging.hpel_test/build.gradle b/dev/com.ibm.ws.logging.hpel_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.logging/bnd.bnd b/dev/com.ibm.ws.logging/bnd.bnd index 4660cb3d5bba..e0bede632ac3 100644 --- a/dev/com.ibm.ws.logging/bnd.bnd +++ b/dev/com.ibm.ws.logging/bnd.bnd @@ -27,6 +27,8 @@ Export-Package: \ com.ibm.ws.logging.internal, \ com.ibm.wsspi.logging;provide:=true +Import-Package: !*.internal.*, !com.ibm.ws.kernel.boot.cmdline, * + -includeresource: \ META-INF/logging/liberty.ras.rawtracelist.properties=resources/liberty.ras.rawtracelist.properties diff --git a/dev/com.ibm.ws.logging_bvt/.classpath b/dev/com.ibm.ws.logging_bvt/.classpath index a9a147f726f1..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.logging_bvt/.classpath +++ b/dev/com.ibm.ws.logging_bvt/.classpath @@ -1,14 +1,7 @@ - - - - - - - - - - + + + diff --git a/dev/com.ibm.ws.logging_bvt/.classpath.gradle b/dev/com.ibm.ws.logging_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.logging_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging_bvt/.project b/dev/com.ibm.ws.logging_bvt/.project index bb8439125434..fc267fd6dab0 100755 --- a/dev/com.ibm.ws.logging_bvt/.project +++ b/dev/com.ibm.ws.logging_bvt/.project @@ -11,13 +11,13 @@ - com.ibm.ws.rasplugin.RASValidationBuilder + bndtools.core.bndbuilder org.eclipse.jdt.core.javanature - com.ibm.ws.rasplugin.RASValidationNature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.logging_bvt/bnd.bnd b/dev/com.ibm.ws.logging_bvt/bnd.bnd index 9cf4ec00a92f..df45604f2727 100755 --- a/dev/com.ibm.ws.logging_bvt/bnd.bnd +++ b/dev/com.ibm.ws.logging_bvt/bnd.bnd @@ -1,9 +1,16 @@ --include= ~../cnf/resources/bnd/bundle.props, +-include= ~../cnf/resources/bnd/liberty-release.props bVersion=1.0 -Bundle-Name: WAS RAS TEST -Fragment-Host: com.ibm.ws.ras -Bundle-SymbolicName: com.ibm.ws.ras.test; singleton:=true -Bundle-Description: WAS RAS TEST, version ${bVersion} +-nobundles=true -Include-Resource: build/bvt/classes +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.threading;version=latest diff --git a/dev/com.ibm.ws.logging_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.logging_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..df45604f2727 --- /dev/null +++ b/dev/com.ibm.ws.logging_bvt/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.threading;version=latest diff --git a/dev/com.ibm.ws.logging_bvt/build.gradle b/dev/com.ibm.ws.logging_bvt/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.logging_fat/.classpath b/dev/com.ibm.ws.logging_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/.classpath.gradle b/dev/com.ibm.ws.logging_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/.gitignore b/dev/com.ibm.ws.logging_fat/.gitignore new file mode 100644 index 000000000000..647380e0e0cb --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.gitignore @@ -0,0 +1 @@ +dropins diff --git a/dev/com.ibm.ws.logging_fat/.project b/dev/com.ibm.ws.logging_fat/.project new file mode 100755 index 000000000000..52807d17e176 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.logging_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..74d9c72c1f30 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,113 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.logging_fat/bnd.bnd b/dev/com.ibm.ws.logging_fat/bnd.bnd new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.logging_fat/bnd.bnd.gradle b/dev/com.ibm.ws.logging_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.logging_fat/build-test.xml b/dev/com.ibm.ws.logging_fat/build-test.xml new file mode 100755 index 000000000000..365255bee8be --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/build-test.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/build.gradle b/dev/com.ibm.ws.logging_fat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.logging_fat/delivery.sets b/dev/com.ibm.ws.logging_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/AbstractStackTraceFilteringTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/AbstractStackTraceFilteringTest.java new file mode 100755 index 000000000000..b35a9f49f361 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/AbstractStackTraceFilteringTest.java @@ -0,0 +1,105 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.net.URL; +import java.util.Arrays; +import java.util.List; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.utils.HttpUtils; + +/** + * + */ +public class AbstractStackTraceFilteringTest { + + protected static final String INTERNAL_CLASSES_REGEXP = "at \\[internal classes\\]"; + protected static final String CONSOLE_LOG = "logs/console.log"; + + protected static final int CONN_TIMEOUT = 10; + + protected static LibertyServer server; + + protected static void hitWebPage(String contextRoot, String servletName, boolean failureAllowed) throws MalformedURLException, IOException, ProtocolException { + try { + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/" + contextRoot + "/" + servletName); + int expectedResponseCode = failureAllowed ? HttpURLConnection.HTTP_INTERNAL_ERROR : HttpURLConnection.HTTP_OK; + HttpURLConnection con = HttpUtils.getHttpConnection(url, expectedResponseCode, CONN_TIMEOUT); + BufferedReader br = HttpUtils.getConnectionStream(con); + String line = br.readLine(); + // Make sure the server gave us something back + assertNotNull(line); + con.disconnect(); + } catch (IOException e) { + // A message about a 500 code may be fine + if (!failureAllowed) { + throw e; + } + + } + + } + + protected void assertConsoleLogDoesNotContain(String message, String stringToCheckFor) throws Exception { + List lines = server.findStringsInFileInLibertyServerRoot(stringToCheckFor, CONSOLE_LOG); + assertTrue(message + " (found \'" + Arrays.toString(lines.toArray()) + "\'", + lines.isEmpty()); + + } + + protected void assertConsoleLogContains(String message, String stringToCheckFor) throws Exception { + assertFalse(message + " (could not find \'" + stringToCheckFor + "\')", + server.findStringsInFileInLibertyServerRoot(stringToCheckFor, CONSOLE_LOG).isEmpty()); + + } + + protected void assertConsoleLogCountEquals(String message, String stringToCheckFor, int count) throws Exception { + assertEquals(message, count, + server.findStringsInFileInLibertyServerRoot(stringToCheckFor, CONSOLE_LOG).size()); + + } + + protected void assertMessagesLogDoesNotContain(String message, String stringToCheckFor) throws Exception { + assertTrue(message, + server.findStringsInLogs(stringToCheckFor).isEmpty()); + + } + + protected void assertMessagesLogContains(String message, String stringToCheckFor) throws Exception { + assertFalse(message, + server.findStringsInLogs(stringToCheckFor).isEmpty()); + + } + + protected void assertTraceLogDoesNotContain(String message, String stringToCheckFor) throws Exception { + assertTrue(message, + server.findStringsInTrace(stringToCheckFor).isEmpty()); + + } + + protected void assertTraceLogContains(String message, String stringToCheckFor) throws Exception { + assertFalse(message, + server.findStringsInTrace(stringToCheckFor).isEmpty()); + + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/FATSuite.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/FATSuite.java new file mode 100755 index 000000000000..6995423fed59 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/FATSuite.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * + */ +@RunWith(Suite.class) +@SuiteClasses({ StackTraceFilteringForLoggedExceptionParametersTest.class, StackTraceFilteringForLoggedExceptionWithACauseParametersTest.class, + StackTraceFilteringForPrintedExceptionTest.class, StackTraceFilteringForPrintedExceptionWithIBMCodeAtTopTest.class, + StackTraceFilteringForNoClassDefFoundErrorTest.class, StackTraceFilteringForBadlyWrittenThrowableTest.class, + StackTraceFilteringForUserFeatureExceptionTest.class, StackTraceFilteringForIBMFeatureExceptionTest.class, + StackTraceFilteringForSpecificationClassesExceptionTest.class, InvalidTraceSpecificationTest.class, + HealthCenterTest.class, TestHideMessages.class, TestHideMsgDefinedBootstrap.class, IsoDateFormatTest.class }) +public class FATSuite { + +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/HealthCenterTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/HealthCenterTest.java new file mode 100755 index 000000000000..250dc8c240bc --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/HealthCenterTest.java @@ -0,0 +1,48 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +public class HealthCenterTest { + private static final boolean J9 = System.getProperty("java.vm.name", "unknown").contains("J9"); + private static LibertyServer server; + + @BeforeClass + public static void beforeClass() { + Assume.assumeTrue(J9); + server = LibertyServerFactory.getStartedLibertyServer("com.ibm.ws.logging.healthcenter"); + } + + @Test + public void testHealthCenterInfo() throws Exception { + Assert.assertFalse("Expected healthcenter INFO message", + server.findStringsInLogs("^INFO:.*com\\.ibm\\.java\\.diagnostics\\.healthcenter\\.agent\\.iiop\\.port", + server.getConsoleLogFile()).isEmpty()); + } + + @Test + public void testConsoleLogLevelOff() throws Exception { + HttpUtils.findStringInReadyUrl(server, "/logger-servlet", "Hello world!"); + List messages = server.findStringsInLogs("Hello world!", server.getConsoleLogFile()); + Assert.assertTrue("Did not expect to find servlet Logger message: " + messages, messages.isEmpty()); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/InvalidTraceSpecificationTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/InvalidTraceSpecificationTest.java new file mode 100755 index 000000000000..044a2f4f7073 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/InvalidTraceSpecificationTest.java @@ -0,0 +1,164 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.config.Logging; +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class InvalidTraceSpecificationTest { + + protected static final String MESSAGE_LOG = "logs/messages.log"; + protected static final String INVALIDTRACEMSG = ""; + protected String invalidTraceSpec1 = "com.ibm.someInvalid.*=all"; + protected String invalidTraceSpec2 = "com.ibm.someMoreInvalid.*=all"; + private final String validTraceSpec1 = "com.ibm.ws.*=all"; + protected static LibertyServer server; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.tracespec"); + System.out.println("Starting server)"); + server.startServer(); + System.out.println("Stared server)"); + } + + //Check if we have one Warning message with "com.ibm.someInvalid.*=all" + protected void checkOnlyOneInvalidTraceSpecEntryExists() throws Exception { + List lines = server.findStringsInFileInLibertyServerRoot("TRAS0040I", MESSAGE_LOG); + assertEquals("Message TRAS0040I not appeared or appeared more than once ", 1, lines.size()); + assertMessagesLogContains(lines.get(0), invalidTraceSpec1); + } + + protected void checkNoInvalidTraceSpecEntryExists() throws Exception { + List lines = server.findStringsInFileInLibertyServerRoot("TRAS0040I", MESSAGE_LOG); + assertEquals("Message TRAS0040I not appeared or appeared more than once ", 0, lines.size()); + } + + @Test + public void testInvalidTraceSpec() throws Exception { + Logging loggingObj; + ServerConfiguration serverConfig = server.getServerConfiguration(); + loggingObj = serverConfig.getLogging(); + loggingObj.setTraceSpecification(invalidTraceSpec1); + server.setMarkToEndOfLog(); + server.updateServerConfiguration(serverConfig); + server.waitForConfigUpdateInLogUsingMark(null); + + //Test 1: Check if TRAS0040I Message appears for invalid trace spec + checkOnlyOneInvalidTraceSpecEntryExists(); + } + + /* + * This test sets valid trace string now. + */ + @Test + public void testValidTraceSpec() throws Exception { + Logging loggingObj; + ServerConfiguration serverConfig = server.getServerConfiguration(); + loggingObj = serverConfig.getLogging(); + loggingObj.setTraceSpecification(validTraceSpec1); + server.setMarkToEndOfLog(); + server.updateServerConfiguration(serverConfig); + server.waitForConfigUpdateInLogUsingMark(null); + checkNoInvalidTraceSpecEntryExists(); + + } + + /* + * Test 3. + * - Stop Server + * - Update Config with invalid trace spec + * - start server + * - TRAS0040I shouldn't appear during startup. + */ + @Test + public void testInvalidTraceSpecOffline() throws Exception { + Logging loggingObj; + server.stopServer(); + //Offline test + ServerConfiguration serverConfig = server.getServerConfiguration(); + loggingObj = serverConfig.getLogging(); + loggingObj.setTraceSpecification(invalidTraceSpec1); + server.updateServerConfiguration(serverConfig); + //Offline test. + + server.startServer(); + checkNoInvalidTraceSpecEntryExists(); + + String existingTraceString = loggingObj.getTraceSpecification(); + loggingObj.setTraceSpecification(existingTraceString + ":" + validTraceSpec1); + server.setMarkToEndOfLog(); + server.updateServerConfiguration(serverConfig); + server.waitForConfigUpdateInLogUsingMark(null); + checkOnlyOneInvalidTraceSpecEntryExists(); + + } + + /* + * Test 4 + * - Update trace specification with invalidTraceSpec1 and invalidTraceSpec2 + * - Make sure the message TRAS0040I appears for both the invalid strings + */ + @Test + public void testMultipleInvalidTraceSpec() throws Exception { + Logging loggingObj; + + ServerConfiguration serverConfig = server.getServerConfiguration(); + loggingObj = serverConfig.getLogging(); + loggingObj.setTraceSpecification(invalidTraceSpec1 + ":" + invalidTraceSpec2); + server.setMarkToEndOfLog(); + server.updateServerConfiguration(serverConfig); + server.waitForConfigUpdateInLogUsingMark(null); + + List lines = server.findStringsInFileInLibertyServerRoot("TRAS0040I", MESSAGE_LOG); + assertEquals("Expecting multiple invalid trace spec message, but not found ", 1, lines.size()); + assertMessagesLogContains(lines.get(0), invalidTraceSpec1); + assertMessagesLogContains(lines.get(0), invalidTraceSpec2); + } + + protected void assertMessagesLogContains(String message, String stringToCheckFor) throws Exception { + assertFalse(message, + server.findStringsInLogs(stringToCheckFor).isEmpty()); + + } + + @Before + public void setup() throws Exception { + if (server != null && !server.isStarted()) { + server.startServer(); + } + } + + @After + public void tearDown() throws Exception { + if (server != null && server.isStarted()) { + server.stopServer(); + } + } + +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/IsoDateFormatTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/IsoDateFormatTest.java new file mode 100644 index 000000000000..9a3a4aa564be --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/IsoDateFormatTest.java @@ -0,0 +1,311 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* WLP Copyright IBM Corp. 2017 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.config.Logging; +import com.ibm.websphere.simplicity.config.ServerConfiguration; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +/** + * + */ +public class IsoDateFormatTest { + private static final String MESSAGE_LOG = "logs/messages.log"; + private static final String TRACE_LOG = "logs/trace.log"; + private static final String TRACE_SPEC = "com.ibm.ws.logging.*=all"; + private static final String SERVER_NAME = "com.ibm.ws.logging.isodateformat"; + private static final String INVALID_ISO_DATE_FORMAT_SERVER = "server-invalidIsoDateFormat.xml"; + private static final String ISO_8601_REGEX_PATTERN = "(\\d{4})\\-(\\d{2})\\-(\\d{2})T(\\d{2})\\:(\\d{2})\\:(\\d{2})\\.(\\d{3})[+-](\\d{4})"; //ISO 8601 Format : yyyy-MM-dd'T'HH:mm:ss.SSSZ + private static final int CONN_TIMEOUT = 10; + + private static LibertyServer server; + + @BeforeClass + public static void initialSetup() throws Exception { + server = LibertyServerFactory.getLibertyServer(SERVER_NAME); + System.out.println("Starting server..."); + server.startServer(); + System.out.println("Started server."); + + // Preserve the original server configuration + server.saveServerConfiguration(); + } + + @Before + public void setUp() throws Exception { + if (server != null && !server.isStarted()) { + // Restore the original server configuration, before starting the server for each test case. + server.restoreServerConfiguration(); + server.startServer(); + } + } + + @After + public void cleanUp() throws Exception { + if (server != null && server.isStarted()) { + server.stopServer(); + } + } + + /* + * This test sets the "isoDateFormat" attribute to true and verifies the ISO-8601 date format in the messages.log file. + */ + @Test + public void testIsoDateFormatInMessagesLog() throws Exception { + // Set isoDateFormat=true and traceSpec=off in server.xml + setServerConfiguration(true, false); + + List lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, MESSAGE_LOG); + assertTrue("The date and time was not formatted in ISO-8601 format in messages.log.", lines.size() > 0); + } + + /* + * This test sets the "isoDateFormat" attribute to true and verifies the ISO-8601 date format in the trace.log file. + */ + @Test + public void testIsoDateFormatInTraceLog() throws Exception { + // Set isoDateFormat=true and traceSpec=on in server.xml + setServerConfiguration(true, true); + + List lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, TRACE_LOG); + assertTrue("The date and time was not formatted in ISO-8601 format in trace.log.", lines.size() > 0); + } + + /* + * This test sets the "isoDateFormat" attribute to true and verifies the ISO-8601 date format in the FFDC log and summary files. + */ + @Test + public void testIsoDateFormatInFFDC() throws Exception { + // Set isoDateFormat = true and traceSpec=off in server.xml + setServerConfiguration(true, false); + + // Run application to generate FFDC + hitWebPage("ffdc-servlet", "FFDCServlet", true, "?generateFFDC=true"); + + // Get latest FFDC file + ArrayList ffdcFiles = server.listFFDCFiles(SERVER_NAME); + RemoteFile ffdcFile = server.getFFDCLogFile(ffdcFiles.get(ffdcFiles.size() - 1)); //Gets the latest FFDC file. + + List lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, "logs/ffdc/" + ffdcFile.getName()); + assertTrue("The date and time was not formatted in ISO-8601 format in FFDC file.", lines.size() > 0); + + // Get latest FFDC Summary file + ArrayList ffdcSummaryFiles = server.listFFDCSummaryFiles(SERVER_NAME); + RemoteFile ffdcSummaryFile = server.getFFDCSummaryFile(ffdcSummaryFiles.get(ffdcSummaryFiles.size() - 1)); //Gets the latest FFDC Summary file. + + lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, "logs/ffdc/" + ffdcSummaryFile.getName()); + assertTrue("The date and time was not formatted in ISO-8601 format in FFDC Summary file.", lines.size() > 0); + } + + /* + * This test sets the "isoDateFormat" attribute to an invalid value and verifies if the appropriate warning message is displayed + * and checks that the previously configured date format is applied. + */ + @Test + public void testInvalidIsoDateFormatAttributeValue() throws Exception { + // Set the invalid true value for attribute. e.g. "isoDateFormat=ture" + server.setServerConfigurationFile(INVALID_ISO_DATE_FORMAT_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + List lines = server.findStringsInFileInLibertyServerRoot("CWWKG0081E", MESSAGE_LOG); + assertEquals("Error CWWKG0081E did not appear in messages.log", 1, lines.size()); + + lines = server.findStringsInFileInLibertyServerRoot("CWWKG0083W", MESSAGE_LOG); + assertEquals("Error CWWKG0083W did not appear in messages.log", 1, lines.size()); + + // Verify that the ISO-8601 date format is not set, and the previously configured Locale date format is being used. + lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, MESSAGE_LOG); + assertFalse("The date and time is being formatted in ISO-8601 format, instead of the default Locale format.", lines.size() > 0); + } + + /* + * This test sets the "isoDateFormat" attribute to true in the bootstrap.properties and verifies the ISO-8601 date format in the FFDC log and summary files. + */ + @Test + public void testIsoDateFormatSetInBootstrapProperties() throws Exception { + // Stop server, if running... + if (server != null && server.isStarted()) { + server.stopServer(); + } + + // Get the bootstrap.properties file and store the original content + RemoteFile bootstrapFile = server.getServerBootstrapPropertiesFile(); + + FileInputStream in = getFileInputStreamForRemoteFile(bootstrapFile); + Properties initialBootstrapProps = loadProperties(in); + + try { + // Update bootstrap.properties file with isoDateFormat = true + Properties newBootstrapProps = new Properties(); + newBootstrapProps.put("com.ibm.ws.logging.isoDateFormat", "true"); + + FileOutputStream out = getFileOutputStreamForRemoteFile(bootstrapFile, true); + writeProperties(newBootstrapProps, out); + + // Start server... + server.startServer(); + + // Check in messages.log file to see if the date and time is formatted in ISO-8601 format + List lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, MESSAGE_LOG); + assertTrue("The date and time was not formatted in ISO-8601 format in messages.log.", lines.size() > 0); + } finally { + // Restore the initial contents of bootstrap.properties + FileOutputStream out = getFileOutputStreamForRemoteFile(bootstrapFile, false); + writeProperties(initialBootstrapProps, out); + } + } + + /* + * This test dynamically changes the isoDateFormat attribute to true and false, and verifies if the date and time are formatted accordingly each time. + */ + @Test + public void testDynamicallyUpdatingIsoDateFormatAttribute() throws Exception { + // Verify if the date and time are in Locale format + List lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, MESSAGE_LOG); + assertFalse("The date and time is being formatted in ISO-8601 format, instead of the default Locale format.", lines.size() > 0); + + // Set the isoDateFormat=true and traceSpec=off in server.xml + setServerConfiguration(true, false); + + // Verify if the server was successfully updated + lines = server.findStringsInFileInLibertyServerRoot("CWWKG0017I", MESSAGE_LOG); + assertEquals("Message CWWKG0017I not appeared or appeared more than once ", 1, lines.size()); + + // Verify the date and time are in ISO-8601 format + lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, MESSAGE_LOG); + assertTrue("The date and time was not formatted in ISO-8601 format in messages.log.", lines.size() > 0); + + // Set the isoDateFormat=false and traceSpec=off in server.xml + setServerConfiguration(false, false); + + // Verify if the server was successfully updated again. + lines = server.findStringsInFileInLibertyServerRoot("CWWKG0017I", MESSAGE_LOG); + assertEquals("Message CWWKG0017I not appeared or appeared more than twice ", 2, lines.size()); + + // Verify if the date and time are in Locale format, by getting the latest server update success message (CWWKG0017I) + // and verifying if the string does not contain the ISO-8601 date format + String latestServerUpdateSuccessMsg = lines.get(1); + assertFalse("The date and time is being formatted in ISO-8601 format, instead of the default Locale format.", latestServerUpdateSuccessMsg.matches(ISO_8601_REGEX_PATTERN)); + } + + private FileInputStream getFileInputStreamForRemoteFile(RemoteFile bootstrapPropFile) throws Exception { + FileInputStream input = null; + try { + input = (FileInputStream) bootstrapPropFile.openForReading(); + } catch (Exception e) { + throw new Exception("Error while getting the FileInputStream for the remote bootstrap properties file."); + } + return input; + } + + private Properties loadProperties(FileInputStream input) throws IOException { + Properties props = new Properties(); + try { + props.load(input); + } catch (IOException e) { + + throw new IOException("Error while loading properties from the remote bootstrap properties file."); + } finally { + try { + input.close(); + } catch (IOException e1) { + throw new IOException("Error while closing the input stream."); + } + } + return props; + } + + private FileOutputStream getFileOutputStreamForRemoteFile(RemoteFile bootstrapPropFile, boolean append) throws Exception { + // Open the remote file for writing with append as false + FileOutputStream output = null; + try { + output = (FileOutputStream) bootstrapPropFile.openForWriting(append); + } catch (Exception e) { + throw new Exception("Error while getting FileOutputStream for the remote bootstrap properties file."); + } + return output; + } + + private void writeProperties(Properties props, FileOutputStream output) throws Exception { + // Write the properties to remote bootstrap properties file + try { + props.store(output, null); + } catch (IOException e) { + throw new Exception("Error while writing to the remote bootstrap properties file."); + } finally { + try { + output.close(); + } catch (IOException e) { + throw new IOException("Error while closing the output stream."); + } + } + } + + private static void setServerConfiguration(boolean useIsoDateFormat, boolean useTraceSpec) throws Exception { + Logging loggingObj; + ServerConfiguration serverConfig = server.getServerConfiguration(); + loggingObj = serverConfig.getLogging(); + if (useTraceSpec) { + loggingObj.setTraceSpecification(TRACE_SPEC); + } + loggingObj.setIsoDateFormat(useIsoDateFormat); + server.setMarkToEndOfLog(); + server.updateServerConfiguration(serverConfig); + server.waitForConfigUpdateInLogUsingMark(null); + } + + private static void hitWebPage(String contextRoot, String servletName, boolean failureAllowed, String params) throws MalformedURLException, IOException, ProtocolException { + try { + String urlStr = "http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/" + contextRoot + "/" + servletName; + urlStr = params != null ? urlStr + params : urlStr; + URL url = new URL(urlStr); + int expectedResponseCode = failureAllowed ? HttpURLConnection.HTTP_INTERNAL_ERROR : HttpURLConnection.HTTP_OK; + HttpURLConnection con = HttpUtils.getHttpConnection(url, expectedResponseCode, CONN_TIMEOUT); + BufferedReader br = HttpUtils.getConnectionStream(con); + String line = br.readLine(); + // Make sure the server gave us something back + assertNotNull(line); + con.disconnect(); + } catch (IOException e) { + // A message about a 500 code may be fine + if (!failureAllowed) { + throw e; + } + } + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForBadlyWrittenThrowableTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForBadlyWrittenThrowableTest.java new file mode 100755 index 000000000000..47df688b1be7 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForBadlyWrittenThrowableTest.java @@ -0,0 +1,67 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForBadlyWrittenThrowableTest extends AbstractStackTraceFilteringTest { + + private static final String EXPECTED_EXCEPTION = "BadlyWrittenException"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("broken-servlet"); + + // Hit the servlet, to drive the error + hitWebPage("broken-servlet", "BrokenWithABadlyWrittenThrowableServlet", true); + + } + + @Test + public void testConsoleDoesNotNPEForPrintedException() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertMessagesLogDoesNotContain("The console log had an NPE in it.", "NullPointerException"); + + } + + @Test + public void testMessagesIsNotTrimmedForPrintedException() throws Exception { + assertMessagesLogContains("The messages log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertMessagesLogDoesNotContain("The messages log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception + assertMessagesLogContains("The console stack didn't show the originating class.", + "at com.ibm.ws.logging.fat.servlet.BrokenWithABadlyWrittenThrowableServlet.doGet"); + // We also want at least one line about javax.servlet + assertMessagesLogContains("The console stack was trimmed too aggressively.", + "at javax.servlet.http.HttpServlet.service"); + assertMessagesLogContains("The console stack was apparently trimmed, but internal WAS classes got left in it", + "at com.ibm.ws.webcontainer"); + + } + + @Test + public void testTraceIsNotTrimmedForPrintedException() throws Exception { + assertTraceLogContains("The trace log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertTraceLogDoesNotContain("The trace log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForIBMFeatureExceptionTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForIBMFeatureExceptionTest.java new file mode 100755 index 000000000000..85785f1a76f0 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForIBMFeatureExceptionTest.java @@ -0,0 +1,78 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForIBMFeatureExceptionTest extends AbstractStackTraceFilteringTest { + + private static final String MAIN_EXCEPTION = "ConfigurationReceivedException"; + private static final String BUNDLE_NAME = "test.configuration.fallalloverthefloor.ibmfeature_1.0.0"; + private static final String FEATURE_NAME = "unconfigurableIbmFeature-1.0"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.badconfig.ibm"); + + // install our user feature + server.installUserBundle(BUNDLE_NAME); // NO HYPHENS! NO ".jar" SUFFIX! + server.installUserFeature(FEATURE_NAME); // NO UNDERSCORES! NO ".mf" SUFFIX! + + // Just starting the server should be enough to get exceptions + server.startServer(); + // ... but to be safe, wait until we know the config has been driven + String successMessage = server.waitForStringInLog("The user feature is about to throw an exception."); + assertNotNull("The user feature should have produced a message saying it was active and about to fall all over the floor.", successMessage); + } + + @AfterClass + public static void tearDown() throws Exception { + server.stopServer(); + + server.uninstallUserBundle(BUNDLE_NAME); + server.uninstallFeature(FEATURE_NAME); + } + + @Test + public void testConsoleIsTrimmedForNastyInternalErrorFromIBMFeature() throws Exception { + assertConsoleLogContains("The console log should at the very least have our exception in it.", MAIN_EXCEPTION); + assertConsoleLogCountEquals("The console stack should only have one [internal classes] in it.", + INTERNAL_CLASSES_REGEXP, 1); + // The other methods from the user feature should still be in the stack trace + assertConsoleLogContains("The console log should have frames from the mock-IBM classes in it.", "reallyThrowAnException"); + assertConsoleLogDoesNotContain("The console log should not have more than one frames from the mock-IBM classes in it.", "thinkAboutThrowingAnException"); + + // We should have no SCR stuff, since SCR is calling a 'Liberty' feature + assertConsoleLogDoesNotContain("The SCR classes should not be in the console log", + "at org.apache.felix.scr.impl"); + // Similarly, the Java frames are just calls to Liberty code from SCR code so should be stripped + assertConsoleLogDoesNotContain("The console stack should not have any JVM frames in it.", + "at java."); + + } + + @Test + public void testMessagesIsNotTrimmedForNastyInternalErrorFromIBMFeature() throws Exception { + assertMessagesLogContains("The messages log should have our exception in it.", + MAIN_EXCEPTION); + assertMessagesLogContains("The console stack should have the scr packages we think our stack trace has in it", + "at org.apache.felix.scr.impl"); + assertMessagesLogDoesNotContain("The messages log should not have a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionParametersTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionParametersTest.java new file mode 100755 index 000000000000..a93042f38260 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionParametersTest.java @@ -0,0 +1,72 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForLoggedExceptionParametersTest extends AbstractStackTraceFilteringTest { + + private static final String SPECIAL_BROKEN_EXCEPTION = "SpecialBrokenException"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("broken-servlet"); + + // Hit the servlet, to drive the error + hitWebPage("broken-servlet", "BrokenServlet", true); + + } + + @Test + public void testConsoleIsTrimmedForLoggedParameter() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + SPECIAL_BROKEN_EXCEPTION); + assertConsoleLogContains("The console stack was not trimmed.", + INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception + assertConsoleLogContains("The console stack was trimmed too aggressively and stripped out our servlet.", + "at com.ibm.ws.logging.fat.servlet.BrokenServlet.doGet"); + // We also want at least one line about javax.servlet + assertConsoleLogContains("The console stack was was trimmed too aggressively and stripped out the API we're using", + "at javax.servlet.http.HttpServlet.service"); + + // We don't want to be seeing anything that looks like internal WAS classes in the console + assertConsoleLogDoesNotContain("The console stack was apparently trimmed, but internal WAS classes got left in it", + "at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest"); + } + + @Test + public void testMessagesIsNotTrimmedForLoggedParameter() throws Exception { + assertMessagesLogContains("The messages log did not have our exception in it at all.", + SPECIAL_BROKEN_EXCEPTION); + assertMessagesLogDoesNotContain("The messages log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + // We don't want to be seeing anything that looks like internal WAS classes in the console + assertMessagesLogContains("The messages stack was apparently untrimmed, but it didn't have the internal WAS class stacks we expected in it", + "at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest"); + } + + @Test + public void testTraceIsNotTrimmedForLoggedParameter() throws Exception { + assertTraceLogContains("The trace log did not have our exception in it at all.", + SPECIAL_BROKEN_EXCEPTION); + assertTraceLogDoesNotContain("The trace log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionWithACauseParametersTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionWithACauseParametersTest.java new file mode 100755 index 000000000000..ca2e339fef14 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionWithACauseParametersTest.java @@ -0,0 +1,67 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForLoggedExceptionWithACauseParametersTest extends AbstractStackTraceFilteringTest { + + private static final String EXCEPTION_WITH_A_CAUSE = "BrokenWithACauseException"; + private static final String CAUSE_EXCEPTION = "ReasonItAllWentWrongException"; + private static final String CAUSED_BY = "Caused by:"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("broken-servlet"); + + // Hit the servlet, to drive the error + hitWebPage("broken-servlet", "BrokenWithACauseServlet", true); + + } + + @Test + public void testConsoleIsTrimmedForLoggedParameter() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + EXCEPTION_WITH_A_CAUSE); + assertConsoleLogContains("The console stack was not trimmed.", + INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception + assertConsoleLogContains("The console stack was trimmed too aggressively and stripped out our servlet.", + "at com.ibm.ws.logging.fat.servlet.BrokenWithACauseServlet.doGet"); + + assertConsoleLogContains("The console log should say 'Caused by'", CAUSED_BY); + assertConsoleLogContains("The console log include the root cause", CAUSE_EXCEPTION); + + } + + @Test + public void testMessagesIsNotTrimmedForLoggedParameter() throws Exception { + assertMessagesLogContains("The messages log did not have our exception in it at all.", + EXCEPTION_WITH_A_CAUSE); + assertMessagesLogDoesNotContain("The messages log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + // We don't want to be seeing anything that looks like internal WAS classes in the console + assertMessagesLogContains("The messages stack was apparently untrimmed, but it didn't have the internal WAS class stacks we expected in it", + "at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest"); + assertConsoleLogContains("The console log should say 'Caused by'", CAUSED_BY); + assertConsoleLogContains("The console log include the root cause", CAUSE_EXCEPTION); + } + +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForNoClassDefFoundErrorTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForNoClassDefFoundErrorTest.java new file mode 100755 index 000000000000..5d81ff416e4b --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForNoClassDefFoundErrorTest.java @@ -0,0 +1,85 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForNoClassDefFoundErrorTest extends AbstractStackTraceFilteringTest { + + private static final String MAIN_EXCEPTION = "NoClassDefFoundError"; + private static final String NESTED_EXCEPTION = "ClassNotFoundException"; + private static final String CAUSED_BY = "Caused by:"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.missingfeatureserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("missing-feature-servlet"); + + hitWebPage("missing-feature-servlet", "MissingEntityManagerServlet", true); + } + + @Test + public void testConsoleIsTrimmedForNoClassDefFoundError() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + MAIN_EXCEPTION); + assertConsoleLogContains("The console stack was not trimmed.", + INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception, but don't make too many assumptions about what class that was + assertConsoleLogContains("The console stack didn't show the originating class.", + "at com.ibm.ws.logging"); + // We only want one line of WAS context + assertConsoleLogCountEquals("The console stack was apparently trimmed, but internal WAS classes got left in it", + "at com.ibm.ws.webcontainer", 1); + + } + + @Test + public void testRedundantCauseIsStrippedOutForNoClassDefFoundError() throws Exception { + assertConsoleLogContains("The console log should always have our exception in it.", + MAIN_EXCEPTION); + assertConsoleLogContains("The console log should have a line saying trimming happened.", INTERNAL_CLASSES_REGEXP); + assertConsoleLogDoesNotContain("The console log should not have anything about \"Caused by\"", + CAUSED_BY); + assertConsoleLogDoesNotContain("The console log should not have our nested exception in it.", + NESTED_EXCEPTION); + } + + @Test + public void testMessagesIsNotTrimmedForNoClassDefFoundError() throws Exception { + assertMessagesLogContains("The messages log should have our exception in it.", + MAIN_EXCEPTION); + assertMessagesLogDoesNotContain("The messages log should not have a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + assertMessagesLogContains("The messages log should have a 'Caused by' line in it.", + CAUSED_BY); + assertMessagesLogContains("The message log should have our nested exception in it.", + NESTED_EXCEPTION); + } + + @Test + public void testTraceIsNotTrimmedForNoClassDefFoundError() throws Exception { + assertTraceLogContains("The trace log should not have our exception in it.", + MAIN_EXCEPTION); + assertTraceLogDoesNotContain("The trace log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + assertTraceLogContains("The trace log should have a 'Caused by' line in it.", + CAUSED_BY); + assertTraceLogContains("The trace log should not have our nested exception in it.", + NESTED_EXCEPTION); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionTest.java new file mode 100755 index 000000000000..59631ac3bc87 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionTest.java @@ -0,0 +1,77 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForPrintedExceptionTest extends AbstractStackTraceFilteringTest { + + private static final String SPECIAL_PRINTED_EXCEPTION = "SpecialPrintingException"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("broken-servlet"); + + // Hit the servlet, to drive the error + hitWebPage("broken-servlet", "ExceptionPrintingServlet", false); + + } + + @Test + public void testConsoleIsTrimmedForPrintedException() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + SPECIAL_PRINTED_EXCEPTION); + assertConsoleLogContains("The console stack was not trimmed.", + INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception + assertConsoleLogContains("The console stack didn't show the originating class.", + "at com.ibm.ws.logging.fat.servlet.ExceptionPrintingServlet.doGet"); + assertConsoleLogContains("The console stack didn't show the inner originating class.", + "ExceptionGeneratingObject.hashCode"); + // We also want at least one line about javax.servlet + assertConsoleLogContains("The console stack was trimmed too aggressively.", + "at javax.servlet.http.HttpServlet.service"); + // We only want one line of internal WAS classes in the console + int traceCount = server.findStringsInFileInLibertyServerRoot(SPECIAL_PRINTED_EXCEPTION, CONSOLE_LOG).size(); + assertConsoleLogCountEquals("The console stack was apparently trimmed, but internal WAS classes got left in it", + "at com.ibm.ws.webcontainer", traceCount); + + // The java.* classes used by the user code should not be trimmed + assertConsoleLogContains("The console stack was trimmed too aggressively of java classes.", + "at java.util.HashMap.put"); + assertConsoleLogContains("The console stack was trimmed too aggressively of java classes.", + "at java.util.HashSet.add"); + + } + + @Test + public void testMessagesIsNotTrimmedForPrintedException() throws Exception { + assertMessagesLogContains("The messages log did not have our exception in it at all.", + SPECIAL_PRINTED_EXCEPTION); + assertMessagesLogDoesNotContain("The messages log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } + + @Test + public void testTraceIsNotTrimmedForPrintedException() throws Exception { + assertTraceLogContains("The trace log did not have our exception in it at all.", + SPECIAL_PRINTED_EXCEPTION); + assertTraceLogDoesNotContain("The trace log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionWithIBMCodeAtTopTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionWithIBMCodeAtTopTest.java new file mode 100755 index 000000000000..5a9b218ffdd3 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionWithIBMCodeAtTopTest.java @@ -0,0 +1,69 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForPrintedExceptionWithIBMCodeAtTopTest extends AbstractStackTraceFilteringTest { + + private static final String EXPECTED_EXCEPTION = "javax.naming.NamingException"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("broken-servlet"); + + // Hit the servlet, to drive the error + hitWebPage("broken-servlet", "IBMCodeAtTopExceptionPrintingServlet", false); + + } + + @Test + public void testConsoleIsTrimmedForPrintedExceptionThrownByIBMCode() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertConsoleLogContains("The console stack was not trimmed.", + INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception + assertConsoleLogContains("The console stack didn't show the originating class.", + "at com.ibm.ws.logging.fat.servlet.IBMCodeAtTopExceptionPrintingServlet.doGet"); + // We also want at least one line about javax.servlet + assertConsoleLogContains("The console stack was trimmed too aggressively.", + "at javax.servlet.http.HttpServlet.service"); + // We only want one line of internal WAS classes in the console + int traceCount = server.findStringsInFileInLibertyServerRoot(EXPECTED_EXCEPTION, CONSOLE_LOG).size(); + assertConsoleLogCountEquals("The console stack was apparently trimmed, but internal WAS classes got left in it", + "at com.ibm.ws.webcontainer", traceCount); + + } + + @Test + public void testMessagesIsNotTrimmedForPrintedExceptionThrownByIBMCode() throws Exception { + assertMessagesLogContains("The messages log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertMessagesLogDoesNotContain("The messages log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } + + @Test + public void testTraceIsNotTrimmedForPrintedExceptionThrownByIBMCode() throws Exception { + assertTraceLogContains("The trace log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertTraceLogDoesNotContain("The trace log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForSpecificationClassesExceptionTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForSpecificationClassesExceptionTest.java new file mode 100755 index 000000000000..b96efd952a00 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForSpecificationClassesExceptionTest.java @@ -0,0 +1,73 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +/** + * A test which makes sure internal classes exported as spec-type API don't get filtered + * from the top of stack traces, but do get filtered from the middle. + * We want to see exceptions like + * + * java.lang.NullPointerException + * at javax.servlet.http.Cookie.isToken(Cookie.java:384) + * at javax.servlet.http.Cookie.(Cookie.java:124) + * at com.ibm.ws.logging.fat.servlet.SpecUsingServlet.doGet(SpecUsingServlet.java:40) + * at javax.servlet.http.HttpServlet.service(HttpServlet.java:575) + * at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) + * at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1240) + * at [internal classes] + */ +public class StackTraceFilteringForSpecificationClassesExceptionTest extends AbstractStackTraceFilteringTest { + + private static final String MAIN_EXCEPTION = "NullPointerException"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + server.addInstalledAppForValidation("broken-servlet"); + hitWebPage("broken-servlet", "SpecUsingServlet", true); + } + + @Test + public void testConsoleIsTrimmedForUserUseOfSpecificationClass() throws Exception { + assertConsoleLogContains("The console log should at the very least have our exception in it.", MAIN_EXCEPTION); + // How many stack traces we get depends a bit on server internals, so to try and be more robust, + // count how many [ERROR] lines we get and match this + // We don't want to count errors that don't have stack traces, so try and exclude these by also checking + // for message id 'SRVE.*E'. This still isn't totally robust since it won't catch printed Errors + // if the message doesn't include the id 'SRVE.*E' or misspells it, as our current messages do + int errorCount = server.findStringsInFileInLibertyServerRoot("ERROR.*SRVE.*E", CONSOLE_LOG).size(); + int causedByCount = server.findStringsInFileInLibertyServerRoot("Caused by", CONSOLE_LOG).size(); + // Sanity check - we got an [ERROR], right? + assertConsoleLogContains("The console log should have [ERROR] prefix in it", "ERROR"); + + assertConsoleLogCountEquals("The console stack should only have one [internal classes] in it per stack trace.", + INTERNAL_CLASSES_REGEXP, errorCount); + // The javax.servlet methods shouldn't be stripped out, because they're spec used by the app + final int servletFrames = 9; + assertConsoleLogCountEquals("The console log should have several frames from the specification javax.servlet classes", "javax.servlet", servletFrames); + + assertConsoleLogContains("The console log should have the user class in it", "SpecUsingServlet"); + + // We want one line of internal WAS classes in the console + assertConsoleLogCountEquals("There should be exactly one IBM frame per stack trace", + "at com.ibm.ws.webcontainer", errorCount + causedByCount); + + } + +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForUserFeatureExceptionTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForUserFeatureExceptionTest.java new file mode 100755 index 000000000000..02f2336723fc --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForUserFeatureExceptionTest.java @@ -0,0 +1,80 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForUserFeatureExceptionTest extends AbstractStackTraceFilteringTest { + + private static final String MAIN_EXCEPTION = "ConfigurationReceivedException"; + private static final String BUNDLE_NAME = "test.configuration.fallalloverthefloor.userfeature_1.0.0"; + private static final String FEATURE_NAME = "unconfigurableUserFeature-1.0"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.badconfig.user"); + + // install our user feature + server.installUserBundle(BUNDLE_NAME); // NO HYPHENS! NO ".jar" SUFFIX! + server.installUserFeature(FEATURE_NAME); // NO UNDERSCORES! NO ".mf" SUFFIX! + + // Just starting the server should be enough to get exceptions + server.startServer(); + // ... but to be safe, wait until we know the config has been driven + String successMessage = server.waitForStringInLog("The user feature is about to throw an exception."); + assertNotNull("The user feature should have produced a message saying it was active and about to fall all over the floor.", successMessage); + } + + @AfterClass + public static void tearDown() throws Exception { + server.stopServer(); + + server.uninstallUserBundle(BUNDLE_NAME); + server.uninstallFeature(FEATURE_NAME); + } + + @Test + public void testConsoleIsTrimmedForNastyInternalErrorFromUserFeature() throws Exception { + assertConsoleLogContains("The console log should at the very least have our exception in it.", MAIN_EXCEPTION); + assertConsoleLogCountEquals("The console stack should only have one [internal classes] in it.", + INTERNAL_CLASSES_REGEXP, 1); + // The other methods from the user feature should still be in the stack trace + assertConsoleLogContains("The console log should have frames from the user classes in it.", "thinkAboutThrowingAnException"); + assertConsoleLogContains("The console log should have more than one frames from the user classes in it.", "reallyThrowAnException"); + + // We should have one line of scr stuff, since it's the last internal line before the java + // class packages are called, which count as third-party, and in the IBM->third party->user + // case, the third-party stuff survives + assertConsoleLogCountEquals("The console stack was apparently trimmed, but the SCR classes got left in it", + "at org.apache.felix.scr.impl", 1); + // We want a Java line, but only one + assertConsoleLogCountEquals("The console stack should have one Java lines in it.", + "at java.", 1); + + } + + @Test + public void testMessagesIsNotTrimmedForNastyInternalErrorFromUserFeature() throws Exception { + assertMessagesLogContains("The messages log should have our exception in it.", + MAIN_EXCEPTION); + assertMessagesLogContains("The console stack should have the scr packages we think our stack trace has in it", + "at org.apache.felix.scr.impl"); + assertMessagesLogDoesNotContain("The messages log should not have a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMessages.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMessages.java new file mode 100755 index 000000000000..2d21b73134e0 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMessages.java @@ -0,0 +1,90 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class TestHideMessages { + + private static LibertyServer msgServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.hidemessage"); + private static final Class logClass = TestHideMessages.class; + static String TWO_HIDDEDN_MESSAGE_SERVER = "server-twomessageids.xml"; + + static long SMALL_TIMEOUT = 10000; + @Rule + public TestName name = new TestName(); + + @BeforeClass + public static void prepareTest() throws Exception { + msgServer.startServer(); + } + + @Test + // No need to wait for message CWWKZ0058I/TRAS3001I since that happens during server startup. So using findStringsInLogs + public void testHiddenMsgIds() throws Exception { + + assertTrue("Hidden Message CWWKZ0058I should not be seen in messages.log", + msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("messages.log")).isEmpty()); + assertTrue("Hidden Message CWWKZ0058I should not be seen in console.log", msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("console.log")).isEmpty()); + assertFalse("Hidden Message CWWKZ0058I should be seen in trace", msgServer.findStringsInTrace("CWWKZ0058I:").isEmpty()); + assertFalse("Info message about redirection to trace file should be logged", + msgServer.findStringsInLogs("TRAS3001I:", msgServer.getMatchingLogFile("messages.log")).isEmpty()); + + } + + @Test + public void testDynamicAddMessageIds() throws Exception { + Log.info(logClass, name.getMethodName(), "Entering test " + name.getMethodName()); + // Need to capture CWWKF0012I messages that are in the logs from initial startup + int initial_messages_size_CWWKF0012I = msgServer.findStringsInLogs("CWWKF0012I:", msgServer.getMatchingLogFile("messages.log")).size(); + int initial_console_size_CWWKF0012I = msgServer.findStringsInLogs("CWWKF0012I:", msgServer.getMatchingLogFile("console.log")).size(); + int initial_trace_size_CWWKF0012I = msgServer.findStringsInTrace("CWWKF0012I:").size(); + + msgServer.setServerConfigurationFile(TWO_HIDDEDN_MESSAGE_SERVER); + + assertTrue("Hidden Message CWWKZ0058I should not be seen in messages.log", + msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("messages.log")).isEmpty()); + assertTrue("Hidden Message CWWKZ0058I should not be seen in console.log", msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("console.log")).isEmpty()); + assertFalse("Hidden Message CWWKZ0058I should be seen in trace", msgServer.findStringsInTrace("CWWKZ0058I:").isEmpty()); + + //This will wait for feature update completion message since we are adding a new feature. And CWWKF0012I should be seen before that + msgServer.waitForConfigUpdateInLogUsingMark(null); + assertTrue("Hidden Message CWWKF0012I should not be seen in messages.log", + msgServer.findStringsInLogs("CWWKF0012I:", msgServer.getMatchingLogFile("messages.log")).size() == initial_messages_size_CWWKF0012I); + assertTrue("Hidden Message CWWKF0012I should not be seen in console.log", + msgServer.findStringsInLogs("CWWKF0012I:", msgServer.getMatchingLogFile("console.log")).size() == initial_console_size_CWWKF0012I); + assertTrue("Hidden Message CWWKF0012I should be seen in trace", + msgServer.findStringsInTrace("CWWKF0012I:").size() == (initial_trace_size_CWWKF0012I + 1)); + + Log.info(logClass, name.getMethodName(), "Exiting test " + name.getMethodName()); + } + + @AfterClass + public static void completeTest() throws Exception { + msgServer.stopServer(); + } + +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMsgDefinedBootstrap.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMsgDefinedBootstrap.java new file mode 100755 index 000000000000..bf7bc50c1141 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMsgDefinedBootstrap.java @@ -0,0 +1,62 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class TestHideMsgDefinedBootstrap { + + private static LibertyServer msgServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.hidemsg.bootstrap"); + private static final Class logClass = TestHideMsgDefinedBootstrap.class; + + @Rule + public TestName name = new TestName(); + + @BeforeClass + public static void prepareTest() throws Exception { + msgServer.startServer(); + } + + @Test + public void testHiddenMsgIds() throws Exception { + assertTrue("Hidden Message CWWKZ0058I should not be seen in messages.log", + msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("messages.log")).isEmpty()); + assertTrue("Hidden Message CWWKZ0058I should not be seen in console.log", msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("console.log")).isEmpty()); + assertFalse("Hidden Message CWWKZ0058I should be seen in trace", msgServer.findStringsInTrace("CWWKZ0058I:").isEmpty()); + } + + @Test + public void testSuppressedIdsInMsgHeader() throws Exception { + assertFalse("Suppressed Message Ids logged in header ", + msgServer.findStringsInLogs("Suppressed message ids:", msgServer.getMatchingLogFile("messages.log")).isEmpty()); + + } + + @AfterClass + public static void completeTest() throws Exception { + msgServer.stopServer(); + } + +} diff --git a/dev/com.ibm.ws.logging_fat/publish/.gitignore b/dev/com.ibm.ws.logging_fat/publish/.gitignore new file mode 100644 index 000000000000..0968b1bceb64 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableIbmFeature-1.0.mf b/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableIbmFeature-1.0.mf new file mode 100755 index 000000000000..db84826829bc --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableIbmFeature-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: unconfigurableIbmFeature-1.0 +Subsystem-SymbolicName: com.ibm.ws.logging.unconfigurableibmfeature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.configuration.fallalloverthefloor.ibmfeature; version="[1,1.0.100)", +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableUserFeature-1.0.mf b/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableUserFeature-1.0.mf new file mode 100755 index 000000000000..79ee094debda --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableUserFeature-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: unconfigurableUserFeature-1.0 +Subsystem-SymbolicName: com.ibm.ws.logging.unconfigurableuserfeature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.configuration.fallalloverthefloor.userfeature; version="[1,1.0.100)", +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.logging_fat/publish/files/server-invalidIsoDateFormat.xml b/dev/com.ibm.ws.logging_fat/publish/files/server-invalidIsoDateFormat.xml new file mode 100755 index 000000000000..1df05405bb37 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/files/server-invalidIsoDateFormat.xml @@ -0,0 +1,9 @@ + + + jsp-2.2 + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/files/server-twomessageids.xml b/dev/com.ibm.ws.logging_fat/publish/files/server-twomessageids.xml new file mode 100755 index 000000000000..ce86dd23a23d --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/files/server-twomessageids.xml @@ -0,0 +1,11 @@ + + + jsp-2.2 + ssl-1.0 + + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/.gitignore b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/server.xml new file mode 100755 index 000000000000..da45c5a65539 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/server.xml @@ -0,0 +1,11 @@ + + + + + + + servlet-3.0 + usr:unconfigurableIbmFeature-1.0 + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/.gitignore b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/.gitignore new file mode 100644 index 000000000000..2b09f7ba1e10 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/server.xml new file mode 100755 index 000000000000..b36cf13d7219 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/server.xml @@ -0,0 +1,11 @@ + + + + + + + servlet-3.0 + usr:unconfigurableUserFeature-1.0 + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/server.xml new file mode 100755 index 000000000000..413710708a2d --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/server.xml @@ -0,0 +1,9 @@ + + + + + + jsp-2.2 + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/bootstrap.properties new file mode 100755 index 000000000000..f67f7f4db103 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +com.ibm.ws.logging.console.log.level=OFF diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/jvm.options b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/jvm.options new file mode 100755 index 000000000000..70bb64f28bba --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/jvm.options @@ -0,0 +1 @@ +-Xhealthcenter \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/server.xml new file mode 100755 index 000000000000..9a5836e936c6 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/server.xml @@ -0,0 +1,7 @@ + + + jsp-2.2 + + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemessage/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemessage/server.xml new file mode 100755 index 000000000000..d64a00016bee --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemessage/server.xml @@ -0,0 +1,9 @@ + + + jsp-2.2 + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/bootstrap.properties new file mode 100755 index 000000000000..d60ff633c372 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/bootstrap.properties @@ -0,0 +1 @@ +com.ibm.ws.logging.hideMessage=CWWKZ0058I \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/server.xml new file mode 100755 index 000000000000..9a5836e936c6 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/server.xml @@ -0,0 +1,7 @@ + + + jsp-2.2 + + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/bootstrap.properties new file mode 100755 index 000000000000..4f1ae5a2e104 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/server.xml new file mode 100644 index 000000000000..085212527e33 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/server.xml @@ -0,0 +1,8 @@ + + + + + + jsp-2.2 + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/server.xml new file mode 100755 index 000000000000..413710708a2d --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/server.xml @@ -0,0 +1,9 @@ + + + + + + jsp-2.2 + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/server.xml new file mode 100755 index 000000000000..779892ce7571 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/server.xml @@ -0,0 +1,8 @@ + + + + + + jsp-2.2 + + diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/.gitignore b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/.gitignore new file mode 100644 index 000000000000..50d9e9338c79 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/.gitignore @@ -0,0 +1 @@ +/WEB-INF diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..254272e1c074 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenServlet.java new file mode 100755 index 000000000000..fbe28197760b --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenServlet.java @@ -0,0 +1,44 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which throws an exception. + */ +@WebServlet("/BrokenServlet") +public class BrokenServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public BrokenServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + // Whoops, we seem to have a problem! Oh dear, how unexpected! + throw new SpecialBrokenException(); + + } + + static class SpecialBrokenException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithABadlyWrittenThrowableServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithABadlyWrittenThrowableServlet.java new file mode 100755 index 000000000000..abdb445489b2 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithABadlyWrittenThrowableServlet.java @@ -0,0 +1,50 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which throws an exception. The getStackTrace() method on the exception returns null. + */ +@WebServlet("/BrokenWithABadlyWrittenThrowableServlet") +public class BrokenWithABadlyWrittenThrowableServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public BrokenWithABadlyWrittenThrowableServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + // Whoops, we seem to have a problem! Oh dear, how unexpected! + throw new BadlyWrittenException(); + + } + + static class BadlyWrittenException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + @Override + public StackTraceElement[] getStackTrace() { + // Can our logging code handle this? + return null; + } + + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithACauseServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithACauseServlet.java new file mode 100755 index 000000000000..c5214b2390df --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithACauseServlet.java @@ -0,0 +1,52 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which throws an exception. + */ +@WebServlet("/BrokenWithACauseServlet") +public class BrokenWithACauseServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public BrokenWithACauseServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + ReasonItAllWentWrongException reasonItAllWentWrongException = new ReasonItAllWentWrongException(); + throw new BrokenWithACauseException(reasonItAllWentWrongException); + + } + + static class BrokenWithACauseException extends RuntimeException { + public BrokenWithACauseException(ReasonItAllWentWrongException reasonItAllWentWrongException) { + super("arbitrary message", reasonItAllWentWrongException); + } + + private static final long serialVersionUID = 1L; + + } + + static class ReasonItAllWentWrongException extends Exception { + private static final long serialVersionUID = 1L; + + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/ExceptionPrintingServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/ExceptionPrintingServlet.java new file mode 100755 index 000000000000..89c159af3693 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/ExceptionPrintingServlet.java @@ -0,0 +1,70 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which prints an exception. + */ +@WebServlet("/ExceptionPrintingServlet") +public class ExceptionPrintingServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public ExceptionPrintingServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + response.getWriter().println("Well, hello there. This servlet is working."); + + // Generate a few lines of java stack trace + Set set = new HashSet(); + set.add(new ExceptionGeneratingObject(true)); + set.add(new ExceptionGeneratingObject(false)); + + response.getWriter().println("There should be an exception in your logs."); + + } + + static class SpecialPrintingException extends Exception { + + private static final long serialVersionUID = 1L; + + } + + static class ExceptionGeneratingObject { + private final boolean shouldPrintException; + + public ExceptionGeneratingObject(boolean b) { + shouldPrintException = b; + } + + @Override + public int hashCode() { + if (shouldPrintException) { + new SpecialPrintingException().printStackTrace(); + return 1; + } else { + return -1; + } + } + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/IBMCodeAtTopExceptionPrintingServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/IBMCodeAtTopExceptionPrintingServlet.java new file mode 100755 index 000000000000..471e8c361a4a --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/IBMCodeAtTopExceptionPrintingServlet.java @@ -0,0 +1,49 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; + +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which prints an exception. + */ +@WebServlet("/IBMCodeAtTopExceptionPrintingServlet") +public class IBMCodeAtTopExceptionPrintingServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public IBMCodeAtTopExceptionPrintingServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + response.getWriter().println("Howdy! This servlet is working just fine, except for all the bits that are deliberately broken."); + + // In the absence of the jndi feature, this lookup shouldn't go well + try { + InitialContext ctx = new InitialContext(); + ctx.lookup("something/That/Does/Not/Exist"); + } catch (NamingException e) { + // Print the stack trace, and see what happens + e.printStackTrace(); + } + + response.getWriter().println("There should be an exception in your logs."); + + } +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/SpecUsingServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/SpecUsingServlet.java new file mode 100755 index 000000000000..958d533ed6fb --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/SpecUsingServlet.java @@ -0,0 +1,65 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which prints an exception. + */ +@WebServlet("/SpecUsingServlet") +public class SpecUsingServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public SpecUsingServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + response.getWriter().println("This servlet uses specification classes, but you shouldn't see this message."); + // Generate an exception which has a few lines of javax.servlet.* content in it + Cookie cookie = new Cookie(null, null); + response.addCookie(cookie); + + } + + static class SpecialPrintingException extends Exception { + + private static final long serialVersionUID = 1L; + + } + + static class ExceptionGeneratingObject { + private final boolean shouldPrintException; + + public ExceptionGeneratingObject(boolean b) { + shouldPrintException = b; + } + + @Override + public int hashCode() { + if (shouldPrintException) { + new SpecialPrintingException().printStackTrace(); + return 1; + } else { + return -1; + } + } + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/.gitignore b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/.gitignore new file mode 100644 index 000000000000..50d9e9338c79 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/.gitignore @@ -0,0 +1 @@ +/WEB-INF diff --git a/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..254272e1c074 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/src/com/ibm/ws/logging/fat/servlet/FFDCServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/src/com/ibm/ws/logging/fat/servlet/FFDCServlet.java new file mode 100755 index 000000000000..1e27d6d6dda0 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/src/com/ibm/ws/logging/fat/servlet/FFDCServlet.java @@ -0,0 +1,26 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; +import java.util.logging.Logger; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet("/FFDCServlet") +public class FFDCServlet extends HttpServlet { + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + response.getWriter().println("Test Servlet to generate FFDC"); + + String generateFFDC = request.getParameter("generateFFDC"); + + if ((generateFFDC != null) && (generateFFDC.equalsIgnoreCase("true"))) { + // Divide by zero, to get an ArithmeticException, which will generate an FFDC + int i = 10 / 0; + } + } +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/.gitignore b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/.gitignore new file mode 100644 index 000000000000..50d9e9338c79 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/.gitignore @@ -0,0 +1 @@ +/WEB-INF diff --git a/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/META-INF/MANIFEST.MF new file mode 100755 index 000000000000..254272e1c074 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/src/com/ibm/ws/logging/fat/servlet/LoggerServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/src/com/ibm/ws/logging/fat/servlet/LoggerServlet.java new file mode 100755 index 000000000000..2da44805cc27 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/src/com/ibm/ws/logging/fat/servlet/LoggerServlet.java @@ -0,0 +1,24 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; +import java.util.logging.Logger; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet("/*") +@SuppressWarnings("serial") +public class LoggerServlet extends HttpServlet { + private static final Logger logger = Logger.getLogger(LoggerServlet.class.getName()); + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + response.getWriter().println("Hello world!"); + // Use severe, which is higher than AUDIT, to ensure this message would + // normally show up in console.log if output wasn't disabled. + logger.severe("Hello world!"); + } +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/.gitignore b/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/.gitignore new file mode 100644 index 000000000000..e47e1b33a748 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/.gitignore @@ -0,0 +1 @@ +/resources diff --git a/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/src/com/ibm/ws/logging/fat/servlet/MissingEntityManagerServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/src/com/ibm/ws/logging/fat/servlet/MissingEntityManagerServlet.java new file mode 100755 index 000000000000..326e4f7a340d --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/src/com/ibm/ws/logging/fat/servlet/MissingEntityManagerServlet.java @@ -0,0 +1,60 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * A servlet with a dependency on JPA, running in a server with no jpa feature loaded. What could + * possibly go wrong? + */ +@WebServlet("/MissingEntityManagerServlet") +public class MissingEntityManagerServlet extends HttpServlet { + + private static final long serialVersionUID = 1L; + + @PersistenceContext(unitName = "thiswontworkpu") + private EntityManager em; + + /** + * @see HttpServlet#HttpServlet() + */ + public MissingEntityManagerServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.getWriter().println("About to try and run a query on the entity manager we don't have."); + String query = "SELECT f FROM ChocolateOrder f"; + Query q = em.createQuery(query); + + List list = q.getResultList(); + response.getWriter().println("How did that work out?" + list); + + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/bnd.bnd b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/bnd.bnd new file mode 100755 index 000000000000..4d6d8c134587 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/bnd.bnd @@ -0,0 +1,19 @@ +# Simulate a failure in Liberty code by having a user feature which looks like IBM code +Bundle-Vendor: IBM +bVersion=1.0.0 +Bundle-Version: 1.0.0 +Bundle-Name: Exception throwing feature +Bundle-Description: This feature throws an exception +Bundle-SymbolicName: test.configuration.fallalloverthefloor.ibmfeature; singleton:=true + +Private-Package: \ + com.ibm.ws.logging.fat.fallalloverthefloor.ibmfeature + +Include-Resource: \ + OSGI-INF=resources/OSGI-INF + +Service-Component: \ + com.ibm.ws.logging.fat.brokenfeature; \ + implementation:=com.ibm.ws.logging.fat.fallalloverthefloor.ibmfeature.BrokenFeature; \ + configurationAdmin=org.osgi.service.cm.ConfigurationAdmin; \ + properties:="service.vendor=IBM,com.ibm.ws.wim.repository.type=File" diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/resources/OSGI-INF/metatype/metatype.xml b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/resources/OSGI-INF/metatype/metatype.xml new file mode 100755 index 000000000000..e3db91d6ff8f --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/resources/OSGI-INF/metatype/metatype.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/ibmfeature/BrokenFeature.java b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/ibmfeature/BrokenFeature.java new file mode 100755 index 000000000000..49ed9a932c65 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/ibmfeature/BrokenFeature.java @@ -0,0 +1,50 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat.fallalloverthefloor.ibmfeature; + +import java.util.Map; + +/** + * + */ +public class BrokenFeature { + + /** + * A method which, after some indirection, throws an exception. + */ + protected void activate(Map properties) throws Exception { + thinkAboutThrowingAnException(); + + } + + /** + * @throws ConfigurationReceivedException + */ + private void thinkAboutThrowingAnException() throws ConfigurationReceivedException { + reallyThrowAnException(); + } + + /** + * @throws ConfigurationReceivedException + */ + private void reallyThrowAnException() throws ConfigurationReceivedException { + System.out.println("The user feature is about to throw an exception."); + throw new ConfigurationReceivedException(); + } + + protected static class ConfigurationReceivedException extends Exception { + + /** */ + private static final long serialVersionUID = 1L; + + } +} diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/bnd.bnd b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/bnd.bnd new file mode 100755 index 000000000000..30ab1f2515b7 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/bnd.bnd @@ -0,0 +1,18 @@ +# Don't include the IBM properties, this is intended to be a user feature +bVersion=1.0.0 +Bundle-Version: 1.0.0 +Bundle-Name: Exception throwing feature +Bundle-Description: This feature throws an exception +Bundle-SymbolicName: test.configuration.fallalloverthefloor.userfeature; singleton:=true + +Private-Package: \ + com.ibm.ws.logging.fat.fallalloverthefloor.userfeature + +Include-Resource: \ + OSGI-INF=resources/OSGI-INF + +Service-Component: \ + com.ibm.ws.logging.fat.brokenfeature; \ + implementation:=com.ibm.ws.logging.fat.fallalloverthefloor.userfeature.BrokenFeature; \ + configurationAdmin=org.osgi.service.cm.ConfigurationAdmin; \ + properties:="service.vendor=IBM,com.ibm.ws.wim.repository.type=File" diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/resources/OSGI-INF/metatype/metatype.xml b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/resources/OSGI-INF/metatype/metatype.xml new file mode 100755 index 000000000000..e3db91d6ff8f --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/resources/OSGI-INF/metatype/metatype.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/userfeature/BrokenFeature.java b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/userfeature/BrokenFeature.java new file mode 100755 index 000000000000..5f8b24615834 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/userfeature/BrokenFeature.java @@ -0,0 +1,50 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat.fallalloverthefloor.userfeature; + +import java.util.Map; + +/** + * + */ +public class BrokenFeature { + + /** + * A method which, after some indirection, throws an exception. + */ + protected void activate(Map properties) throws Exception { + thinkAboutThrowingAnException(); + + } + + /** + * @throws ConfigurationReceivedException + */ + private void thinkAboutThrowingAnException() throws ConfigurationReceivedException { + reallyThrowAnException(); + } + + /** + * @throws ConfigurationReceivedException + */ + private void reallyThrowAnException() throws ConfigurationReceivedException { + System.out.println("The user feature is about to throw an exception."); + throw new ConfigurationReceivedException(); + } + + protected static class ConfigurationReceivedException extends Exception { + + /** */ + private static final long serialVersionUID = 1L; + + } +} diff --git a/dev/com.ibm.ws.logging_test/.classpath b/dev/com.ibm.ws.logging_test/.classpath index f33512485743..bd880329225d 100644 --- a/dev/com.ibm.ws.logging_test/.classpath +++ b/dev/com.ibm.ws.logging_test/.classpath @@ -1,15 +1,7 @@ - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.logging_test/.classpath.gradle b/dev/com.ibm.ws.logging_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.logging_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging_test/.project b/dev/com.ibm.ws.logging_test/.project index b783dd485952..b9f4c114cf06 100755 --- a/dev/com.ibm.ws.logging_test/.project +++ b/dev/com.ibm.ws.logging_test/.project @@ -11,13 +11,13 @@ - com.ibm.ws.rasplugin.RASValidationBuilder + bndtools.core.bndbuilder org.eclipse.jdt.core.javanature - com.ibm.ws.rasplugin.RASValidationNature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.logging_test/bnd.bnd b/dev/com.ibm.ws.logging_test/bnd.bnd index 478b504c1f57..a00c4755ca59 100755 --- a/dev/com.ibm.ws.logging_test/bnd.bnd +++ b/dev/com.ibm.ws.logging_test/bnd.bnd @@ -1,9 +1,26 @@ --include= ~../cnf/resources/bnd/bundle.props, +-include= ~../cnf/resources/bnd/liberty-release.props bVersion=1.0 -Bundle-Name: WAS RAS TEST -Fragment-Host: com.ibm.ws.ras -Bundle-SymbolicName: com.ibm.ws.ras.test; singleton:=true -Bundle-Description: WAS RAS TEST, version ${bVersion} +-nobundles=true -Include-Resource: bin/ \ No newline at end of file +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + org.eclipse.osgi;version=latest, \ + com.ibm.ws.kernel.boot.logging;version=latest, \ + com.ibm.ws.kernel.security.thread;version=latest, \ + com.ibm.ws.logging.core;version=latest, \ + com.ibm.ws.logging.osgi;version=latest, \ + com.ibm.ws.logging;version=latest diff --git a/dev/com.ibm.ws.logging_test/bnd.bnd.gradle b/dev/com.ibm.ws.logging_test/bnd.bnd.gradle new file mode 100755 index 000000000000..a00c4755ca59 --- /dev/null +++ b/dev/com.ibm.ws.logging_test/bnd.bnd.gradle @@ -0,0 +1,26 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + org.eclipse.osgi;version=latest, \ + com.ibm.ws.kernel.boot.logging;version=latest, \ + com.ibm.ws.kernel.security.thread;version=latest, \ + com.ibm.ws.logging.core;version=latest, \ + com.ibm.ws.logging.osgi;version=latest, \ + com.ibm.ws.logging;version=latest diff --git a/dev/com.ibm.ws.logging_test/build.gradle b/dev/com.ibm.ws.logging_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.org.codehaus.jackson/.classpath b/dev/com.ibm.ws.org.codehaus.jackson/.classpath index ba360b1b66d9..bd52baaf243d 100644 --- a/dev/com.ibm.ws.org.codehaus.jackson/.classpath +++ b/dev/com.ibm.ws.org.codehaus.jackson/.classpath @@ -1,9 +1,6 @@ - - - - - - + + + diff --git a/dev/com.ibm.ws.org.codehaus.jackson/.classpath.gradle b/dev/com.ibm.ws.org.codehaus.jackson/.classpath.gradle new file mode 100644 index 000000000000..bd52baaf243d --- /dev/null +++ b/dev/com.ibm.ws.org.codehaus.jackson/.classpath.gradle @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.ws.org.codehaus.jackson/bnd.bnd b/dev/com.ibm.ws.org.codehaus.jackson/bnd.bnd new file mode 100644 index 000000000000..7cb51f1a2b30 --- /dev/null +++ b/dev/com.ibm.ws.org.codehaus.jackson/bnd.bnd @@ -0,0 +1,19 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: Jackson JSON processor 1.6.2 +Bundle-SymbolicName: com.ibm.ws.org.codehaus.jackson.1.6.2 +Bundle-Description: Provides Jackson Processor as a bundle; version=${bVersion} + +Export-Package: \ + org.codehaus.jackson.* + +publish.wlp.jar.disabled: true + +-pedantic: false + +-buildpath: \ + lib/jackson-core-asl-1.6.2.jar;version=file,\ + lib/jackson-jaxrs-1.6.2.jar;version=file,\ + lib/jackson-mapper-asl-1.6.2.jar;version=file,\ + lib/jackson-xc-1.6.2.jar;version=file diff --git a/dev/com.ibm.ws.org.codehaus.jackson/bnd.bnd.gradle b/dev/com.ibm.ws.org.codehaus.jackson/bnd.bnd.gradle new file mode 100644 index 000000000000..7cb51f1a2b30 --- /dev/null +++ b/dev/com.ibm.ws.org.codehaus.jackson/bnd.bnd.gradle @@ -0,0 +1,19 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: Jackson JSON processor 1.6.2 +Bundle-SymbolicName: com.ibm.ws.org.codehaus.jackson.1.6.2 +Bundle-Description: Provides Jackson Processor as a bundle; version=${bVersion} + +Export-Package: \ + org.codehaus.jackson.* + +publish.wlp.jar.disabled: true + +-pedantic: false + +-buildpath: \ + lib/jackson-core-asl-1.6.2.jar;version=file,\ + lib/jackson-jaxrs-1.6.2.jar;version=file,\ + lib/jackson-mapper-asl-1.6.2.jar;version=file,\ + lib/jackson-xc-1.6.2.jar;version=file diff --git a/dev/com.ibm.ws.org.codehaus.jackson/build.gradle b/dev/com.ibm.ws.org.codehaus.jackson/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.org.codehaus.jackson/build.xml b/dev/com.ibm.ws.org.codehaus.jackson/build.xml new file mode 100644 index 000000000000..6623762efcea --- /dev/null +++ b/dev/com.ibm.ws.org.codehaus.jackson/build.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.classpath b/dev/com.ibm.ws.org.glassfish.json_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.classpath.gradle b/dev/com.ibm.ws.org.glassfish.json_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.gitignore b/dev/com.ibm.ws.org.glassfish.json_fat/.gitignore new file mode 100644 index 000000000000..1117ac1f9e93 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.gitignore @@ -0,0 +1,2 @@ +junit.jar +/bootstrapping.properties diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.project b/dev/com.ibm.ws.org.glassfish.json_fat/.project new file mode 100644 index 000000000000..99f4e3006457 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.org.glassfish.json_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000000..8607a4626e40 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,63 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_settings_version=11 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd b/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd new file mode 100644 index 000000000000..9801b86a42e8 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd @@ -0,0 +1,13 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + com.ibm.ws.componenttest;version=latest, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.org.glassfish.json.1.0;version=latest diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd.gradle b/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..9801b86a42e8 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd.gradle @@ -0,0 +1,13 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + com.ibm.ws.componenttest;version=latest, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.org.glassfish.json.1.0;version=latest diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/build-test.xml b/dev/com.ibm.ws.org.glassfish.json_fat/build-test.xml new file mode 100644 index 000000000000..28e8733b7e3b --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/build-test.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/build.gradle b/dev/com.ibm.ws.org.glassfish.json_fat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/delivery.sets b/dev/com.ibm.ws.org.glassfish.json_fat/delivery.sets new file mode 100644 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/FATSuite.java b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/FATSuite.java new file mode 100644 index 000000000000..1be011b859a6 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/FATSuite.java @@ -0,0 +1,28 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.org.glassfish.json.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import com.ibm.ws.org.glassfish.json.fat.tests.BasicJSONPTest; +import com.ibm.ws.org.glassfish.json.fat.tests.CustomFeatureJSONPTest; +import componenttest.custom.junit.runner.AlwaysPassesTest; + +@RunWith(Suite.class) +@SuiteClasses({ + AlwaysPassesTest.class, + BasicJSONPTest.class, + CustomFeatureJSONPTest.class +}) +public class FATSuite {} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/AbstractTest.java b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/AbstractTest.java new file mode 100644 index 000000000000..723219190a64 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/AbstractTest.java @@ -0,0 +1,145 @@ +package com.ibm.ws.org.glassfish.json.fat.tests; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +import static componenttest.topology.utils.HttpUtils.getHttpConnection; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; + +import junit.framework.Assert; + +import org.junit.AfterClass; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.app.FATServlet; +import componenttest.custom.junit.runner.OnlyRunInJava7Rule; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.utils.HttpUtils; +import componenttest.topology.utils.HttpUtils.HTTPRequestMethod; + +/** + * Abstract test class. This should be extended when adding a new test class, + * so that this shared logic for running the actual tests remains in one place. + * + * To add new test, simply implement @BeforeClass method that gets and starts + * the server needed. + */ +public abstract class AbstractTest { + /** The time in seconds to wait at a URL before giving up. **/ + public static final int CONN_TIMEOUT = 30; + + protected static LibertyServer server; + private static final Class c = AbstractTest.class; + + @ClassRule + public static final TestRule java7Rule = new OnlyRunInJava7Rule(); + + @Rule + public TestName testName = new TestName(); + + public String servlet; + + /** + * Call {@link #runTest} with the configured servlet name and the current + * test method as the "testMethod" query parameter. + */ + protected void runTest() throws Exception { + Assert.assertNotNull(servlet); + runTest(servlet + "?testMethod=" + testName.getMethodName()); + } + + protected void runTest(String servlet, String method) throws Exception { + Assert.assertNotNull(servlet); + String invocationString = servlet + "?testMethod=" + method; + runTest(invocationString); + } + + /** + * Invoke the specified servlet and look for "PASSED" as a response. + */ + protected void runTest(String servlet) throws Exception { + final String method = testName.getMethodName(); + + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + servlet); + Log.info(c, method, "Calling application with URL=" + url.toString()); + HttpURLConnection con = getHttpConnection(url, HttpURLConnection.HTTP_OK, new int[0], CONN_TIMEOUT, HTTPRequestMethod.GET); + + // Check the response from servlet for "PASSED" + String response = getAnyResponse(con); + Log.info(c, method, "Response from " + servlet + ": " + response); + if (!"PASSED".equals(response) && + !response.contains(FATServlet.SUCCESS)) { + fail(servlet + " failed: " + response); + } + } + + /** + * Invoke the specified servlet and wait until the passed in response + * code is returned. + * + * @return the message associated with the response + */ + String runTest(String servlet, int responseCode) throws Exception { + final String method = testName.getMethodName(); + + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + servlet); + Log.info(c, method, "Calling application with URL=" + url.toString()); + HttpURLConnection con = getHttpConnection(url, responseCode, CONN_TIMEOUT); + + // Check the response from servlet for "PASSED" + String response = getAnyResponse(con); + Log.info(c, method, "Response from " + servlet + ": " + response); + + return response; + } + + /** + * This method is used to read the response from either the input stream or + * error stream. + * + * @param con The connection to the HTTP address + * @return The output or error from the webpage + * @throws IOException if neither the input stream nor error stream can be read + */ + public static String getAnyResponse(HttpURLConnection urlConnection) throws IOException { + BufferedReader br; + try { + br = HttpUtils.getConnectionStream(urlConnection); + } catch (IOException ioex) { + br = HttpUtils.getErrorStream(urlConnection); + } + + String response = ""; + String aLine; + + while ((aLine = br.readLine()) != null) { + response = response + aLine; + } + return response; + } + + @AfterClass + public static void tearDown() throws Exception { + if (server != null && server.isStarted()) { + server.stopServer(); + } + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/BasicJSONPTest.java b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/BasicJSONPTest.java new file mode 100644 index 000000000000..151ff2ec2b49 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/BasicJSONPTest.java @@ -0,0 +1,85 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +package com.ibm.ws.org.glassfish.json.fat.tests; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class BasicJSONPTest extends AbstractTest { + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer"); + server.addInstalledAppForValidation("JSONPWAR"); + server.addInstalledAppForValidation("customAppJSONPWAR"); + server.addInstalledAppForValidation("customLibJSONPWAR"); + server.startServer("BasicJSONPTest.log"); + } + + /** + * Ensure that JsonObjectBuilder is functioning. + */ + @Test + public void testJsonBuild() throws Exception { + this.servlet = "/JSONPWAR/BuildJSONPServlet"; + runTest(); + } + + /** + * Ensure that JsonReader is functioning. + */ + @Test + public void testJsonRead() throws Exception { + this.servlet = "/JSONPWAR/ReadJSONPServlet"; + runTest(); + } + + /** + * Ensure that JsonWriter is functioning. + */ + @Test + public void testJsonWrite() throws Exception { + this.servlet = "/JSONPWAR/WriteJSONPServlet"; + runTest(); + } + + /** + * Ensure that JsonGenerator is functioning. + */ + @Test + public void testJsonStream() throws Exception { + this.servlet = "/JSONPWAR/StreamJSONPServlet"; + runTest(); + } + + /** + * Test plugging in a custom implementation for JSON processing, + * where the custom implementation is packaged in the application. + */ + @Test + public void testCustomAppJsonProvider() throws Exception { + this.servlet = "/customAppJSONPWAR/CustomJsonProviderServlet"; + runTest(); + } + + /** + * Test plugging in a custom implementation for JSON processing, + * where the custom implementation is packaged in a shared library. + */ + @Test + public void testCustomLibJsonProvider() throws Exception { + this.servlet = "/customLibJSONPWAR/CustomJsonProviderServlet"; + runTest(); + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/CustomFeatureJSONPTest.java b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/CustomFeatureJSONPTest.java new file mode 100644 index 000000000000..0b53c606e034 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/CustomFeatureJSONPTest.java @@ -0,0 +1,49 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +package com.ibm.ws.org.glassfish.json.fat.tests; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class CustomFeatureJSONPTest extends AbstractTest { + private static final String FEATURE_NAME = "customJsonpProvider-1.0"; + private static final String BUNDLE_NAME = "com.ibm.ws.jsonp.feature.provider.1.0_1.0.0"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer"); + server.installUserFeature(FEATURE_NAME); + server.installUserBundle(BUNDLE_NAME); + server.addInstalledAppForValidation("customFeatureJSONPWAR"); + server.startServer("customFeatureJSONPTest.log"); + } + + @AfterClass + public static void afterClass() throws Exception { + server.stopServer(); + server.uninstallUserBundle(BUNDLE_NAME); + server.uninstallUserFeature(FEATURE_NAME); + } + + /** + * Test plugging in a custom implementation for JSON processing, + * where the custom implementation is packaged in a user defined feature. + */ + @Test + public void testCustomFeatureJsonProvider() throws Exception { + this.servlet = "/customFeatureJSONPWAR/CustomJsonProviderServlet"; + runTest(); + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/.gitignore b/dev/com.ibm.ws.org.glassfish.json_fat/publish/.gitignore new file mode 100644 index 000000000000..0968b1bceb64 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/features/customJsonpProvider-1.0.mf b/dev/com.ibm.ws.org.glassfish.json_fat/publish/features/customJsonpProvider-1.0.mf new file mode 100644 index 000000000000..34c4cb146bc4 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/features/customJsonpProvider-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: customJsonpProvider-1.0 +Subsystem-SymbolicName: com.ibm.ws.jsonp.feature.provider.1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.websphere.appserver.classloading-1.0; type="osgi.subsystem.feature", + com.ibm.ws.jsonp.feature.provider.1.0; version="[1,1.0.100)" +IBM-API-Package: com.ibm.ws.jsonp.feature.provider; type="api" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/.gitignore b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/.gitignore new file mode 100644 index 000000000000..a443afd97439 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/.gitignore @@ -0,0 +1,4 @@ +/JSONPProviderLib +/apps +/dropins +/lib diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/bootstrap.properties b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/bootstrap.properties new file mode 100644 index 000000000000..af984ccafa52 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +com.ibm.ws.logging.trace.specification=*=info diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/build.properties b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/build.properties new file mode 100644 index 000000000000..ae211a3c3cc1 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/build.properties @@ -0,0 +1 @@ +include.JSONPProviderLib=true \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/server.xml b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/server.xml new file mode 100644 index 000000000000..1de1369c8e5c --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/server.xml @@ -0,0 +1,17 @@ + + + + + servlet-3.0 + jsonp-1.0 + + + + + + + + + + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/.gitignore b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/.gitignore new file mode 100644 index 000000000000..26548bf9b650 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/.gitignore @@ -0,0 +1,2 @@ +/dropins +/lib diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/bootstrap.properties b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/bootstrap.properties new file mode 100644 index 000000000000..af984ccafa52 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +com.ibm.ws.logging.trace.specification=*=info diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/server.xml b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/server.xml new file mode 100644 index 000000000000..9d1ab7f343a0 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/server.xml @@ -0,0 +1,10 @@ + + + + + servlet-3.0 + jsonp-1.0 + usr:customJsonpProvider-1.0 + + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/package.properties b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/package.properties new file mode 100644 index 000000000000..3ee53ab9e54a --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/package.properties @@ -0,0 +1,2 @@ +server.pattern=com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer +lib.componenttest=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/META-INF/permissions.xml new file mode 100644 index 000000000000..28acc02da031 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/WEB-INF/json_read_test_data.js b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/WEB-INF/json_read_test_data.js new file mode 100644 index 000000000000..7d566461a52f --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/WEB-INF/json_read_test_data.js @@ -0,0 +1,6 @@ +{ "firstName": "Steve", "lastName": "Watson", "age": 45, + "phoneNumber": [ + { "type": "office", "number": "507-253-1234" }, + { "type": "cell", "number": "507-253-4321" } + ] +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/AbstractJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/AbstractJSONPServlet.java new file mode 100644 index 000000000000..f0ad42056090 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/AbstractJSONPServlet.java @@ -0,0 +1,138 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.util.HashMap; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.stream.JsonParser; +import javax.json.stream.JsonParser.Event; +import javax.json.stream.JsonParserFactory; + +import junit.framework.Assert; + +import componenttest.app.FATServlet; + +@SuppressWarnings("serial") +public abstract class AbstractJSONPServlet extends FATServlet { + private String jsonData = ""; + + protected JsonParser getJsonParser(String fileLocation) { + FileInputStream fis = createFileInputStream(fileLocation); + JsonParserFactory jsonParserFactory = Json.createParserFactory(new HashMap()); + JsonParser parser = jsonParserFactory.createParser(fis); + return parser; + } + + protected JsonParser getJsonParser(JsonObject value) { + JsonParserFactory jsonParserFactory = Json.createParserFactory(new HashMap()); + JsonParser parser = jsonParserFactory.createParser(value); + return parser; + } + + protected void parseJson(JsonParser parser) { + + Boolean startObjectOrArray = false; + Boolean endObjectOrArray = false; + while (parser.hasNext()) { + Event event = parser.next(); + + if (endObjectOrArray && (event.equals(Event.START_ARRAY) || event.equals(Event.START_OBJECT))) { + logJsonElement(","); + } + endObjectOrArray = false; + + switch (event) { + case START_ARRAY: + startObjectOrArray = true; + logJsonElement("["); + break; + case END_ARRAY: + endObjectOrArray = true; + logJsonElement("]"); + break; + case START_OBJECT: + startObjectOrArray = true; + logJsonElement("{"); + break; + case END_OBJECT: + endObjectOrArray = true; + logJsonElement("}"); + break; + case VALUE_NUMBER: + if (parser.isIntegralNumber()) { + logJsonElement(Integer.toString(parser.getInt())); + } else { + logJsonElement(Long.toString(parser.getLong())); + } + break; + case VALUE_FALSE: + logJsonElement("FALSE"); + break; + case VALUE_NULL: + logJsonElement("NULL"); + break; + case VALUE_TRUE: + logJsonElement("TRUE"); + break; + case KEY_NAME: + if (!startObjectOrArray) { + logJsonElement(","); + } + startObjectOrArray = false; + + logJsonElement("\"" + parser.getString() + "\":"); + break; + case VALUE_STRING: + logJsonElement("\"" + parser.getString() + "\""); + break; + } + } + //System.out.println("DEBUG: " + jsonData); + } + + private void logJsonElement(String element) { + System.out.println(element); + jsonData = jsonData + element; + } + + protected void checkJsonData() { + String expectedString = "{\"firstName\":\"Steve\",\"lastName\":\"Watson\",\"age\":45,\"phoneNumber\":[{\"type\":\"office\",\"number\":\"507-253-1234\"},{\"type\":\"cell\",\"number\":\"507-253-4321\"}]}"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString + "> FOUND <" + jsonData + ">", expectedString.equals(jsonData)); + } + + protected FileOutputStream createFileOutputStream(String fileLocation) { + FileOutputStream fos = null; + try { + fos = new FileOutputStream(fileLocation); + } catch (FileNotFoundException e) { + e.printStackTrace(); + Assert.fail("AbstractJSONPServlet threw an unexpected FileNotFoundException."); + } + return fos; + } + + protected FileInputStream createFileInputStream(String fileLocation) { + FileInputStream fis = null; + try { + fis = new FileInputStream(fileLocation); + } catch (FileNotFoundException e) { + e.printStackTrace(); + Assert.fail("AbstractJSONPServlet threw an unexpected FileNotFoundException."); + } + return fis; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/BuildJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/BuildJSONPServlet.java new file mode 100644 index 000000000000..f0a134d7d58e --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/BuildJSONPServlet.java @@ -0,0 +1,41 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +@WebServlet("/BuildJSONPServlet") +@SuppressWarnings("serial") +public class BuildJSONPServlet extends AbstractJSONPServlet { + + public void testJsonBuild() { + JsonObject value = buildJsonObject(); + JsonParser parser = getJsonParser(value); + parseJson(parser); + checkJsonData(); + } + + private JsonObject buildJsonObject() { + JsonObject value = Json.createObjectBuilder() + .add("firstName", "Steve") + .add("lastName", "Watson") + .add("age", 45) + .add("phoneNumber", Json.createArrayBuilder() + .add(Json.createObjectBuilder().add("type", "office").add("number", "507-253-1234")) + .add(Json.createObjectBuilder().add("type", "cell").add("number", "507-253-4321"))) + .build(); + return value; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/ReadJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/ReadJSONPServlet.java new file mode 100644 index 000000000000..98daf7189b69 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/ReadJSONPServlet.java @@ -0,0 +1,41 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.InputStream; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonReader; +import javax.json.stream.JsonParser; +import javax.servlet.ServletContext; +import javax.servlet.annotation.WebServlet; + +@WebServlet("/ReadJSONPServlet") +@SuppressWarnings("serial") +public class ReadJSONPServlet extends AbstractJSONPServlet { + + public void testJsonRead() { + JsonObject jsonData = readJsonFile("/WEB-INF/json_read_test_data.js"); + JsonParser parser = getJsonParser(jsonData); + parseJson(parser); + checkJsonData(); + } + + private JsonObject readJsonFile(String fileLocation) { + ServletContext context = getServletContext(); + InputStream is = context.getResourceAsStream(fileLocation); + JsonReader reader = Json.createReader(is); + JsonObject value = reader.readObject(); + return value; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/StreamJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/StreamJSONPServlet.java new file mode 100644 index 000000000000..6bbd7f6a6b71 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/StreamJSONPServlet.java @@ -0,0 +1,59 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.FileOutputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.json.Json; +import javax.json.stream.JsonGenerator; +import javax.json.stream.JsonGeneratorFactory; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +@WebServlet("/StreamJSONPServlet") +@SuppressWarnings("serial") +public class StreamJSONPServlet extends AbstractJSONPServlet { + + public void testJsonStream() { + String outputDir = System.getenv("X_LOG_DIR") + "/json_stream_test_data.js"; + generateJSON(outputDir); + JsonParser parser = getJsonParser(outputDir); + parseJson(parser); + checkJsonData(); + } + + private void generateJSON(String fileLocation) { + FileOutputStream os = createFileOutputStream(fileLocation); + Map props = new HashMap(); + props.put(JsonGenerator.PRETTY_PRINTING, new Object()); + JsonGeneratorFactory factory = Json.createGeneratorFactory(props); + JsonGenerator generator = factory.createGenerator(os); + generator.writeStartObject() + .write("firstName", "Steve") + .write("lastName", "Watson") + .write("age", 45) + .writeStartArray("phoneNumber") + .writeStartObject() + .write("type", "office") + .write("number", "507-253-1234") + .writeEnd() + .writeStartObject() + .write("type", "cell") + .write("number", "507-253-4321") + .writeEnd() + .writeEnd() + .writeEnd(); + generator.close(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/WriteJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/WriteJSONPServlet.java new file mode 100644 index 000000000000..081424f3cc83 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/WriteJSONPServlet.java @@ -0,0 +1,54 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonReader; +import javax.json.JsonWriter; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +@WebServlet("/WriteJSONPServlet") +@SuppressWarnings("serial") +public class WriteJSONPServlet extends AbstractJSONPServlet { + + public void testJsonWrite() { + InputStream originalInputStream = getServletContext().getResourceAsStream("/WEB-INF/json_read_test_data.js"); + JsonObject originalJsonData = readJsonFile(originalInputStream); + + String outputDir = System.getenv("X_LOG_DIR") + "/json_write_test_data.js"; + writeJsonFile(outputDir, originalJsonData); + FileInputStream newInputStream = createFileInputStream(outputDir); + JsonObject newJsonData = readJsonFile(newInputStream); + JsonParser parser = getJsonParser(newJsonData); + parseJson(parser); + checkJsonData(); + } + + private void writeJsonFile(String fileLocation, JsonObject value) { + FileOutputStream os = createFileOutputStream(fileLocation); + JsonWriter writer = Json.createWriter(os); + writer.writeObject(value); + writer.close(); + } + + private JsonObject readJsonFile(InputStream is) { + JsonReader reader = Json.createReader(is); + JsonObject value = reader.readObject(); + return value; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/permissions.xml new file mode 100644 index 000000000000..28acc02da031 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider new file mode 100644 index 000000000000..34dbcb5cfc51 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider @@ -0,0 +1 @@ +com.ibm.ws.jsonp.app.provider.JsonProviderImpl \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonParserImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonParserImpl.java new file mode 100644 index 000000000000..08605d060144 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonParserImpl.java @@ -0,0 +1,65 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.app.provider; + +import java.math.BigDecimal; + +import javax.json.stream.JsonLocation; + +/** + * + */ +public class JsonParserImpl implements javax.json.stream.JsonParser { + + @Override + public void close() {} + + @Override + public BigDecimal getBigDecimal() { + return null; + } + + @Override + public int getInt() { + return 0; + } + + @Override + public JsonLocation getLocation() { + return null; + } + + @Override + public long getLong() { + return 0; + } + + @Override + public String getString() { + return "Custom JSONP implementation loaded from an application library"; + } + + @Override + public boolean hasNext() { + return false; + } + + @Override + public boolean isIntegralNumber() { + return false; + } + + @Override + public Event next() { + return null; + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonProviderImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonProviderImpl.java new file mode 100644 index 000000000000..3c122636eb76 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonProviderImpl.java @@ -0,0 +1,97 @@ +package com.ibm.ws.jsonp.app.provider; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.util.Map; + +import javax.json.JsonArrayBuilder; +import javax.json.JsonBuilderFactory; +import javax.json.JsonObjectBuilder; +import javax.json.JsonReader; +import javax.json.JsonReaderFactory; +import javax.json.JsonWriter; +import javax.json.JsonWriterFactory; +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonGenerator; +import javax.json.stream.JsonGeneratorFactory; +import javax.json.stream.JsonParser; +import javax.json.stream.JsonParserFactory; + +public class JsonProviderImpl extends JsonProvider { + @Override + public JsonParser createParser(Reader reader) { + return null; + } + + @Override + public JsonParser createParser(InputStream in) { + return new JsonParserImpl(); + } + + @Override + public JsonParserFactory createParserFactory(Map config) { + return null; + } + + @Override + public JsonGenerator createGenerator(Writer writer) { + return null; + } + + @Override + public JsonGenerator createGenerator(OutputStream out) { + return null; + } + + @Override + public JsonGeneratorFactory createGeneratorFactory(Map config) { + return null; + } + + @Override + public JsonReader createReader(Reader reader) { + return null; + } + + @Override + public JsonReader createReader(InputStream in) { + return null; + } + + @Override + public JsonWriter createWriter(Writer writer) { + return null; + } + + @Override + public JsonWriter createWriter(OutputStream out) { + return null; + } + + @Override + public JsonWriterFactory createWriterFactory(Map config) { + return null; + } + + @Override + public JsonReaderFactory createReaderFactory(Map config) { + return null; + } + + @Override + public JsonObjectBuilder createObjectBuilder() { + return null; + } + + @Override + public JsonArrayBuilder createArrayBuilder() { + return null; + } + + @Override + public JsonBuilderFactory createBuilderFactory(Map config) { + return null; + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/package.properties b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/package.properties new file mode 100644 index 000000000000..109d9f3a7d9c --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/package.properties @@ -0,0 +1,3 @@ +server.pattern=com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer +lib.pattern=customAppJSONPProvider.jar +lib.componenttest=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/resources/META-INF/permissions.xml new file mode 100644 index 000000000000..28acc02da031 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomAppJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomAppJSONPServlet.java new file mode 100644 index 000000000000..cf771f427e5f --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomAppJSONPServlet.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.InputStream; + +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +import junit.framework.Assert; + +import componenttest.app.FATServlet; + +@WebServlet("/CustomJsonProviderServlet") +@SuppressWarnings("serial") +public class CustomAppJSONPServlet extends FATServlet { + public void testCustomAppJsonProvider() { + // Verify the custom JSON Provider class is being used. + JsonProvider dummyProvider = JsonProvider.provider(); + String providerName = dummyProvider.getClass().getName(); + String expectedString1 = "com.ibm.ws.jsonp.app.provider.JsonProviderImpl"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString1 + "> FOUND <" + providerName + ">", expectedString1.equals(providerName)); + + // Verify the custom implemented JsonParser class gets loaded and used. + InputStream dummyInputStream = null; + JsonParser dummyParser = dummyProvider.createParser(dummyInputStream); + String parserString = dummyParser.getString(); + String expectedString2 = "Custom JSONP implementation loaded from an application library"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString2 + "> FOUND <" + parserString + ">", expectedString2.equals(parserString)); + + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/package.properties b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/package.properties new file mode 100644 index 000000000000..92fd83b503db --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/package.properties @@ -0,0 +1,2 @@ +server.pattern=com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer +lib.componenttest=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/resources/META-INF/permissions.xml new file mode 100644 index 000000000000..28acc02da031 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomFeatureJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomFeatureJSONPServlet.java new file mode 100644 index 000000000000..6424974169c8 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomFeatureJSONPServlet.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.InputStream; + +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +import junit.framework.Assert; + +import componenttest.app.FATServlet; + +@WebServlet("/CustomJsonProviderServlet") +@SuppressWarnings("serial") +public class CustomFeatureJSONPServlet extends FATServlet { + public void testCustomFeatureJsonProvider() { + // Verify the custom JSON Provider class is being used. + JsonProvider dummyProvider = JsonProvider.provider(); + String providerName = dummyProvider.getClass().getName(); + String expectedString1 = "com.ibm.ws.jsonp.feature.provider.JsonProviderImpl"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString1 + "> FOUND <" + providerName + ">", expectedString1.equals(providerName)); + + // Verify the custom implemented JsonParser class gets loaded and used. + InputStream dummyInputStream = null; + JsonParser dummyParser = dummyProvider.createParser(dummyInputStream); + String parserString = dummyParser.getString(); + String expectedString2 = "Custom JSONP implementation loaded from a user defined feature"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString2 + "> FOUND <" + parserString + ">", expectedString2.equals(parserString)); + + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/permissions.xml new file mode 100644 index 000000000000..28acc02da031 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider new file mode 100644 index 000000000000..6f90d7810ce1 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider @@ -0,0 +1 @@ +com.ibm.ws.jsonp.lib.provider.JsonProviderImpl \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonParserImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonParserImpl.java new file mode 100644 index 000000000000..54ce647847d7 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonParserImpl.java @@ -0,0 +1,65 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.lib.provider; + +import java.math.BigDecimal; + +import javax.json.stream.JsonLocation; + +/** + * + */ +public class JsonParserImpl implements javax.json.stream.JsonParser { + + @Override + public void close() {} + + @Override + public BigDecimal getBigDecimal() { + return null; + } + + @Override + public int getInt() { + return 0; + } + + @Override + public JsonLocation getLocation() { + return null; + } + + @Override + public long getLong() { + return 0; + } + + @Override + public String getString() { + return "Custom JSONP implementation loaded from a shared library"; + } + + @Override + public boolean hasNext() { + return false; + } + + @Override + public boolean isIntegralNumber() { + return false; + } + + @Override + public Event next() { + return null; + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonProviderImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonProviderImpl.java new file mode 100644 index 000000000000..672ff871cc8a --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonProviderImpl.java @@ -0,0 +1,97 @@ +package com.ibm.ws.jsonp.lib.provider; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.util.Map; + +import javax.json.JsonArrayBuilder; +import javax.json.JsonBuilderFactory; +import javax.json.JsonObjectBuilder; +import javax.json.JsonReader; +import javax.json.JsonReaderFactory; +import javax.json.JsonWriter; +import javax.json.JsonWriterFactory; +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonGenerator; +import javax.json.stream.JsonGeneratorFactory; +import javax.json.stream.JsonParser; +import javax.json.stream.JsonParserFactory; + +public class JsonProviderImpl extends JsonProvider { + @Override + public JsonParser createParser(Reader reader) { + return null; + } + + @Override + public JsonParser createParser(InputStream in) { + return new JsonParserImpl(); + } + + @Override + public JsonParserFactory createParserFactory(Map config) { + return null; + } + + @Override + public JsonGenerator createGenerator(Writer writer) { + return null; + } + + @Override + public JsonGenerator createGenerator(OutputStream out) { + return null; + } + + @Override + public JsonGeneratorFactory createGeneratorFactory(Map config) { + return null; + } + + @Override + public JsonReader createReader(Reader reader) { + return null; + } + + @Override + public JsonReader createReader(InputStream in) { + return null; + } + + @Override + public JsonWriter createWriter(Writer writer) { + return null; + } + + @Override + public JsonWriter createWriter(OutputStream out) { + return null; + } + + @Override + public JsonWriterFactory createWriterFactory(Map config) { + return null; + } + + @Override + public JsonReaderFactory createReaderFactory(Map config) { + return null; + } + + @Override + public JsonObjectBuilder createObjectBuilder() { + return null; + } + + @Override + public JsonArrayBuilder createArrayBuilder() { + return null; + } + + @Override + public JsonBuilderFactory createBuilderFactory(Map config) { + return null; + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/package.properties b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/package.properties new file mode 100644 index 000000000000..4678d3b93f77 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/package.properties @@ -0,0 +1,3 @@ +server.pattern=com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer +app.dir=apps +lib.componenttest=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/resources/META-INF/permissions.xml new file mode 100644 index 000000000000..28acc02da031 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomLibJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomLibJSONPServlet.java new file mode 100644 index 000000000000..5322b03e3010 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomLibJSONPServlet.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.InputStream; + +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +import junit.framework.Assert; + +import componenttest.app.FATServlet; + +@WebServlet("/CustomJsonProviderServlet") +@SuppressWarnings("serial") +public class CustomLibJSONPServlet extends FATServlet { + public void testCustomLibJsonProvider() { + // Verify the custom JSON Provider class is being used. + JsonProvider dummyProvider = JsonProvider.provider(); + String providerName = dummyProvider.getClass().getName(); + String expectedString1 = "com.ibm.ws.jsonp.lib.provider.JsonProviderImpl"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString1 + "> FOUND <" + providerName + ">", expectedString1.equals(providerName)); + + // Verify the custom implemented JsonParser class gets loaded and used. + InputStream dummyInputStream = null; + JsonParser dummyParser = dummyProvider.createParser(dummyInputStream); + String parserString = dummyParser.getString(); + String expectedString2 = "Custom JSONP implementation loaded from a shared library"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString2 + "> FOUND <" + parserString + ">", expectedString2.equals(parserString)); + + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/bnd.bnd b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/bnd.bnd new file mode 100644 index 000000000000..ab64fc7816b0 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/bnd.bnd @@ -0,0 +1,25 @@ +-include=~../../../cnf/resources/bnd/bundle.props + +bVersion=1.0.0 + + +Bundle-SymbolicName: com.ibm.ws.jsonp.feature.provider.1.0 + +# Provide these as resources to applications. +app-resources= \ + META-INF/services/javax.json.spi.JsonProvider + +Export-Package: \ + com.ibm.ws.jsonp.feature.provider.* + +# The file system path is relative to the location of this bnd.bnd file. +Include-Resource: \ + META-INF/services=resources/META-INF/services + +Service-Component: \ + com.ibm.ws.jsonp.feature.provide_${bVersion}.ResourceProvider; \ + implementation:=com.ibm.wsspi.classloading.ResourceProvider; \ + provide:=com.ibm.wsspi.classloading.ResourceProvider; \ + configuration-policy:=ignore; \ + properties:= "resources=${app-resources}" + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/resources/META-INF/services/javax.json.spi.JsonProvider b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/resources/META-INF/services/javax.json.spi.JsonProvider new file mode 100644 index 000000000000..cfe62ac4c416 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/resources/META-INF/services/javax.json.spi.JsonProvider @@ -0,0 +1 @@ +com.ibm.ws.jsonp.feature.provider.JsonProviderImpl \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonParserImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonParserImpl.java new file mode 100644 index 000000000000..11e32120c142 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonParserImpl.java @@ -0,0 +1,65 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.feature.provider; + +import java.math.BigDecimal; + +import javax.json.stream.JsonLocation; + +/** + * + */ +public class JsonParserImpl implements javax.json.stream.JsonParser { + + @Override + public void close() {} + + @Override + public BigDecimal getBigDecimal() { + return null; + } + + @Override + public int getInt() { + return 0; + } + + @Override + public JsonLocation getLocation() { + return null; + } + + @Override + public long getLong() { + return 0; + } + + @Override + public String getString() { + return "Custom JSONP implementation loaded from a user defined feature"; + } + + @Override + public boolean hasNext() { + return false; + } + + @Override + public boolean isIntegralNumber() { + return false; + } + + @Override + public Event next() { + return null; + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonProviderImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonProviderImpl.java new file mode 100644 index 000000000000..69e4a1d86ec3 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonProviderImpl.java @@ -0,0 +1,97 @@ +package com.ibm.ws.jsonp.feature.provider; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.util.Map; + +import javax.json.JsonArrayBuilder; +import javax.json.JsonBuilderFactory; +import javax.json.JsonObjectBuilder; +import javax.json.JsonReader; +import javax.json.JsonReaderFactory; +import javax.json.JsonWriter; +import javax.json.JsonWriterFactory; +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonGenerator; +import javax.json.stream.JsonGeneratorFactory; +import javax.json.stream.JsonParser; +import javax.json.stream.JsonParserFactory; + +public class JsonProviderImpl extends JsonProvider { + @Override + public JsonParser createParser(Reader reader) { + return null; + } + + @Override + public JsonParser createParser(InputStream in) { + return new JsonParserImpl(); + } + + @Override + public JsonParserFactory createParserFactory(Map config) { + return null; + } + + @Override + public JsonGenerator createGenerator(Writer writer) { + return null; + } + + @Override + public JsonGenerator createGenerator(OutputStream out) { + return null; + } + + @Override + public JsonGeneratorFactory createGeneratorFactory(Map config) { + return null; + } + + @Override + public JsonReader createReader(Reader reader) { + return null; + } + + @Override + public JsonReader createReader(InputStream in) { + return null; + } + + @Override + public JsonWriter createWriter(Writer writer) { + return null; + } + + @Override + public JsonWriter createWriter(OutputStream out) { + return null; + } + + @Override + public JsonWriterFactory createWriterFactory(Map config) { + return null; + } + + @Override + public JsonReaderFactory createReaderFactory(Map config) { + return null; + } + + @Override + public JsonObjectBuilder createObjectBuilder() { + return null; + } + + @Override + public JsonArrayBuilder createArrayBuilder() { + return null; + } + + @Override + public JsonBuilderFactory createBuilderFactory(Map config) { + return null; + } +} diff --git a/dev/com.ibm.ws.org.osgi.service.resolver/.classpath b/dev/com.ibm.ws.org.osgi.service.resolver/.classpath index 6e48000f881b..bd52baaf243d 100644 --- a/dev/com.ibm.ws.org.osgi.service.resolver/.classpath +++ b/dev/com.ibm.ws.org.osgi.service.resolver/.classpath @@ -1,6 +1,6 @@ - - - + + + diff --git a/dev/com.ibm.ws.org.osgi.service.resolver/.classpath.gradle b/dev/com.ibm.ws.org.osgi.service.resolver/.classpath.gradle new file mode 100644 index 000000000000..bd52baaf243d --- /dev/null +++ b/dev/com.ibm.ws.org.osgi.service.resolver/.classpath.gradle @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.ws.org.osgi.service.resolver/bnd.bnd b/dev/com.ibm.ws.org.osgi.service.resolver/bnd.bnd new file mode 100644 index 000000000000..598fb2ecb202 --- /dev/null +++ b/dev/com.ibm.ws.org.osgi.service.resolver/bnd.bnd @@ -0,0 +1,6 @@ +-include= jar:${fileuri;lib/org.osgi.service.resolver-1.0.1.jar}!/META-INF/MANIFEST.MF,bnd.overrides + +-includeresource: \ + @lib/org.osgi.service.resolver-1.0.1.jar!/!(OSGI-OPT/src|META-INF/maven)/* + +-buildpath: lib/org.osgi.service.resolver-1.0.1.jar;version=file diff --git a/dev/com.ibm.ws.org.osgi.service.resolver/bnd.bnd.gradle b/dev/com.ibm.ws.org.osgi.service.resolver/bnd.bnd.gradle new file mode 100644 index 000000000000..598fb2ecb202 --- /dev/null +++ b/dev/com.ibm.ws.org.osgi.service.resolver/bnd.bnd.gradle @@ -0,0 +1,6 @@ +-include= jar:${fileuri;lib/org.osgi.service.resolver-1.0.1.jar}!/META-INF/MANIFEST.MF,bnd.overrides + +-includeresource: \ + @lib/org.osgi.service.resolver-1.0.1.jar!/!(OSGI-OPT/src|META-INF/maven)/* + +-buildpath: lib/org.osgi.service.resolver-1.0.1.jar;version=file diff --git a/dev/com.ibm.ws.org.osgi.service.resolver/bnd.overrides b/dev/com.ibm.ws.org.osgi.service.resolver/bnd.overrides new file mode 100644 index 000000000000..acafa86249b1 --- /dev/null +++ b/dev/com.ibm.ws.org.osgi.service.resolver/bnd.overrides @@ -0,0 +1,4 @@ +-include= ~../cnf/resources/bnd/rejar.props +bVersion=1.0 + +Bundle-SymbolicName: com.ibm.ws.org.osgi.service.resolver.1.0.1 diff --git a/dev/com.ibm.ws.org.osgi.service.resolver/build.gradle b/dev/com.ibm.ws.org.osgi.service.resolver/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.org.osgi.service.resolver/build.xml b/dev/com.ibm.ws.org.osgi.service.resolver/build.xml new file mode 100644 index 000000000000..288530df346a --- /dev/null +++ b/dev/com.ibm.ws.org.osgi.service.resolver/build.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_bvt/.classpath b/dev/com.ibm.ws.product.utility_bvt/.classpath index 1c5135f64035..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.product.utility_bvt/.classpath +++ b/dev/com.ibm.ws.product.utility_bvt/.classpath @@ -1,15 +1,7 @@ - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.product.utility_bvt/.classpath.gradle b/dev/com.ibm.ws.product.utility_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.product.utility_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_bvt/.project b/dev/com.ibm.ws.product.utility_bvt/.project index ca24ad322f5c..32abda0f4e49 100755 --- a/dev/com.ibm.ws.product.utility_bvt/.project +++ b/dev/com.ibm.ws.product.utility_bvt/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.product.utility_bvt/bnd.bnd b/dev/com.ibm.ws.product.utility_bvt/bnd.bnd new file mode 100755 index 000000000000..27abb02cc16e --- /dev/null +++ b/dev/com.ibm.ws.product.utility_bvt/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.product.utility;version=latest diff --git a/dev/com.ibm.ws.product.utility_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.product.utility_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..27abb02cc16e --- /dev/null +++ b/dev/com.ibm.ws.product.utility_bvt/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.product.utility;version=latest diff --git a/dev/com.ibm.ws.product.utility_bvt/build.gradle b/dev/com.ibm.ws.product.utility_bvt/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_fat/.classpath b/dev/com.ibm.ws.product.utility_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/.classpath.gradle b/dev/com.ibm.ws.product.utility_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/.gitignore b/dev/com.ibm.ws.product.utility_fat/.gitignore new file mode 100644 index 000000000000..106ad11d242b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.gitignore @@ -0,0 +1,5 @@ +bundles +dist +/*.log* +/coverage.ec +/lib diff --git a/dev/com.ibm.ws.product.utility_fat/.project b/dev/com.ibm.ws.product.utility_fat/.project new file mode 100755 index 000000000000..f421c24b8890 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.product.utility_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..845c3083c7df --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c874b5816985 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.product.utility_fat/bnd.bnd b/dev/com.ibm.ws.product.utility_fat/bnd.bnd new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.product.utility_fat/bnd.bnd.gradle b/dev/com.ibm.ws.product.utility_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.product.utility_fat/build-test.xml b/dev/com.ibm.ws.product.utility_fat/build-test.xml new file mode 100755 index 000000000000..adf0e26c1ad5 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/build-test.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/build.gradle b/dev/com.ibm.ws.product.utility_fat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_fat/delivery.sets b/dev/com.ibm.ws.product.utility_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/FATSuite.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/FATSuite.java new file mode 100755 index 000000000000..92b28c8f4435 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/FATSuite.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ + ProductUtilToolTest.class, + ProductInfoToolTest.class, + ProductInfoValidateTest.class, + ProductInfoLicenseFileTest.class +}) +/** + * Purpose: This suite collects and runs all known good test suites. + */ +public class FATSuite { + +} diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoLicenseFileTest.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoLicenseFileTest.java new file mode 100755 index 000000000000..2adea07dac07 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoLicenseFileTest.java @@ -0,0 +1,205 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Collection; +import java.util.HashSet; +import java.util.Locale; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This class tests that license information and license agreement gets generated properly + */ +public class ProductInfoLicenseFileTest { + + public static final Class c = ProductInfoLicenseFileTest.class; + public static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.info.tool"); + public static String javaExc; + public static String installRoot; + public static final Collection filesToTidy = new HashSet(); + + @Rule + public final TestName method = new TestName(); + + @BeforeClass + public static void before() throws Exception { + setupEnv(LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.info.tool")); + } + + @AfterClass + public static void after() throws Exception { + server.deleteDirectoryFromLibertyInstallRoot("lafiles"); + } + + /** + * Setup the environment. + * + * @param svr The server instance. + * + * @throws Exception + */ + public static void setupEnv(LibertyServer svr) throws Exception { + final String METHOD_NAME = "setup"; + server = svr; + installRoot = server.getInstallRoot(); + javaExc = System.getProperty("java.home") + "/bin/java"; + Log.entering(c, METHOD_NAME); + Log.info(c, METHOD_NAME, "java: " + javaExc); + Log.info(c, METHOD_NAME, "installRoot: " + installRoot); + + // Create a directory to store the output files. + File toolsOutputDir = new File(installRoot + "/tool.output.dir"); + toolsOutputDir.mkdir(); + } + + /** + * Tests that the license information gets generated properly + * + * @throws Exception + */ + @Test + public void testLicenseInformation() throws Exception { + Log.entering(c, method.getMethodName()); + + if (!verifyLicenseFilesExists()) { + Log.info(c, method.getMethodName(), "The lafiles directory does not exist in installdir. Skipping."); + return; + } + + testLicenseInfoContents(installRoot + "/bin/productInfo", new String[] { "viewLicenseInfo" }, installRoot); + Log.exiting(c, method.getMethodName()); + } + + /** + * Tests that the agreement information gets generated properly + * + * @throws Exception + */ + @Test + public void testLicenseAgreement() throws Exception { + Log.entering(c, method.getMethodName()); + + if (!verifyLicenseFilesExists()) { + Log.info(c, method.getMethodName(), "The lafiles directory does not exist in installdir. Skipping."); + return; + } + testLicenseAgreementContents(installRoot + "/bin/productInfo", new String[] { "viewLicenseAgreement" }, installRoot); + Log.exiting(c, method.getMethodName()); + } + + /** + * Tests the command productInfo produces license information correctly + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testLicenseInfoContents(String cmd, String[] parms, String workDir) throws Exception { + Log.entering(c, method.getMethodName()); + + if (!verifyLicenseFilesExists()) { + Log.info(c, method.getMethodName(), "The lafiles directory does not exist in installdir. Skipping."); + return; + } + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po); + assertEquals("License information should be generated", po.getReturnCode(), 0); + + Locale locale = Locale.getDefault(); + String lang = locale.getLanguage(); + Log.info(ProductInfoLicenseFileTest.class, "localelanguage", lang); + + assertTrue("FAIL: License information doesnt exist:", new File(installRoot + "/lafiles/" + "LI_" + lang).exists()); + assertEquals("License locale is not en or not LI:", "LI_" + lang, new File(installRoot + "/lafiles/" + "LI_" + lang).getName()); + Log.exiting(c, method.getMethodName()); + } + + /** + * Tests the command productInfo produces license agreement correctly + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testLicenseAgreementContents(String cmd, String[] parms, String workDir) throws Exception { + Log.entering(c, method.getMethodName()); + + if (!verifyLicenseFilesExists()) { + Log.info(c, method.getMethodName(), "The lafiles directory does not exist in installdir. Skipping."); + return; + } + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po); + assertEquals("License agreement should be generated", po.getReturnCode(), 0); + + Locale locale = Locale.getDefault(); + String lang = locale.getLanguage(); + Log.info(ProductInfoLicenseFileTest.class, "localelanguage", lang); + + assertTrue("FAIL: License agreement doesnt exist:", new File(installRoot + "/lafiles/" + "LA_" + lang).exists()); + assertEquals("License locale is not en or not LA:", "LA_" + lang, new File(installRoot + "/lafiles/" + "LA_" + lang).getName()); + Log.exiting(c, method.getMethodName()); + } + + /** + * Prints an extended debug output. + * + * @param po The programOutput + * @param fileName + * @throws Exception + */ + public void logInfo(ProgramOutput po) throws Exception { + String methodName = "logInfo"; + Log.info(c, methodName, "Return Code: " + po.getReturnCode() + ". STDOUT: " + po.getStdout()); + + if (po.getReturnCode() != 0) { + Log.info(c, methodName, "STDERR: " + po.getStderr()); + } + } + + private boolean verifyLicenseFilesExists() { + boolean licenseFileExists = false; + File folder = new File(installRoot + "/lafiles/"); + + if (folder.exists()) { + for (File fileEntry : folder.listFiles()) { + if (fileEntry.exists() && !(fileEntry.getName().startsWith("com.ibm"))) { + licenseFileExists = true; + } else { + licenseFileExists = false; + } + Log.info(ProductInfoLicenseFileTest.class, method.getMethodName(), fileEntry.getName() + "status:" + licenseFileExists); + } + } + return licenseFileExists; + } +} diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoToolTest.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoToolTest.java new file mode 100755 index 000000000000..c268fe9c82cb --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoToolTest.java @@ -0,0 +1,126 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Properties; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServerFactory; + +public class ProductInfoToolTest extends ProductToolTestCommon { + + @BeforeClass + public static void beforeClassSetup() throws Exception { + setupEnv(LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.info.tool")); + setupProductExtensions(SETUP_ALL_PROD_EXTS); + + } + + /** + * Test that productInfo version will display information for all installed products. + * This includes core, product extensions in default usr location and other installed product extensions. + * + * @throws Exception + */ + @Test + public void testProdInfoToolPrintProductVersionForAllProductsInstalled() throws Exception { + testPrintProductVersionForAllProductsInstalled(installRoot + "/bin/productInfo", new String[] { "version" }, installRoot); + } + + /** + * Test that productInfo featureInfo will display a list of all installed features. + * This includes core, product extensions in default usr location and other installed product extensions. + * + * @throws Exception + */ + @Test + public void testProdInfoToolPrintFeatureInfoForAllProductsInstalled() throws Exception { + testPrintFeatureInfoForAllProductsInstalled(installRoot + "/bin/productInfo", new String[] { "featureInfo" }, installRoot); + } + + /** + * Test that productInfo version will display ifix information for all installed products. + * This includes core, product extensions in default usr location and other installed product extensions. + * + * @throws Exception + */ + @Test + public void testProdInfoToolPrintProductVersionIfixesForAllProductsInstalled() throws Exception { + testPrintProductVersionIfixesForAllProductsInstalled(installRoot + "/bin/productInfo", new String[] { "version", "--ifixes" }, installRoot); + } + + /** + * + * Tests the command that lists the installed features for all products installed + * does not have duplicates in the list. + * + * @throws Exception + */ + @Test + public void testPrintFeatureInfoForAllProductsInstalledNoDuplicates() throws Exception { + final String METHOD_NAME = "testPrintFeatureInfoForAllProductsInstalledNoDuplicates"; + Log.entering(c, METHOD_NAME); + String cmd = installRoot + "/bin/productInfo"; + String[] parms = new String[] { "featureInfo" }; + + ProgramOutput po = server.getMachine().execute(cmd, parms, installRoot); + logInfo(po); + String stdout = po.getStdout(); + assertTrue("The output should contain only one copy of the usr product feature: usertest-1.0 [1.0.0].", + stdout.indexOf("usertest [1.0.0]") == stdout.lastIndexOf("usertest [1.0.0]")); + assertTrue("The output should contain only one copy of the product feature: prodtest-1.0 [1.0.0].", + stdout.indexOf("prodtest-1.0 [1.0.0]") == stdout.lastIndexOf("prodtest-1.0 [1.0.0]")); + assertTrue("The output should contain only one copy of the core features: check servlet-3.0 [1.0.0].", + stdout.indexOf("servlet-3.0 [1.0.0]") == stdout.lastIndexOf("servlet-3.0 [1.0.0]")); + + Log.exiting(c, METHOD_NAME); + } + + @Test + /** + * This test validates that the productInfo script functions correctly when the CDPATH environment variable + * is present. + * + * @throws Exception + */ + public void testProdInfoToolWithCDPATH() throws Exception { + final String METHOD_NAME = "testProdInfoToolWithCDPATH"; + Log.entering(c, METHOD_NAME); + + // issuing the command from the Liberty install root while supplying the bin directory as + // part of the command itself causes the productInfo script to cd to the bin directory, which + // is where we noticed problems when CDPATH is set + String executionDir = server.getInstallRoot(); + String command = "bin" + File.separator + "productInfo"; + + String[] parms = new String[1]; + parms[0] = "version"; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "stderr = " + po.getStderr()); + + assertTrue("productInfo does not contain the correct output", po.getStdout().contains("Product name")); + + Log.exiting(c, METHOD_NAME); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoValidateTest.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoValidateTest.java new file mode 100755 index 000000000000..293023ead7c3 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoValidateTest.java @@ -0,0 +1,67 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import static org.junit.Assert.assertTrue; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class ProductInfoValidateTest { + + public static Class c = ProductInfoValidateTest.class; + //don't really need a server for this test, but need to get the install paths + public static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.product.utility.test.validate.server"); + + private static String installRoot; + + @BeforeClass + public static void setup() throws Exception { + final String METHOD_NAME = "setup"; + installRoot = server.getInstallRoot(); + Log.entering(c, METHOD_NAME); + Log.info(c, METHOD_NAME, "installRoot: " + installRoot); + } + + /** + * Tests that we can run the productInfo validate command without exception. + * Does not verify the output of the command, only that there were no exceptions + * during the run of the command. + * + * @throws Exception + */ + @Test + public void testProductInfoValidate() throws Exception { + final String METHOD_NAME = "testProductInfoValidate"; + Log.entering(c, METHOD_NAME); + String cmd = installRoot + "/bin/productInfo"; + String[] parms = new String[] { "validate" }; + + ProgramOutput po = server.getMachine().execute(cmd, parms, installRoot); + Log.info(c, METHOD_NAME, "productInfo validate stdout: "); + Log.info(c, METHOD_NAME, po.getStdout()); + Log.info(c, METHOD_NAME, "productInfo validate stderr: "); + Log.info(c, METHOD_NAME, po.getStderr()); + assertTrue("The productInfo validate command returned an error code, see autoFVT/results/output.txt log for detailed output", po.getReturnCode() == 0); + + Log.exiting(c, METHOD_NAME); + } + +} diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductToolTestCommon.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductToolTestCommon.java new file mode 100755 index 000000000000..729cef8cb77b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductToolTestCommon.java @@ -0,0 +1,265 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Collection; +import java.util.HashSet; + +import org.junit.AfterClass; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; + +/** + * + */ +public abstract class ProductToolTestCommon { + public static final Class c = ProductToolTestCommon.class; + public static LibertyServer server; + public static String javaExc; + public static String installRoot; + + // ETC product extension related variables. + public static final String PRODUCT_FEATURE_PATH = "producttest/lib/features/"; + public static final String PRODUCT_VERSIONS_PATH = "producttest/lib/versions/"; + public static final String PRODUCT_BUNDLE_PATH = "producttest/lib/"; + public static final String PRODUCT_EXTENSIONS_PATH = "etc/extensions/"; + public static final String PRODUCT_FEATURE_PROPERTIES_FILE = "testproduct.properties"; + public static final String PRODUCT_VERSIONS_PROPERTIES_FILE = "producttest.properties"; + public static final String PRODUCT_FEATURE_PRODTEST_MF = "prodtest-1.0.mf"; + public static final String PRODUCT_FEATURE_PRODTEST_JAR = "com.ibm.ws.prodtest.internal_1.0.jar"; + public static final String PRODUCT_EXT_NAME = "testproduct"; + + // USR product extension related properties: + public static final String USR_PRODUCT_BUNDLE_PATH = "usr/extension/lib/"; + public static final String USR_PRODUCT_FEATURE_PATH = "usr/extension/lib/features/"; + public static final String USR_PRODUCT_VERSIONS_PATH = "usr/extension/lib/versions/"; + public static final String USR_PRODUCT_FEATURE_NAME = "usertest.with.versions.props.file"; + public static final String USR_PRODUCT_FEATURE_MF = "user.ext.version.info.mf"; + public static final String USR_PRODUCT_BUNDLE_JAR = "userProdExt_1.0.0.jar"; + public static final String USR_PRODUCT_VERSIONS_PROPERTIES_FILE = "user.ext.version.info.properties"; + + // Product pre-set return codes as set in: + // com.ibm.ws.kernel.feature.internal.cmdline.ReturnCode, + // com.ibm.ws.kernel.feature.internal.generator.FeatureListOptions. + public static final int PRODUCT_EXT_NOT_FOUND = 26; + public static final int PRODUCT_EXT_NOT_DEFINED = 27; + public static final int PRODUCT_EXT_NO_FEATURES_FOUND = 28; + + // Other variables. + public static final String CORE_PRODUCT_NAME = "core"; + public static final String USR_PRODUCT_NAME = "usr"; + public static final int SETUP_PROD_EXT = 1; + public static final int SETUP_USR_PROD_EXT = 2; + public static final int SETUP_ALL_PROD_EXTS = 3; + public static final Collection filesToTidy = new HashSet(); + + /** + * Setup the environment. + * + * @param svr The server instance. + * + * @throws Exception + */ + public static void setupEnv(LibertyServer svr) throws Exception { + final String METHOD_NAME = "setup"; + server = svr; + installRoot = server.getInstallRoot(); + javaExc = System.getProperty("java.home") + "/bin/java"; + Log.entering(c, METHOD_NAME); + Log.info(c, METHOD_NAME, "java: " + javaExc); + Log.info(c, METHOD_NAME, "installRoot: " + installRoot); + + // Create a directory to store the output files. + File toolsOutputDir = new File(installRoot + "/tool.output.dir"); + toolsOutputDir.mkdir(); + } + + /** + * Setup product extensions. + * + * @param setupOption The option that determines what preset product extension will be installed. + * + * @throws Exception + */ + public static void setupProductExtensions(int setupOption) throws Exception { + final String METHOD_NAME = "setupProductExtensions"; + Log.exiting(c, METHOD_NAME); + boolean setupAll = false; + switch (setupOption) { + case SETUP_ALL_PROD_EXTS: + setupAll = true; + case SETUP_PROD_EXT: + // Copy the product's feature manifest. + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, "productFeatures/" + PRODUCT_FEATURE_PRODTEST_MF); + assertTrue("product feature: " + PRODUCT_FEATURE_PRODTEST_MF + " should have been copied to: " + PRODUCT_FEATURE_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_FEATURE_PATH + PRODUCT_FEATURE_PRODTEST_MF)); + // Copy the product's bundle jar. + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, "productBundles/" + PRODUCT_FEATURE_PRODTEST_JAR); + assertTrue("product bundle: " + PRODUCT_FEATURE_PRODTEST_JAR + " should have been copied to: " + PRODUCT_BUNDLE_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_BUNDLE_PATH + PRODUCT_FEATURE_PRODTEST_JAR)); + // Copy the product's extension properties file. + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, "productProperties/" + PRODUCT_FEATURE_PROPERTIES_FILE); + assertTrue("product extension props file: " + PRODUCT_FEATURE_PROPERTIES_FILE + " should have been copied to: " + PRODUCT_EXTENSIONS_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE)); + // Copy the product's version properties file. + server.copyFileToLibertyInstallRoot(PRODUCT_VERSIONS_PATH, "productVersionProperties/" + PRODUCT_VERSIONS_PROPERTIES_FILE); + assertTrue("product version props file: " + PRODUCT_VERSIONS_PROPERTIES_FILE + " should have been copied to: " + PRODUCT_VERSIONS_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_VERSIONS_PATH + PRODUCT_VERSIONS_PROPERTIES_FILE)); + + Log.info(c, METHOD_NAME, "Product extension: " + PRODUCT_EXT_NAME + " has been installed."); + if (!setupAll) { + break; + } + case SETUP_USR_PROD_EXT: + // install a (usr) product extension. + ProgramOutput po = server.installFeature(null, USR_PRODUCT_FEATURE_NAME); + String stdout = po.getStdout(); + if (!stdout.contains("CWWKF1000I")) { + assertEquals("The feature: " + USR_PRODUCT_FEATURE_NAME + " should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, + po.getReturnCode()); + } + assertTrue("The " + USR_PRODUCT_FEATURE_MF + " feature manifest should exist.", + server.fileExistsInLibertyInstallRoot(USR_PRODUCT_FEATURE_PATH + USR_PRODUCT_FEATURE_MF)); + assertTrue("The " + USR_PRODUCT_BUNDLE_JAR + " bundle should exist.", server.fileExistsInLibertyInstallRoot(USR_PRODUCT_BUNDLE_PATH + USR_PRODUCT_BUNDLE_JAR)); + assertTrue("The " + USR_PRODUCT_VERSIONS_PROPERTIES_FILE + " bundle should exist.", + server.fileExistsInLibertyInstallRoot(USR_PRODUCT_VERSIONS_PATH + USR_PRODUCT_VERSIONS_PROPERTIES_FILE)); + + Log.info(c, METHOD_NAME, "Product extension: " + USR_PRODUCT_FEATURE_NAME + " has been installed in usr"); + + break; + default: + throw new Exception("Invalid setupOption: " + setupOption); + + } + + Log.exiting(c, METHOD_NAME); + } + + /** + * Cleans up the installation from any files that may have been left around. + * + * @throws Exception + */ + @AfterClass + public static void AfterClassCleanup() throws Exception { + final String METHOD_NAME = "cleanup"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) + server.stopServer(); + + server.deleteDirectoryFromLibertyInstallRoot("usr/extension/"); + server.deleteDirectoryFromLibertyInstallRoot("producttest"); + server.deleteDirectoryFromLibertyInstallRoot("etc/extensions"); + server.deleteDirectoryFromLibertyInstallRoot("tool.output.dir"); + + for (String filePath : filesToTidy) { + server.deleteFileFromLibertyInstallRoot(filePath); + } + filesToTidy.clear(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the command to print product information such as product name and version. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testPrintProductVersionForAllProductsInstalled(String cmd, String[] parms, String workDir) throws Exception { + final String METHOD_NAME = "testPrintProductVersionForAllProductsInstalled"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po); + String stdout = po.getStdout(); + assertTrue("The output should contain usr product name: XYZ User Product.", stdout.contains("XYZ User Product")); + assertTrue("The output should contain usr product version: 1.0.0.", stdout.contains("1.0.0")); + assertTrue("The output should contain product name: ACMEProductTest.", stdout.contains("ACMEProductTest")); + assertTrue("The output should contain product version: 9.8.8.9.", stdout.contains("9.8.8.9")); + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the command to print product information such as product name and version. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testPrintProductVersionIfixesForAllProductsInstalled(String cmd, String[] parms, String workDir) throws Exception { + final String METHOD_NAME = "testPrintProductVersionForAllProductsInstalled"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po); + String stdout = po.getStdout(); + assertTrue("The output should contain usr product name: XYZ User Product.", stdout.contains("XYZ User Product")); + assertTrue("The output should contain usr product version: 1.0.0.", stdout.contains("1.0.0")); + assertTrue("The output should contain product name: ACMEProductTest.", stdout.contains("ACMEProductTest")); + assertTrue("The output should contain product version: 9.8.8.9.", stdout.contains("9.8.8.9")); + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the command that list the installed features for all products installed. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testPrintFeatureInfoForAllProductsInstalled(String cmd, String[] parms, String workDir) throws Exception { + final String METHOD_NAME = "testPrintFeatureInfoForAllProductsInstalled"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po); + String stdout = po.getStdout(); + assertTrue("The output should contain usr product feature heading: Product Extension: usr.", stdout.contains("Product Extension: usr")); + assertTrue("The output should contain usr product feature: user.ext.version.info [1.0.0].", stdout.contains("user.ext.version.info [1.0.0]")); + assertTrue("The output should contain product feature heading: Product Extension: testproduct.", stdout.contains("Product Extension: testproduct")); + assertTrue("The output should contain product feature: prodtest-1.0 [1.0.0].", stdout.contains("prodtest-1.0 [1.0.0]")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Prints an extended debug output. + * + * @param po The programOutput + * @param fileName + * @throws Exception + */ + public void logInfo(ProgramOutput po) throws Exception { + String methodName = "logInfo"; + Log.info(c, methodName, "Return Code: " + po.getReturnCode() + ". STDOUT: " + po.getStdout()); + + if (po.getReturnCode() != 0) { + Log.info(c, methodName, "STDERR: " + po.getStderr()); + } + } +} diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductUtilToolTest.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductUtilToolTest.java new file mode 100755 index 000000000000..f84806da31b2 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductUtilToolTest.java @@ -0,0 +1,53 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class ProductUtilToolTest extends ProductToolTestCommon { + + @BeforeClass + public static void beforeClassSetup() throws Exception { + setupEnv(LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.util.tool")); + setupProductExtensions(SETUP_ALL_PROD_EXTS); + + } + + /** + * Test that ws-productutil.jar version will display information for all installed products. + * This includes core, product extensions in default usr location and other installed product extensions. + * + * @throws Exception + */ + @Test + public void testProdUtilToolPrintProductVersionForAllProductsInstalled() throws Exception { + testPrintProductVersionForAllProductsInstalled(javaExc, + new String[] { "-jar", installRoot + "/bin/tools/ws-productutil.jar", "version" }, + installRoot); + } + + /** + * Test that ws-productutil.jar featureInfo will display a list of all installed features. + * This includes core, product extensions in default usr location and other installed product extensions. + * + * @throws Exception + */ + @Test + public void testProdUtilToolPrintFeatureInfoForAllProductsInstalled() throws Exception { + testPrintFeatureInfoForAllProductsInstalled(javaExc, + new String[] { "-jar", installRoot + "/bin/tools/ws-productutil.jar", "featureInfo" }, + installRoot); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.esa b/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.esa new file mode 100755 index 000000000000..05653fcc8224 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.esa differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.with.versions.props.file.esa b/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.with.versions.props.file.esa new file mode 100755 index 000000000000..284b5458db47 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.with.versions.props.file.esa differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_cs b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_cs new file mode 100755 index 000000000000..04cdb53a945a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_cs differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_de b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_de new file mode 100755 index 000000000000..06e0bfa021fc Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_de differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_el b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_el new file mode 100755 index 000000000000..bfaab3fb744a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_el differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_en b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_en new file mode 100755 index 000000000000..862d183280c1 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_en differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_es b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_es new file mode 100755 index 000000000000..6bbe59a266c1 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_es differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_fr b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_fr new file mode 100755 index 000000000000..120b31ca8692 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_fr differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_in b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_in new file mode 100755 index 000000000000..ad7a5b2e4951 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_in differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_it b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_it new file mode 100755 index 000000000000..faff1a330d4d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_it differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ja b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ja new file mode 100755 index 000000000000..1df9b49079a0 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ja differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ko b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ko new file mode 100755 index 000000000000..7e31f7fc2429 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ko differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_lt b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_lt new file mode 100755 index 000000000000..4108a4badcc7 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_lt differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pl b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pl new file mode 100755 index 000000000000..3152ccb3a35c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pl differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pt b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pt new file mode 100755 index 000000000000..3fccbeffa8cd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pt differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ru b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ru new file mode 100755 index 000000000000..01ba7e0d52cc Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ru differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_sl b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_sl new file mode 100755 index 000000000000..e63dd4789b33 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_sl differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_tr b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_tr new file mode 100755 index 000000000000..c80dafb18df0 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_tr differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh new file mode 100755 index 000000000000..beeb8557b10e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh_TW b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh_TW new file mode 100755 index 000000000000..9f95d22b82e3 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_cs b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_cs new file mode 100755 index 000000000000..2e9618e0d5c2 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_cs differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_de b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_de new file mode 100755 index 000000000000..bbe9181847b1 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_de differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_el b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_el new file mode 100755 index 000000000000..6829b8fea29f Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_el differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_en b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_en new file mode 100755 index 000000000000..431157f0e0ef Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_en differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_es b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_es new file mode 100755 index 000000000000..0e42d4c4eb5d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_es differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_fr b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_fr new file mode 100755 index 000000000000..20bf2fac8233 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_fr differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_in b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_in new file mode 100755 index 000000000000..f793986fe27a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_in differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_it b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_it new file mode 100755 index 000000000000..4dec02ff3d4b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_it differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ja b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ja new file mode 100755 index 000000000000..dcfa4c21f68f Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ja differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ko b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ko new file mode 100755 index 000000000000..952cccb81157 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ko differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_lt b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_lt new file mode 100755 index 000000000000..a2b4cfcec4a4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_lt differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pl b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pl new file mode 100755 index 000000000000..6f59bf8cb610 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pl differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pt b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pt new file mode 100755 index 000000000000..e9e5f1db4031 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pt differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ru b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ru new file mode 100755 index 000000000000..a8c645ca2aa2 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ru differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_sl b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_sl new file mode 100755 index 000000000000..c42d8c30ef02 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_sl differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_tr b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_tr new file mode 100755 index 000000000000..aff41b0d16d3 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_tr differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh new file mode 100755 index 000000000000..32f29d044b24 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh_TW b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh_TW new file mode 100755 index 000000000000..1a3124ab929e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/notices b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/notices new file mode 100755 index 000000000000..accdd6bba9db Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/notices differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/productBundles/com.ibm.ws.prodtest.internal_1.0.jar b/dev/com.ibm.ws.product.utility_fat/publish/files/productBundles/com.ibm.ws.prodtest.internal_1.0.jar new file mode 100755 index 000000000000..85a6fa4f6adf Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/productBundles/com.ibm.ws.prodtest.internal_1.0.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/productFeatures/prodtest-1.0.mf b/dev/com.ibm.ws.product.utility_fat/publish/files/productFeatures/prodtest-1.0.mf new file mode 100755 index 000000000000..21b5ef9153be --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/files/productFeatures/prodtest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/productProperties/testproduct.properties b/dev/com.ibm.ws.product.utility_fat/publish/files/productProperties/testproduct.properties new file mode 100755 index 000000000000..1b80aa40d231 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/files/productProperties/testproduct.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall=wlp/producttest/ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/producttest.properties b/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/producttest.properties new file mode 100755 index 000000000000..d7bc0dcba662 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/producttest.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.acme.product.test +com.ibm.websphere.productOwner=ACME +com.ibm.websphere.productVersion=9.8.8.9 +com.ibm.websphere.productName=ACMEProductTest +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/usertest.properties b/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/usertest.properties new file mode 100755 index 000000000000..ac6e3e932b6a --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/usertest.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.acme.user.test +com.ibm.websphere.productOwner=ACME +com.ibm.websphere.productVersion=8.7.7.8 +com.ibm.websphere.productName=ACMEUserTest +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.info.tool/bootstrap.properties b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.info.tool/bootstrap.properties new file mode 100755 index 000000000000..a809f012e2eb --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.info.tool/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.util.tool/bootstrap.properties b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.util.tool/bootstrap.properties new file mode 100755 index 000000000000..a809f012e2eb --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.util.tool/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.product.utility.test.validate.server/bootstrap.properties b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.product.utility.test.validate.server/bootstrap.properties new file mode 100755 index 000000000000..4f1ae5a2e104 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.product.utility.test.validate.server/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_cs b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_cs new file mode 100755 index 000000000000..04cdb53a945a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_cs differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_de b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_de new file mode 100755 index 000000000000..06e0bfa021fc Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_de differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_el b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_el new file mode 100755 index 000000000000..bfaab3fb744a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_el differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_en b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_en new file mode 100755 index 000000000000..862d183280c1 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_en differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_es b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_es new file mode 100755 index 000000000000..6bbe59a266c1 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_es differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_fr b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_fr new file mode 100755 index 000000000000..120b31ca8692 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_fr differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_in b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_in new file mode 100755 index 000000000000..ad7a5b2e4951 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_in differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_it b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_it new file mode 100755 index 000000000000..faff1a330d4d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_it differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ja b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ja new file mode 100755 index 000000000000..1df9b49079a0 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ja differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ko b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ko new file mode 100755 index 000000000000..7e31f7fc2429 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ko differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_lt b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_lt new file mode 100755 index 000000000000..4108a4badcc7 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_lt differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pl b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pl new file mode 100755 index 000000000000..3152ccb3a35c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pl differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pt b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pt new file mode 100755 index 000000000000..3fccbeffa8cd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pt differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ru b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ru new file mode 100755 index 000000000000..01ba7e0d52cc Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ru differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_sl b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_sl new file mode 100755 index 000000000000..e63dd4789b33 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_sl differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_tr b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_tr new file mode 100755 index 000000000000..c80dafb18df0 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_tr differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh new file mode 100755 index 000000000000..beeb8557b10e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh_TW b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh_TW new file mode 100755 index 000000000000..9f95d22b82e3 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_cs b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_cs new file mode 100755 index 000000000000..2e9618e0d5c2 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_cs differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_de b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_de new file mode 100755 index 000000000000..bbe9181847b1 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_de differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_el b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_el new file mode 100755 index 000000000000..6829b8fea29f Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_el differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_en b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_en new file mode 100755 index 000000000000..431157f0e0ef Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_en differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_es b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_es new file mode 100755 index 000000000000..0e42d4c4eb5d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_es differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_fr b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_fr new file mode 100755 index 000000000000..20bf2fac8233 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_fr differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_in b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_in new file mode 100755 index 000000000000..f793986fe27a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_in differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_it b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_it new file mode 100755 index 000000000000..4dec02ff3d4b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_it differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ja b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ja new file mode 100755 index 000000000000..dcfa4c21f68f Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ja differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ko b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ko new file mode 100755 index 000000000000..952cccb81157 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ko differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_lt b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_lt new file mode 100755 index 000000000000..a2b4cfcec4a4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_lt differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pl b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pl new file mode 100755 index 000000000000..6f59bf8cb610 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pl differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pt b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pt new file mode 100755 index 000000000000..e9e5f1db4031 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pt differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ru b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ru new file mode 100755 index 000000000000..a8c645ca2aa2 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ru differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_sl b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_sl new file mode 100755 index 000000000000..c42d8c30ef02 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_sl differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_tr b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_tr new file mode 100755 index 000000000000..aff41b0d16d3 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_tr differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh new file mode 100755 index 000000000000..32f29d044b24 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh_TW b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh_TW new file mode 100755 index 000000000000..1a3124ab929e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/notices b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/notices new file mode 100755 index 000000000000..accdd6bba9db Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/notices differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testFile b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testFile new file mode 100755 index 000000000000..0c8ec66607e6 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testFile differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testfile1 b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testfile1 new file mode 100755 index 000000000000..d22d8a162c11 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testfile1 differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/md5Tests/TestFile.txt b/dev/com.ibm.ws.product.utility_fat/resources/md5Tests/TestFile.txt new file mode 100755 index 000000000000..bce167b4099b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/md5Tests/TestFile.txt @@ -0,0 +1 @@ +Please do *NOT* change the content of this file! \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/TwoAparsArchiveFixPack.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/TwoAparsArchiveFixPack.jar new file mode 100755 index 000000000000..73df83be1d0b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/TwoAparsArchiveFixPack.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/fixes/badDate.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/fixes/badDate.xml new file mode 100755 index 000000000000..6f06ddbca5b0 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/fixes/badDate.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip new file mode 100755 index 000000000000..81647df36959 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar new file mode 100755 index 000000000000..3223d5164dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml new file mode 100755 index 000000000000..772a45701861 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix with a missing file + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..abbcb9ca0dd4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..1b4b6ef8dd93 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/fixes/noApar.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/fixes/noApar.xml new file mode 100755 index 000000000000..521da57aa08b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/fixes/noApar.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + iFix with no problem element so not apar list + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/foo.txt b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/foo.txt new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..abbcb9ca0dd4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..1b4b6ef8dd93 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml new file mode 100755 index 000000000000..c6d82afacfdb --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml @@ -0,0 +1,17 @@ + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/foo.txt b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/foo.txt new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml new file mode 100755 index 000000000000..0c75511c5573 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/foo.txt b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/foo.txt new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties new file mode 100755 index 000000000000..c98455a766dd --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.other +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=Other Product +com.ibm.websphere.productInstallType= +com.ibm.websphere.productEdition= \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml new file mode 100755 index 000000000000..43d13f997054 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix with a static file who's date is a long way into the future so the file will be older and therefore not valid + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/foo.txt b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/foo.txt new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..abbcb9ca0dd4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..1b4b6ef8dd93 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml new file mode 100755 index 000000000000..c2f9394e9f38 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix that is applicable to an old version of WAS + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/foo.txt b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/foo.txt new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..abbcb9ca0dd4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..1b4b6ef8dd93 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip new file mode 100755 index 000000000000..b998aa53dcdb Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar new file mode 100755 index 000000000000..3223d5164dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar new file mode 100755 index 000000000000..3223d5164dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml new file mode 100755 index 000000000000..bc373d18ca80 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..098bb14b19b4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..831626ac335c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar new file mode 100755 index 000000000000..3223d5164dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar new file mode 100755 index 000000000000..3223d5164dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml new file mode 100755 index 000000000000..bc373d18ca80 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml new file mode 100755 index 000000000000..ce99d7e52cfa --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + iFix 2 with one APAR + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..098bb14b19b4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..831626ac335c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/.classpath b/dev/com.ibm.ws.product.utility_test/.classpath new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/.classpath.gradle b/dev/com.ibm.ws.product.utility_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/.gitignore b/dev/com.ibm.ws.product.utility_test/.gitignore new file mode 100644 index 000000000000..106ad11d242b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.gitignore @@ -0,0 +1,5 @@ +bundles +dist +/*.log* +/coverage.ec +/lib diff --git a/dev/com.ibm.ws.product.utility_test/.project b/dev/com.ibm.ws.product.utility_test/.project new file mode 100755 index 000000000000..019b18480f0f --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.product.utility_test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..845c3083c7df --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c874b5816985 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.product.utility_test/bnd.bnd b/dev/com.ibm.ws.product.utility_test/bnd.bnd new file mode 100755 index 000000000000..f8cbc41aa163 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/bnd.bnd @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.logging.core;version=latest, \ + com.ibm.ws.product.utility;version=latest diff --git a/dev/com.ibm.ws.product.utility_test/bnd.bnd.gradle b/dev/com.ibm.ws.product.utility_test/bnd.bnd.gradle new file mode 100755 index 000000000000..f8cbc41aa163 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/bnd.bnd.gradle @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.logging.core;version=latest, \ + com.ibm.ws.product.utility;version=latest diff --git a/dev/com.ibm.ws.product.utility_test/build-unittest.xml b/dev/com.ibm.ws.product.utility_test/build-unittest.xml new file mode 100755 index 000000000000..4d6b82ee7c5b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/build-unittest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_test/build.gradle b/dev/com.ibm.ws.product.utility_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_test/delivery.sets b/dev/com.ibm.ws.product.utility_test/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_cs b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_cs new file mode 100755 index 000000000000..04cdb53a945a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_cs differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_de b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_de new file mode 100755 index 000000000000..06e0bfa021fc Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_de differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_el b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_el new file mode 100755 index 000000000000..bfaab3fb744a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_el differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_en b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_en new file mode 100755 index 000000000000..862d183280c1 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_en differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_es b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_es new file mode 100755 index 000000000000..6bbe59a266c1 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_es differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_fr b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_fr new file mode 100755 index 000000000000..120b31ca8692 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_fr differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_in b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_in new file mode 100755 index 000000000000..ad7a5b2e4951 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_in differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_it b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_it new file mode 100755 index 000000000000..faff1a330d4d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_it differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ja b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ja new file mode 100755 index 000000000000..1df9b49079a0 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ja differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ko b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ko new file mode 100755 index 000000000000..7e31f7fc2429 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ko differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_lt b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_lt new file mode 100755 index 000000000000..4108a4badcc7 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_lt differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pl b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pl new file mode 100755 index 000000000000..3152ccb3a35c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pl differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pt b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pt new file mode 100755 index 000000000000..3fccbeffa8cd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pt differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ru b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ru new file mode 100755 index 000000000000..01ba7e0d52cc Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ru differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_sl b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_sl new file mode 100755 index 000000000000..e63dd4789b33 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_sl differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_tr b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_tr new file mode 100755 index 000000000000..c80dafb18df0 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_tr differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh new file mode 100755 index 000000000000..beeb8557b10e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh_TW b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh_TW new file mode 100755 index 000000000000..9f95d22b82e3 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_cs b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_cs new file mode 100755 index 000000000000..2e9618e0d5c2 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_cs differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_de b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_de new file mode 100755 index 000000000000..bbe9181847b1 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_de differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_el b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_el new file mode 100755 index 000000000000..6829b8fea29f Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_el differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_en b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_en new file mode 100755 index 000000000000..431157f0e0ef Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_en differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_es b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_es new file mode 100755 index 000000000000..0e42d4c4eb5d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_es differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_fr b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_fr new file mode 100755 index 000000000000..20bf2fac8233 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_fr differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_in b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_in new file mode 100755 index 000000000000..f793986fe27a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_in differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_it b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_it new file mode 100755 index 000000000000..4dec02ff3d4b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_it differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ja b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ja new file mode 100755 index 000000000000..dcfa4c21f68f Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ja differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ko b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ko new file mode 100755 index 000000000000..952cccb81157 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ko differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_lt b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_lt new file mode 100755 index 000000000000..a2b4cfcec4a4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_lt differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pl b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pl new file mode 100755 index 000000000000..6f59bf8cb610 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pl differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pt b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pt new file mode 100755 index 000000000000..e9e5f1db4031 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pt differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ru b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ru new file mode 100755 index 000000000000..a8c645ca2aa2 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ru differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_sl b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_sl new file mode 100755 index 000000000000..c42d8c30ef02 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_sl differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_tr b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_tr new file mode 100755 index 000000000000..aff41b0d16d3 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_tr differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh new file mode 100755 index 000000000000..32f29d044b24 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh_TW b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh_TW new file mode 100755 index 000000000000..1a3124ab929e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/notices b/dev/com.ibm.ws.product.utility_test/resources/lafiles/notices new file mode 100755 index 000000000000..accdd6bba9db Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/notices differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/testFile b/dev/com.ibm.ws.product.utility_test/resources/lafiles/testFile new file mode 100755 index 000000000000..0c8ec66607e6 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/testFile differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/testfile1 b/dev/com.ibm.ws.product.utility_test/resources/lafiles/testfile1 new file mode 100755 index 000000000000..d22d8a162c11 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/testfile1 differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/md5Tests/TestFile.txt b/dev/com.ibm.ws.product.utility_test/resources/md5Tests/TestFile.txt new file mode 100755 index 000000000000..bce167b4099b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/md5Tests/TestFile.txt @@ -0,0 +1 @@ +Please do *NOT* change the content of this file! \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/TwoAparsArchiveFixPack.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/TwoAparsArchiveFixPack.jar new file mode 100755 index 000000000000..73df83be1d0b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/TwoAparsArchiveFixPack.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/fixes/badDate.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/fixes/badDate.xml new file mode 100755 index 000000000000..6f06ddbca5b0 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/fixes/badDate.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip new file mode 100755 index 000000000000..81647df36959 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar new file mode 100755 index 000000000000..3223d5164dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml new file mode 100755 index 000000000000..772a45701861 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix with a missing file + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..abbcb9ca0dd4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..1b4b6ef8dd93 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/fixes/noApar.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/fixes/noApar.xml new file mode 100755 index 000000000000..521da57aa08b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/fixes/noApar.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + iFix with no problem element so not apar list + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/foo.txt b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/foo.txt new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..abbcb9ca0dd4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..1b4b6ef8dd93 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml new file mode 100755 index 000000000000..c6d82afacfdb --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml @@ -0,0 +1,17 @@ + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/foo.txt b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/foo.txt new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml new file mode 100755 index 000000000000..0c75511c5573 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/foo.txt b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/foo.txt new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties new file mode 100755 index 000000000000..c98455a766dd --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.other +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=Other Product +com.ibm.websphere.productInstallType= +com.ibm.websphere.productEdition= \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml new file mode 100755 index 000000000000..43d13f997054 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix with a static file who's date is a long way into the future so the file will be older and therefore not valid + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/foo.txt b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/foo.txt new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..abbcb9ca0dd4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..1b4b6ef8dd93 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml new file mode 100755 index 000000000000..c2f9394e9f38 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix that is applicable to an old version of WAS + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/foo.txt b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/foo.txt new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..abbcb9ca0dd4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..1b4b6ef8dd93 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip new file mode 100755 index 000000000000..b998aa53dcdb Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar new file mode 100755 index 000000000000..3223d5164dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar new file mode 100755 index 000000000000..3223d5164dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml new file mode 100755 index 000000000000..bc373d18ca80 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..098bb14b19b4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..831626ac335c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar new file mode 100755 index 000000000000..3223d5164dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar new file mode 100755 index 000000000000..3223d5164dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml new file mode 100755 index 000000000000..bc373d18ca80 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml new file mode 100755 index 000000000000..ce99d7e52cfa --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + iFix 2 with one APAR + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 000000000000..ad8cd7d7339b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 000000000000..098bb14b19b4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 000000000000..831626ac335c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/BaseCommandTaskTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/BaseCommandTaskTest.java new file mode 100755 index 000000000000..89e2377f3ab4 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/BaseCommandTaskTest.java @@ -0,0 +1,164 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.Test; + +import junit.framework.Assert; + +public class BaseCommandTaskTest { + private static final String SUPPORTED_OPTION = "--supportedOption"; + private static final String BAD_PREFIX_OPTION = "attemptToSupportOptionWithBadPrefix"; + private static final String TOTALLY_UNSUPPORTED_OPTION = "GIBBERISH!$!^@$@%$"; + private static final String SUCCESS_MESSAGE = "SUCCESS!"; + + private final Mockery mock = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + + private final CommandConsole commandConsole = mock.mock(CommandConsole.class, "commandConsole"); + + /* + * The test command should only print a success message because no options should be detected. + */ + @Test + public void testNoOptions() { + ExecutionContextImpl context = createExecutionContext(new String[] {}); + mock.checking(new Expectations() { + { + one(commandConsole).printlnInfoMessage(SUCCESS_MESSAGE); + } + }); + new TestCommandTask().execute(context); + } + + /* + * The test command should indicate that it found the supported option but it should not detect a + * value for it. + */ + @Test + public void testSupportedOptionNoValue() { + ExecutionContextImpl context = createExecutionContext(new String[] { SUPPORTED_OPTION }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnInfoMessage("found" + SUPPORTED_OPTION); + one(commandConsole).printlnInfoMessage(SUCCESS_MESSAGE); + } + }); + new TestCommandTask().execute(context); + } + + /* + * The test command should indicate that it found the supported option AND that it has an associated + * value. + */ + @Test + public void testSupportedOptionWithValue() { + ExecutionContextImpl context = createExecutionContext(new String[] { SUPPORTED_OPTION + "=test" }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnInfoMessage("found" + SUPPORTED_OPTION); + one(commandConsole).printlnInfoMessage("value=test"); + one(commandConsole).printlnInfoMessage(SUCCESS_MESSAGE); + } + }); + new TestCommandTask().execute(context); + } + + /* + * This one is a bit tricky. The test command is *claiming* that it supports BAD_PREFIX_OPTION (look at the + * "getSupportedOptions" method), but the expected result is that BAD_PREFIX_OPTION should not pass validation + * and should result in an error message. This is to protect against developers who add future command tasks and + * who aren't aware that all options should be standardized and start with the "--" prefix. They might code their + * command task to support an option without the appropriate prefix, but the command will not actually work. + */ + @Test + public void testBadPrefixOption() { + ExecutionContextImpl context = createExecutionContext(new String[] { SUPPORTED_OPTION + "=test", BAD_PREFIX_OPTION }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnErrorMessage("CWWKE0514E: An invalid option, " + BAD_PREFIX_OPTION + ", was supplied on the command line. Valid options are: [--output, " + SUPPORTED_OPTION + "]"); + } + }); + new TestCommandTask().execute(context); + } + + /** + * Obviously, since the user is passing in a totally unsupported option, the test should complain about it. + */ + @Test + public void testTotallyUnsupportedOption() { + ExecutionContextImpl context = createExecutionContext(new String[] { SUPPORTED_OPTION + "=test", TOTALLY_UNSUPPORTED_OPTION }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnErrorMessage("CWWKE0514E: An invalid option, " + TOTALLY_UNSUPPORTED_OPTION + ", was supplied on the command line. Valid options are: [--output, " + SUPPORTED_OPTION + "]"); + } + }); + new TestCommandTask().execute(context); + } + + private ExecutionContextImpl createExecutionContext(String[] args) { + ExecutionContextImpl context = new ExecutionContextImpl(commandConsole, args, null); + return context; + } + + public static class TestCommandTask extends BaseCommandTask { + /** {@inheritDoc} */ + @Override + public Set getSupportedOptions() { + return new HashSet(Arrays.asList(SUPPORTED_OPTION, + BAD_PREFIX_OPTION)); + } + + /** {@inheritDoc} */ + @Override + public String getTaskName() { + return null; + } + + /** {@inheritDoc} */ + @Override + public String getTaskDescription() { + return null; + } + + /** {@inheritDoc} */ + @Override + public String getTaskHelp() { + return null; + } + + /** {@inheritDoc} */ + @Override + public void doExecute(ExecutionContext context) { + if (context.optionExists(SUPPORTED_OPTION)) { + context.getCommandConsole().printlnInfoMessage("found" + SUPPORTED_OPTION); + String value = context.getOptionValue(SUPPORTED_OPTION); + if (value != null && !value.isEmpty()) { + context.getCommandConsole().printlnInfoMessage("value=" + value); + } + } + Assert.assertFalse("Option " + BAD_PREFIX_OPTION + " should not exist", context.optionExists(BAD_PREFIX_OPTION)); + context.getCommandConsole().printlnInfoMessage(SUCCESS_MESSAGE); + } + } +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/ExecutionContextTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/ExecutionContextTest.java new file mode 100755 index 000000000000..cbc777d3db6b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/ExecutionContextTest.java @@ -0,0 +1,58 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility; + +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.Test; + +import junit.framework.Assert; + +public class ExecutionContextTest { + + private final Mockery mock = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + + private final CommandConsole commandConsole = mock.mock(CommandConsole.class, "commandConsole"); + + private final CommandTaskRegistry commandTaskRegistry = new CommandTaskRegistry(); + + @Test + public void testParsingOptions() throws Exception { + String[] arguments = { "--help", "--output=a.txt", "--encode=us", "abc" }; + ExecutionContext executionContext = createExecutionContext(arguments); + Assert.assertEquals("The expected option value of --output should be a.txt", "a.txt", executionContext.getOptionValue("--output")); + Assert.assertEquals("The expected option value of --encode should be us", "us", executionContext.getOptionValue("--encode")); + + Assert.assertTrue("The --help option should exist in the parsed result", executionContext.optionExists("--help")); + Assert.assertTrue("The abc option should exist in the parsed result", executionContext.optionExists("abc")); + + Assert.assertFalse("The --INVALID should not exist in the parsed result", executionContext.optionExists("--INVALID")); + } + + @Test + public void testEmptyParsingOptions() throws Exception { + String[] arguments = {}; + ExecutionContext executionContext = createExecutionContext(arguments); + Assert.assertFalse("The --INVALID should not be existing in the parsed result", executionContext.optionExists("--INVALID")); + Assert.assertFalse("The abc should not be existing in the parsed result", executionContext.optionExists("abc")); + } + + private ExecutionContext createExecutionContext(String[] args) { + return new ExecutionContextImpl(commandConsole, args, commandTaskRegistry); + } + +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/HelpCommandTaskTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/HelpCommandTaskTest.java new file mode 100755 index 000000000000..68572f6d9c11 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/HelpCommandTaskTest.java @@ -0,0 +1,126 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility; + +import java.util.HashSet; +import java.util.Set; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.ibm.ws.product.utility.extension.HelpCommandTask; + +public class HelpCommandTaskTest { + + private final Mockery mock = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + + private final CommandConsole commandConsole = mock.mock(CommandConsole.class, "commandConsole"); + + private final CommandTaskRegistry commandTaskRegistry = new CommandTaskRegistry(); + + @Before + public void setUp() { + commandTaskRegistry.registerCommandTask("test", TestCommandTask.class); + } + + @After + public void tearDown() { + commandTaskRegistry.clear(); + } + + @Test + public void testEmptyArguments() { + ExecutionContextImpl context = createExecutionContext(new String[0]); + mock.checking(new Expectations() { + { + one(commandConsole).printlnInfoMessage(""); + one(commandConsole).printlnInfoMessage("Usage: testScript {testTaskName} [options]"); + one(commandConsole).printlnInfoMessage(CommandConstants.LINE_SEPARATOR + "Actions:" + CommandConstants.LINE_SEPARATOR + CommandConstants.LINE_SEPARATOR + + " " + "testTaskName" + CommandConstants.LINE_SEPARATOR + "testTaskDescription" + + CommandConstants.LINE_SEPARATOR + CommandConstants.LINE_SEPARATOR + "Options:" + + CommandConstants.LINE_SEPARATOR + + "\tUse help [actionName] for detailed option information of each action."); + } + }); + new HelpCommandTask().execute(context); + } + + @Test + public void testTaskName() { + ExecutionContextImpl context = createExecutionContext(new String[] { "test" }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnInfoMessage("testTaskHelp"); + one(commandConsole).printlnInfoMessage(""); + } + }); + new HelpCommandTask().doExecute(context); + } + + @Test + public void testInvalidTaskName() { + ExecutionContextImpl context = createExecutionContext(new String[] { "invalidTaskName" }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnErrorMessage(""); + one(commandConsole).printlnErrorMessage("CWWKE0502E: Unknown task: invalidTaskName."); + } + }); + new HelpCommandTask().doExecute(context); + } + + private ExecutionContextImpl createExecutionContext(String[] args) { + ExecutionContextImpl context = new ExecutionContextImpl(commandConsole, args, commandTaskRegistry); + context.setAttribute(CommandConstants.SCRIPT_NAME, "testScript"); + return context; + } + + public static class TestCommandTask implements CommandTask { + /** {@inheritDoc} */ + @Override + public Set getSupportedOptions() { + return new HashSet(); + } + + /** {@inheritDoc} */ + @Override + public String getTaskName() { + return "testTaskName"; + } + + /** {@inheritDoc} */ + @Override + public String getTaskDescription() { + return "testTaskDescription"; + } + + /** {@inheritDoc} */ + @Override + public String getTaskHelp() { + return "testTaskHelp"; + } + + /** {@inheritDoc} */ + @Override + public void execute(ExecutionContext context) {} + + } +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/LicenseUtilityTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/LicenseUtilityTest.java new file mode 100755 index 000000000000..e8fa18a697c2 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/LicenseUtilityTest.java @@ -0,0 +1,128 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.junit.Before; +import org.junit.Test; + +/** + * Units tests for LicenseUtility that displays License Information and License Agreement + */ +public class LicenseUtilityTest { + + private final LicenseUtility utility = new LicenseUtility(); + String TEST_FILE_NAME = "lafiles/testfile1"; + String LICENSE_DIR = "lafiles"; + String EMPTY_LICENSE_DIR = "emptyLAFiles"; + String INVALID_TEST_FILE_NAME = "lafiles/invalidFile"; + + private Mockery mockery; + private CommandConsole console; + + /** + * This method is run before each test to make the {@link #mockery} object with a mocked {@link #console} and {@link #context} and you can retrieve the console via a call + * {@link ExecutionContext#getCommandConsole()} + */ + @Before + public void createMockery() { + this.mockery = new Mockery(); + this.console = mockery.mock(CommandConsole.class); + } + + @Test + public void testShowLicenseFile() throws FileNotFoundException, URISyntaxException { + File testFile = new File(ClassLoader.getSystemResource(TEST_FILE_NAME).toURI()); + InputStream is = new FileInputStream(testFile); + + this.mockery.checking(new Expectations() { + { + one(console).printlnInfoMessage("hewey"); + one(console).printlnInfoMessage("dewey"); + one(console).printlnInfoMessage("luey"); + one(console).printlnInfoMessage(""); + } + }); + utility.showLicenseFile(is, console); + } + + @Test + public void testDisplayLicenseFile() throws FileNotFoundException, URISyntaxException { + File testFile = new File(ClassLoader.getSystemResource(TEST_FILE_NAME).toURI()); + InputStream is = new FileInputStream(testFile); + + this.mockery.checking(new Expectations() { + { + one(console).printlnInfoMessage("hewey"); + one(console).printlnInfoMessage("dewey"); + one(console).printlnInfoMessage("luey"); + one(console).printlnInfoMessage(""); + } + }); + utility.displayLicenseFile(is, console); + + createMockery(); + this.mockery.checking(new Expectations() { + { + one(console).printErrorMessage(with(any(String.class))); + } + }); + utility.displayLicenseFile(null, console); + + } + + @Test + public void testGetLicenseFile() throws URISyntaxException, IOException { + + File licenseDir = new File(ClassLoader.getSystemResource(LICENSE_DIR).toURI()); + File licenseInfo = utility.getLicenseFile(licenseDir, "LI"); + assertTrue("FAIL: License info doesnt exist:", licenseInfo.exists()); + + Locale locale = Locale.getDefault(); + String lang = locale.getLanguage(); + + assertEquals("License locale is not en or not LI:", "LI_" + lang, licenseInfo.getName()); + + File licenseAgreement = utility.getLicenseFile(licenseDir, "LA"); + assertTrue("FAIL: License agreement doesnt exist:", licenseAgreement.exists()); + assertEquals("License locale is not en or not LA:", "LA_" + lang, licenseAgreement.getName()); + } + + @Test + @SuppressWarnings("static-access") + public void testWordWrap() { + + String fullLine = "This is a test string for testing the license agreement and license information word wrap"; + List actualLine = utility.wordWrap(fullLine, null); + + List expectedLine = new ArrayList(); + expectedLine.add("This is a test string for testing the license agreement and license, information word wrap"); + assertEquals("FAIL: wordWrap is not wrapping line properly:", actualLine.toString(), expectedLine.toString()); + + List actualLine1 = utility.wordWrap("", null); + assertEquals("FAIL: wordWrap is not returning empty:", actualLine1.toString(), "[]"); + } +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/MD5UtilsTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/MD5UtilsTest.java new file mode 100755 index 000000000000..7f44de59fd80 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/MD5UtilsTest.java @@ -0,0 +1,58 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility; + +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; + +import junit.framework.Assert; + +import org.junit.Test; + +import com.ibm.ws.product.utility.extension.MD5Utils; + +/** + * Test the MD5 Utilities works as expect. + */ +public class MD5UtilsTest { + + private static final String TEST_STR = "abc"; + private static final String TEST_STR_MD5_VALUE = "900150983cd24fb0d6963f7d28e17f72"; + + private static final String TEST_FILE_NAME = "md5Tests/TestFile.txt"; + private static final String TEST_FILE_MD5_VALUE = "91d4999210e9ffa1444b37b9ca8364b2"; + + @Test + public void testGetMD5String() { + String calculatedValue = MD5Utils.getMD5String(TEST_STR); + Assert.assertEquals("The expected MD5 value of string abc is " + TEST_STR_MD5_VALUE, TEST_STR_MD5_VALUE, calculatedValue); + } + + @Test + public void testGetFileMD5String() { + File testFile; + String calculatedValue; + try { + testFile = new File(ClassLoader.getSystemResource(TEST_FILE_NAME).toURI()); + calculatedValue = MD5Utils.getFileMD5String(testFile); + } catch (URISyntaxException e) { + Assert.fail("Can not find mock file!"); + return; + } catch (IOException e) { + Assert.fail("Can not read mock file!"); + return; + } + Assert.assertEquals("The expected MD5 value of file " + testFile.getName(), TEST_FILE_MD5_VALUE, calculatedValue); + } + +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixCompareCommandTaskTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixCompareCommandTaskTest.java new file mode 100755 index 000000000000..15cd3cd5f696 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixCompareCommandTaskTest.java @@ -0,0 +1,690 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.extension; + +import java.io.File; +import java.net.URISyntaxException; +import java.net.URL; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.junit.Before; +import org.junit.Test; + +import com.ibm.ws.product.utility.CommandConsole; +import com.ibm.ws.product.utility.CommandConstants; +import com.ibm.ws.product.utility.ExecutionContext; + +/** + * + */ +public class IFixCompareCommandTaskTest { + + private Mockery mockery; + private ExecutionContext context; + private CommandConsole console; + + /** + * This method is run before each test to make the {@link #mockery} object with a mocked {@link #console} and {@link #context} and you can retrieve the console via a call + * {@link ExecutionContext#getCommandConsole()} + */ + @Before + public void createMockery() { + this.mockery = new Mockery(); + this.context = mockery.mock(ExecutionContext.class); + this.console = mockery.mock(CommandConsole.class); + this.mockery.checking(new Expectations() { + { + allowing(context).getCommandConsole(); + will(returnValue(console)); + // Some messages are spaced out a bit so always allow "" + allowing(console).printlnInfoMessage(""); + } + }); + } + + /** + * This test makes sure that when you have matching APARs to iFixes then the compare --target works correctly when comparing with directory install + * + * @throws URISyntaxException + */ + @Test + public void testCompareToMatchingApars() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL threeAparInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File threeAparInstallFile = new File(threeAparInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(threeAparInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + threeAparInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + threeAparInstallFile.getAbsolutePath() + " and in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [iFix1]")); + oneOf(console).printlnInfoMessage(with("2 in the iFix(es): [iFix1]")); + oneOf(console).printlnInfoMessage(with("3 in the iFix(es): [iFix2]")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test checks that when we compare two images with iFixes we use the iFixes in the target when working out if all + * the fixes exist in the target install. + * + * @throws URISyntaxException + */ + @Test + public void testCompareIncludesIFixes() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL threeAparInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File threeAparInstallFile = new File(threeAparInstallFileLocation.toURI()); + URL oneIFixTwoFP = this.getClass().getClassLoader().getResource("mockInstalls/oneIFixTwoFP"); + final File threeAparFixPackFile = new File(oneIFixTwoFP.toURI()); + this.setUpTargetMockery(threeAparInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("Some of the iFixes in the image at " + threeAparInstallFile.getAbsolutePath() + " are missing in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + threeAparInstallFile.getAbsolutePath() + " but are missing in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("3 in the iFix(es): [iFix2]")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + threeAparInstallFile.getAbsolutePath() + " and in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [iFix1]")); + oneOf(console).printlnInfoMessage(with("2 in the iFix(es): [iFix1]")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when you have some APARs in iFixes then the compare --target works correctly when comparing with archive install + * + * @throws URISyntaxException + */ + @Test + public void testCompareToMissingApars() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL installLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File installFile = new File(installLocation.toURI()); + URL fpLocation = this.getClass().getClassLoader().getResource("mockInstalls/TwoAparsArchiveFixPack.jar"); + final File fpFile = new File(fpLocation.toURI()); + this.setUpTargetMockery(installFile, fpFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("Some of the iFixes in the image at " + installFile.getAbsolutePath() + " are missing in the image at " + + fpFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + installFile.getAbsolutePath() + " but are missing in the image at " + + fpFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("2 in the iFix(es): [iFix1]")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + installFile.getAbsolutePath() + " and in the image at " + + fpFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [iFix1]")); + oneOf(console).printlnInfoMessage(with("3 in the iFix(es): [iFix2]")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + public static final class APARTestData { + public final String description; + public final String aparsOption; + public final String[] presentApars; + public final String[] missingApars; + public final String resultText; + + public APARTestData(String description, String aparsOption, String[] presentApars, String[] missingApars) { + this.description = description; + this.aparsOption = aparsOption; + this.presentApars = presentApars; + this.missingApars = missingApars; + this.resultText = getResultText(this.presentApars, this.missingApars); + } + + public static final String ALL_APARS_PRESENT_TEXT = "All of the APARs are in the installation."; + public static final String MISSING_APARS_PREFIX = "The following APARs are not in the installation: ["; + public static final String MISSING_APARS_DELIM = ", "; + public static final String MISSING_APARS_SUFFIX = "]."; + + public static String getResultText(String[] presentApars, String[] missingApars) { + if ((missingApars == null) || (missingApars.length == 0)) { + return ALL_APARS_PRESENT_TEXT; + } + + StringBuilder builder = new StringBuilder(MISSING_APARS_PREFIX); + for (int aparNo = 0; aparNo < missingApars.length; aparNo++) { + if (aparNo > 0) { + builder.append(MISSING_APARS_DELIM); + } + builder.append(missingApars[aparNo]); + } + builder.append(MISSING_APARS_SUFFIX); + + return builder.toString(); + } + } + + public static final String[] EMPTY_STRINGS = new String[] {}; + + public static final APARTestData[] COMPREHENSIVE_APAR_TEST_DATA = + new APARTestData[] { new APARTestData("empty", "", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("spaces", " ", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("tabs", "\t\t\t", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("bare comma", ",", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("comma and spaces", " , ", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("comma and tabs", "\t,\t", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("one absent", "PM99999", EMPTY_STRINGS, new String[] { "PM99999" }), + new APARTestData("one absent, extra spaces", " PM99999 ", EMPTY_STRINGS, new String[] { "PM99999" }), + new APARTestData("one absent, extra tabs", "\t\tPM99999\t\t", EMPTY_STRINGS, new String[] { "PM99999" }), + new APARTestData("multiple absent", "PM99999,PM99998", EMPTY_STRINGS, new String[] { "PM99999", "PM99998" }), + new APARTestData("multiple absent, extra spaces", " PM99999 , PM99998 ", EMPTY_STRINGS, new String[] { "PM99999", "PM99998" }), + new APARTestData("duplicate absent", "PM99999,PM99998,PM99999", EMPTY_STRINGS, new String[] { "PM99999", "PM99998" }), + new APARTestData("one present", "1", new String[] { "1" }, EMPTY_STRINGS), + new APARTestData("one present, one absent, comma delimited", "1,PM99999", new String[] { "1" }, new String[] { "PM99999" }), + new APARTestData("one present, one absent, space delimited", "1 PM99999", new String[] { "1" }, new String[] { "PM99999" }), + new APARTestData("one present, one absent, tab delimited", "1\tPM99999", new String[] { "1" }, new String[] { "PM99999" }), + new APARTestData("two present, one absent, space delimited", "1 10 PM99999", new String[] { "1", "10" }, new String[] { "PM99999" }), + new APARTestData("two present, one absent, mixed delimiters", "1,10 PM99999", new String[] { "1", "10" }, new String[] { "PM99999" }) + }; + + @Test + public void testCompareAparsAllPresent() throws URISyntaxException { + // Use the sample data with two ifixes and three APARs + APARTestData testData = new APARTestData("three present", "1,4,10", new String[] { "1", "4", "10" }, EMPTY_STRINGS); + runAparsTest(testData); // throws URISyntaxException + } + + @Test + public void testCompareAparsSomeMissing() throws URISyntaxException { + APARTestData testData = new APARTestData("two present, one absent", "1,4,apar5", new String[] { "1", "4" }, new String[] { "apar5" }); + runAparsTest(testData); // throws URISyntaxException + } + + @Test + public void testAparsComprehensive() throws URISyntaxException { + for (int testNo = 0; testNo < COMPREHENSIVE_APAR_TEST_DATA.length; testNo++) { + if (testNo > 0) { + createMockery(); // Get this for free on the first test. Recreate for the remaining tests. + } + runAparsTest(COMPREHENSIVE_APAR_TEST_DATA[testNo]); // throws URISyntaxException + } + } + + public void runAparsTest(final APARTestData productInfoData) throws URISyntaxException { + URL installLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File installFile = new File(installLocation.toURI()); + mockery.checking(new Expectations() { + { + allowing(context).getAttribute(with(CommandConstants.WLP_INSTALLATION_LOCATION), with(File.class)); + will(returnValue(installFile)); + allowing(context).optionExists(with("--target")); + will(returnValue(false)); + allowing(context).optionExists(with("--apars")); + will(returnValue(true)); + allowing(context).optionExists(with("--verbose")); + will(returnValue(false)); + allowing(context).getOptionValue(with("--apars")); + will(returnValue(productInfoData.aparsOption)); + } + }); + + // Verify the specified expected result. + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage(with(productInfoData.resultText)); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * Test to make sure when no input is provided an error is output + * + * @throws URISyntaxException + */ + @Test + public void testNoOptionsSet() throws URISyntaxException { + // Add expectations for no input + mockery.checking(new Expectations() { + { + allowing(context).optionExists(with("--target")); + will(returnValue(false)); + allowing(context).optionExists(with("--apars")); + will(returnValue(false)); + } + }); + + // Add expectations for the error + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + with("Unable to compare because of invalid usage of command, one of --target or --apars\nmust be supplied.")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * Test to make sure when no input is provided an error is output + * + * @throws URISyntaxException + */ + @Test + public void testToOptionDoesNotExist() throws URISyntaxException { + // Add expectations for to an invalid location + URL installLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File installFile = new File(installLocation.toURI()); + final File missingFile = new File(installFile, "foo"); + this.setUpTargetMockery(installFile, missingFile); + + // Add expectations for the error + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + with("Installation file " + missingFile.getAbsolutePath() + " does not exist.")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * Tests that when the to points to a file then there is a warning + * + * @throws URISyntaxException + */ + @Test + public void testInvalidToOption() throws URISyntaxException { + // Add expectations for to an invalid location + URL installLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File installFile = new File(installLocation.toURI()); + final File illegalFile = new File(this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml").toURI()); + this.setUpTargetMockery(installFile, illegalFile); + + // Add expectations for the error + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + with("The install location " + illegalFile.getAbsolutePath() + " is not a directory or archive file (.jar or .zip)")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * Tests that when the to points to an install directory that has an invalid APAR ID zip in it then there is an appropriate error + * + * @throws URISyntaxException + */ + @Test + public void testInvalidZip() throws URISyntaxException { + // Add expectations for to an invalid location + URL installLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File installFile = new File(installLocation.toURI()); + final File illegalFile = new File(this.getClass().getClassLoader().getResource("mockInstalls/invalidZip").toURI()); + this.setUpTargetMockery(installFile, illegalFile); + + // Add expectations for the error + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + with("The installation location " + + illegalFile.getAbsolutePath() + + " is invalid. It contains an archive for listing APARs (wlp_fp8509_aparIds.zip) but no file listing the APARs inside it aparIds.csv.")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when you have a <file> element that has a badly formatted date then it produces the right error + * + * @throws URISyntaxException + */ + @Test + public void testInvalidTimeInFile() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL badDateInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/badDate"); + final File badDateInstallFile = new File(badDateInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(badDateInstallFile, threeAparFixPackFile, true); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + badDateInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + badDateInstallFile.getAbsolutePath() + " and in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [badDate]")); + oneOf(console).printlnErrorMessage( + "Unable to read iFix information for badDate so cannot check if the iFix is still installed"); + oneOf(console).printlnErrorMessage( + "The following iFix(es) were not included in the comparison because their XML is invalid (use --verbose option for more information): [badDate]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when you don't have any properties for WAS versions then that check is skipped + * + * @throws URISyntaxException + */ + @Test + public void testNoProperties() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL noPropertiesInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/noProperties"); + final File noPropertiesInstallFile = new File(noPropertiesInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(noPropertiesInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + "Unable to obtain version for the current install so cannot check if iFixes are applicable to this installation. The exception message is: No properties were found with productId 'com.ibm.websphere.appserver'"); + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + noPropertiesInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + noPropertiesInstallFile.getAbsolutePath() + " and in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [noProperties]")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when there is an XML with no offering element that you get a warning + * + * @throws URISyntaxException + */ + @Test + public void testNoOffering() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL noOfferingInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/noOffering"); + final File noOfferingInstallFile = new File(noOfferingInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(noOfferingInstallFile, threeAparFixPackFile, true); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + "The iFix XML meta data for noOffering does not contain an offering element so cannot check that the iFix is valid for this installation"); + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + noOfferingInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + noOfferingInstallFile.getAbsolutePath() + " and in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [noOffering]")); + oneOf(console).printlnErrorMessage( + "The following iFix(es) were not included in the comparison because their XML is invalid (use --verbose option for more information): [noOffering]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when there is an XML with no problem element that you get a warning + * + * @throws URISyntaxException + */ + @Test + public void testNoApar() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL noAparInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/noApar"); + final File noAparInstallFile = new File(noAparInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(noAparInstallFile, threeAparFixPackFile, true); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + "The iFix noApar does not have any APARs listed in elements in the meta data XML"); + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + noAparInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnErrorMessage( + "The following iFix(es) were not included in the comparison because their XML is invalid (use --verbose option for more information): [noApar]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test is the same as the previous test so it makes sure that when there is an XML with no problem element that you get a warning but there is no verbose option so it + * should not give details of what is wrong in the XML. + * + * @throws URISyntaxException + */ + @Test + public void testNoApar_noVerbose() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL noAparInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/noApar"); + final File noAparInstallFile = new File(noAparInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(noAparInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + noAparInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnErrorMessage( + "The following iFix(es) were not included in the comparison because their XML is invalid (use --verbose option for more information): [noApar]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when there is a feature JAR in the XML that isn't on the disk then that iFix is ignored + * + * @throws URISyntaxException + */ + @Test + public void testMissingFeatureJar() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL missingFeatureInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/missingFeatureJar"); + final File missingFeatureInstallFile = new File(missingFeatureInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(missingFeatureInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + missingFeatureInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage( + "The following iFix(es) were not included in the comparison because the files listed in the are no longer present or are out of date: [missingFeatureJar]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when there is a non-feature JAR file that is older than the time stamp in the XML then the test fails. This test will start failing in 2022 if the + * files timestamps are recreated when check out of RTC! + * + * @throws URISyntaxException + */ + @Test + public void testOldStaticFile() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL oldStaticFileInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oldStaticFile"); + final File oldStaticFileInstallFile = new File(oldStaticFileInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(oldStaticFileInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + oldStaticFileInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage( + "The following iFix(es) were not included in the comparison because the files listed in the are no longer present or are out of date: [oldStaticFile]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when there is an iFix that is applicable to an old version of WAS then it isn't included in the test + * + * @throws URISyntaxException + */ + @Test + public void testOldVersion() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL oldVersionInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oldVersion"); + final File oldVersionInstallFile = new File(oldVersionInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(oldVersionInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + oldVersionInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage( + "The following iFix(es) were not included in the comparison because it is not applicable to this version of WebSphere Application Server: [oldVersion]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * Sets up the mockery to allow the --target to be run by itself defaulting verbose to false + * + * @param installLocation The install location for the main product + * @param targetFile The fix pack to put in the target + */ + private void setUpTargetMockery(final File installLocation, final File targetFile) { + setUpTargetMockery(installLocation, targetFile, false); + } + + /** + * Sets up the mockery to allow the --target to be run by itself + * + * @param installLocation The install location for the main product + * @param targetFile The fix pack to put in the target + * @param verbose true if the command should be run in verbose mode + */ + private void setUpTargetMockery(final File installLocation, final File targetFile, final boolean verbose) { + mockery.checking(new Expectations() { + { + allowing(context).getAttribute(with(CommandConstants.WLP_INSTALLATION_LOCATION), with(File.class)); + will(returnValue(installLocation)); + allowing(context).optionExists(with("--target")); + will(returnValue(true)); + allowing(context).optionExists(with("--apars")); + will(returnValue(false)); + allowing(context).optionExists(with("--verbose")); + will(returnValue(verbose)); + allowing(context).getOptionValue(with("--target")); + will(returnValue(targetFile.getAbsolutePath())); + } + }); + } + +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixUtilsTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixUtilsTest.java new file mode 100755 index 000000000000..98437da6e553 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixUtilsTest.java @@ -0,0 +1,444 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.extension; + +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; + +import com.ibm.ws.kernel.boot.cmdline.Utils; +import com.ibm.ws.kernel.feature.internal.subsystem.SubsystemFeatureDefinitionImpl; +import com.ibm.ws.kernel.feature.provisioning.ProvisioningFeatureDefinition; +import com.ibm.ws.kernel.provisioning.ContentBasedLocalBundleRepository; +import com.ibm.ws.kernel.provisioning.ExtensionConstants; +import com.ibm.ws.logging.internal.BundleManifest; +import com.ibm.ws.product.utility.CommandConsole; +import com.ibm.ws.product.utility.extension.ifix.xml.BundleFile; +import com.ibm.ws.product.utility.extension.ifix.xml.IFixInfo; +import com.ibm.ws.product.utility.extension.utils.TestUtils; + +/** + * + */ +public class IFixUtilsTest { + final static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + // This is used to create a unique directory for each test. We sometimes get failures deleting files/dirs which can + // cause the next test to fail. + private static int testInstallDirCount = 0; + // Some default File names that we'll use in the tests. + private static final File tmpDir = new File("build/unittest/tmp"); + private static File wlpDir; + private static File fixesDir; + private static File libDir; + private static File binDir; + private static File featuresDir; + private static File platformDir; + private static File toolsDir; + + public static final ValidateCommandTask task = new ValidateCommandTask(); + private static CommandConsole console = new CommandConsole() { + @Override + public boolean isInputStreamAvailable() { + return false; + } + + @Override + public String readMaskedText(String prompt) { + return null; + } + + @Override + public String readText(String prompt) { + return null; + } + + @Override + public void printInfoMessage(String message) { + System.out.print(message); + } + + @Override + public void printlnInfoMessage(String message) { + System.out.println(message); + } + + @Override + public void printErrorMessage(String errorMessage) { + System.err.print(errorMessage); + } + + @Override + public void printlnErrorMessage(String errorMessage) { + System.err.print(errorMessage); + } + }; + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void classSetup() {} + + @Before + public void testSetup() { + + // Initially clean up. + TestUtils.delete(tmpDir); + + // We have to specify the absolute path in the wlpdir parent dir, because otherwise we get relative entries. + wlpDir = new File(tmpDir.getAbsolutePath(), "Test" + testInstallDirCount++ + "/wlp"); + fixesDir = new File(wlpDir, "lib/fixes"); + libDir = new File(wlpDir, "lib"); + binDir = new File(wlpDir, "bin"); + featuresDir = new File(libDir, "features"); + platformDir = new File(libDir, "platform"); + toolsDir = new File(libDir, "tools-internal"); + // Configure all of the required directories for the tests. + binDir.mkdirs(); + fixesDir.mkdirs(); + featuresDir.mkdirs(); + platformDir.mkdirs(); + toolsDir.mkdirs(); + + // Reflectively amend the Utils class to set the current WLP dir as the installDir field. + try { + Field getInstallField = Utils.class.getDeclaredField("installDir"); + getInstallField.setAccessible(true); + getInstallField.set(null, wlpDir); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @After + public void teardown() { + // We clear the Bundle Repositories to clear any locks on files that we need to remove. + TestUtils.refreshBundleRepository(); + TestUtils.delete(tmpDir); + } + + /** + * This test ensures that when we have a number of ifix xmls, the files that are stored are the latest versions of the files. + * + * @throws Exception + */ + @Test + public void testIfixFileCreationDateFiltering() throws Exception { + + // These are the files that are the ifix jars that have been installed into the runtime. + File test1IFixJar = TestUtils.createJarFile(libDir, "test1", "1.0.0.20130101", true, true); + File test2IFixJar = TestUtils.createJarFile(libDir, "test2", "1.0.0.20130101", true, false); + File test3IFixJar = TestUtils.createJarFile(libDir, "test3", "1.0.0.20130101", true, true); + File test4IFixJar = TestUtils.createJarFile(libDir, "test4", "1.0.0.20130101", true, false); + + // The relative paths that get stored in the xmls for each jar. + String test1IFixJarRelativePath = TestUtils.createRelativePath(test1IFixJar, wlpDir); + String test2IFixJarRelativePath = TestUtils.createRelativePath(test2IFixJar, wlpDir); + String test3IFixJarRelativePath = TestUtils.createRelativePath(test3IFixJar, wlpDir); + String test4IFixJarRelativePath = TestUtils.createRelativePath(test4IFixJar, wlpDir); + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + + // These are the files that are the ifix static files that have been installed into the runtime. + File test1StaticFile = TestUtils.createFile(new File(binDir, "staticFile1"), fileContents); + File test2StaticFile = TestUtils.createFile(new File(binDir, "staticFile2"), fileContents); + File test3StaticFile = TestUtils.createFile(new File(binDir, "staticFile3"), fileContents); + File test4StaticFile = TestUtils.createFile(new File(binDir, "staticFile4"), fileContents); + + // The relative paths that get stored in the xmls for each static file. + String test1StaticFileRelativePath = TestUtils.createRelativePath(test1StaticFile, wlpDir); + String test2StaticFileRelativePath = TestUtils.createRelativePath(test2StaticFile, wlpDir); + String test3StaticFileRelativePath = TestUtils.createRelativePath(test3StaticFile, wlpDir); + String test4StaticFileRelativePath = TestUtils.createRelativePath(test4StaticFile, wlpDir); + + // Create the first ifix xml. + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), "Test-Ifix1", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create the second ifix xml. + updateFiles.clear(); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix2.xml"), "Test-Ifix2", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + // Create the third ifix xml. + updateFiles.clear(); + updateFiles.add(""); + updateFiles.add(""); + updateFiles.add(""); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix3.xml"), "Test-Ifix3", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create the fourth ifix xml. + updateFiles.clear(); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix4.xml"), "Test-Ifix4", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create the fifth ifix xml. + updateFiles.clear(); + updateFiles.add(""); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix5.xml"), "Test-Ifix5", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create the sixth ifix xml. + updateFiles.clear(); + updateFiles.add(""); + updateFiles.add(""); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix6.xml"), "Test-Ifix6", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Now we have to reflectively allow the processIfixXmls method to be accessed and called, as it is a private method. + Method processIFixXmlsMethod = IFixUtils.class.getDeclaredMethod("processIFixXmls", File.class, Map.class, CommandConsole.class); + processIFixXmlsMethod.setAccessible(true); + Method processLPMFXmlsMethod = IFixUtils.class.getDeclaredMethod("processLPMFXmls", File.class, CommandConsole.class); + processLPMFXmlsMethod.setAccessible(true); + Map bundleFiles = (Map) processLPMFXmlsMethod.invoke(null, wlpDir, console); + Map latestFiles = (Map) processIFixXmlsMethod.invoke(null, wlpDir, bundleFiles, console); + + // Assert that we're getting the latest versions of the jars from the expected xml files. + Assert.assertTrue("latest version of test1.1.0.0.20130101.jar should be in Test-Ifix6, but is in " + latestFiles.get(test1IFixJarRelativePath).getId(), + "Test-Ifix6".equals(latestFiles.get(test1IFixJarRelativePath).getId())); + Assert.assertTrue("latest version of test2.1.0.0.20130101.jar should be in Test-Ifix6, but is in " + latestFiles.get(test2IFixJarRelativePath).getId(), + "Test-Ifix6".equals(latestFiles.get(test2IFixJarRelativePath).getId())); + Assert.assertTrue("latest version of test3.1.0.0.20130101.jar should be in Test-Ifix5, but is in " + latestFiles.get(test3IFixJarRelativePath).getId(), + "Test-Ifix5".equals(latestFiles.get(test3IFixJarRelativePath).getId())); + Assert.assertTrue("latest version of test4.1.0.0.20130101.jar should be in Test-Ifix3, but is in " + latestFiles.get(test4IFixJarRelativePath).getId(), + "Test-Ifix3".equals(latestFiles.get(test4IFixJarRelativePath).getId())); + + Assert.assertTrue("latest version of staticFile1 should be in Test-Ifix1, but is in " + latestFiles.get(test1StaticFileRelativePath).getId(), + "Test-Ifix1".equals(latestFiles.get(test1StaticFileRelativePath).getId())); + Assert.assertTrue("latest version of staticFile2 should be in Test-Ifix3, but is in " + latestFiles.get(test2StaticFileRelativePath).getId(), + "Test-Ifix3".equals(latestFiles.get(test2StaticFileRelativePath).getId())); + Assert.assertTrue("latest version of staticFile3 should be in Test-Ifix3, but is in " + latestFiles.get(test3StaticFileRelativePath).getId(), + "Test-Ifix3".equals(latestFiles.get(test3StaticFileRelativePath).getId())); + Assert.assertTrue("latest version of staticFile4 should be in Test-Ifix4, but is in " + latestFiles.get(test4StaticFileRelativePath).getId(), + "Test-Ifix4".equals(latestFiles.get(test4StaticFileRelativePath).getId())); + + } + + /** + * This method tests the gathering of static content from different feature manifest Subsystem content headers. + * It tests a number of different types/styles of location and ensures that only the static content files are returned. + * + * @throws Exception + */ + @Test + public void testSubsystemContentStaticFiles() throws Throwable { + + Map features = new TreeMap(); + + // Configure the files we're going to check for. + File static1Bat = TestUtils.createFile(new File(binDir, "static1.bat"), new StringBuffer()); + File static2Bat = TestUtils.createFile(new File(binDir, "static2.bat"), new StringBuffer()); + File static2 = TestUtils.createFile(new File(binDir, "static2"), new StringBuffer()); + File static3Bat = TestUtils.createFile(new File(binDir, "static3.bat"), new StringBuffer()); + File staticTools3Bat = TestUtils.createFile(new File(toolsDir, "static3.bat"), new StringBuffer()); + File static4Bat = TestUtils.createFile(new File(binDir, "static4.bat"), new StringBuffer()); + File staticTool4Bat = TestUtils.createFile(new File(toolsDir, "static4.bat"), new StringBuffer()); + File static4 = TestUtils.createFile(new File(binDir, "static4"), new StringBuffer()); + File staticTools4 = TestUtils.createFile(new File(toolsDir, "static4"), new StringBuffer()); + File static5Bat = TestUtils.createFile(new File(binDir, "static5.bat"), new StringBuffer()); + File staticTools5Bat = TestUtils.createFile(new File(toolsDir, "static5.bat"), new StringBuffer()); + // We'll create this file, but it shouldn't be included in the static content. + File nonStatic5 = TestUtils.createFile(new File(toolsDir, "nonstatic5"), new StringBuffer()); + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + File test1IfixJar = TestUtils.createJarFile(libDir, "test1", "1.0.0.20130101", true, true); + File test2IfixJar = TestUtils.createJarFile(libDir, "test2", "1.0.0.20130101", true, false); + + // Create the 1st feature + Map feature1Files = new HashMap(); + feature1Files.put("bin/static1.bat", "static1.bat"); + File feature1 = TestUtils.createFeature(new File(featuresDir, "testFeature1-1.0.mf"), "testFeature1-1.0", feature1Files); + + // Once we've created the manifest, create a SubsystemFeatureDef object and then load that into the list of features that we + // pass into the processSubsystemContent method + ProvisioningFeatureDefinition fd = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature1); + features.put(fd.getSymbolicName(), fd); + + // Create the 2nd feature + Map feature2Files = new HashMap(); + feature2Files.put("bin/static2.bat", "static2.bat"); + feature2Files.put("bin/static2", "static2"); + File feature2 = TestUtils.createFeature(new File(featuresDir, "testFeature2-1.0.mf"), "testFeature2-1.0", feature2Files); + ProvisioningFeatureDefinition fd2 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature2); + features.put(fd2.getSymbolicName(), fd2); + + // Create the 2nd feature + Map feature3Files = new HashMap(); + feature3Files.put("bin/static3.bat", "static3.bat"); + feature3Files.put("lib/tools-internal/static3.bat", "static3.bat.internal"); + File feature3 = TestUtils.createFeature(new File(featuresDir, "testFeature3-1.0.mf"), "testFeature3-1.0", feature3Files); + ProvisioningFeatureDefinition fd3 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature3); + features.put(fd3.getSymbolicName(), fd3); + + // Feature 4 is put in the lib/platform dir like the kernel features + Map feature4Files = new HashMap(); + feature4Files.put("bin/static4.bat", "static4.bat"); + feature4Files.put("lib/tools-internal/static4.bat", "static4.bat.internal"); + feature4Files.put("bin/static4", "static4"); + feature4Files.put("lib/tools-internal/static4", "static4.internal"); + feature4Files.put("lib/test1_1.0.0.jar", "test1_1.0.0.jar"); + File feature4 = TestUtils.createFeature(new File(platformDir, "testFeature4-1.0.mf"), "testFeature4-1.0", feature4Files); + ProvisioningFeatureDefinition fd4 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature4); + features.put(fd4.getSymbolicName(), fd4); + + // This feature has a some static content and some non-static content. + Map feature5Files = new HashMap(); + feature5Files.put("bin/static5.bat", "static5.bat"); + feature5Files.put("lib/tools-internal/static5.bat", "static5.bat.internal"); + feature5Files.put("lib/features, lib/tools-internal", "nonstatic5.jar"); + File feature5 = TestUtils.createFeature(new File(platformDir, "testFeature5-1.0.mf"), "testFeature5-1.0", feature5Files); + ProvisioningFeatureDefinition fd5 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature5); + features.put(fd5.getSymbolicName(), fd5); + + // Remove any existing and recreate the bundle repository that will work out the latest versions of the jars. + ContentBasedLocalBundleRepository repo = TestUtils.refreshBundleRepository(); + + // Now we have to reflectively allow the processIfixXmls method to be accessed and called, as it is a private method. + Method processSubsysteContentMethod = IFixUtils.class.getDeclaredMethod("processSubsystemContent", File.class, Map.class, + ContentBasedLocalBundleRepository.class, Map.class, + Set.class, Set.class, CommandConsole.class); + processSubsysteContentMethod.setAccessible(true); + + Map allBaseBundleJarContent = new HashMap(); + Set allBundleJarContent = new HashSet(); + Set allStaticFileContent = new HashSet(); + processSubsysteContentMethod.invoke(null, wlpDir, features, repo, allBaseBundleJarContent, allBundleJarContent, allStaticFileContent, console); + + File[] expectedFiles = { static1Bat, static2Bat, static2, static3Bat, staticTools3Bat, static4Bat, static4, staticTools4, staticTool4Bat, + static5Bat, staticTools5Bat, feature1, feature2, feature3, feature4, feature5 }; + + File[] unExpectedFiles = { nonStatic5, test1Jar, test1IfixJar, test2IfixJar }; + + // Iterate over the expected files making sure they exist, and then over the unexpected file ensuring that they don't. + for (File chkFile : expectedFiles) { + Assert.assertTrue(chkFile.getAbsolutePath() + " not found in static content list", allStaticFileContent.contains(chkFile)); + } + + for (File chkFile : unExpectedFiles) { + Assert.assertFalse(chkFile.getAbsolutePath() + " was unexpectedly found in static content list", allStaticFileContent.contains(chkFile)); + } + } + + /** + * This method tests the gathering of Bundle and jar information from different feature manifest Subsystem content headers. + * It tests a number of different types/styles of location and ensures that only the jar content files are returned. + * + * @throws Exception + */ + @Test + public void testSubsystemContentBundleJarFiles() throws Throwable { + + Map features = new TreeMap(); + + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + File test2Jar = TestUtils.createJarFile(libDir, "test2", "1.0.1", false, false); + + File test1staticJar = TestUtils.createJarFile(libDir, "test1static", "1.0.0", false, false); + File test2staticJar = TestUtils.createJarFile(libDir, "test2static", "1.0.1", false, false); + + File test1staticfile = TestUtils.createFile(new File(binDir, "static1.bat"), new StringBuffer()); + File test2staticfile = TestUtils.createFile(new File(binDir, "static2"), new StringBuffer()); + File test3staticfile = TestUtils.createFile(new File(toolsDir, "static5.bat"), new StringBuffer()); + + // Create the 1st feature + Map feature1Files = new HashMap(); + feature1Files.put(null, "test1_1.0.0.jar"); + feature1Files.put("bin/static2.bat", "static2.bat"); + feature1Files.put("lib/test1static_1.0.0.jar", "test1static_1.0.0.jar"); + File feature1 = TestUtils.createFeature(new File(featuresDir, "testFeature1-1.0.mf"), "testFeature1-1.0", feature1Files); + + // Once we've created the manifest, create a SubsystemFeatureDef object and then load that into the list of features that we + // pass into the processSubsystemContent method + ProvisioningFeatureDefinition fd = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature1); + features.put(fd.getSymbolicName(), fd); + + // Create the 1st feature + Map feature2Files = new HashMap(); + feature2Files.put(null, "test2_1.0.1.jar"); + feature2Files.put("bin/static2", "static2"); + feature2Files.put("lib/test2static_1.0.1.jar", "test1static_1.0.1.jar"); + File feature2 = TestUtils.createFeature(new File(featuresDir, "testFeature2-1.0.mf"), "testFeature2-1.0", feature2Files); + + ProvisioningFeatureDefinition fd2 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature2); + features.put(fd2.getSymbolicName(), fd2); + + // Create the 1st feature + Map feature3Files = new HashMap(); + feature3Files.put("lib/tools-internal/static5.bat", "static5.bat"); + File feature3 = TestUtils.createFeature(new File(featuresDir, "testFeature3-1.0.mf"), "testFeature3-1.0", feature3Files); + + ProvisioningFeatureDefinition fd3 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature3); + features.put(fd3.getSymbolicName(), fd3); + + // Remove any existing and recreate the bundle repository that will work out the latest versions of the jars. + ContentBasedLocalBundleRepository repo = TestUtils.refreshBundleRepository(); + + // Now we have to reflectively allow the processIfixXmls method to be accessed and called, as it is a private method. + Method processSubsysteContentMethod = IFixUtils.class.getDeclaredMethod("processSubsystemContent", File.class, Map.class, + ContentBasedLocalBundleRepository.class, Map.class, + Set.class, Set.class, CommandConsole.class); + processSubsysteContentMethod.setAccessible(true); + + Map allBaseBundleJarContent = new HashMap(); + Set allBundleJarContent = new HashSet(); + Set allStaticFileContent = new HashSet(); + processSubsysteContentMethod.invoke(null, wlpDir, features, repo, allBaseBundleJarContent, allBundleJarContent, allStaticFileContent, console); + + File[] expectedFiles = { test1Jar, test2Jar, test1staticJar, test2staticJar }; + + File[] unExpectedFiles = { test1staticfile, test2staticfile, test3staticfile, feature1, feature2, feature3 }; + + // Iterate over the expected files making sure they exist, and then over the unexpected file ensuring that they don't. + for (File chkFile : expectedFiles) { + Assert.assertTrue(chkFile.getAbsolutePath() + " not found in jar content list", allBundleJarContent.contains(chkFile)); + } + + for (File chkFile : unExpectedFiles) { + Assert.assertFalse(chkFile.getAbsolutePath() + " was unexpectedly found in static content list", allBundleJarContent.contains(chkFile)); + } + } + +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/ValidateCommandTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/ValidateCommandTest.java new file mode 100755 index 000000000000..8cd4b542f4c2 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/ValidateCommandTest.java @@ -0,0 +1,951 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.extension; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.api.Invocation; +import org.jmock.lib.action.CustomAction; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.ws.kernel.boot.cmdline.Utils; +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry; +import com.ibm.ws.product.utility.CommandConsole; +import com.ibm.ws.product.utility.CommandConstants; +import com.ibm.ws.product.utility.ExecutionContext; +import com.ibm.ws.product.utility.extension.utils.TestUtils; + +/** + * + */ +public class ValidateCommandTest { + + // This is used to create a unique directory for each test. We sometimes get failures deleting files/dirs which can + // cause the next test to fail. + private static int testInstallDirCount = 0; + // Some default File names that we'll use in the tests. + private static final File tmpDir = new File("build/unittest/tmp"); + private static File uniqueTestDir; + private static File wlpDir; + private static File libDir; + private static File binDir; + private static File fixesDir; + private static File featuresDir; + private static File platformDir; + private static File versionsDir; + private static File checksumsDir; + private static File toolsDir; + // This dir is for the ifix files which are effectively from the ifix jar file. + // We need them to generate hashes and locations in the ifix.xml + private static File ifixLibDir; + private static File ifixBinDir; + private static File ifixFeaturesDir; + + // The List that will hold the console messages from the validate command. + private static final List consoleInfoMessages = new ArrayList(); + private static final List consoleErrorMessages = new ArrayList(); + + // The JMock objects + private static Mockery mockery = null; + private static ExecutionContext context = null; + private static CommandConsole console = null; + + // A static instance of the ValidateCommandTask. + public static final ValidateCommandTask task = new ValidateCommandTask(); + + @Rule + public final TestName name = new TestName(); + + /** + * This method is run before each test to setup the mocked Liberty runtime. + */ + @Before + public void testSetup() { + + // Clean up from last test. + if (tmpDir.exists()) + TestUtils.delete(tmpDir); + + // Define unique test dir. + uniqueTestDir = new File(tmpDir, "Test" + testInstallDirCount++); + wlpDir = new File(uniqueTestDir, "wlp"); + setupMocking(); + + // Reflectively amend the Utils class to set the current WLP dir as the installDir field. + try { + Field getInstallField = Utils.class.getDeclaredField("installDir"); + getInstallField.setAccessible(true); + getInstallField.set(null, wlpDir); + } catch (Exception e) { + e.printStackTrace(); + } + + libDir = new File(wlpDir, "lib"); + binDir = new File(wlpDir, "bin"); + fixesDir = new File(libDir, "fixes"); + featuresDir = new File(libDir, "features"); + platformDir = new File(libDir, "platform"); + versionsDir = new File(libDir, "versions"); + checksumsDir = new File(versionsDir, "checksums"); + toolsDir = new File(libDir, "internal-tools"); + // This dir is for the ifix files which are effectively from the ifix jar file. + // We need them to generate hashes and locations in the ifix.xml + ifixLibDir = new File(uniqueTestDir, "lib"); + ifixBinDir = new File(uniqueTestDir, "bin"); + ifixFeaturesDir = new File(ifixLibDir, "features"); + // These dirs should make all parent dirs. + fixesDir.mkdirs(); + binDir.mkdirs(); + featuresDir.mkdirs(); + checksumsDir.mkdirs(); + ifixLibDir.mkdirs(); + ifixBinDir.mkdirs(); + ifixFeaturesDir.mkdirs(); + toolsDir.mkdirs(); + platformDir.mkdirs(); + + // Setup up the ContentBasedLocalBundleRepository + TestUtils.refreshBundleRepository(); + } + + private static void setupMocking() { + // Configure the JMock Objects. This is mainly setting up the console to store any messages that are written to + // it so we can read them back and assert that we're getting the expected messages. + mockery = new Mockery(); + context = mockery.mock(ExecutionContext.class); + console = mockery.mock(CommandConsole.class); + mockery.checking(new Expectations() { + { + //------Context expectations ------ + // Configure the Context to return the wlp location when the attribute is called. + allowing(context).getAttribute(with(CommandConstants.WLP_INSTALLATION_LOCATION), with(File.class)); + will(returnValue(wlpDir)); + + // Configure the Context to return the null when the against option value is requested. + allowing(context).getOptionValue(with("against")); + will(returnValue(null)); + + //Return the mocked CommandConsole object when the method is called on the context. + allowing(context).getCommandConsole(); + will(returnValue(console)); + + // When an info message is written to the console, write this to our list so we can parse the output in the test. + allowing(console).printlnInfoMessage(with(any(String.class))); + will(new CustomAction("Add string to collection") { + @Override + public Object invoke(Invocation invocation) throws Throwable { + consoleInfoMessages.add(((String) invocation.getParameter(0)).trim()); + return null; + } + }); + + //------Context expectations ------ + + // When an info message is written to the console, write this to our list so we can parse the output in the test. + allowing(console).printInfoMessage(with(any(String.class))); + will(new CustomAction("Add string to collection") { + @Override + public Object invoke(Invocation invocation) throws Throwable { + consoleInfoMessages.add(((String) invocation.getParameter(0)).trim()); + return null; + } + }); + + // When an error message is written to the console, write this to our list so we can parse the output in the test. + allowing(console).printlnErrorMessage(with(any(String.class))); + will(new CustomAction("Add string to collection") { + @Override + public Object invoke(Invocation invocation) throws Throwable { + consoleErrorMessages.add((String) invocation.getParameter(0)); + return null; + } + }); + + // When an error message is written to the console, write this to our list so we can parse the output in the test. + allowing(console).printErrorMessage(with(any(String.class))); + will(new CustomAction("Add string to collection") { + @Override + public Object invoke(Invocation invocation) throws Throwable { + consoleErrorMessages.add((String) invocation.getParameter(0)); + return null; + } + }); + } + }); + } + + @After + public void teardown() { + TestUtils.clearBundleRepositoryHolders(); + TestUtils.delete(tmpDir); + } + + /** + * This test proves that the ValidateCommandTask displays any IFixes that need to be reapplied when checking jar files. The ifix xml file + * also contains a Test3 ifix jar. Because we don't have a test3 jar in the runtime, it shouldn't affect whether we need to reapply the ifix or + * not. This test does a 2 step process. It checks that we do need a reapply when we are genuinely missing an ifix jar, and then we "apply" + * the ifix, and ensure that the ifix reapply msg isn't issued. This will prove that the test3 missing ifix jar isn't relevant. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForJars() throws Exception { + + // These are the files that are the ifix files that have been installed into the runtime. + File test1IFixJar = TestUtils.createJarFile(libDir, "test1", "1.0.0.20130101", true, true); + // Store the ifix jar 2 and 3 in a temp dir outside of the wlp runtime, as we want to generate hashes but don't want them in the runtime. + // We will create the runtime version of jar 2 later in the test. + File test2IFixJar = TestUtils.createJarFile(ifixLibDir, "test2", "1.0.0.20130101", true, false); + File test3IFixJar = TestUtils.createJarFile(ifixLibDir, "test3", "1.0.0.20130101", true, true); + + // These are the jars files that are put in the runtime lib dir. + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + File test2Jar = TestUtils.createJarFile(libDir, "test2", "1.0.0", false, false); + + // Generate the IFix xml file for just ifix jars + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create test feature + Map featureFiles = new HashMap(); + featureFiles.put(TestUtils.createRelativePath(test1Jar, wlpDir), test1Jar.getName()); + featureFiles.put(TestUtils.createRelativePath(test2Jar, wlpDir), test2Jar.getName()); + TestUtils.createFeature(new File(featuresDir, "test-1.0.mf"), "test-1.0", featureFiles); + + runValidateCommand(); + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks(true, "The following fixes must be reapplied: [" + ifixName1 + "]."); + + // Now "reapply" the ifix and check that the command doesn't report any issues. + File copiedTest2IfixJar = new File(libDir, test2IFixJar.getName()); + TestUtils.copyFile(test2IFixJar, copiedTest2IfixJar); + // Rerun the command after clearing the console + runValidateCommand(); + + // Check that the command has run successfully, but ensure it doesn't include the reapply Ifix msg. + assertChecks(false, "The following fixes must be reapplied: [" + ifixName1 + "]."); + } + + /** + * This test proves that the ValidateCommandTask displays any IFixes that need to be reapplied when checking static content files. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForStaticContent() throws Exception { + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + fileContents.append("This is the 2nd line of file \n"); + + String staticFile1Name = "staticFile1.bat"; + String staticFile2Name = "staticFile2"; + String staticFile3Name = "staticFile3.bat"; + // Just create the static file 1 and 2. + TestUtils.createFile(new File(binDir, staticFile1Name), fileContents); + + // Add an extra line to the static files so that we get a different hash. + fileContents.append("This is an ifix static file \n"); + + File test1IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, staticFile1Name), fileContents); + File test2IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, staticFile2Name), fileContents); + File test3IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, staticFile3Name), fileContents); + + // Generate the IFix xml files for just ifix static content + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Generate a second ifix xml for the static 3 file + String ifixName2 = "Test-Ifix2"; + updateFiles.clear(); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix2.xml"), ifixName2, updateFiles, TestUtils.generateSet("Apar4")); + + // Create test feature + Map featureContent = new HashMap(); + featureContent.put(TestUtils.createRelativePath(test1IFixStaticFile, uniqueTestDir), staticFile1Name); + featureContent.put(TestUtils.createRelativePath(test2IFixStaticFile, uniqueTestDir), staticFile2Name); + TestUtils.createFeature(new File(featuresDir, "test-1.0.mf"), "test-1.0", featureContent); + + // Create test feature 2 + Map feature2Content = new HashMap(); + feature2Content.put(TestUtils.createRelativePath(test3IFixStaticFile, uniqueTestDir), staticFile3Name); + TestUtils.createFeature(new File(featuresDir, "test-2.0.mf"), "test-2.0", feature2Content); + + // Run the command + runValidateCommand(); + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks2Ifixes(ifixName1, ifixName2); + + // Now "reapply" the the static1 file and check that the we still report an error for static2 file + File copiedTest1StaticFile = new File(binDir, test1IFixStaticFile.getName()); + TestUtils.copyFile(test1IFixStaticFile, copiedTest1StaticFile); + + // Rerun the command + runValidateCommand(); + + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks2Ifixes(ifixName1, ifixName2); + + // Now "reapply" the static2 ifix and check that the command doesn't report any issues with ifix 1. + File copiedTest2StaticFile = new File(binDir, test2IFixStaticFile.getName()); + TestUtils.copyFile(test2IFixStaticFile, copiedTest2StaticFile); + + // Rerun the command + runValidateCommand(); + + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks(true, "The following fixes must be reapplied: [" + ifixName2 + "]."); + + // Now "reapply" the static3 file which fixes the ifix2 xml and check that the command doesn't report any issues. + File copiedTest3StaticFile = new File(binDir, test3IFixStaticFile.getName()); + TestUtils.copyFile(test3IFixStaticFile, copiedTest3StaticFile); + // Rerun the command + runValidateCommand(); + // Check that the command has run successfully, but ensure it doesn't include the reapply Ifix msg. + assertChecks(false, "The following fixes must be reapplied: [" + ifixName2 + "]."); + } + + /** + * This test proves that the ValidateCommandTask doesn't display the reapplication message if the ifix files are already installed. + * + * @throws Exception + */ + @Test + public void testValidateDoesNotDisplayIfixReApplicationIfIfixInstalled() throws Exception { + + // These are the files that are the ifix files that have been installed into the runtime. + TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + File test1IFixJar = TestUtils.createJarFile(libDir, "test1", "1.0.0.20130101", true, true); + TestUtils.createJarFile(libDir, "test2", "1.0.0", false, false); + File test2IFixJar = TestUtils.createJarFile(libDir, "test2", "1.0.0.20130101", true, false); + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + fileContents.append("This is the 2nd line of file \n"); + + File test1IFixStaticFile = TestUtils.createFile(new File(binDir, "staticFile1.bat"), fileContents); + File test2IFixStaticFile = TestUtils.createFile(new File(binDir, "staticFile2"), fileContents); + + // Generate the IFix xml files for just ifix static content + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + Set update2Files = new HashSet(); + update2Files.add(""); + update2Files.add(""); + String ifixName2 = "Test-Ifix2"; + TestUtils.createIfixXML(new File(fixesDir, "ifix2.xml"), ifixName2, update2Files, TestUtils.generateSet("Apar4")); + + // Create test feature + Map featureContent = new HashMap(); + featureContent.put(TestUtils.createRelativePath(test1IFixStaticFile, uniqueTestDir), test1IFixStaticFile.getName()); + featureContent.put(TestUtils.createRelativePath(test1IFixJar, wlpDir), test1IFixJar.getName()); + TestUtils.createFeature(new File(featuresDir, "test-1.0.mf"), "test-1.0", featureContent); + + Map feature2Content = new HashMap(); + feature2Content.put(TestUtils.createRelativePath(test2IFixJar, wlpDir), test2IFixJar.getName()); + feature2Content.put(TestUtils.createRelativePath(test2IFixStaticFile, uniqueTestDir), test2IFixStaticFile.getName()); + TestUtils.createFeature(new File(featuresDir, "test2-1.0.mf"), "test2-1.0", feature2Content); + + runValidateCommand(); + assertChecks(false, null); + } + + /** + * This test proves that the ValidateCommandTask displays multiple IFixes that need to be reapplied when checking both + * static content and jars together. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForMultipleIFix() throws Exception { + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + fileContents.append("This is the 2nd line of file \n"); + // These are the static files that we'll use for the tests. They are in the runtime structure. + File test1StaticFile = TestUtils.createFile(new File(binDir, "server.bat"), fileContents); + File test2StaticFile = TestUtils.createFile(new File(binDir, "server"), fileContents); + File test3StaticFile = TestUtils.createFile(new File(binDir, "version.bat"), fileContents); + File test4StaticFile = TestUtils.createFile(new File(toolsDir, "version.bat"), fileContents); + + // Store the ifix Static files in the tmp dir, as we want to generate hashes but don't want them in the runtime. + fileContents.append("This is the 2nd line of file \n"); + File test4IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "version.bat"), fileContents); + File test5IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "nonexistantFile"), fileContents); + + // Base Bundle for test 1 + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + // Ifix Bundle for test 1 + File test1IFixJar = TestUtils.createJarFile(libDir, "test1", "1.0.0.20130101", true, true); + // Base Bundle for test 2 + File test2Jar = TestUtils.createJarFile(libDir, "test2", "1.0.0", false, false); + // Ifix Bundle for test 2 + File test2IFixJar = TestUtils.createJarFile(ifixLibDir, "test2", "1.0.0.20130101", true, false); + // Test3IfixJar isn't meant to be installed into the runtime. It is just in the ifix xml. No base bundle exists + File test3IFixJar = TestUtils.createJarFile(ifixLibDir, "test3", "1.0.0.20130101", true, true); + + // Maps that we'll store the file content info for the ifix xml files. The key is the file name, and the + // value is the actual file that we use for hashes/file size etc. + Set ifix1Content = new HashSet(); + Set ifix2Content = new HashSet(); + Set ifix3Content = new HashSet(); + Set ifix4Content = new HashSet(); + + // Load the ifix content for ifix 1. + ifix1Content.add(""); + ifix1Content.add(""); + + // Load the ifix content for ifix 2. This contains the ifix1 content as this ifix supersedes ifix1. + ifix2Content.addAll(ifix1Content); + ifix2Content.add(""); + ifix2Content.add(""); + ifix2Content.add(""); + + // Load the ifix content for ifix 3. This contains files that aren't relevant for this runtime, and should be ignored, and not + // reported as being required to be reapplied. + ifix3Content.add(""); + + // Load the ifix content for ifix 4. This also supersedes ifix 1. + ifix4Content.addAll(ifix1Content); + ifix4Content.add(""); + ifix4Content.add(""); + + // Generate the 1st IFix xml file. + File ifixFile = new File(fixesDir, "ifix1.xml"); + TestUtils.createIfixXML(ifixFile, "ifix1", ifix1Content, TestUtils.generateSet("Apar1")); + + // Generate the 2nd IFix xml file. + File ifixFile2 = new File(fixesDir, "ifix2.xml"); + TestUtils.createIfixXML(ifixFile2, "ifix2", ifix2Content, TestUtils.generateSet("Apar1", "Apar2")); + + // Generate the 3rd IFix xml file. + File ifixFile3 = new File(fixesDir, "ifix3.xml"); + TestUtils.createIfixXML(ifixFile3, "ifix3", ifix3Content, TestUtils.generateSet("Apar4")); + + // Generate the 3rd IFix xml file. + File ifixFile4 = new File(fixesDir, "ifix4.xml"); + TestUtils.createIfixXML(ifixFile4, "ifix4", ifix4Content, TestUtils.generateSet("Apar1", "Apar3")); + + // Create test feature1 + Map feature1Files = new HashMap(); + feature1Files.put(TestUtils.createRelativePath(test1StaticFile, wlpDir), test1StaticFile.getName()); + feature1Files.put(TestUtils.createRelativePath(test1Jar, wlpDir), test1Jar.getName()); + TestUtils.createFeature(new File(featuresDir, "testFeature1-1.0.mf"), "testFeature1-1.0", feature1Files); + + // Create test feature2 + Map feature2Files = new HashMap(); + feature2Files.put(TestUtils.createRelativePath(test2StaticFile, wlpDir), test2StaticFile.getName()); + feature2Files.put(TestUtils.createRelativePath(test2Jar, wlpDir), test2Jar.getName()); + TestUtils.createFeature(new File(featuresDir, "testFeature2-1.0.mf"), "testFeature2-1.0", feature2Files); + + // Create test feature4 + Map feature3Files = new HashMap(); + feature3Files.put(TestUtils.createRelativePath(test3StaticFile, wlpDir), test3StaticFile.getName()); + feature3Files.put(TestUtils.createRelativePath(test4StaticFile, wlpDir), test4StaticFile.getName() + ".internal"); + TestUtils.createFeature(new File(featuresDir, "testFeature3-1.0.mf"), "testFeature3-1.0", feature3Files); + + runValidateCommand(); + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks2Ifixes("ifix2", "ifix4"); + } + + /** + * This test proves that changes to a Manifest file will also flag an ifix reapply. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForManifestChanges() throws Exception { + + // Base Bundle for test 1 + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + // Ifix Bundle for test 2 + File test2Jar = TestUtils.createJarFile(libDir, "test2", "1.0.0", false, false); + // Base Bundle for test 3 + File test3Jar = TestUtils.createJarFile(libDir, "test3", "1.0.0", false, false); + // Ifix Bundle for test 4 + File test4Jar = TestUtils.createJarFile(libDir, "test4", "1.0.0", false, false); + + // Create test feature 1 + Map feature1Content = new HashMap(); + feature1Content.put(TestUtils.createRelativePath(test1Jar, wlpDir), test1Jar.getName()); + File feature1 = TestUtils.createFeature(new File(featuresDir, "test-1.0.mf"), "test-1.0", feature1Content); + + // Create test ifix feature 1 + Map feature1IfixContent = new HashMap(); + feature1IfixContent.put(TestUtils.createRelativePath(test2Jar, wlpDir), test2Jar.getName()); + File featureIfix1 = TestUtils.createFeature(new File(ifixFeaturesDir, "test-1.0.mf"), "test-1.0", feature1IfixContent); + + // Create test feature 2 + Map feature2Content = new HashMap(); + feature2Content.put(TestUtils.createRelativePath(test3Jar, wlpDir), test3Jar.getName()); + File feature2 = TestUtils.createFeature(new File(featuresDir, "test-2.0.mf"), "test-2.0", feature2Content); + + // Create test ifix feature 2 + Map feature2IfixContent = new HashMap(); + feature2IfixContent.put(TestUtils.createRelativePath(test4Jar, wlpDir), test4Jar.getName()); + File featureIfix2 = TestUtils.createFeature(new File(ifixFeaturesDir, "test-2.0.mf"), "test-2.0", feature2IfixContent); + + // Generate the IFix xml files for just ifix static content + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Run the command + runValidateCommand(); + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks(true, "The following fixes must be reapplied: [" + ifixName1 + "]."); + + // Now "reapply" the the static1 file and check that the we still report an error for static2 file + TestUtils.copyFile(featureIfix1, feature1); + TestUtils.copyFile(featureIfix2, feature2); + + // Rerun the command + runValidateCommand(); + + // Check that the command has run successfully, and ensure there is no reapply Ifix msg. + assertChecks(false, null); + } + + /** + * This test proves that multiple product extensions that have missing ifixes are reported. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForMultipleProductExtensions() throws Exception { + + // Setup the Alternate product extension dir. + File alternateWLPDir = new File(uniqueTestDir, "alternate/wlp"); + File alternateLibDir = new File(alternateWLPDir, "lib"); + File alternateBinDir = new File(alternateWLPDir, "bin"); + File alternateFixesDir = new File(alternateLibDir, "fixes"); + File alternateFeaturesDir = new File(alternateLibDir, "features"); + File extensionsDir = new File(wlpDir, "etc/extensions"); + + alternateFeaturesDir.mkdirs(); + alternateFixesDir.mkdirs(); + alternateBinDir.mkdirs(); + extensionsDir.mkdirs(); + + // Plug in the new alternate product extension location to the runtime. + Properties extensionProps = new Properties(); + extensionProps.put("com.ibm.websphere.productInstall", alternateWLPDir.getAbsolutePath()); + extensionProps.put("com.ibm.websphere.productId", "ALTERNATE"); + + FileOutputStream fos = new FileOutputStream(new File(extensionsDir, "alternate.properties")); + try { + extensionProps.store(fos, "testing extension props"); + } catch (IOException ioe) { + ioe.printStackTrace(); + } finally { + if (fos != null) + fos.close(); + } + + // These are the files that are the ifix files that have been installed into the runtime using a properties file. + File test1Jar = TestUtils.createJarFile(alternateLibDir, "test1", "1.0.0", false, false); + File test1IFixJar = TestUtils.createJarFile(ifixLibDir, "test1", "1.0.0.20130101", true, true); + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + + File test1IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "staticFile1.bat"), fileContents); + + // Generate the IFix xml files for just ifix static content + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(alternateFixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create test feature + Map featureContent = new HashMap(); + featureContent.put(TestUtils.createRelativePath(test1IFixStaticFile, uniqueTestDir), test1IFixStaticFile.getName()); + featureContent.put(TestUtils.createRelativePath(test1Jar, alternateWLPDir), test1Jar.getName()); + TestUtils.createFeature(new File(alternateFeaturesDir, "test-1.0.mf"), "test-1.0", featureContent); + + // Add the new repository for the alternate location. + BundleRepositoryRegistry.addBundleRepository(alternateWLPDir.getAbsolutePath(), "alternate"); + + // Run the validate command. + runValidateCommand(); + + // Check we have the expected error message + assertChecks(true, "The following fixes must be reapplied: [" + ifixName1 + "]."); + + // "Re-apply the ifix" + TestUtils.copyFile(test1IFixJar, new File(alternateLibDir, test1IFixJar.getName())); + TestUtils.copyFile(test1IFixStaticFile, new File(alternateBinDir, test1IFixStaticFile.getName())); + runValidateCommand(); + + // Check that the command is now happy and not reporting any reapplication msgs + assertChecks(false, null); + } + + /** + * This test proves that the correct file is checked when it is included in multiple ifix xmls. We work out the entry with the newest date + * and log the hash/location to use for checking. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForSameFileInMultipleIfixes() throws Exception { + + // Store the ifix jars in a temp dir outside of the wlp runtime, as we want to generate hashes but don't want them in the runtime. + // We will create the runtime version of jar 2 later in the test. + File test1IFixJar = TestUtils.createJarFile(ifixLibDir, "test1", "1.0.0.20130101", true, true); + File test2IFixJar = TestUtils.createJarFile(ifixLibDir, "test1", "1.0.0.20130201", true, false); + File test3IFixJar = TestUtils.createJarFile(ifixLibDir, "test1", "1.0.0.20130301", true, true); + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + fileContents.append("This is the 2nd line of file \n"); + + File test1IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "server.bat"), fileContents); + + // Create the 1st ifix.xml. It has the latest version of the test1 ifix jar. + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Amend the static files so we get different hashes for each ifix xml. + fileContents.append("This is the 3rd line of file \n"); + + File test2IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "server.bat"), fileContents); + // Create the 2nd ifix.xml. This has been superseded and doen't have latest version of any of the files. + Set updateFiles2 = new HashSet(); + updateFiles2.add(""); + updateFiles2.add(""); + String ifixName2 = "Test-Ifix2"; + TestUtils.createIfixXML(new File(fixesDir, "ifix2.xml"), ifixName2, updateFiles2, TestUtils.generateSet("Apar4")); + + // Amend the static files so we get different hashes for each ifix xml. + fileContents.append("This is the 4th line of file \n"); + File test3IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "server.bat"), fileContents); + + // Create the 3rd ifix.xml. This has the latest version of server.bat. + Set updateFiles3 = new HashSet(); + updateFiles3.add(""); + updateFiles3.add(""); + String ifixName3 = "Test-Ifix3"; + TestUtils.createIfixXML(new File(fixesDir, "ifix3.xml"), ifixName3, updateFiles3, TestUtils.generateSet("Apar5")); + + // These are the jars files that are put in the runtime lib dir. + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + + // Create test feature + Map featureFiles = new HashMap(); + featureFiles.put(TestUtils.createRelativePath(test1IFixStaticFile, uniqueTestDir), test1IFixStaticFile.getName()); + featureFiles.put(null, test1Jar.getName()); + TestUtils.createFeature(new File(featuresDir, "test-1.0.mf"), "test-1.0", featureFiles); + + runValidateCommand(); + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks2Ifixes(ifixName1, ifixName3); + + TestUtils.copyFile(test3IFixStaticFile, new File(binDir, test3IFixStaticFile.getName())); + TestUtils.copyFile(test3IFixJar, new File(libDir, test3IFixJar.getName())); + + runValidateCommand(); + // Check that the command has run successfully, and ensure no reapply Ifix msg is issued. + assertChecks(false, null); + } + + /** + * When a fix has been applied we need to use the latest version of the hashcode for validation. + * This test checks that the latest hash is used (and hence validation passes) for a static file + * after an ifix has been applied. + */ + @Test + public void testStaticContentIfixHashValidation() { + //mock up a feature + String featureName = "testIfixHash-1.0"; + File testFeatureFile = generateIfixFeatureWithChecksum(featureName); + + //create a "fixed" version of the feature manifest file + File fixedTestFeatureFile = generateAugmentedFeatureManifest(featureName, testFeatureFile, "SomeNewMfHeader: someFakeValue"); + + // Create an ifix.xml. It has the latest version of the feature manifest we are testing. + generateSingleFixXml(fixedTestFeatureFile, "TF0001", "2013-08-21 11:15", "Apar1"); + + //copy the fix file, equivalent to an archive install of the ifix + TestUtils.copyFile(fixedTestFeatureFile, testFeatureFile); + + //run the validation + runValidateCommand(); + + //check that validation succeeds and there are no reapply messages + assertChecks(false, null); + } + + /** + * This test ensures that date ordering works when multiple fixes are made to the same file + */ + @Test + public void testStaticContentMultipleIfixHashValidation() { + performMultipleFixTest(false); + } + + /** + * This test ensures that two fixes to the same static file with the same date still results + * in the correct hash being used for validation. + * This is testing for an issue caused because some fixes were published with incorrect (and constant) + * date information for some static files. + */ + @Test + public void testStaticContentMultipleIfixHashValidationSameDate() { + performMultipleFixTest(true); + } + + private void generateSingleFixXml(File fixFile, String ifixName, String date, String... apars) { + // Create an ifix.xml. It has the latest version of the feature manifest we are testing. + Set updateFiles = new HashSet(); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, ifixName + ".xml"), ifixName, updateFiles, TestUtils.generateSet(apars)); + } + + /** + * We need to run two very similar tests so we just common it up in this method + * + * @param useSameDateForSecondFix + */ + private void performMultipleFixTest(boolean useSameDateForSecondFix) { + //mock up a feature + String featureName = "testIfixHash-1.0"; + File testFeatureFile = generateIfixFeatureWithChecksum(featureName); + + //create a "fixed" version of the feature manifest file + File fixedTestFeatureFile = generateAugmentedFeatureManifest(featureName, testFeatureFile, "SomeNewMfHeader: someFakeValue"); + + // Create an ifix.xml + generateSingleFixXml(fixedTestFeatureFile, "TF0001", "2013-08-21 11:15", "Apar1"); + + // Now perform a second patch of the same file + File secondFixTestFeatureFile = generateAugmentedFeatureManifest(featureName, testFeatureFile, "AnotherNewMfHeader: differentValue"); + // Create another ifix.xml + generateSingleFixXml(secondFixTestFeatureFile, "TF0002", "2013-08-21 " + (useSameDateForSecondFix ? "11:15" : "12:15"), "Apar1", "Apar2"); + + //copy the fix file, equivalent to an archive install of the ifix + TestUtils.copyFile(secondFixTestFeatureFile, testFeatureFile); + + //run the validation + runValidateCommand(); + + //check that validation succeeds and there are no reapply messages + assertChecks(false, null); + } + + /** + * This method creates a mock feature manifest and the appropriate checksum file + * + * @param featureName + * @return + */ + private File generateIfixFeatureWithChecksum(String featureName) { + String featureMfName = featureName + ".mf"; + + //create a test feature + Map featureFiles = new HashMap(); + File testFeatureFile = TestUtils.createFeature(new File(featuresDir, featureName + ".mf"), featureName, featureFiles); + + //create a checksum for the original feature + String originalMfHash = TestUtils.generateHash(testFeatureFile); + StringBuffer csFileContent = new StringBuffer(); + csFileContent.append("lib/features/" + featureMfName); + csFileContent.append("="); + csFileContent.append(originalMfHash); + TestUtils.createFile(new File(featuresDir, "checksums/com.ibm.websphere.appserver." + featureName + ".cs"), csFileContent); + + return testFeatureFile; + } + + /** + * This method augments a feature manifest with some new content, to immitate the patching of a static file + * + * @param featureName + * @param featureFile + * @param newContent + * @return + */ + private File generateAugmentedFeatureManifest(String featureName, File featureFile, String newContent) { + StringBuffer fixContent = new StringBuffer(); + fixContent.append(newContent + "\n"); + //create the new file + File fixedTestFeatureFile = TestUtils.createFile(new File(ifixFeaturesDir, featureName + ".mf"), fixContent); + //append the rest of the feature content to our "fix" + TestUtils.copyFile(featureFile, fixedTestFeatureFile, true); + return fixedTestFeatureFile; + } + + /** + * This method asserts that the right messages are in the console logs. + * WARNING THIS ONLY WORKS FOR 1 IFIX the ifixes are a set not a list so could be in any order. + * + * @param ifixAppliedMessage - This boolean indicates whether the ifix reapply message is expected or not. + * If not, we assert that it isn't in the list. + * @parem ifixReApplicationMsg - The message to ensure is or isn't in the console logs. If the ifixReApplicationMsg is null, we just check that the + * "The following fixes must be reapplied:" prefix is either present or not present depending on the ifixApplicationMessage boolean. + */ + private void assertChecks(boolean ifixAppliedMessage, String ifixReApplicationMsg) { + + String ifixReApplicationMessagePrefix = "The following fixes must be reapplied:"; + // Assert that we always get a successful run of the command. + Assert.assertTrue("The console info messages don't contain message \"Product validation completed successfully.\": " + Arrays.toString(consoleInfoMessages.toArray()), + consoleInfoMessages.contains("Product validation completed successfully.")); + + if (ifixAppliedMessage) { + if (ifixReApplicationMsg == null) { + Assert.assertTrue("The console info messages don't contain message \"" + ifixReApplicationMessagePrefix + "\": " + + Arrays.toString(consoleInfoMessages.toArray()), + messagePrefixPresentInLogs(consoleInfoMessages, ifixReApplicationMessagePrefix)); + } else { + Assert.assertTrue("The console info messages don't contain message \"" + ifixReApplicationMsg + "\": " + + Arrays.toString(consoleInfoMessages.toArray()), consoleInfoMessages.contains(ifixReApplicationMsg)); + } + } else { + if (ifixReApplicationMsg == null) { + Assert.assertFalse("The console info messages unexpectedly contains message \"" + ifixReApplicationMessagePrefix + "\": " + + Arrays.toString(consoleInfoMessages.toArray()), + messagePrefixPresentInLogs(consoleInfoMessages, ifixReApplicationMessagePrefix)); + } else { + Assert.assertFalse("The console info messages unexpectedly contains message \"" + ifixReApplicationMsg + "\": " + + Arrays.toString(consoleInfoMessages.toArray()), consoleInfoMessages.contains(ifixReApplicationMsg)); + } + } + } + + /** + * This method asserts that 2 Ifixes are in the console logs in either order. + * It looks for strings of the form "The following fixes must be reapplied: [ifixName1,ifixName2]." + * or in the reverse order. If we ever needed to check for more than 2 ifies we should re-write this to take a list. + * + * @param ifixName1 - + * @parem ifixName2 - + */ + private void assertChecks2Ifixes(String ifixName1, String ifixName2) { + + String ifixReApplicationMessagePrefix = "The following fixes must be reapplied:"; + // Assert that we always get a successful run of the command. + Assert.assertTrue("The console info messages don't contain message \"Product validation completed successfully.\": " + Arrays.toString(consoleInfoMessages.toArray()), + consoleInfoMessages.contains("Product validation completed successfully.")); + + String message1 = "The following fixes must be reapplied: [" + ifixName1 + ", " + ifixName2 + "]."; + String message2 = "The following fixes must be reapplied: [" + ifixName2 + ", " + ifixName1 + "]."; + + Assert.assertTrue("The console info messages don't contain message \"" + message1 + "\" or \"" + message2 + "\": " + + Arrays.toString(consoleInfoMessages.toArray()), + consoleInfoMessages.contains(message1) || consoleInfoMessages.contains(message2)); + } + + /** + * This method checks all of the strings in the list of msgs, and checks to see if any entry starts with the specified prefix. + * + * @param msgs - The list of Strings to check + * @param msgPrefix - The prefix to check. + * @return - A boolean indicating whether any of the strings starts with the message prefix. + */ + private boolean messagePrefixPresentInLogs(List msgs, String msgPrefix) { + boolean msgFound = false; + for (String msg : msgs) { + if (msg.startsWith(msgPrefix)) + msgFound = true; + } + return msgFound; + } + + /** + * Run the validate Command after clearing the logs. + */ + private void runValidateCommand() { + consoleInfoMessages.clear(); + consoleErrorMessages.clear(); + TestUtils.refreshBundleRepository(); + task.doExecute(context); + //log the output in case we need to debug + List output = new ArrayList(); + output.addAll(consoleInfoMessages); + output.addAll(consoleErrorMessages); + System.out.println("====== Validate results for test " + name.getMethodName() + "======"); + for (String line : output) { + System.out.println(line); + } + } +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/utils/TestUtils.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/utils/TestUtils.java new file mode 100755 index 000000000000..53400770c2da --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/utils/TestUtils.java @@ -0,0 +1,406 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.extension.utils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.lang.reflect.Field; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarOutputStream; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry; +import com.ibm.ws.kernel.provisioning.ContentBasedLocalBundleRepository; +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry.BundleRepositoryHolder; +import com.ibm.ws.product.utility.extension.MD5Utils; + +/** + * + */ +public class TestUtils { + + // The pattern we use to break out the symbolic name and version from an ifix update xml element. + private static final Pattern updateSymbolicNameVersionPattern = Pattern.compile(".*id=\"(.*?)_(.*?)\\.jar.*"); + // The pattern we use to get the attrs from the ifix xml file element. + private static final Pattern updateAttrPattern = Pattern.compile(""); + + /** + * This method generates the ifix xml files that contain the files that are in the ifix install. This method also + * builds the Liberty Profile Metadata files for any jars supplied. + * + * @param ifixFile - The Ifix File to write to. + * @param ifixName - The name of the ifix + * @param updates - A Set of string containing the update file names. + * @param ifixApars - A set of String containing the apar numbers. + */ + public static void createIfixXML(File ifixFile, String ifixName, Set updates, Set ifixApars) { + + // The ifix xml buffer + StringBuffer ifixBuffer = new StringBuffer(); + // The Liberty profile metadata buffer if it is needed. + StringBuffer lpmfBuffer = new StringBuffer(); + + ifixBuffer.append("\n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" Web application response times are very slow\n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + for (String apar : ifixApars) + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + + lpmfBuffer.append("\n"); + lpmfBuffer.append(" \n"); + + for (String update : updates) { + ifixBuffer.append(" " + update + "\n"); + + // If the current update is a jar file, then work out the symbolicname and version and write the values out to the + // Liberty Profile Metadata file. + if (update.contains(".jar\"")) { + Matcher symbolicNameMatcher = updateSymbolicNameVersionPattern.matcher(update); + Matcher updateAttrMatcher = updateAttrPattern.matcher(update); + if (symbolicNameMatcher.matches() && updateAttrMatcher.matches()) { + String updateAttrString = updateAttrMatcher.group(1); + String symbolicName = symbolicNameMatcher.group(1); + if (symbolicName.contains("/")) + symbolicName = symbolicName.substring(symbolicName.lastIndexOf("/") + 1); + + lpmfBuffer.append(" \n"); + } + } + } + + ifixBuffer.append(" \n"); + ifixBuffer.append("\n"); + + lpmfBuffer.append(" \n"); + lpmfBuffer.append("\n"); + + createFile(ifixFile, ifixBuffer, false); + String ifixABSPath = ifixFile.getAbsolutePath(); + File lpmfFile = new File(ifixABSPath.substring(0, ifixABSPath.lastIndexOf(".")) + ".lpmf"); + createFile(lpmfFile, lpmfBuffer, false); + } + + /** + * This writes a StringBuffer out to the required file. The file is always overwritten. + * + * @param fileToWrite - The file to write the buffer to. + * @param buffer - A String buffer containing the contents of the file + */ + public static File createFile(File fileToWrite, StringBuffer buffer) { + return createFile(fileToWrite, buffer, false); + } + + /** + * This writes a StringBuffer out to the required file. + * + * @param fileToWrite - The file to write the buffer to. + * @param buffer - A String buffer containing the contents of the file + * @param append - Whether we should be appending to the file or overwriting it. + */ + public static File createFile(File fileToWrite, StringBuffer buffer, boolean append) { + FileOutputStream fos = null; + try { + //make any non-existent dirs + fileToWrite.getParentFile().mkdirs(); + + fos = new FileOutputStream(fileToWrite, append); + fos.write(buffer.toString().getBytes()); + } catch (Exception e) { + e.printStackTrace(System.err); + } finally { + if (fos != null) { + try { + fos.close(); + } catch (Exception e) { + e.printStackTrace(System.err); + } + } + } + return fileToWrite; + } + + /** + * This method deletes a file or directory. If a directory is passed it deletes the directory and + * all subdirectories and their contents. + * + * @param file - The file/Directory to delete. + */ + public static void delete(File file) { + // If this is a directory, then iterate over each element and recursively call this method for the child. + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (files != null) { + for (File child : files) { + delete(child); + } + } + } + + boolean deleted = file.delete(); + if (!deleted) + System.out.println("Unable to delete " + file.getAbsolutePath()); + } + + /** + * This method generates a hash for the requested file. + * + * @param file - The file to hash + * @return - A String containing the hash of the file. + */ + public static String generateHash(File file) { + String result = ""; + try { + result = MD5Utils.getFileMD5String(file); + } catch (Exception e) { + e.printStackTrace(System.err); + } + + return result; + } + + /** + * This method creates a jar which is symbolicName_version.jar which just contains a manifest. It adds ifix headers if required. + * + * @param directory - The directory in which to put the jar file + * @param symbolicName - The symbolic Name of the jar file + * @param version - The String representation of the version + * @param ifixJar - A boolean to indicate whether this is an ifix jar + * @param testFix - A boolean to indicate whether this is a test ifix or not. + * @return - The jar file. + */ + public static File createJarFile(File directory, String symbolicName, String version, boolean ifixJar, boolean testFix) { + + JarOutputStream jos = null; + FileOutputStream fos = null; + + File newJarFile = new File(directory, symbolicName + "_" + version + ".jar"); + + try { + fos = new FileOutputStream(newJarFile); + jos = new JarOutputStream(fos); + + // Create the manifest for the bundle. + String manifestFileName = "META-INF/MANIFEST.MF"; + //Generate the manifest using a StringBuffer. + StringBuffer buffer = new StringBuffer(); + buffer.append("Manifest-Version: 1.0\n"); + buffer.append("Bundle-SymbolicName: " + symbolicName + "\n"); + buffer.append("Bundle-Version: " + version + "\n"); + + if (ifixJar) { + if (testFix) { + buffer.append("IBM-Test-Fixes: apar1\n"); + } else { + buffer.append("IBM-Interim-Fixes: apar2\n"); + } + } + buffer.append("Bundle-ManifestVersion: 2\n\n"); + + // write out the jarEntry for the manifest. + JarEntry jarEntry = new JarEntry(manifestFileName); + jarEntry.setTime(System.currentTimeMillis()); + jos.putNextEntry(jarEntry); + jos.write(buffer.toString().getBytes()); + } catch (Exception e) { + e.printStackTrace(System.err); + } finally { + if (jos != null) { + try { + jos.close(); + } catch (Exception e) { + e.printStackTrace(System.err); + } + } + + if (fos != null) { + try { + fos.close(); + } catch (Exception e) { + e.printStackTrace(System.err); + } + } + + } + + return newJarFile; + } + + /** + * This method generate a set with the vars args supplied. + * + * @param elements The elements to be put in the set. + * @return The set containing the elements. + */ + public static Set generateSet(E... elements) { + Set result = new HashSet(); + for (E element : elements) + result.add(element); + + return result; + } + + /** + * This method creates a relative pathname based on an actual file and a toplevel dir. + * It also transforms "\"'s to "/"'s. + * + * So actual file c:\test\installroot\lib\file1.xml and topLevelDir of c:\test\installroot + * would return a value of lib/file1.xml. + * + * @param actualFile - The actual file we're creating a relative pathname for. + * @param topLevelDir - The Top level Dir that we remove from the actual pathname. + * @return - A relative pathname from the toplevel dir. + */ + public static String createRelativePath(File actualFile, File topLevelDir) { + String relativeFileName = actualFile.getAbsolutePath().substring(topLevelDir.getAbsolutePath().length() + 1); + if (relativeFileName.contains("\\")) + relativeFileName = relativeFileName.replace("\\", "/"); + + return relativeFileName; + } + + /** + * This method generates a test feature with the required subsystem content headers + * + * @param featureFile - The actual Feature File. + * @param featureName - the name of the feature + * @param subsystemContent - A Map of subsystem content.The key is the location string, and the value is the file name. + * @return - The file for the feature. + */ + public static File createFeature(File featureFile, String featureName, Map subsystemContent) { + // Create test feature + StringBuffer featureContents = new StringBuffer(); + featureContents.append("Subsystem-ManifestVersion: 1\n"); + featureContents.append("IBM-ShortName: " + featureName + "\n"); + featureContents.append("Subsystem-Type: osgi.subsystem.feature\n"); + featureContents.append("Subsystem-SymbolicName: com.ibm.websphere.appserver." + featureName + "\n"); + featureContents.append("Subsystem-Version: 1.0.0\n"); + featureContents.append("IBM-Feature-Version: 2\n"); + boolean writeHeader = true; + // Iterate over the subsystem content and add it to the header. We need to ensure that the 1st entry is prefixed with the header + // name and all entries have ,\n unless it is the last entry, which just has \n. + for (Map.Entry entry : subsystemContent.entrySet()) { + if (writeHeader) { + featureContents.append("Subsystem-Content:"); + writeHeader = false; + } else { + featureContents.append(",\n"); + } + String location = entry.getKey(); + String fileName = entry.getValue(); + if (fileName.endsWith(".jar")) { + String[] jarParts = fileName.split("_"); + if (fileName.contains("static")) { + featureContents.append(" " + jarParts[0] + "; location:=\"" + location + "\"; type=\"jar\""); + } else { + featureContents.append(" " + jarParts[0] + "; version=\"[1,1.0.100)\""); + } + } else { + featureContents.append(" " + fileName + "; location:=\"" + location + "\"; type=\"file\""); + } + } + featureContents.append("\n"); + + return createFile(featureFile, featureContents, false); + } + + /** + * This method refreshes the Bundle repository that is used to identify files that are within the liberty runtime. + * We have to refresh this because if we add a file to the runtime, it won't get picked up unless the repo is cleaned and + * it re-reads the dirs. This is effectively bouncing the liberty server. + * + * @return + */ + public static ContentBasedLocalBundleRepository refreshBundleRepository() { + + clearBundleRepositoryHolders(); + BundleRepositoryRegistry.initializeDefaults("server1", true); + return BundleRepositoryRegistry.getInstallBundleRepository(); + } + + /** + * This method clears the existing repositoryHolders from the BundleRepositoryRegistry. This behaves as though we were bouncing the + * Liberty server. + */ + public static void clearBundleRepositoryHolders() { + // Remove any existing and recreate the bundle repository that will work out the latest versions of the jars. + try { + Field repositoryHoldersField = BundleRepositoryRegistry.class.getDeclaredField("repositoryHolders"); + repositoryHoldersField.setAccessible(true); + Map m = (Map) repositoryHoldersField.get(null); + m.clear(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void copyFile(File originalFile, File destFile) { + copyFile(originalFile, destFile, false); + } + + /** + * This method copies the original file to the new destination. + * + * @param originalFile - The file to copy + * @param destFile - The location of the new file. + */ + public static void copyFile(File originalFile, File destFile, boolean appendToDest) { + FileInputStream fis = null; + FileOutputStream fos = null; + try { + fis = new FileInputStream(originalFile); + fos = new FileOutputStream(destFile, appendToDest); + + byte[] bytes = new byte[4096]; + int readBytes; + while ((readBytes = fis.read(bytes)) >= 0) { + fos.write(bytes, 0, readBytes); + } + fos.flush(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + if (fos != null) { + try { + fos.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + } +} diff --git a/dev/com.ibm.ws.repository.resolver_fat/.classpath b/dev/com.ibm.ws.repository.resolver_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.resolver_fat/.classpath.gradle b/dev/com.ibm.ws.repository.resolver_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.resolver_fat/.gitignore b/dev/com.ibm.ws.repository.resolver_fat/.gitignore new file mode 100644 index 000000000000..b47a9937a4d0 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.gitignore @@ -0,0 +1,5 @@ +/dist +/bundles +/lib +/*.log* +/bootstrapping.properties diff --git a/dev/com.ibm.ws.repository.resolver_fat/.project b/dev/com.ibm.ws.repository.resolver_fat/.project new file mode 100755 index 000000000000..6fc7204fd8cb --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.repository.resolver_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..99f26c0203a7 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..845c3083c7df --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c874b5816985 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd b/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd new file mode 100644 index 000000000000..fba254439add --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd @@ -0,0 +1,25 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + org.eclipse.osgi;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.org.apache.aries.util.1.1.2;version=latest, \ + com.ibm.ws.product.utility;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.repository.test.utils;version=latest, \ + com.ibm.ws.repository.resolver;version=latest diff --git a/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd.gradle b/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..fba254439add --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd.gradle @@ -0,0 +1,25 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + org.eclipse.osgi;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.org.apache.aries.util.1.1.2;version=latest, \ + com.ibm.ws.product.utility;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.repository.test.utils;version=latest, \ + com.ibm.ws.repository.resolver;version=latest diff --git a/dev/com.ibm.ws.repository.resolver_fat/build-test.xml b/dev/com.ibm.ws.repository.resolver_fat/build-test.xml new file mode 100755 index 000000000000..4cbb3559e5e2 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/build-test.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.resolver_fat/build.gradle b/dev/com.ibm.ws.repository.resolver_fat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/FATSuite.java b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/FATSuite.java new file mode 100755 index 000000000000..4c92b02c6f73 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/FATSuite.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.resolver; + +import org.junit.ClassRule; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import com.ibm.ws.repository.base.servers.LarsServerRule; +import com.ibm.ws.repository.base.servers.MassiveServerRule; +import com.ibm.ws.repository.resolver.internal.RepositoryResolveContextFatTest; + +@RunWith(Suite.class) +@SuiteClasses({ + RepositoryResolverTest.RepositoryResolverTestLars.class, + RepositoryResolverTest.RepositoryResolverTestMassive.class, + RepositoryResolverTest.RepositoryResolverTestDirectory.class, + RepositoryResolveContextFatTest.RepositoryResolveContextFatTestLars.class, + RepositoryResolveContextFatTest.RepositoryResolveContextFatTestMassive.class, + RepositoryResolveContextFatTest.RepositoryResolveContextFatTestDirectory.class, +}) +public class FATSuite { + + @ClassRule + public static LarsServerRule larsResource; + static { + if (!System.getProperty("java.version").startsWith("1.6")) { + larsResource = new LarsServerRule(); + } + } + + @ClassRule + public static MassiveServerRule massiveResource = new MassiveServerRule(); + +} diff --git a/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/RepositoryResolverTest.java b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/RepositoryResolverTest.java new file mode 100755 index 000000000000..8803fdf6edee --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/RepositoryResolverTest.java @@ -0,0 +1,2496 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.resolver; + +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasProperty; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.junit.Assume.assumeTrue; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.jmock.Mockery; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.osgi.service.resolver.ResolutionException; + +import com.ibm.ws.kernel.feature.provisioning.ProvisioningFeatureDefinition; +import com.ibm.ws.kernel.productinfo.ProductInfo; +import com.ibm.ws.kernel.productinfo.ProductInfoParseException; +import com.ibm.ws.product.utility.extension.ifix.xml.IFixInfo; +import com.ibm.ws.product.utility.extension.ifix.xml.UpdatedFile; +import com.ibm.ws.repository.base.NoRepoAvailableException; +import com.ibm.ws.repository.base.servers.DirectoryConnectionRule; +import com.ibm.ws.repository.base.servers.LarsConnectionRule; +import com.ibm.ws.repository.base.servers.MassiveConnectionRule; +import com.ibm.ws.repository.base.servers.RestRepositoryConnectionRule; +import com.ibm.ws.repository.common.enums.InstallPolicy; +import com.ibm.ws.repository.common.enums.ResourceType; +import com.ibm.ws.repository.connections.ProductDefinition; +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RepositoryConnectionList; +import com.ibm.ws.repository.connections.SimpleProductDefinition; +import com.ibm.ws.repository.connections.liberty.ProductInfoProductDefinition; +import com.ibm.ws.repository.exceptions.RepositoryBackendException; +import com.ibm.ws.repository.exceptions.RepositoryException; +import com.ibm.ws.repository.exceptions.RepositoryResourceException; +import com.ibm.ws.repository.resolver.RepositoryResolutionException.MissingRequirement; +import com.ibm.ws.repository.resolver.internal.resource.LpmResource; +import com.ibm.ws.repository.resolver.ResolverTestUtils; +import com.ibm.ws.repository.resources.RepositoryResource; +import com.ibm.ws.repository.resources.internal.EsaResourceImpl; +import com.ibm.ws.repository.resources.internal.IfixResourceImpl; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; +import com.ibm.ws.repository.resources.internal.SampleResourceImpl; +import com.ibm.ws.repository.strategies.writeable.BaseStrategy; + +/** + * Tests for {@link RepositoryResolver} + */ +public class RepositoryResolverTest { + + private int _count = 0; + + private RepositoryConnectionList _loginInfoList; + + @Rule + public RestRepositoryConnectionRule connection; + + private RepositoryConnection getConnection() { + return connection.getConnection(); + } + + public static class RepositoryResolverTestMassive extends RepositoryResolverTest { + public RepositoryResolverTestMassive() { + connection = new MassiveConnectionRule(FATSuite.massiveResource); + } + } + + public static class RepositoryResolverTestLars extends RepositoryResolverTest { + public RepositoryResolverTestLars() { + if (FATSuite.larsResource != null) { + connection = new LarsConnectionRule(FATSuite.larsResource); + } + } + } + + public static class RepositoryResolverTestDirectory extends RepositoryResolverTest { + public RepositoryResolverTestDirectory() { + connection = new DirectoryConnectionRule(); + } + } + + /** + * Don't run tests if the connection is null. This will happen where + * (for example) it is a LARS connection running on a Java 6 VM. + */ + @Before + public void skipIfNullConnection() { + assumeTrue(connection != null); + } + + @Before + public void setupLoginInfo() throws NoRepoAvailableException { + // Unlike most tests resolver wants to use a collection of LoginInfoResources so create one and use that instead + if (connection != null) { + _loginInfoList = new RepositoryConnectionList(getConnection()); + } + } + + /** + * Test to make sure a single feature can be obtained from Massive by symbolic name + * + * @throws Throwable + */ + @Test + public void testSingleFeatureBySymbolicName() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure a single feature can be obtained from Massive by short name + * + * @throws ResolutionException + * @throws RepositoryException + */ + @Test + public void testSingleFeatureByShortName() throws RepositoryException, ResolutionException { + String symbolicName = "com.ibm.ws.test-1.0"; + String shortName = "test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, shortName, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(shortName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure a single feature can be obtained from Massive by short name with the wrong case + * + * @throws ResolutionException + * @throws RepositoryException + */ + @Test + public void testSingleFeatureByWrongCasedShortName() throws RepositoryException, ResolutionException { + String symbolicName = "com.ibm.ws.test-1.0"; + String shortName = "teST-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, shortName, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve("TEst-1.0"); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure that if a feature is already installed you get an empty collection back. + * + * @throws RepositoryException + */ + @Test + public void testFeatureThatIsAlreadyInstalled() throws RepositoryException { + String symbolicName = "com.ibm.ws.test-1.0"; + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, symbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("The resource is already installed so should not of been returned", 0, resolvedResources.size()); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Test to make sure a single feature can be obtained from Massive by symbolic name and version + * + * @throws ResolutionException + * @throws RepositoryException + */ + @Test + public void testSingleFeatureBySymbolicNameAndVersion() throws RepositoryException, ResolutionException { + // Add two test resources to massive, we want to make sure we get the right one + String symbolicName = "com.ibm.ws.test-1.0"; + String correctVersion = "1.0.0.0"; + createEsaResource(symbolicName, null, "1.0.0.1"); + EsaResourceImpl correctResource = createEsaResource(symbolicName, null, correctVersion); + + // Now see if we can resolve it! + String toResolve = symbolicName + "/" + correctVersion; + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(toResolve); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied at the right version", resolvedResources.iterator().next().contains(correctResource)); + } + + /** + * Test a feature dependency in the repo + */ + @Test + public void testFeatureDependencyInRepo() throws RepositoryException, ResolutionException { + // Add two test resources to massive, we want to make sure they both are returned in the right order + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + EsaResourceImpl dependencyResource = createEsaResource(secondSymbolicName, null, "1.0.0.1"); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resource", 2, resolvedResources.iterator().next().size()); + assertEquals("The dependency should be installed first", dependencyResource, resolvedResources.iterator().next().get(0)); + assertEquals("The resource being resolved should be installed second", firstResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Test a feature dependency in the install + */ + @Test + public void testFeatureDependencyInInstall() throws RepositoryException, ResolutionException { + // Add one test resource to massive, but make a dependency to an already installed feature + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, secondSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertEquals("The resource being resolved should be the one in the list", firstResource, resolvedResources.iterator().next().get(0)); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Test when there are two features with the same symbolic name that the latest one is picked + */ + @Test + public void testFeaturePicked() throws RepositoryException, ResolutionException { + // Add two test resources to massive, we want to make sure we get the right one + String symbolicName = "com.ibm.ws.test-1.0"; + createEsaResource(symbolicName, null, "1.0.0.0"); + EsaResourceImpl secondResource = createEsaResource(symbolicName, null, "1.0.0.1"); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one with the latest version", resolvedResources.iterator().next().contains(secondResource)); + } + + /** + * Test when there is a feature dependency installed and in the repo then the one in the install is picked + */ + @Test + public void testFeatureDependencyInInstallPicked() throws RepositoryException, ResolutionException { + // Add two test resources to massive, and one to the install the resolver should not return the dependency feature from Massive even if it's a better version + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + createEsaResource(secondSymbolicName, null, "1.0.0.1"); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, secondSymbolicName, null, "1.0.0.0"); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertEquals("The resource being resolved should be the one in the list", firstResource, resolvedResources.iterator().next().get(0)); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Test applies to is used to work out the best feature to install + * + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testFeatureWithAppliesToFilters() throws RepositoryException, ResolutionException, IOException, ProductInfoParseException { + // Add two test resources to massive, we want to make sure we get the right one, even though the second one is a higher number the first should be picked as it applies to the correct product + String symbolicName = "com.ibm.ws.test-1.0"; + createEsaResource(symbolicName, null, "1.0.0.1", null, "com.ibm.ws.test.product; productVersion=5.0.0.1; productEdition=DEVELOPERS"); + EsaResourceImpl correctResource = createEsaResource(symbolicName, null, "1.0.0.0", null, "com.ibm.ws.test.product; productVersion=5.0.0.0; productEdition=DEVELOPERS"); + + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.ws.test.product", "DEVELOPERS", "5.0.0.0", null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one with the correct applies to", resolvedResources.iterator().next().contains(correctResource)); + } + + /** + * Tests that if you have a dependency in the install and a different dependency in the repo then it all works ok + */ + @Test + public void testFeatureDependencyInInstallAndRepo() throws RepositoryException, ResolutionException { + // Add two test resources to massive, and one different dependency to the install the resolver should return the dependency feature from Massive + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(secondSymbolicName); + dependencies.add(thirdSymbolicName); + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, dependencies, null); + EsaResourceImpl dependencyInMassive = createEsaResource(secondSymbolicName, null, null); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, thirdSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resource", 2, resolvedResources.iterator().next().size()); + assertEquals("The dependency in massive should be installed first", dependencyInMassive, resolvedResources.iterator().next().get(0)); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(1)); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Tests that when you have a chain of feature dependencies then they are all returned and in the right order + */ + @Test + public void testChainedFeatureDependencies() throws RepositoryException, ResolutionException { + // Add three test resources in a chain to massive + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + EsaResourceImpl firstDependency = createEsaResource(secondSymbolicName, null, null, Collections.singleton(thirdSymbolicName), null); + EsaResourceImpl secondDependency = createEsaResource(thirdSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be three resolved resource", 3, resolvedResources.iterator().next().size()); + assertEquals("The final dependency in massive should be installed first", secondDependency, resolvedResources.iterator().next().get(0)); + assertEquals("The first dependency in massive should be installed second", firstDependency, resolvedResources.iterator().next().get(1)); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(2)); + } + + /** + * Tests that when you have a chain of feature dependencies with multiple features depending on the end of the chain then the install order is still correct + */ + @Test + public void testChainedFeatureDependenciesWithMultipleRoutes() throws RepositoryException, ResolutionException { + // Add four test resources in a chain to massive with the final resource having two routes to it + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + String fourthSymbolicName = "com.ibm.ws.test.third.dep-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(secondSymbolicName); + dependencies.add(thirdSymbolicName); + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, dependencies, null); + EsaResourceImpl firstDependency = createEsaResource(secondSymbolicName, null, null, Collections.singleton(fourthSymbolicName), null); + EsaResourceImpl secondDependency = createEsaResource(thirdSymbolicName, null, null, Collections.singleton(fourthSymbolicName), null); + EsaResourceImpl finalDependency = createEsaResource(fourthSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be four resolved resource", 4, resolvedResources.iterator().next().size()); + assertEquals("The final dependency in massive should be installed first", finalDependency, resolvedResources.iterator().next().get(0)); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(3)); + + // The order of the middle two doesn't matter as long as they are in the middle somewhere + assertTrue("The first dependency should be in the resolved list", resolvedResources.iterator().next().contains(firstDependency)); + assertTrue("The second dependency should be in the resolved list", resolvedResources.iterator().next().contains(secondDependency)); + } + + /** + * Test an iFix dependency in the repo + */ + @Test + public void testFixDependencyInRepo() throws RepositoryException, ResolutionException { + // Add a test resource to massive with a dependency on an iFix + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, Collections.singleton(fixId)); + IfixResourceImpl iFixResource = createIFixResource(fixId, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resources", 2, resolvedResources.iterator().next().size()); + assertEquals("The iFix needs to be installed first", iFixResource, resolvedResources.iterator().next().get(0)); + assertEquals("The feature should be installed second", testResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Test an iFix dependency in the install + */ + @Test + public void testFixDependencyInInstall() throws RepositoryException, ResolutionException { + // Add a test resource to massive with a dependency on an iFix that is already installed + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, Collections.singleton(fixId)); + + IFixInfo iFixInfo = new IFixInfo(null, null, Collections.singleton(fixId), null, null, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections.singleton(iFixInfo), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resources", 1, resolvedResources.iterator().next().size()); + assertEquals("The feature should be in the resolved list", testResource, resolvedResources.iterator().next().get(0)); + } + + /** + * Test when there are two iFixes for the same fix that the latest one is picked + */ + @Test + public void testBestIFixPicked() throws RepositoryException, ResolutionException { + // Add a test resource to massive with a dependency on an iFix but where there are two fixes to the same iFix + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, Collections.singleton(fixId)); + createIFixResource(fixId, null, new Date(1)); + IfixResourceImpl newIFixResource = createIFixResource(fixId, null, new Date(10000000)); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resources", 2, resolvedResources.iterator().next().size()); + assertEquals("The new iFix needs to be installed first", newIFixResource, resolvedResources.iterator().next().get(0)); + assertEquals("The feature should be installed second", testResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Test when there are two iFixes for the same fix that the one with a date set is picked over a null value + */ + @Test + public void testIFixWithDateSetPicked() throws RepositoryException, ResolutionException { + // Add a test resource to massive with a dependency on an iFix but where there are two fixes to the same iFix + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, Collections.singleton(fixId)); + createIFixResource(fixId, null, null); + IfixResourceImpl newIFixResource = createIFixResource(fixId, null, new Date(1)); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resources", 2, resolvedResources.iterator().next().size()); + assertEquals("The new iFix needs to be installed first", newIFixResource, resolvedResources.iterator().next().get(0)); + assertEquals("The feature should be installed second", testResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Test when there is an iFix dependency installed and in the repo then the one in the install is picked + */ + @Test + public void testFixDependencyInInstallPicked() throws RepositoryException, ResolutionException { + // Add a test resource to massive with a dependency on an iFix that is in the install and massive and make sure that it picks the install one even when the massive one is later + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, Collections.singleton(fixId)); + createIFixResource(fixId, null, new Date(10000000)); + + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + UpdatedFile updatedFile = new UpdatedFile(null, 0, dateFormat.format(new Date(0)), null); + IFixInfo iFixInfo = new IFixInfo(null, null, Collections.singleton(fixId), null, null, null, Collections.singleton(updatedFile)); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections.singleton(iFixInfo), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resources", 1, resolvedResources.iterator().next().size()); + assertEquals("The feature should be in the resolved list", testResource, resolvedResources.iterator().next().get(0)); + } + + /** + * Test applies to is used to work out the best fix to install + * + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testFixWithAppliesToFilters() throws RepositoryException, ResolutionException, IOException, ProductInfoParseException { + // Add a test resource to massive with a dependency on an iFix but where there are two fixes to the same iFix + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null, null, "com.ibm.ws.test.product", null, false, Collections.singleton(fixId)); + + createIFixResource(fixId, "com.ibm.ws.test.product; productVersion=5.0.0.1; productEdition=DEVELOPERS", new Date(10000000)); + IfixResourceImpl correctIFix = createIFixResource(fixId, "com.ibm.ws.test.product; productVersion=5.0.0.0; productEdition=DEVELOPERS", new Date(0)); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new SimpleProductDefinition("com.ibm.ws.test.product", "5.0.0.0", null, null, "DEVELOPERS")), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resources", 2, resolvedResources.iterator().next().size()); + assertEquals("The iFix needs to be installed first", correctIFix, resolvedResources.iterator().next().get(0)); + assertEquals("The feature should be installed second", testResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Tests that if you have an IFix dependency in the install and a different dependency in the repo then it all works ok + */ + @Test + public void testFixDependencyInInstallAndRepo() throws RepositoryException, ResolutionException { + // Create a feature with two iFix dependencies, one in massive, the other in the install + String symbolicName = "com.ibm.ws.test-1.0"; + String fix1Id = "PM00001"; + String fix2Id = "PM00002"; + Collection fixIds = new HashSet(); + fixIds.add(fix1Id); + fixIds.add(fix2Id); + EsaResourceImpl testResource = createEsaResource(symbolicName, fixIds); + IfixResourceImpl iFixResource = createIFixResource(fix1Id, null, null); + + IFixInfo iFixInfo = new IFixInfo(null, null, Collections.singleton(fix2Id), null, null, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections.singleton(iFixInfo), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resources", 2, resolvedResources.iterator().next().size()); + assertEquals("The iFix should be installed first", iFixResource, resolvedResources.iterator().next().get(0)); + assertEquals("The feature should be installed second", testResource, resolvedResources.iterator().next().get(1)); + + } + + /** + * Tests that if you have multiple IFix dependencies in the repo then it all works ok + */ + @Test + public void testMultipleFixDependencyInRepo() throws RepositoryException, ResolutionException { + // Create a feature with two iFix dependencies, one in massive, the other in the install + String symbolicName = "com.ibm.ws.test-1.0"; + String fix1Id = "PM00001"; + String fix2Id = "PM00002"; + Collection fixIds = new HashSet(); + fixIds.add(fix1Id); + fixIds.add(fix2Id); + EsaResourceImpl testResource = createEsaResource(symbolicName, fixIds); + IfixResourceImpl iFixResource = createIFixResource(fix1Id, null, null); + IfixResourceImpl iFix2Resource = createIFixResource(fix2Id, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + List orderedResourceList = resolvedResources.iterator().next(); + assertEquals("There should be three resolved resources", 3, orderedResourceList.size()); + assertEquals("The feature should be installed last", testResource, resolvedResources.iterator().next().get(2)); + assertTrue("The iFix should be installed before the feature", orderedResourceList.contains(iFixResource)); + assertTrue("The second iFix should be installed before the feature", orderedResourceList.contains(iFix2Resource)); + + } + + /** + * Tests that when you have a chain of feature dependencies that each have a required fix then they are all returned and in the right order, the features at each level should + * always be installed first + */ + @Test + public void testChainedFixDependencies() throws RepositoryException, ResolutionException { + // Kitchen sink test, specifically testing that iFix and feature dependencies at the same level are returned in the right order + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + String fourthSymbolicName = "com.ibm.ws.test.fourth.dep-1.0"; + String fix1Id = "PM00001"; + String fix2Id = "PM00002"; + String fix3Id = "PM00003"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null, null, false, + Collections.singleton(fix1Id)); + EsaResourceImpl firstDependency = createEsaResource(secondSymbolicName, null, null, Collections.singleton(thirdSymbolicName), null, null, false, + Collections.singleton(fix2Id)); + EsaResourceImpl secondDependency = createEsaResource(thirdSymbolicName, null, null, Collections.singleton(fourthSymbolicName), null, null, false, + Collections.singleton(fix3Id)); + IfixResourceImpl iFix1Resource = createIFixResource(fix1Id, null, null); + IfixResourceImpl iFix2Resource = createIFixResource(fix2Id, null, null); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, fourthSymbolicName, null, null); + IFixInfo iFixInfo = new IFixInfo(null, null, Collections.singleton(fix3Id), null, null, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections.singleton(iFixInfo), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be five resolved resource", 5, resolvedResources.iterator().next().size()); + assertEquals("The final feature dependency in massive should be installed first", secondDependency, resolvedResources.iterator().next().get(0)); + assertEquals("The final iFix dependency should be installed second (after the feature it might fix)", iFix2Resource, resolvedResources.iterator().next().get(1)); + assertEquals("The middle feature dependency in massive should be installed third", firstDependency, resolvedResources.iterator().next().get(2)); + assertEquals("The middle iFix dependency should be installed fourth (after the feature it might fix)", iFix1Resource, resolvedResources.iterator().next().get(3)); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(4)); + + mockery.assertIsSatisfied(); + + } + + /** + * Make sure the resolution error message is fairly helpful + * + * @throws RepositoryException + */ + @Test + public void testResolutionMessage() throws RepositoryException { + String missingSymbolicName = "does.not.exist"; + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(missingSymbolicName); + fail("The resource does not exist so should not resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + missingSymbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(missingSymbolicName)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound().contains(missingSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the feature itself " + + e.getAllRequirementsResourcesNotFound(), missingSymbolicName, missingRequirement.requirementName); + assertNull("The exception should say there is no resource that owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Test to make sure if it isn't a top level feature that is missing you get the right message + */ + @Test + public void testResolutionMessageDeepFeatureMissing() throws RepositoryException { + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.other.dep-1.0"; + createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + RepositoryResourceImpl secondResource = createEsaResource(secondSymbolicName, null, "1.0.0.1", Collections.singleton(thirdSymbolicName), null); + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(Collections.singleton(firstSymbolicName)); + fail("The resource does not exist so should not resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state the top level feature that couldn't be resolved but it is: " + e.getMessage(), + e.getMessage().contains("resource=" + firstSymbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(firstSymbolicName)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertThat("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound(), contains(thirdSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the third feature " + + e.getAllRequirementsResourcesNotFound(), thirdSymbolicName, missingRequirement.requirementName); + assertEquals("The exception should include the resource that owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), secondResource, missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Test to make sure if you get further by doing a short name resolution you get the right message + */ + @Test + public void testResolutionShortNameTopLevel() throws RepositoryException { + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String firstShortName = "test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + RepositoryResourceImpl resource = createEsaResource(firstSymbolicName, firstShortName, null, Collections.singleton(secondSymbolicName), null); + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(Collections.singleton(firstShortName)); + fail("The resource does not exist so should not resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state the top level feature that couldn't be resolved but it is: " + e.getMessage(), + e.getMessage().contains("resource=" + firstShortName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(firstShortName)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound().contains(secondSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the second feature " + + e.getAllRequirementsResourcesNotFound(), secondSymbolicName, missingRequirement.requirementName); + assertEquals("The exception should include the resource that owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), resource, missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Test to make sure if you get further by doing a case insensitive short name resolution you get the right message + */ + @Test + public void testResolutionCaseInsensitiveShortNameTopLevel() throws RepositoryException { + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String firstShortName = "teST-1.0"; + String otherCaseShortName = "TEst-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + RepositoryResourceImpl resource = createEsaResource(firstSymbolicName, firstShortName, null, Collections.singleton(secondSymbolicName), null); + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(Collections.singleton(otherCaseShortName)); + fail("The resource does not exist so should not resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state the top level feature that couldn't be resolved but it is: " + e.getMessage(), + e.getMessage().contains("resource=" + otherCaseShortName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed but was: " + e.getTopLevelFeaturesNotResolved(), + e.getTopLevelFeaturesNotResolved().contains(otherCaseShortName)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertThat("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound(), contains(secondSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the second feature " + + e.getAllRequirementsResourcesNotFound(), secondSymbolicName, missingRequirement.requirementName); + assertEquals("The exception should include the resource that owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), resource, missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Make sure that iFixes cannot be directly resolved. Note this is a largely artificial restriction added because only feature manager is going to be used instead of a liberty + * package manager. There is nothing intrinsic in the resolver that stops iFixes being resolved except the {@link LpmResource} says it is only looking for features. + * + * @throws RepositoryException + */ + @Test + public void testFixesDontResolve() throws RepositoryException { + String fixId = "PM00001"; + createIFixResource(fixId, null, null); + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(fixId); + fail("The resource being searched for is an IFix so shouldn't resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + fixId)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(fixId)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound().contains(fixId)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the fix " + + e.getAllRequirementsResourcesNotFound(), fixId, missingRequirement.requirementName); + assertNull("The exception should state that no resource owns the requirement " + + e.getAllRequirementsResourcesNotFound(), missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Test to make sure multiple features can be resolved in a single step. + * + * @throws RepositoryException + * @throws ResolutionException + */ + @Test + public void testMultipleFeatures() throws RepositoryException, ResolutionException { + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.second-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null); + EsaResourceImpl secondResource = createEsaResource(secondSymbolicName, null, null); + Collection namesToResolve = new HashSet(); + namesToResolve.add(firstSymbolicName); + namesToResolve.add(secondSymbolicName); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(namesToResolve); + assertEquals("There should be a list of resources for each top level feature", 2, resolvedResources.size()); + Collection allResolvedResources = new ArrayList(); + for (List massiveResourceList : resolvedResources) { + allResolvedResources.addAll(massiveResourceList); + } + assertEquals("There should be two resolved resource", 2, allResolvedResources.size()); + assertTrue("The first resource should be resolve", allResolvedResources.contains(firstResource)); + assertTrue("The second resource should be resolve", allResolvedResources.contains(secondResource)); + } + + /** + * Test to make sure multiple features with one missing throws an exception + * + * @throws RepositoryException + * @throws ResolutionException + */ + @Test + public void testMultipleFeaturesWithOneMissing() throws RepositoryException, ResolutionException { + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.missing-1.0"; + createEsaResource(firstSymbolicName, null, null); + Collection namesToResolve = new HashSet(); + namesToResolve.add(firstSymbolicName); + namesToResolve.add(secondSymbolicName); + + // Now see if we can resolve it! + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(namesToResolve); + fail("Missing the second feature so should have failed to resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The exception should contain the info about the missing resource but was: " + e.getMessage(), e.getMessage().contains("resource=" + secondSymbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(secondSymbolicName)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound().contains(secondSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the third feature " + + e.getAllRequirementsResourcesNotFound(), secondSymbolicName, missingRequirement.requirementName); + assertNull("The exception should state no resource owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Test to make sure we can resolve multiple features using a mix of short and symbolic names + * + * @throws RepositoryException + */ + @Test + public void testMultipleFeaturesShortAndSymbolic() throws RepositoryException { + String firstSymbolicName = "com.ibm.ws.testa-1.0"; + String firstShortName = "TestA-1.0"; + String secondSymbolicName = "com.ibm.ws.testb-1.0"; + String secondShortName = "TestB-1.0"; + String thirdSymbolicName = "com.ibm.ws.testc-1.0"; + String thirdShortName = "TestC-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, firstShortName, null); + EsaResourceImpl secondResource = createEsaResource(secondSymbolicName, secondShortName, null); + EsaResourceImpl thirdResource = createEsaResource(thirdSymbolicName, thirdShortName, null); + + Collection namesToResolve = new HashSet(); + namesToResolve.add(firstSymbolicName); + namesToResolve.add(secondShortName); + namesToResolve.add(thirdShortName.toLowerCase()); + + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(namesToResolve); + // Flatten the list of resolvedResources + Set flatResolvedResources = new HashSet(); + for (List massiveResourceList : resolvedResources) { + flatResolvedResources.addAll(massiveResourceList); + } + + assertEquals("There should be three resolved resources", 3, flatResolvedResources.size()); + assertTrue("The first resource should be resolved", flatResolvedResources.contains(firstResource)); + assertTrue("The second resource should be resolved", flatResolvedResources.contains(secondResource)); + assertTrue("The third resource should be resolved", flatResolvedResources.contains(thirdResource)); + } + + /** + * Test to make sure an auto feature is not automatically installed if its capabilities are not met + * + * @throws Throwable + */ + @Test + public void testAutoFeatureNotSatisfied() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the unsatisfied auto-resource + createEsaResource("not.satisfied", null, null, null, null, Collections.singleton("does.not.exist"), true, null); + + // Now see if we can resolve just the single feature + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure an auto feature is not automatically installed if its capabilities are not met due to a missing iFix + * + * @throws Throwable + */ + @Test + public void testAutoFeatureNotSatisfiedWhenIFixMissing() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the resource that depends on an iFix + createEsaResource("auto.feature.with.ifix.dep", null, null, null, null, Collections.singleton(symbolicName), true, Collections.singleton("PM00001")); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure an auto feature is automatically installed if its capabilities are met by what is being installed + * + * @throws Throwable + */ + @Test + public void testAutoFeatureSatisfiedByNewFeature() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = createEsaResource("satisfied.auto.feature", null, null, null, null, Collections.singleton(symbolicName), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be two lists of resources one for the feature being installed and one for the auto feature, set is:" + resolvedResources, 2, + resolvedResources.size()); + boolean foundFeatureList = false; + boolean foundAutoList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(testResource) && resolvedList.size() == 1) { + foundFeatureList = true; + } else if (resolvedList.contains(autoFeature)) { + foundAutoList = true; + assertEquals("There should be 2 resolved resources in the auto list", 2, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(1)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found feature", foundFeatureList); + assertTrue("Should have found auto", foundAutoList); + } + + /** + * Test to make sure an auto feature is automatically installed if its capabilities are met by what is being installed even if it is through an OR relationships + * + * @throws Throwable + */ + @Test + public void testAutoFeatureWithSatisfiedByNewFeatureAndOtherAutoFeature() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + String requiredAutoFeatureSymbolicName = "com.ibm.ws.auto-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + EsaResourceImpl requiredAutoFeature = createEsaResource(requiredAutoFeatureSymbolicName, null, null, null, null, Collections.singleton(symbolicName), true, null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = new EsaResourceImpl(getConnection()); + autoFeature.setProvideFeature("satisfied.auto.feature"); + autoFeature.setName("name"); + String ibmProvisionCapability = "osgi.identity; filter:=\"(&(type=osgi.subsystem.feature)(osgi.identity=" + symbolicName + + "))\", osgi.identity; filter:=\"(&(type=osgi.subsystem.feature)(osgi.identity=" + requiredAutoFeatureSymbolicName + "))\""; + autoFeature.setProvisionCapability(ibmProvisionCapability.toString()); + autoFeature.setInstallPolicy(InstallPolicy.WHEN_SATISFIED); + uploadResource(autoFeature); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be three lists of resources one for the feature being installed and one for each of the auto feature, set is:" + resolvedResources, 3, + resolvedResources.size()); + boolean foundFeatureList = false; + boolean foundAutoList = false; + boolean foundRequiredAutoList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(testResource) && resolvedList.size() == 1) { + foundFeatureList = true; + } else if (resolvedList.contains(requiredAutoFeature) && resolvedList.size() == 2) { + foundRequiredAutoList = true; + assertEquals("Required Auto should be installed last", requiredAutoFeature, resolvedList.get(1)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + } else if (resolvedList.contains(autoFeature)) { + foundAutoList = true; + assertEquals("There should be 3 resolved resources in the auto list", 3, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(2)); + assertEquals("Required auto feature should be installed", requiredAutoFeature, resolvedList.get(1)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found feature", foundFeatureList); + assertTrue("Should have found auto", foundAutoList); + assertTrue("Should have found required auto", foundRequiredAutoList); + } + + /** + * Test to make sure an auto feature is automatically installed if its capabilities are met by what is being installed even if it is through an OR relationships + * + * @throws Throwable + */ + @Test + public void testAutoFeatureWithOrSatisfiedByNewFeature() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = new EsaResourceImpl(getConnection()); + autoFeature.setProvideFeature("satisfied.auto.feature"); + autoFeature.setName("name"); + StringBuilder ibmProvisionCapability = new StringBuilder(); + ibmProvisionCapability.append("osgi.identity; filter:=\"(|(&(type=osgi.subsystem.feature)(osgi.identity=" + symbolicName + + "))(&(type=osgi.subsystem.feature)(osgi.identity=other)))\""); + autoFeature.setProvisionCapability(ibmProvisionCapability.toString()); + autoFeature.setInstallPolicy(InstallPolicy.WHEN_SATISFIED); + uploadResource(autoFeature); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be two lists of resources one for the feature being installed and one for the auto feature, set is:" + resolvedResources, 2, + resolvedResources.size()); + boolean foundFeatureList = false; + boolean foundAutoList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(testResource) && resolvedList.size() == 1) { + foundFeatureList = true; + } else if (resolvedList.contains(autoFeature)) { + foundAutoList = true; + assertEquals("There should be 2 resolved resources in the auto list", 2, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(1)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found feature", foundFeatureList); + assertTrue("Should have found auto", foundAutoList); + } + + /** + * Test to make sure an auto feature that is satisified by a feature in massive that is not in the install list doesn't cause that feature to be installed + * + * @throws Throwable + */ + @Test + public void testAutoFeatureDoesntPullInMoreFeatures() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + String symbolicNameForCapability = "com.ibm.ws.capabilit-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + createEsaResource(symbolicNameForCapability, null, null); + + // Now add the auto feature + createEsaResource("satisfiable.auto.feature", null, null, null, null, Collections.singleton(symbolicNameForCapability), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resources", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resources should contain the one we were looking for", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure when an auto feature is satisfied but has subsystem content listing another feature then it is installed pulls in the required feature. + * + * @throws Throwable + */ + @Test + public void testAutoFeaturePullsInSubsystemContentFeatures() throws Throwable { + // Add a test resource to massive + String mainFeatureSymbolicName = "com.ibm.ws.test-1.0"; + String autoFeatureSymbolicName = "com.ibm.ws.auto-1.0"; + String dependentFeatureSymbolicName = "com.ibm.ws.dependent-1.0"; + EsaResourceImpl mainFeature = createEsaResource(mainFeatureSymbolicName, null, null); + EsaResourceImpl dependentFeature = createEsaResource(dependentFeatureSymbolicName, null, null); + + // Now add the auto feature + EsaResourceImpl autoFeature = createEsaResource(autoFeatureSymbolicName, null, null, Collections.singleton(dependentFeatureSymbolicName), null, + Collections.singleton(mainFeatureSymbolicName), true, + null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(mainFeatureSymbolicName); + assertEquals("There should be two lists of resources, set is:" + resolvedResources, 2, resolvedResources.size()); + boolean foundAutoList = false; + boolean foundMainList = false; + for (List resources : resolvedResources) { + if (resources.size() == 1) { + assertEquals(mainFeature, resources.get(0)); + foundMainList = true; + } else if (resources.size() == 3) { + assertTrue("Dependencies should be installed first " + resources, resources.contains(mainFeature)); + assertTrue("Dependencies should be installed first " + resources, resources.contains(dependentFeature)); + assertEquals("Auto feature should be installed last as it depends on the other two " + resources, autoFeature, resources.get(2)); + foundAutoList = true; + } else { + fail("Unkown list of resources: " + resources); + } + } + assertTrue(foundAutoList); + assertTrue(foundMainList); + } + + /** + * Test to make sure an auto feature is installed if it is explicitly asked for and pulls in it's dependent features. + * + * @throws Throwable + */ + @Test + public void testAutoFeatureExplicitlyAskedFor() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + String autoSymbolicName = "com.ibm.ws.auto-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = createEsaResource(autoSymbolicName, null, null, null, null, Collections.singleton(symbolicName), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(autoSymbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + List resolvedList = resolvedResources.iterator().next(); + assertEquals("There should be 2 resolved resources in the auto list", 2, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(1)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + } + + /** + * Test to make sure that if an auto feature is set to be not auto-installable then it is not installed even when it's requirements are satisfied. + * + * @throws Throwable + */ + @Test + public void testAutoFeatureNotAutoInstallable() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the satisified auto-resource but make it not auto installable + createEsaResource("satisfied.auto.feature", null, null, null, null, Collections.singleton(symbolicName), false, null); + + // Now see if we can resolve just the single feature + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure an auto feature is automatically installed if its capabilities are met by what is already installed + */ + @Test + public void testAutoFeatureSatisfiedByInstalledFeature() throws RepositoryException, ResolutionException { + // Add one test resource to massive, but make a dependency to an already installed feature + String repoSymbolicName = "com.ibm.ws.test-1.0"; + String installedSymbolicName = "com.ibm.ws.test.installed-1.0"; + EsaResourceImpl testResource = createEsaResource(repoSymbolicName, null, null); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, installedSymbolicName, null, null); + + // Create the auto feature requiring the installed feature + EsaResourceImpl autoFeature = createEsaResource("satisfied.auto.feature", null, null, null, null, Collections.singleton(installedSymbolicName), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(repoSymbolicName); + assertEquals("There should be two lists of resources as the auto feature doesn't require the massive resource, set is:" + resolvedResources, 2, resolvedResources.size()); + Collection allResolvedResources = new ArrayList(); + for (List massiveResourceList : resolvedResources) { + allResolvedResources.addAll(massiveResourceList); + } + assertEquals("There should be two resolved resources", 2, allResolvedResources.size()); + assertTrue("The resolved resources should contain the one we were looking for", allResolvedResources.contains(testResource)); + assertTrue("The resolved resources should contain the now satisified auto feature", allResolvedResources.contains(autoFeature)); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Test to make sure an auto feature is not automatically installed if it is already installed + */ + @Test + public void testAutoFeatureAlreadyInstalled() throws RepositoryException, ResolutionException { + // Add one test resource to massive, but make a dependency to an already installed feature + String repoSymbolicName = "com.ibm.ws.test-1.0"; + String requiredInstalledSymbolicName = "com.ibm.ws.test.installed-1.0"; + String autoFeatureSymbolicName = "com.ibm.ws.test.auto-1.0"; + EsaResourceImpl testResource = createEsaResource(repoSymbolicName, null, null); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, requiredInstalledSymbolicName, null, null); + ProvisioningFeatureDefinition mockAutoFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, autoFeatureSymbolicName, null, null); + Collection installedFeatures = new HashSet(); + installedFeatures.add(mockFeatureDefinition); + installedFeatures.add(mockAutoFeatureDefinition); + + // Create the auto feature requiring the installed feature + createEsaResource(autoFeatureSymbolicName, null, null, null, null, Collections.singleton(requiredInstalledSymbolicName), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), installedFeatures, Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(repoSymbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertEquals("The resource being resolved should be the one in the list", testResource, resolvedResources.iterator().next().get(0)); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Test to make sure if an auto feature needs two other features from the repo then everything works + */ + @Test + public void testAutoFeatureNeedingTwoFeatures() throws RepositoryException { + // Add two test resources to massive + String symbolicName1 = "com.ibm.ws.test.one-1.0"; + EsaResourceImpl testResource1 = createEsaResource(symbolicName1, null, null); + String symbolicName2 = "com.ibm.ws.test.two-1.0"; + EsaResourceImpl testResource2 = createEsaResource(symbolicName2, null, null); + + // Now add the soon-to-be-satisfied auto feature + Collection requiredFeatures = new HashSet(); + requiredFeatures.add(symbolicName1); + requiredFeatures.add(symbolicName2); + EsaResourceImpl autoFeature = createEsaResource("satisfied.auto.feature", null, null, null, null, requiredFeatures, true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(requiredFeatures); + assertEquals("There should be three lists of resources one for each of the features asked for and one for the auto feature, set is:" + resolvedResources, 3, + resolvedResources.size()); + + boolean found1List = false; + boolean found2List = false; + boolean foundAutoList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(testResource1) && resolvedList.size() == 1) { + found1List = true; + } else if (resolvedList.contains(testResource2) && resolvedList.size() == 1) { + found2List = true; + } else if (resolvedList.contains(autoFeature)) { + foundAutoList = true; + assertEquals("There should be 3 resolved resources in the auto list", 3, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(2)); + assertTrue("1 should be installed", resolvedList.contains(testResource1)); + assertTrue("2 should be installed", resolvedList.contains(testResource2)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found 1", found1List); + assertTrue("Should have found 2", found2List); + assertTrue("Should have found auto", foundAutoList); + } + + /** + * Test to make sure if an auto feature needs two other features from the repo but one is missing then it isn't installed + */ + @Test + public void testAutoFeaturePartiallySatisfied() throws RepositoryException { + // Add two test resources to massive + String symbolicName1 = "com.ibm.ws.test.one-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName1, null, null); + String symbolicName2 = "com.ibm.ws.test.two-1.0"; + + // Now add the soon-to-be-satisfied auto feature + Collection requiredFeatures = new HashSet(); + requiredFeatures.add(symbolicName1); + requiredFeatures.add(symbolicName2); + createEsaResource("satisfied.auto.feature", null, null, null, null, requiredFeatures, true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName1); + assertEquals("There should only be a single list of resources as the auto feature isn't satisified, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertEquals("The resource being resolved should be the one in the list", testResource, resolvedResources.iterator().next().get(0)); + } + + /** + * Test to make sure an auto feature is automatically along with any iFixes it needs + * + * @throws Throwable + */ + @Test + public void testAutoFeatureRequiringIFix() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + String fixId = "PM00010"; + IfixResourceImpl iFixResource = createIFixResource(fixId, null, null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = createEsaResource("satisfied.auto.feature", null, null, null, null, Collections.singleton(symbolicName), true, Collections.singleton(fixId)); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be two lists of resources one for the feature being installed and one for the auto feature, set is:" + resolvedResources, 2, + resolvedResources.size()); + boolean foundFeatureList = false; + boolean foundAutoList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(testResource) && resolvedList.size() == 1) { + foundFeatureList = true; + } else if (resolvedList.contains(autoFeature)) { + foundAutoList = true; + assertEquals("There should be 3 resolved resources in the auto list", 3, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(2)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + assertEquals("IFix should be installed second", iFixResource, resolvedList.get(1)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found feature", foundFeatureList); + assertTrue("Should have found auto", foundAutoList); + } + + /** + * This method tests that a resolver can be used more than once. + * + * @throws RepositoryException + */ + @Test + public void testCaching() throws RepositoryException { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> firstResolution = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, firstResolution.size()); + List firstResolutionList = firstResolution.iterator().next(); + assertEquals("There should be one resolved resource", 1, firstResolutionList.size()); + assertTrue("The resolved resource should be the one we supplied", firstResolutionList.contains(testResource)); + + Collection> secondResolution = resolver.resolve(symbolicName); + assertEquals("Multiple invocations of resolve should return the same result", firstResolution, secondResolution); + } + + /** + * Tests if you have two intersecting feature dependencies then they appear in both lists + */ + @Test + public void testIntersectingFeatures() throws RepositoryException { + // Have a require b and c require b and ask to install a and c, both lists should contain b + String aSymbolicName = "com.ibm.ws.test.A-1.0"; + String bSymbolicName = "com.ibm.ws.test.B-1.0"; + String cSymbolicName = "com.ibm.ws.test.C-1.0"; + EsaResourceImpl aResource = createEsaResource(aSymbolicName, null, null, Collections.singleton(bSymbolicName), null); + EsaResourceImpl bResource = createEsaResource(bSymbolicName, null, null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, null, null, Collections.singleton(bSymbolicName), null); + + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection symbolicNames = new HashSet(); + symbolicNames.add(aSymbolicName); + symbolicNames.add(cSymbolicName); + Collection> resolvedResources = resolver.resolve(symbolicNames); + assertEquals("There should be two lists of resolved resources", 2, resolvedResources.size()); + boolean foundAList = false; + boolean foundCList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(aResource)) { + foundAList = true; + assertEquals("There should be 2 resolved resources in the a list", 2, resolvedList.size()); + assertEquals("A should be installed last", aResource, resolvedList.get(1)); + assertEquals("B should be installed first", bResource, resolvedList.get(0)); + } else if (resolvedList.contains(cResource)) { + foundCList = true; + assertEquals("There should be 2 resolved resources in the c list", 2, resolvedList.size()); + assertEquals("C should be installed last", cResource, resolvedList.get(1)); + assertEquals("B should be installed first", bResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found A", foundAList); + assertTrue("Should have found C", foundCList); + } + + /** + * Tests if you have two intersecting fix dependencies then they appear in both lists + */ + @Test + public void testIntersectingFixes() throws RepositoryException { + // Have a require b (fix) and c require b and ask to install a and c, both lists should contain b + String aSymbolicName = "com.ibm.ws.test.A-1.0"; + String bFixId = "PM0000b"; + String cSymbolicName = "com.ibm.ws.test.C-1.0"; + EsaResourceImpl aResource = createEsaResource(aSymbolicName, Collections.singleton(bFixId)); + IfixResourceImpl bResource = createIFixResource(bFixId, null, null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, Collections.singleton(bFixId)); + + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection symbolicNames = new HashSet(); + symbolicNames.add(aSymbolicName); + symbolicNames.add(cSymbolicName); + Collection> resolvedResources = resolver.resolve(symbolicNames); + assertEquals("There should be two lists of resolved resources", 2, resolvedResources.size()); + boolean foundAList = false; + boolean foundCList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(aResource)) { + foundAList = true; + assertEquals("There should be 2 resolved resources in the a list", 2, resolvedList.size()); + assertEquals("A should be installed last", aResource, resolvedList.get(1)); + assertEquals("B should be installed first", bResource, resolvedList.get(0)); + } else if (resolvedList.contains(cResource)) { + foundCList = true; + assertEquals("There should be 2 resolved resources in the c list", 2, resolvedList.size()); + assertEquals("C should be installed last", cResource, resolvedList.get(1)); + assertEquals("B should be installed first", bResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found A", foundAList); + assertTrue("Should have found C", foundCList); + } + + /** + * This test makes sure that if you have two trees of features that intersect then the intersecting parts appear in both lists of stuff to install. + * + * @throws RepositoryException + */ + @Test + public void testIntersectingLists() throws RepositoryException { + // Build up a data structure like so (where -> indicates a requirement and i or f prefix state whether it is an ifix or a feature): + // fA -> fB -> iC, (fD -> iE) + // fZ -> iC, fY -> fD -> iE + // We will then ask to resolve fA and fZ and should then get back the following two lists of stuff to install: + // [iE, fD, iC, fB, fA] + // [iE, fD, fY, iC, fZ] + String fASymbolicName = "com.ibm.ws.test.A-1.0"; + String fBSymbolicName = "com.ibm.ws.test.B-1.0"; + String fDSymbolicName = "com.ibm.ws.test.D-1.0"; + String fZSymbolicName = "com.ibm.ws.test.Z-1.0"; + String fYSymbolicName = "com.ibm.ws.test.Y-1.0"; + String iCId = "PM0000C"; + String iEId = "PM0000E"; + EsaResourceImpl aResource = createEsaResource(fASymbolicName, null, null, Collections.singleton(fBSymbolicName), null); + EsaResourceImpl bResource = createEsaResource(fBSymbolicName, null, null, Collections.singleton(fDSymbolicName), null, null, false, Collections.singleton(iCId)); + EsaResourceImpl dResource = createEsaResource(fDSymbolicName, Collections.singleton(iEId)); + EsaResourceImpl zResource = createEsaResource(fZSymbolicName, null, null, Collections.singleton(fYSymbolicName), null, null, false, Collections.singleton(iCId)); + EsaResourceImpl yResource = createEsaResource(fYSymbolicName, null, null, Collections.singleton(fDSymbolicName), null); + IfixResourceImpl iCResource = createIFixResource(iCId, null, null); + IfixResourceImpl iEResource = createIFixResource(iEId, null, null); + + // Now do the resolution + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection symbolicNames = new HashSet(); + symbolicNames.add(fASymbolicName); + symbolicNames.add(fZSymbolicName); + Collection> resolvedResources = resolver.resolve(symbolicNames); + assertEquals("There should be two lists of resolved resources", 2, resolvedResources.size()); + boolean foundAList = false; + boolean foundZList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(aResource)) { + foundAList = true; + assertEquals("There should be 5 resolved resources in the a list", 5, resolvedList.size()); + assertEquals("A should be installed last", aResource, resolvedList.get(4)); + assertEquals("B should be installed second last", bResource, resolvedList.get(3)); + assertEquals("C should be installed in the middle", iCResource, resolvedList.get(2)); + assertEquals("D should be installed second ", dResource, resolvedList.get(1)); + assertEquals("E should be installed first", iEResource, resolvedList.get(0)); + } else if (resolvedList.contains(zResource)) { + foundZList = true; + assertEquals("There should be 5 resolved resources in the z list", 5, resolvedList.size()); + assertEquals("A should be installed last", zResource, resolvedList.get(4)); + assertEquals("C should be installed second last", iCResource, resolvedList.get(3)); + assertEquals("Y should be installed in the middle", yResource, resolvedList.get(2)); + assertEquals("D should be installed second ", dResource, resolvedList.get(1)); + assertEquals("E should be installed first", iEResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found A", foundAList); + assertTrue("Should have found Z", foundZList); + } + + /** + * Test based on review of work item 118781 (comment 6) where if you have two long paths to the same object then it can appear after things that depend on it. + * + * @throws RepositoryException + * @throws RepositoryResolutionException + */ + @Test + public void testOrderingOnMultipleLongPaths() throws RepositoryResolutionException, RepositoryException { + // Construct the following dependency model in the repo: + // A -> B, C + // B -> D + // C -> E + // D -> F + // E -> F + String aSymbolicName = "com.ibm.ws.test.A-1.0"; + String bSymbolicName = "com.ibm.ws.test.B-1.0"; + String cSymbolicName = "com.ibm.ws.test.C-1.0"; + String dSymbolicName = "com.ibm.ws.test.D-1.0"; + String eSymbolicName = "com.ibm.ws.test.E-1.0"; + String fSymbolicName = "com.ibm.ws.test.F-1.0"; + Collection aDeps = new HashSet(); + aDeps.add(bSymbolicName); + aDeps.add(cSymbolicName); + EsaResourceImpl aResource = createEsaResource(aSymbolicName, null, null, aDeps, null); + EsaResourceImpl bResource = createEsaResource(bSymbolicName, null, null, Collections.singleton(dSymbolicName), null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, null, null, Collections.singleton(eSymbolicName), null); + EsaResourceImpl dResource = createEsaResource(dSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + EsaResourceImpl eResource = createEsaResource(eSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + EsaResourceImpl fResource = createEsaResource(fSymbolicName, null, null); + + // Resolve + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(aSymbolicName); + + // Test result + assertEquals("There should be a single list of resolved resources", 1, resolvedResources.size()); + List resolvedList = resolvedResources.iterator().next(); + assertEquals("There should be 6 resolved resources, list is: " + resolvedList, 6, resolvedList.size()); + assertEquals("Everything depends on f so it should be installed first, list is: " + resolvedList, fResource, resolvedList.get(0)); + assertEquals("A is at the root so should be installed last, list is: " + resolvedList, aResource, resolvedList.get(5)); + assertTrue("The list should contain B, list is: " + resolvedList, resolvedList.contains(bResource)); + assertTrue("The list should contain C, list is: " + resolvedList, resolvedList.contains(cResource)); + assertTrue("The list should contain D, list is: " + resolvedList, resolvedList.contains(dResource)); + assertTrue("The list should contain E, list is: " + resolvedList, resolvedList.contains(eResource)); + assertTrue("B depends on D so should be installed after it, list is: " + resolvedList, resolvedList.indexOf(bResource) > resolvedList.indexOf(dResource)); + assertTrue("C depends on E so should be installed after it, list is: " + resolvedList, resolvedList.indexOf(cResource) > resolvedList.indexOf(eResource)); + } + + /** + * Same as {@link #testOrderingOnMultipleLongPaths()} but with an extra dependency on the end to ensure that everything that needs to appear at the end does so. + * + * @throws RepositoryException + * @throws RepositoryResolutionException + */ + @Test + public void testOrderingOnMultipleLongPathsAndLongTail() throws RepositoryResolutionException, RepositoryException { + // Construct the following dependency model in the repo: + // A -> B, C + // B -> D + // C -> E + // D -> F + // E -> F + // F -> G + String aSymbolicName = "com.ibm.ws.test.A-1.0"; + String bSymbolicName = "com.ibm.ws.test.B-1.0"; + String cSymbolicName = "com.ibm.ws.test.C-1.0"; + String dSymbolicName = "com.ibm.ws.test.D-1.0"; + String eSymbolicName = "com.ibm.ws.test.E-1.0"; + String fSymbolicName = "com.ibm.ws.test.F-1.0"; + String gSymbolicName = "com.ibm.ws.test.G-1.0"; + Collection aDeps = new HashSet(); + aDeps.add(bSymbolicName); + aDeps.add(cSymbolicName); + EsaResourceImpl aResource = createEsaResource(aSymbolicName, null, null, aDeps, null); + EsaResourceImpl bResource = createEsaResource(bSymbolicName, null, null, Collections.singleton(dSymbolicName), null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, null, null, Collections.singleton(eSymbolicName), null); + EsaResourceImpl dResource = createEsaResource(dSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + EsaResourceImpl eResource = createEsaResource(eSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + EsaResourceImpl fResource = createEsaResource(fSymbolicName, null, null, Collections.singleton(gSymbolicName), null); + EsaResourceImpl gResource = createEsaResource(gSymbolicName, null, null); + + // Resolve + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(aSymbolicName); + + // Test result + assertEquals("There should be a single list of resolved resources", 1, resolvedResources.size()); + List resolvedList = resolvedResources.iterator().next(); + assertEquals("There should be 7 resolved resources, list is: " + resolvedList, 7, resolvedList.size()); + assertEquals("Everything depends on g through f so it should be installed first, list is: " + resolvedList, gResource, resolvedList.get(0)); + assertEquals("f should be second, list is: " + resolvedList, fResource, resolvedList.get(1)); + assertEquals("A is at the root so should be installed last, list is: " + resolvedList, aResource, resolvedList.get(6)); + assertTrue("The list should contain B, list is: " + resolvedList, resolvedList.contains(bResource)); + assertTrue("The list should contain C, list is: " + resolvedList, resolvedList.contains(cResource)); + assertTrue("The list should contain D, list is: " + resolvedList, resolvedList.contains(dResource)); + assertTrue("The list should contain E, list is: " + resolvedList, resolvedList.contains(eResource)); + assertTrue("B depends on D so should be installed after it, list is: " + resolvedList, resolvedList.indexOf(bResource) > resolvedList.indexOf(dResource)); + assertTrue("C depends on E so should be installed after it, list is: " + resolvedList, resolvedList.indexOf(cResource) > resolvedList.indexOf(eResource)); + } + + /** + *

Test for work item 129271:

+ *

Here is the scenario when a feature can not be resolved.

+ * + *

Feature A (applies-to ND 8.5.5.2 only) has a dependency on Feature B (applies-to CORE/BASE/ND 8.5.5.2 and Archive Install only).

+ * + *

When a user is trying to install Feature A from a Liberty BASE 8.5.5.2 Installation Manager installation which doesn't have Feature B installed, the resolver should throw + * an exception indicating the feature A is missing the applies-to requirement.

+ * + *

But it currently throws an exception indicating the dependent feature is not meeting the requirement.

+ * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testExceptionFromUnresolvableItemWithUnresolveableDependency() throws RepositoryException, IOException, ProductInfoParseException { + String firstSymbolicName = "com.ibm.ws.A-1.0"; + String firstAppliesTo = "com.ibm.websphere.appserver; productVersion=8.5.5.2; productEdition=\"ND\""; + String secondSymbolicName = "com.ibm.ws.B-1.0"; + RepositoryResourceImpl resource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), firstAppliesTo); + createEsaResource(secondSymbolicName, null, "1.0.0.1", null, + "com.ibm.websphere.appserver; productVersion=8.5.5.2; productEdition=\"CORE,BASE,ND\"; productInstallType=Archive"); + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.websphere.appserver", "BASE", "8.5.5.2", null, "INSTALLATION_MANAGER"); + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + try { + resolver.resolve(firstSymbolicName); + fail("The resource should not resolve and neither should it's dependency"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + firstSymbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(firstSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsNotFound().size()); + assertThat("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the first feature", + e.getAllRequirementsNotFound(), contains(firstAppliesTo)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the third feature " + + e.getAllRequirementsResourcesNotFound(), firstAppliesTo, missingRequirement.requirementName); + assertEquals("The exception should include the resource that owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), resource, missingRequirement.owningResource); + assertEquals("One product should have not been found", 1, e.getMissingProducts().size()); + assertEquals("The exception should list which products features were found for", + new ProductRequirementInformation("[8.5.5.2, 8.5.5.2]", "com.ibm.websphere.appserver", null, null, Collections.singletonList("ND")), + e.getMissingProducts().iterator().next()); + assertEquals("The exception should contain the right minimum product value", "8.5.5.2", + e.getMinimumVersionForMissingProduct("com.ibm.websphere.appserver", null, null)); + assertEquals("The exception should contain the right maximum product value", "8.5.5.2", e.getMaximumVersionForMissingProduct(null, null, null)); + } + // Just double check we can't resolve the second item either (otherwise this might be the cause of the "correct" error message coming out) + try { + resolver.resolve(secondSymbolicName); + fail("The resource should not resolve"); + } catch (RepositoryResolutionException e) { + + } + + } + + /** + *

Test to demonstrate one of the hard cases in the resolver scalability (similar to web cache monitor). The setup is this:

+ * + *

Feature A (applies-to ND, any version) depends on Feature B (applies-to ND, 8.5.5.4)

+ * + *

Then try to resolve feature A on 8.5.5.2, you should get an error saying it only applies to 8554 and not one saying that feature B is missing.

+ * + *

Note this test also provides a test for defect 173065

+ * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testExceptionFromUnresolvableDepdendencyDueToBadAppliesTo() throws RepositoryException, IOException, ProductInfoParseException { + String firstSymbolicName = "com.ibm.ws.A-1.0"; + String firstAppliesTo = "com.ibm.websphere.appserver; productEdition=\"ND\""; + String secondSymbolicName = "com.ibm.ws.B-1.0"; + String secondAppliesTo = "com.ibm.websphere.appserver; productVersion=8.5.5.4; productEdition=\"ND\""; + createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), firstAppliesTo); + RepositoryResourceImpl secondResource = createEsaResource(secondSymbolicName, null, "1.0.0.1", null, secondAppliesTo); + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.websphere.appserver", "ND", "8.5.5.2", null, "INSTALLATION_MANAGER"); + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + try { + resolver.resolve(firstSymbolicName); + fail("The resource should not resolve and neither should it's dependency"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + firstSymbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(firstSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the second feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(secondAppliesTo)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the second feature " + + e.getAllRequirementsResourcesNotFound(), secondAppliesTo, missingRequirement.requirementName); + assertEquals("The exception should say which resources owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), secondResource, missingRequirement.owningResource); + assertEquals("One product should have not been found", 1, e.getMissingProducts().size()); + assertEquals("The exception should list which products features were found for", + new ProductRequirementInformation("[8.5.5.4, 8.5.5.4]", "com.ibm.websphere.appserver", null, null, Collections.singletonList("ND")), + e.getMissingProducts().iterator().next()); + assertEquals("The exception should contain the right minimum product value", "8.5.5.4", e.getMinimumVersionForMissingProduct(null, null, null)); + assertEquals("The exception should contain the right maximum product value", "8.5.5.4", + e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", null, null)); + } + } + + /** + * This tests asks for a feature for 8552 but there are only features for 8553 and 8554 so the resolution fails, we should get information that features were found for the + * other versions though. + * + * @throws ProductInfoParseException + * @throws IOException + * @throws RepositoryException + */ + @SuppressWarnings("unchecked") + @Test + public void testFeaturesOnMultipleProductsButNotRightOne() throws IOException, ProductInfoParseException, RepositoryException { + String symbolicName = "com.ibm.ws.A-1.0"; + String firstAppliesTo = "com.ibm.websphere.appserver; productVersion=8.5.5.3; productEdition=\"BASE\""; + String secondAppliesTo = "com.ibm.websphere.appserver; productVersion=8.5.5.10; productEdition=\"ND\""; + String thirdAppliesTo = "com.ibm.websphere.appserver; productVersion=9.0.0.2; productEdition=\"ND\""; + RepositoryResourceImpl resource1 = createEsaResource(symbolicName, null, null, null, firstAppliesTo); + RepositoryResourceImpl resource2 = createEsaResource(symbolicName, null, "1.0.0.1", null, secondAppliesTo); + RepositoryResourceImpl resource3 = createEsaResource(symbolicName, null, "1.0.0.2", null, thirdAppliesTo); + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.websphere.appserver", "BASE", "8.5.5.2", null, null); + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + try { + resolver.resolve(symbolicName); + fail("The resource should not resolve and neither should it's dependency"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + symbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(symbolicName)); + assertEquals("Three requirements should not be found", 3, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which requirement actually wasn't found and it should include the requirement on the product for the first feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(firstAppliesTo)); + assertTrue("The exception should say which requirement actually wasn't found and it should include the requirement on the product for the second feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(secondAppliesTo)); + assertTrue("The exception should say which requirement actually wasn't found and it should include the requirement on the product for the third feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(thirdAppliesTo)); + assertEquals("Three requirements should not be found", 3, e.getAllRequirementsResourcesNotFound().size()); + Collection missingRequirements = e.getAllRequirementsResourcesNotFound(); + assertThat("All the requirements should be in the list of missing requirements", missingRequirements, + containsInAnyOrder(allOf(hasProperty("requirementName", equalTo(firstAppliesTo)), hasProperty("owningResource", equalTo(resource1))), + allOf(hasProperty("requirementName", equalTo(secondAppliesTo)), hasProperty("owningResource", equalTo(resource2))), + allOf(hasProperty("requirementName", equalTo(thirdAppliesTo)), hasProperty("owningResource", equalTo(resource3))))); + assertEquals("Two products should have not been found", 3, e.getMissingProducts().size()); + assertTrue("The exception should list that a feature for product at version 8553 was found but was: " + e.getMissingProducts(), + e.getMissingProducts().contains(new ProductRequirementInformation("[8.5.5.3, 8.5.5.3]", "com.ibm.websphere.appserver", null, null, Collections.singletonList("BASE")))); + assertTrue("The exception should list that a feature for product at version 85510 was found but was: " + e.getMissingProducts(), + e.getMissingProducts().contains(new ProductRequirementInformation("[8.5.5.10, 8.5.5.10]", "com.ibm.websphere.appserver", null, null, Collections.singletonList("ND")))); + assertTrue("The exception should list that a feature for product at version 9002 was found but was: " + e.getMissingProducts(), + e.getMissingProducts().contains(new ProductRequirementInformation("[9.0.0.2, 9.0.0.2]", "com.ibm.websphere.appserver", null, null, Collections.singletonList("ND")))); + assertEquals("The exception should contain the right minimum product value", "8.5.5.3", e.getMinimumVersionForMissingProduct(null, null, null)); + assertEquals("The exception should contain the right maximum product value", "9.0.0.2", + e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", null, null)); + assertEquals("The exception should contain the right minimum product value filtering on edition", "8.5.5.10", e.getMinimumVersionForMissingProduct(null, null, "ND")); + assertEquals("The exception should contain the right maximum product value filtering on edition", "9.0.0.2", + e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", null, "ND")); + assertEquals("The exception should contain the right minimum product value filtering on version", "8.5.5.3", + e.getMinimumVersionForMissingProduct(null, "8.5.5.0", null)); + assertEquals("The exception should contain the right maximum product value filtering on version", "8.5.5.10", + e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", "8.5.5.0", null)); + assertEquals("The exception should contain the right minimum product value filtering on version and edition", "9.0.0.2", + e.getMinimumVersionForMissingProduct(null, "9.0.0.0", "ND")); + assertEquals("The exception should contain the right maximum product value filtering on version", "9.0.0.2", + e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", "9.0.0.0", "ND")); + } + } + + /** + * Test that you can resolve a sample + * + * @throws RepositoryException + */ + @Test + public void testSample() throws RepositoryException { + String name = "testSample"; + SampleResourceImpl testResource = createAndUploadSampleResource(name); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(name); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Try to resolve a sample by it's lower case name + * + * @throws RepositoryException + */ + @Test + public void testSampleByLowerCaseShortName() throws RepositoryException { + String name = "testSampleByLowerCaseShortName"; + SampleResourceImpl testResource = createAndUploadSampleResource(name); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(name.toLowerCase()); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test you can resolve an OSI + * + * @throws RepositoryException + */ + @Test + public void testOsi() throws RepositoryException { + String name = "testOsi"; + SampleResourceImpl testResource = createSampleResource(name); + testResource.setType(ResourceType.OPENSOURCE); + uploadResource(testResource); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(name); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test that you can resolve more than one sample at once + * + * @throws RepositoryException + */ + @Test + public void testMultipleSamples() throws RepositoryException { + String name1 = "testMultipleSamples1"; + SampleResourceImpl testResource1 = createAndUploadSampleResource(name1); + String name2 = "testMultipleSamples2"; + SampleResourceImpl testResource2 = createAndUploadSampleResource(name2); + + // Now see if we can resolve them! + Collection names = new HashSet(); + names.add(name1); + names.add(name2); + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(names); + assertEquals("There should be a two lists of resources", 2, resolvedResources.size()); + boolean found1 = false; + boolean found2 = false; + for (List list : resolvedResources) { + assertEquals("Each resolve list should only have a single resource " + list, 1, list.size()); + if (list.contains(testResource1)) { + found1 = true; + } else if (list.contains(testResource2)) { + found2 = true; + } else { + fail("Unknown resource list resolved: " + list); + } + } + assertTrue("Should have resolved the first sample", found1); + assertTrue("Should have resolved the second sample", found2); + } + + /** + * Tests that if a sample depends on a feature then it is resolved along with the feature and in the right order + */ + @Test + public void testSampleWithFeatureDependency() throws RepositoryException { + String name = "testSampleWithFeatureDependency"; + String featureSymbolicName = "com.ibm.ws.feature"; + SampleResourceImpl sampleResource = createSampleResource(name); + sampleResource.setRequireFeature(Collections.singleton(featureSymbolicName)); + uploadResource(sampleResource); + EsaResourceImpl feature = createEsaResource(featureSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(name); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + List installList = resolvedResources.iterator().next(); + assertEquals("There should be two resolved resource", 2, installList.size()); + assertEquals("The feature needs installing first so it should be first in the list", feature, installList.get(0)); + assertEquals("The sample needs installing second so it should be second in the list", sampleResource, installList.get(1)); + } + + /** + * Tests that if there is an applies to to an exact product version then it matches + * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testSampleWithAppliesToExact() throws RepositoryException, IOException, ProductInfoParseException { + runAppliesToSampleTest("testSampleWithAppliesToExact", "com.ibm.ws.test.product; productVersion=5.0.0.0; productEdition=DEVELOPERS", "5.0.0.0"); + } + + /** + * Tests that if there is an applies to to a range of product version but the product version is the min version then it matches + * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testSampleWithAppliesToRangeExactVersion() throws RepositoryException, IOException, ProductInfoParseException { + runAppliesToSampleTest("testSampleWithAppliesToRangeExactVersion", "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS", "5.0.0.0"); + } + + /** + * Tests that if there is an applies to to a range of product version and the product version is the higher than the min version then it matches + */ + @Test + public void testSampleWithAppliesToRangeHigherVersion() throws RepositoryException, IOException, ProductInfoParseException { + runAppliesToSampleTest("testSampleWithAppliesToRangeExactVersion", "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS", "6.0.0.0"); + } + + /** + * Tests that if there is an applies to to a range of product version but the product version is the min version then it matches + * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testFeatureWithAppliesToRangeExactVersion() throws RepositoryException, IOException, ProductInfoParseException { + String symoblicName = "com.ibm.ws.applies.to.range.exact.version"; + RepositoryResourceImpl testResource = createEsaResource(symoblicName, null, null, null, "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS"); + runTestAgainstProductDefinitionWithSingleResult(symoblicName, "5.0.0.0", testResource); + } + + /** + * Tests that if there is an applies to to a range of product version and the product version is the higher than the min version then it matches + */ + @Test + public void testFeatureWithAppliesToRangeHigherVersion() throws RepositoryException, IOException, ProductInfoParseException { + String symoblicName = "com.ibm.ws.applies.to.range.higher.version"; + RepositoryResourceImpl testResource = createEsaResource(symoblicName, null, null, null, "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS"); + runTestAgainstProductDefinitionWithSingleResult(symoblicName, "6.0.0.0", testResource); + } + + /** + * Tests that if there is an applies to to a range of product version and the product version is the lower than the min version then it throws an exception + */ + @Test + public void testFeatureWithAppliesToRangeLowerVersion() throws RepositoryException, IOException, ProductInfoParseException { + String symoblicName = "com.ibm.ws.applies.to.range.higher.version"; + String appliesTo = "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS"; + RepositoryResourceImpl testResource = createEsaResource(symoblicName, null, null, null, appliesTo); + try { + runTestAgainstProductDefinitionWithSingleResult(symoblicName, "4.0.0.0", testResource); + fail("Should have thrown an exception"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + symoblicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed " + e.getTopLevelFeaturesNotResolved(), e.getTopLevelFeaturesNotResolved().contains(symoblicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the second feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(appliesTo)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the applies to " + + e.getAllRequirementsResourcesNotFound(), appliesTo, missingRequirement.requirementName); + assertEquals("The exception should say which resources owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), testResource, missingRequirement.owningResource); + assertEquals("There should only be one product that couldn't be resolved", 1, e.getMissingProducts().size()); + assertTrue("The exception should list which products features were found for: " + e.getMissingProducts(), + e.getMissingProducts().contains(new ProductRequirementInformation("5.0.0.0", "com.ibm.ws.test.product", null, null, Collections.singletonList("DEVELOPERS")))); + assertEquals("The exception should contain the right minimum product value", "5.0.0.0", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should have no max product version for an unbounded range", e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", null, null)); + } + } + + /** + * Test that when you have multiple features that are applicable to a given version the correct one is picked. For more comprehensive ordering tests are done in the + * FeatureResourceTest unit test so this is a sniff test to make sure a basic rule is applied when integrated into the resolver. + * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + * @throws RepositoryResolutionException + */ + @Test + public void testRightFeaturePicked() throws RepositoryResolutionException, IOException, ProductInfoParseException, RepositoryException { + String symoblicName = "com.ibm.ws.applies.to.range.higher.version"; + createEsaResource(symoblicName, null, null, null, "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS"); + RepositoryResourceImpl exactTestResource = createEsaResource(symoblicName, null, null, null, "com.ibm.ws.test.product; productVersion=6.0.0.0; productEdition=DEVELOPERS"); + runTestAgainstProductDefinitionWithSingleResult(symoblicName, "6.0.0.0", exactTestResource); + } + + /** + * Tests the exception when a sample with a higher applies to than the current product + * + * @throws ProductInfoParseException + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testSampleWrongProductVersion() throws IOException, ProductInfoParseException, RepositoryException { + String name = "testSampleWrongProductVersion"; + SampleResourceImpl testResource = createSampleResource(name); + String appliesTo = "com.ibm.ws.test.product; productVersion=6.0.0.0+; productEdition=DEVELOPERS"; + testResource.setAppliesTo(appliesTo); + uploadResource(testResource); + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.ws.test.product", "DEVELOPERS", "5.0.0.0", null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + try { + resolver.resolve(name); + fail("The sample does not apply to this product so should not have resolved"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + name)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(name)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the second feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(appliesTo)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the applies to " + + e.getAllRequirementsResourcesNotFound(), appliesTo, missingRequirement.requirementName); + assertEquals("The exception should say which resources owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), testResource, missingRequirement.owningResource); + assertEquals("There should only be one product that couldn't be resolved", 1, e.getMissingProducts().size()); + assertTrue("The exception should list which products samples were found for: " + e.getMissingProducts(), + e.getMissingProducts().contains(new ProductRequirementInformation("6.0.0.0", "com.ibm.ws.test.product", null, null, Collections.singletonList("DEVELOPERS")))); + assertEquals("The exception should contain the right minimum product value", "6.0.0.0", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should have no max product version for an unbounded range", e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", null, null)); + } + + } + + /** + * Tests the exception when a sample is missing a feature + * + * @throws RepositoryException + */ + @Test + public void testSampleMissingFeature() throws RepositoryException { + String name = "testSampleWithFeatureDependency"; + String featureSymbolicName = "com.ibm.ws.feature"; + SampleResourceImpl sampleResource = createSampleResource(name); + sampleResource.setRequireFeature(Collections.singleton(featureSymbolicName)); + uploadResource(sampleResource); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + try { + resolver.resolve(name); + fail("The sample is missing a dependency so should not resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state the top level feature that couldn't be resolved but it is: " + e.getMessage(), + e.getMessage().contains("resource=" + name)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(name)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound().contains(featureSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the feature " + + e.getAllRequirementsResourcesNotFound(), featureSymbolicName, missingRequirement.requirementName); + assertEquals("The exception should say which resources owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), sampleResource, missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Tests that circles in features are ok. Squares never are though. + * + * @throws RepositoryException + */ + @Test + public void testCircularRelationship() throws RepositoryException { + // Add two test resources to massive, we want to make sure they both are returned in the right order + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + EsaResourceImpl dependencyResource = createEsaResource(secondSymbolicName, null, "1.0.0.1", Collections.singleton(firstSymbolicName), null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + + // Order is weird here, the two resources are effectively symbiotic so could be installed in either order but we asked for the first one so expect that to be installed last + assertEquals("There should be two resolved resource", 2, resolvedResources.iterator().next().size()); + assertEquals("The dependency should be installed first", dependencyResource, resolvedResources.iterator().next().get(0)); + assertEquals("The resource being resolved should be installed second", firstResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Tests that circles in features caused by an auto feature are ok. + * + * @throws RepositoryException + */ + @Test + public void testAutoFeatureCircularRelationship() throws RepositoryException { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + String autoFeatureSymbolicName = "satisfied.auto.feature"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null, Collections.singleton(autoFeatureSymbolicName), null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = createEsaResource(autoFeatureSymbolicName, null, null, null, null, Collections.singleton(symbolicName), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be two lists of resources one for the feature being installed and one for the auto feature, set is:" + resolvedResources, 2, + resolvedResources.size()); + boolean foundFeatureList = false; + boolean foundAutoList = false; + for (List resolvedList : resolvedResources) { + // As it's a circle you should have two lists with both in but in different order + assertEquals(2, resolvedList.size()); + if (resolvedList.get(0).equals(testResource) && resolvedList.get(1).equals(autoFeature)) { + foundFeatureList = true; + } else if (resolvedList.get(1).equals(testResource) && resolvedList.get(0).equals(autoFeature)) { + foundAutoList = true; + + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found feature", foundFeatureList); + assertTrue("Should have found auto", foundAutoList); + } + + /** + * Same as {@link #testChainedFeatureDependenciesWithMultipleRoutes()} but with a circle at the end. + */ + @Test + public void testChainedFeatureDependenciesWithMultipleRoutesWithCircle() throws RepositoryException, ResolutionException { + // Add four test resources in a chain to massive with the final resource having two routes to it + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + String fourthSymbolicName = "com.ibm.ws.test.third.dep-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(secondSymbolicName); + dependencies.add(thirdSymbolicName); + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, dependencies, null); + EsaResourceImpl firstDependency = createEsaResource(secondSymbolicName, null, null, Collections.singleton(fourthSymbolicName), null); + EsaResourceImpl secondDependency = createEsaResource(thirdSymbolicName, null, null, Collections.singleton(fourthSymbolicName), null); + EsaResourceImpl finalDependency = createEsaResource(fourthSymbolicName, null, null, Collections.singleton(firstSymbolicName), null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be four resolved resource", 4, resolvedResources.iterator().next().size()); + assertEquals("The final dependency in massive should be installed first", finalDependency, resolvedResources.iterator().next().get(0)); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(3)); + + // The order of the middle two doesn't matter as long as they are in the middle somewhere + assertTrue("The first dependency should be in the resolved list", resolvedResources.iterator().next().contains(firstDependency)); + assertTrue("The second dependency should be in the resolved list", resolvedResources.iterator().next().contains(secondDependency)); + } + + /** + * Test that if you have a resource with two dependencies, one of which causes a circle then it doesn't loop around the circle. + */ + @Test + public void testMultipleDependenciesWithOneCircle() throws RepositoryException, ResolutionException { + // Add four test resources in a chain to massive with the final resource having two routes to it + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(secondSymbolicName); + dependencies.add(thirdSymbolicName); + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, dependencies, null); + EsaResourceImpl firstDependency = createEsaResource(secondSymbolicName, null, null, Collections.singleton(firstSymbolicName), null); + EsaResourceImpl secondDependency = createEsaResource(thirdSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be four resolved resource", 3, resolvedResources.iterator().next().size()); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(2)); + + // The order of the middle two doesn't matter as long as they are in the middle somewhere + assertTrue("The first dependency should be in the resolved list", resolvedResources.iterator().next().contains(firstDependency)); + assertTrue("The second dependency should be in the resolved list", resolvedResources.iterator().next().contains(secondDependency)); + } + + /** + * Has a -> [b -> d -> f -> [a, g], c -> e -> f -> [a, g]]. b -> d -> e -> f -> [a, g]. + * + * Tests that we always put f's dependency on g at the start of the install list. + */ + @Test + public void testLongRoutesWithCircleAndTail() throws RepositoryException, ResolutionException { + // Add the test resources in a chain to massive with the f resource having two routes to it + String aSymbolicName = "com.ibm.ws.testA-1.0"; + String bSymbolicName = "com.ibm.ws.testB-1.0"; + String cSymbolicName = "com.ibm.ws.testC-1.0"; + String dSymbolicName = "com.ibm.ws.testD-1.0"; + String eSymbolicName = "com.ibm.ws.testE-1.0"; + String fSymbolicName = "com.ibm.ws.testF-1.0"; + String gSymbolicName = "com.ibm.ws.testG-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(bSymbolicName); + dependencies.add(cSymbolicName); + EsaResourceImpl aResource = createEsaResource(aSymbolicName, null, null, dependencies, null); + EsaResourceImpl bResource = createEsaResource(bSymbolicName, null, null, Collections.singleton(dSymbolicName), null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, null, null, Collections.singleton(eSymbolicName), null); + EsaResourceImpl dResource = createEsaResource(dSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + EsaResourceImpl eResource = createEsaResource(eSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + Collection fDependencies = new HashSet(); + fDependencies.add(aSymbolicName); + fDependencies.add(gSymbolicName); + EsaResourceImpl fResource = createEsaResource(fSymbolicName, null, null, fDependencies, null); + EsaResourceImpl gResource = createEsaResource(gSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(aSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be 7 resolved resources", 7, resolvedResources.iterator().next().size()); + List resourceList = resolvedResources.iterator().next(); + assertEquals("The tail dependency in massive should be installed first", gResource, resourceList.get(0)); + assertEquals("The resource being resolved should be installed last", fResource, resourceList.get(1)); + assertTrue("The resource in the chains should be there", resourceList.contains(bResource)); + assertTrue("The resource in the chains should be there", resourceList.contains(cResource)); + assertTrue("The resource in the chains should be there", resourceList.contains(dResource)); + assertTrue("The resource in the chains should be there", resourceList.contains(eResource)); + assertEquals("The resource being resolved should be installed last", aResource, resourceList.get(6)); + } + + /** + * Has a -> b -> c -> b + */ + @Test + public void testCircleNotToRoot() throws Exception { + // Setup resources + String aSymbolicName = "com.ibm.ws.testA-1.0"; + String bSymbolicName = "com.ibm.ws.testB-1.0"; + String cSymbolicName = "com.ibm.ws.testC-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(bSymbolicName); + dependencies.add(cSymbolicName); + EsaResourceImpl aResource = createEsaResource(aSymbolicName, null, null, Collections.singleton(bSymbolicName), null); + EsaResourceImpl bResource = createEsaResource(bSymbolicName, null, null, Collections.singleton(cSymbolicName), null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, null, null, Collections.singleton(bSymbolicName), null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(aSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be 3 resolved resources", 3, resolvedResources.iterator().next().size()); + List resourceList = resolvedResources.iterator().next(); + assertEquals(cResource, resourceList.get(0)); + assertEquals(bResource, resourceList.get(1)); + assertEquals(aResource, resourceList.get(2)); + } + + /** + * Run a test to make sure that a sample with an applies to set is resolved correctly + * + * @param name The name of the sample + * @param appliesTo The applies to to put onto the sample + * @param productVersion The product version to be + * @throws RepositoryResourceException + * @throws RepositoryBackendException + * @throws IOException + * @throws ProductInfoParseException + * @throws RepositoryException + * @throws RepositoryResolutionException + */ + private void runAppliesToSampleTest(String name, String appliesTo, + String productVersion) throws RepositoryResourceException, RepositoryBackendException, IOException, ProductInfoParseException, RepositoryException, RepositoryResolutionException { + SampleResourceImpl testResource = createSampleResource(name); + testResource.setAppliesTo(appliesTo); + uploadResource(testResource); + + runTestAgainstProductDefinitionWithSingleResult(name, productVersion, testResource); + } + + /** + * Run a test against a product definition with the supplied version and expect a single result back. + * + * @param name The name to resolve + * @param productVersion The product version to use + * @param testResource The resource to expect + * @throws IOException + * @throws ProductInfoParseException + * @throws RepositoryException + * @throws RepositoryResolutionException + */ + private void runTestAgainstProductDefinitionWithSingleResult(String name, String productVersion, + RepositoryResourceImpl testResource) throws IOException, ProductInfoParseException, RepositoryException, RepositoryResolutionException { + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.ws.test.product", "DEVELOPERS", productVersion, null, null); + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(name); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Create a {@link SampleResourceImpl} of type {@link ResourceType#PRODUCTSAMPLE} with the supplied short name + * + * @param shortName + * @return + * @throws RepositoryBackendException + * @throws RepositoryResourceException + */ + private SampleResourceImpl createAndUploadSampleResource(String shortName) throws RepositoryResourceException, RepositoryBackendException { + SampleResourceImpl testResource = createSampleResource(shortName); + uploadResource(testResource); + return testResource; + } + + /** + * @return + */ + private SampleResourceImpl createSampleResource(String shortName) { + SampleResourceImpl testResource = new SampleResourceImpl(getConnection()); + testResource.setType(ResourceType.PRODUCTSAMPLE); + testResource.setShortName(shortName); + testResource.setName(shortName + " Full Name"); + return testResource; + } + + /** + * Creates an {@link EsaResourceImpl} and uploads it to massive with just the core fields set. + * + * @param symbolicName The symbolic name of the resource + * @param shortName The short name of the resource + * @param version The version of the resource + * @return The resource + * @throws RepositoryResourceException + * @throws RepositoryBackendException + */ + private EsaResourceImpl createEsaResource(String symbolicName, String shortName, String version) throws RepositoryResourceException, RepositoryBackendException { + return createEsaResource(symbolicName, shortName, version, null, null); + } + + /** + * Creates an ESA resource with a set of required iFixes, only the symbolic name will be set from the core fields. + * + * @param symbolicName + * @param singleton + * @return + * @throws RepositoryResourceException + * @throws RepositoryBackendException + */ + private EsaResourceImpl createEsaResource(String symbolicName, Collection fixes) throws RepositoryResourceException, RepositoryBackendException { + return createEsaResource(symbolicName, null, null, null, null, null, false, fixes); + } + + /** + * Creates an {@link EsaResourceImpl} and uploads it to massive with all fields set but no fixes + * + * @param symbolicName The symbolic name of the resource + * @param shortName The short name of the resource + * @param version The version of the resource + * @param dependencySymoblicName The symbolic names of dependencies + * @param appliesTo The product this feature applies to + * @return The resource + * @throws RepositoryBackendException + */ + private EsaResourceImpl createEsaResource(String symbolicName, String shortName, String version, Collection dependencySymoblicNames, + String appliesTo) throws RepositoryResourceException, RepositoryBackendException { + return createEsaResource(symbolicName, shortName, version, dependencySymoblicNames, appliesTo, null, false, null); + } + + /** + * Creates an {@link EsaResourceImpl} and uploads it to massive with all fields set. + * + * @param symbolicName The symbolic name of the resource + * @param shortName The short name of the resource + * @param version The version of the resource + * @param appliesTo The product this feature applies to + * @param dependencySymoblicName The symbolic names of dependencies + * @param provisionSymbolicNames The symbolic name(s) of the capability required for this feature to be auto provision + * @param autoInstallable The autoInstallable value to use + * @param requiredFixes fixes required by this feature + * @return The resource + * @throws RepositoryBackendException + */ + private EsaResourceImpl createEsaResource(String symbolicName, String shortName, String version, Collection dependencySymoblicNames, String appliesTo, + Collection provisionSymbolicNames, boolean autoInstallable, + Collection requiredFixes) throws RepositoryResourceException, RepositoryBackendException { + EsaResourceImpl testResource = new EsaResourceImpl(getConnection()); + testResource.setProvideFeature(symbolicName); + testResource.setShortName(shortName); + testResource.setVersion(version); + testResource.setRequireFeature(dependencySymoblicNames); + testResource.setAppliesTo(appliesTo); + String name = "name"; + if (shortName != null) { + name = shortName; + } else if (symbolicName != null) { + name = symbolicName; + } + testResource.setName(name); + if (provisionSymbolicNames != null && !provisionSymbolicNames.isEmpty()) { + boolean first = true; + StringBuilder ibmProvisionCapability = new StringBuilder(); + for (String provisionSymbolicName : provisionSymbolicNames) { + if (!first) { + ibmProvisionCapability.append(","); + } + ibmProvisionCapability.append("osgi.identity; filter:=\"(&(type=osgi.subsystem.feature)(osgi.identity=" + provisionSymbolicName + "))\""); + first = false; + } + testResource.setProvisionCapability(ibmProvisionCapability.toString()); + } + testResource.setInstallPolicy(autoInstallable ? InstallPolicy.WHEN_SATISFIED : InstallPolicy.MANUAL); + if (requiredFixes != null) { + for (String fix : requiredFixes) { + testResource.addRequireFix(fix); + } + } + uploadResource(testResource); + return testResource; + } + + /** + * Creates and uploads a new IfixResource in Massive + * + * @param fixId + * @param appliesTo + * @param lastUpdateDate + * @return + * @throws RepositoryResourceException + * @throws RepositoryBackendException + */ + private IfixResourceImpl createIFixResource(String fixId, String appliesTo, Date lastUpdateDate) throws RepositoryResourceException, RepositoryBackendException { + IfixResourceImpl iFixResource = new IfixResourceImpl(getConnection()); + iFixResource.setProvideFix(Collections.singleton(fixId)); + iFixResource.setAppliesTo(appliesTo); + iFixResource.setDate(lastUpdateDate); + iFixResource.setName("ifix " + _count++); + iFixResource.setProviderName("IBM"); + uploadResource(iFixResource); + return iFixResource; + } + + private void uploadResource(RepositoryResourceImpl mr) + throws RepositoryResourceException, RepositoryBackendException { + mr.uploadToMassive(new BasicTestStrategy()); + } + + /** + * A really stupid strategy, that assumes all you want to do is add one asset + * to an empty repository, and not change it's state, or hide anything else + * or anything really. + */ + public static class BasicTestStrategy extends BaseStrategy { + @Override + public void uploadAsset(RepositoryResourceImpl resource, List matchingResources) throws RepositoryBackendException, RepositoryResourceException { + resource.addAsset(); + } + + } + +} diff --git a/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/ResolverTestUtils.java b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/ResolverTestUtils.java new file mode 100755 index 000000000000..03c7879086ad --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/ResolverTestUtils.java @@ -0,0 +1,89 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.resolver; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Properties; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.osgi.framework.Version; + +import com.ibm.ws.kernel.feature.provisioning.ProvisioningFeatureDefinition; +import com.ibm.ws.kernel.productinfo.ProductInfo; +import com.ibm.ws.kernel.productinfo.ProductInfoParseException; + +/** + * Utilities for testing the Massive Resolver + */ +public class ResolverTestUtils { + + /** + * Mocks a {@link ProvisioningFeatureDefinition}. + * + * @param mockery + * @param provideFeature + * @param version + * @param shortName + * @return + */ + public static ProvisioningFeatureDefinition mockSimpleFeatureDefinition(Mockery mockery, final String provideFeature, final Version version, final String shortName) { + final ProvisioningFeatureDefinition featureDefinition = mockery.mock(ProvisioningFeatureDefinition.class, provideFeature); + mockery.checking(new Expectations() { + { + allowing(featureDefinition).getSymbolicName(); + will(returnValue(provideFeature)); + allowing(featureDefinition).getIbmShortName(); + will(returnValue(shortName)); + allowing(featureDefinition).getVersion(); + will(returnValue(version)); + allowing(featureDefinition).getHeader(with(any(String.class))); + } + }); + return featureDefinition; + } + + /** + * @param id required + * @param edition required + * @param version required + * @param license optional + * @param installType optional + * @return + * @throws IOException + * @throws ProductInfoParseException + */ + public static ProductInfo createProductInfo(String id, String edition, String version, String license, String installType) throws IOException, ProductInfoParseException { + Properties properties = new Properties(); + properties.put(ProductInfo.COM_IBM_WEBSPHERE_PRODUCTID_KEY, id); + + // Every product info needs a name but we don't use it so just set to ID + properties.put(ProductInfo.COM_IBM_WEBSPHERE_PRODUCTNAME_KEY, id); + properties.put(ProductInfo.COM_IBM_WEBSPHERE_PRODUCTVERSION_KEY, version); + properties.put(ProductInfo.COM_IBM_WEBSPHERE_PRODUCTEDITION_KEY, edition); + if (license != null) { + properties.put("com.ibm.websphere.productLicenseType", license); + } + if (installType != null) { + properties.put("com.ibm.websphere.productInstallType", installType); + } + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + properties.store(outputStream, null); + ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); + ProductInfo productInfo1 = ProductInfo.parseProductInfo(new InputStreamReader(inputStream), null); + return productInfo1; + } + +} diff --git a/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/internal/RepositoryResolveContextFatTest.java b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/internal/RepositoryResolveContextFatTest.java new file mode 100755 index 000000000000..83582b068319 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/internal/RepositoryResolveContextFatTest.java @@ -0,0 +1,131 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.resolver.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assume.assumeTrue; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.osgi.resource.Capability; +import org.osgi.resource.Requirement; +import org.osgi.resource.Resource; + +import com.ibm.ws.repository.base.servers.DirectoryConnectionRule; +import com.ibm.ws.repository.base.servers.LarsConnectionRule; +import com.ibm.ws.repository.base.servers.MassiveConnectionRule; +import com.ibm.ws.repository.base.servers.RestRepositoryConnectionRule; +import com.ibm.ws.repository.common.enums.ResourceType; +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RepositoryConnectionList; +import com.ibm.ws.repository.exceptions.RepositoryBackendException; +import com.ibm.ws.repository.exceptions.RepositoryResourceException; +import com.ibm.ws.repository.resolver.FATSuite; +import com.ibm.ws.repository.resolver.RepositoryResolverTest; +import com.ibm.ws.repository.resolver.RepositoryResolverTest.BasicTestStrategy; +import com.ibm.ws.repository.resolver.internal.namespace.InstallableEntityIdentityConstants; +import com.ibm.ws.repository.resolver.internal.namespace.InstallableEntityIdentityConstants.NameAttributes; +import com.ibm.ws.repository.resolver.internal.resource.InstallableEntityRequirement; +import com.ibm.ws.repository.resources.internal.EsaResourceImpl; + +/** + * Tests for the {@link RepositoryResolveContext} class. + */ +public class RepositoryResolveContextFatTest { + + @Rule + public RestRepositoryConnectionRule connection; + + private RepositoryConnection getConnection() { + return connection.getConnection(); + } + + public static class RepositoryResolveContextFatTestMassive extends RepositoryResolveContextFatTest { + public RepositoryResolveContextFatTestMassive() { + connection = new MassiveConnectionRule(FATSuite.massiveResource); + } + } + + public static class RepositoryResolveContextFatTestLars extends RepositoryResolveContextFatTest { + public RepositoryResolveContextFatTestLars() { + if (FATSuite.larsResource != null) { + connection = new LarsConnectionRule(FATSuite.larsResource); + } + } + } + + public static class RepositoryResolveContextFatTestDirectory extends RepositoryResolveContextFatTest { + public RepositoryResolveContextFatTestDirectory() { + connection = new DirectoryConnectionRule(); + } + } + + /** + * Don't run tests if the connection is null. This will happen where + * (for example) it is a LARS connection running on a Java 6 VM. + */ + @Before + public void skipIfNullConnection() { + assumeTrue(connection != null); + } + + /** + * Tests that if no matching feature is found then it will be loaded from the repository + * + * @throws RepositoryBackendException + * @throws RepositoryResourceException + */ + @Test + public void testFeatureFromRepo() throws RepositoryResourceException, RepositoryBackendException { + Requirement requirement = new InstallableEntityRequirement("foo", InstallableEntityIdentityConstants.TYPE_FEATURE); + List empty = Collections.emptyList(); + EsaResourceImpl resourceToMatch = new EsaResourceImpl(getConnection()); + resourceToMatch.setProvideFeature("foo"); + resourceToMatch.uploadToMassive(new BasicTestStrategy()); + + List repoResources = new ArrayList(); + RepositoryResolveContext testObject = new RepositoryResolveContext(null, null, empty, empty, repoResources, new RepositoryConnectionList(getConnection())); + List foundCapabilities = testObject.findProviders(requirement); + assertEquals("There should be one match to the repo capability", 1, foundCapabilities.size()); + assertEquals("The repo resource should have been added to the list of repo resources", 1, repoResources.size()); + assertEquals("The match should be to the repo capability", repoResources.get(0).getCapabilities(null).get(0), foundCapabilities.get(0)); + } + + /** + * Tests that if no matching sample is found then it will be loaded from the repository + * + * @throws RepositoryBackendException + * @throws RepositoryResourceException + */ + @Test + public void testSampleFromRepo() throws RepositoryResourceException, RepositoryBackendException { + Requirement requirement = new InstallableEntityRequirement(NameAttributes.SHORT_NAME, "foo", null, InstallableEntityIdentityConstants.TYPE_SAMPLE); + List empty = Collections.emptyList(); + com.ibm.ws.repository.resources.internal.SampleResourceImpl resourceToMatch = new com.ibm.ws.repository.resources.internal.SampleResourceImpl(getConnection()); + resourceToMatch.setShortName("foo"); + resourceToMatch.setType(ResourceType.PRODUCTSAMPLE); + resourceToMatch.uploadToMassive(new RepositoryResolverTest.BasicTestStrategy()); + + List repoResources = new ArrayList(); + RepositoryResolveContext testObject = new RepositoryResolveContext(null, null, empty, empty, repoResources, new RepositoryConnectionList(getConnection())); + List foundCapabilities = testObject.findProviders(requirement); + assertEquals("There should be one match to the repo capability", 1, foundCapabilities.size()); + assertEquals("The repo resource should have been added to the list of repo resources", 1, repoResources.size()); + assertEquals("The match should be to the repo capability", repoResources.get(0).getCapabilities(null).get(0), foundCapabilities.get(0)); + } + +} diff --git a/dev/com.ibm.ws.repository.resolver_test/.classpath b/dev/com.ibm.ws.repository.resolver_test/.classpath index 1fa11811c595..bd880329225d 100755 --- a/dev/com.ibm.ws.repository.resolver_test/.classpath +++ b/dev/com.ibm.ws.repository.resolver_test/.classpath @@ -1,13 +1,7 @@ - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.repository.resolver_test/.classpath.gradle b/dev/com.ibm.ws.repository.resolver_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.resolver_test/.project b/dev/com.ibm.ws.repository.resolver_test/.project index 4b73e714991e..277db9768e56 100755 --- a/dev/com.ibm.ws.repository.resolver_test/.project +++ b/dev/com.ibm.ws.repository.resolver_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.repository.resolver_test/bnd.bnd b/dev/com.ibm.ws.repository.resolver_test/bnd.bnd new file mode 100755 index 000000000000..445e4e8464d5 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_test/bnd.bnd @@ -0,0 +1,24 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + org.eclipse.osgi;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.org.apache.aries.util.1.1.2;version=latest, \ + com.ibm.ws.product.utility;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.repository.resolver;version=latest diff --git a/dev/com.ibm.ws.repository.resolver_test/bnd.bnd.gradle b/dev/com.ibm.ws.repository.resolver_test/bnd.bnd.gradle new file mode 100755 index 000000000000..445e4e8464d5 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_test/bnd.bnd.gradle @@ -0,0 +1,24 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + org.eclipse.osgi;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.org.apache.aries.util.1.1.2;version=latest, \ + com.ibm.ws.product.utility;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.repository.resolver;version=latest diff --git a/dev/com.ibm.ws.repository.resolver_test/build.gradle b/dev/com.ibm.ws.repository.resolver_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.repository.test.utils/.classpath b/dev/com.ibm.ws.repository.test.utils/.classpath new file mode 100755 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.test.utils/.classpath.gradle b/dev/com.ibm.ws.repository.test.utils/.classpath.gradle new file mode 100644 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.test.utils/.gitignore b/dev/com.ibm.ws.repository.test.utils/.gitignore new file mode 100644 index 000000000000..98d5fd07357c --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.gitignore @@ -0,0 +1,3 @@ +testLogin.properties +/dist +/testLogin_basicAuth.properties diff --git a/dev/com.ibm.ws.repository.test.utils/.project b/dev/com.ibm.ws.repository.test.utils/.project new file mode 100755 index 000000000000..cee40e1dafa7 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.repository.test.utils + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..169aea7eabe7 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Wed Aug 17 16:19:12 BST 2011 +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..95719ae3709c --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert diff --git a/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..13e9e1f92c53 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,116 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.remove_trailing_whitespaces=true +cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.add_missing_nls_tags=false +org.eclipse.jdt.ui.staticondemandthreshold=99 +cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_blocks=false +sp_cleanup.make_private_fields_final=true +org.eclipse.jdt.ui.ignorelowercasenames=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.remove_private_constructors=true +sp_cleanup.never_use_parentheses_in_expressions=true +cleanup.remove_unnecessary_casts=true +sp_cleanup.organize_imports=true +sp_cleanup.never_use_blocks=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_fields=true +org.eclipse.jdt.ui.text.custom_code_templates= +cleanup.always_use_parentheses_in_expressions=false +cleanup.use_parentheses_in_expressions=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.always_use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.correct_indentation=true +cleanup.make_private_fields_final=false +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.correct_indentation=false +cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +org.eclipse.jdt.ui.ondemandthreshold=99 +sp_cleanup.sort_members_all=false +sp_cleanup.use_this_for_non_static_field_access=false +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +org.eclipse.jdt.ui.exception.name=e +sp_cleanup.format_source_code=true +org.eclipse.jdt.ui.javadoc=true +cleanup.format_source_code=false +cleanup.remove_unused_imports=true +cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_methods=true +cleanup.add_missing_annotations=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_private_methods=true +cleanup.always_use_this_for_non_static_method_access=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.sort_members=false +sp_cleanup.use_parentheses_in_expressions=false +cleanup.add_missing_override_annotations=true +org.eclipse.jdt.ui.gettersetter.use.is=false +cleanup.convert_to_enhanced_for_loop=false +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.overrideannotation=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.add_missing_annotations=true +cleanup.make_variable_declarations_final=false +cleanup.remove_unused_private_types=true +cleanup.use_blocks=true +cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.remove_unused_imports=true +cleanup.add_missing_deprecated_annotations=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.convert_to_enhanced_for_loop=false +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.sort_members=false +sp_cleanup.remove_unused_private_members=false +org.eclipse.jdt.ui.importorder=java;javax;org;com; +cleanup.remove_unused_private_members=false +sp_cleanup.format_source_code_changes_only=false +cleanup.never_use_blocks=false +cleanup.organize_imports=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_generated_serial_version_id=false +cleanup.make_parameters_final=true +org.eclipse.jdt.ui.keywordthis=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.always_use_blocks=true +cleanup.add_serial_version_id=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.always_use_blocks=true +cleanup.remove_unused_local_variables=false +cleanup.sort_members_all=false +sp_cleanup.remove_trailing_whitespaces=true +cleanup.format_source_code_changes_only=false +cleanup.add_generated_serial_version_id=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.remove_private_constructors=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_local_variable_final=false +cleanup.make_local_variable_final=false +sp_cleanup.add_serial_version_id=false +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.add_default_serial_version_id=false +cleanup.add_missing_methods=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.add_missing_methods=false diff --git a/dev/com.ibm.ws.repository.test.utils/IBMInternalRootCA.der b/dev/com.ibm.ws.repository.test.utils/IBMInternalRootCA.der new file mode 100755 index 000000000000..f89a8b2ccf6d Binary files /dev/null and b/dev/com.ibm.ws.repository.test.utils/IBMInternalRootCA.der differ diff --git a/dev/com.ibm.ws.repository.test.utils/bnd.bnd b/dev/com.ibm.ws.repository.test.utils/bnd.bnd new file mode 100644 index 000000000000..3d5aad1281ac --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/bnd.bnd @@ -0,0 +1,13 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/mongo-client/mongo-java-driver-2.14.2.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.json4j;version=latest, \ + com.ibm.websphere.javaee.jsonp.1.0;version=latest, \ + com.ibm.ws.org.codehaus.jackson.1.6.2;version=latest, \ + com.ibm.ws.repository;version=latest diff --git a/dev/com.ibm.ws.repository.test.utils/bnd.bnd.gradle b/dev/com.ibm.ws.repository.test.utils/bnd.bnd.gradle new file mode 100644 index 000000000000..3d5aad1281ac --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/bnd.bnd.gradle @@ -0,0 +1,13 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/mongo-client/mongo-java-driver-2.14.2.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.json4j;version=latest, \ + com.ibm.websphere.javaee.jsonp.1.0;version=latest, \ + com.ibm.ws.org.codehaus.jackson.1.6.2;version=latest, \ + com.ibm.ws.repository;version=latest diff --git a/dev/com.ibm.ws.repository.test.utils/build-noship.xml b/dev/com.ibm.ws.repository.test.utils/build-noship.xml new file mode 100755 index 000000000000..3aa19ba792c1 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/build-noship.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.test.utils/build.gradle b/dev/com.ibm.ws.repository.test.utils/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.repository.test.utils/delivery.sets b/dev/com.ibm.ws.repository.test.utils/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.repository.test.utils/lib/larsServer.jar b/dev/com.ibm.ws.repository.test.utils/lib/larsServer.jar new file mode 100755 index 000000000000..1a7c265a996d Binary files /dev/null and b/dev/com.ibm.ws.repository.test.utils/lib/larsServer.jar differ diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/AssetByIdMatcher.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/AssetByIdMatcher.java new file mode 100755 index 000000000000..d5f95c36ebcf --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/AssetByIdMatcher.java @@ -0,0 +1,58 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import org.hamcrest.Description; +import org.hamcrest.Factory; +import org.hamcrest.TypeSafeMatcher; + +import com.ibm.ws.repository.transport.model.Asset; + +/** + * Matches Assets against each other by comparing only the IDs. + *

+ * If you have added some assets and then retrieved them, you can check the list of retrieved assets is correct with + *

+ * assertThat(returnedAssets, containsInAnyOrder(byId(asset1), byId(asset2), ...))
+ * 
+ */ +public class AssetByIdMatcher extends TypeSafeMatcher { + + private final String expectedId; + + private AssetByIdMatcher(String expectedId) { + this.expectedId = expectedId; + } + + /** {@inheritDoc} */ + @Override + public void describeTo(Description description) { + description.appendText("asset id should be ").appendValue(expectedId); + } + + /** {@inheritDoc} */ + @Override + protected boolean matchesSafely(Asset asset) { + return asset.get_id().equals(expectedId); + } + + @Factory + public static AssetByIdMatcher hasId(String id) { + return new AssetByIdMatcher(id); + } + + @Factory + public static AssetByIdMatcher hasId(Asset asset) { + return new AssetByIdMatcher(asset.get_id()); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DeleteRepo.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DeleteRepo.java new file mode 100755 index 000000000000..9db6ef8e8ab5 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DeleteRepo.java @@ -0,0 +1,184 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package com.ibm.ws.repository.base; + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.charset.Charset; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.codehaus.jackson.JsonGenerator.Feature; +import org.codehaus.jackson.JsonParseException; +import org.codehaus.jackson.map.JsonMappingException; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; +import org.codehaus.jackson.map.type.TypeFactory; +import org.codehaus.jackson.type.JavaType; + +import com.ibm.ws.repository.connections.RestRepositoryConnection; + +/** + * Deletes all the entries in a repo. This is a standalone util that does not + * rely on the MassiveClient so that it will work even if the repo being deleted + * has backwards breaking changes, sadly this leads to some code duplication but + * this is a necessary evil to be able to delete "broken" repos. + */ +public class DeleteRepo { + + private static final String URL_BASE = "https://5.153.49.84/ma/v1"; + private static final String SOFTLAYER_USER_ID = "liberty"; + private static final String SOFTLAYER_USER_PASSWORD = "W3bSp#3reD!"; + private static final String USER_ID = "svt2@ibm.com"; + private static final String PASSWORD = "g0pher##"; + private static final String API_KEY = "18965347087"; + private final static ObjectMapper MAPPER = new ObjectMapper(); + static { + // Setup the mapper config, have one mapper for all + // Printing to sysout at the mo so don't want to close it + MAPPER.configure(Feature.AUTO_CLOSE_TARGET, false); + + // Use the date format dictated by Massive + MAPPER.getSerializationConfig().setSerializationInclusion( + Inclusion.NON_NULL); + SimpleDateFormat df = new SimpleDateFormat( + "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); + MAPPER.getDeserializationConfig().setDateFormat(df); + MAPPER.getSerializationConfig().setDateFormat(df); + + // Ignore unknown attributes, we just care about IDs + MAPPER.getDeserializationConfig() + .disable( + org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); + } + + public static void main(String[] args) throws JsonParseException, + JsonMappingException, IOException { + RestRepositoryConnection loginInfo = new RestRepositoryConnection(USER_ID, PASSWORD, API_KEY, + URL_BASE, SOFTLAYER_USER_ID, SOFTLAYER_USER_PASSWORD); + deleteRepo(loginInfo); + } + + public static void deleteRepo(RestRepositoryConnection loginInfoResource) throws IOException { + // Get all + HttpURLConnection getAllConnection = createHttpURLConnection(loginInfoResource.getRepositoryUrl() + "/assets", loginInfoResource); + getAllConnection.setRequestMethod("GET"); + List assets = readValues(getAllConnection.getInputStream(), IdHolder.class); + + // Get all doesn't return attachments so call get attachments on each to + // get them as there isn't a delete asset and attachment method on + // massive so need to delete attachments first + for (IdHolder asset : assets) { + HttpURLConnection getAttachmentsConnection = createHttpURLConnection(loginInfoResource.getRepositoryUrl() + + "/assets/" + asset.get_id() + + "/attachments", loginInfoResource); + getAttachmentsConnection.setRequestMethod("GET"); + List attachments = readValues(getAttachmentsConnection.getInputStream(), IdHolder.class); + Logger logger = Logger.getLogger(DeleteRepo.class.getName()); + for (IdHolder attachment : attachments) { + logger.log(Level.INFO, "Deleting attachment " + attachment.get_id()); + HttpURLConnection deleteAttachmentConnection = createHttpURLConnection(loginInfoResource.getRepositoryUrl() + "/assets/" + + asset.get_id() + "/attachments/" + + attachment.get_id(), loginInfoResource); + deleteAttachmentConnection.setRequestMethod("DELETE"); + if (HttpURLConnection.HTTP_OK != deleteAttachmentConnection.getResponseCode()) { + throw new RuntimeException("Unable to delete " + + attachment.get_id() + " from " + asset.get_id() + + ", got return code: " + + deleteAttachmentConnection.getResponseCode()); + } + } + + // Now delete asset + logger.log(Level.INFO, "Deleting " + asset.get_id()); + HttpURLConnection deleteAssetConnection = createHttpURLConnection(loginInfoResource.getRepositoryUrl() + "/assets/" + asset.get_id(), + loginInfoResource); + deleteAssetConnection.setRequestMethod("DELETE"); + int responseCode = deleteAssetConnection.getResponseCode(); + if (responseCode != HttpURLConnection.HTTP_OK && responseCode != HttpURLConnection.HTTP_NO_CONTENT) { + throw new RuntimeException("Unable to delete " + asset.get_id() + + ", got return code: " + + deleteAssetConnection.getResponseCode()); + } + } + } + + public static List readValues(InputStream inputStream, Class type) + throws JsonParseException, JsonMappingException, IOException { + JavaType jacksonType = TypeFactory.collectionType(List.class, type); + return MAPPER.readValue(inputStream, jacksonType); + } + + private static class IdHolder { + private String _id; + + public String get_id() { + return _id; + } + + public void set_id(String _id) { + this._id = _id; + } + + } + + private static HttpURLConnection createHttpURLConnection( + final String urlString, final RestRepositoryConnection loginInfoResource) throws IOException { + // Add the api key, might already have query parameters so check + final String connectingString = urlString.contains("?") ? "&" : "?"; + URL url; + try { + url = AccessController.doPrivileged(new PrivilegedExceptionAction() { + + @Override + public URL run() throws MalformedURLException { + return new URL(urlString + connectingString + "apiKey=" + loginInfoResource.getApiKey()); + } + }); + } catch (PrivilegedActionException e) { + throw (MalformedURLException) e.getCause(); + } + + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + String basicAuthUserPass = null; + + if (loginInfoResource.getSoftlayerUserId() != null) { + basicAuthUserPass = loginInfoResource.getSoftlayerUserId() + ":" + loginInfoResource.getSoftlayerPassword(); + } else if (loginInfoResource.getUserId() != null && loginInfoResource.getPassword() != null) { + basicAuthUserPass = loginInfoResource.getUserId() + ":" + loginInfoResource.getPassword(); + } + + if (basicAuthUserPass != null) { + String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(basicAuthUserPass.getBytes(Charset.forName("UTF-8"))); + connection.setRequestProperty("Authorization", basicAuth); + } + + if (loginInfoResource.getUserId() != null) { + connection.addRequestProperty("userId", loginInfoResource.getUserId()); + } + if (loginInfoResource.getPassword() != null) { + connection.addRequestProperty("password", loginInfoResource.getPassword()); + } + return connection; + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DirectoryRepositoryTestUtils.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DirectoryRepositoryTestUtils.java new file mode 100755 index 000000000000..cff05a2a1247 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DirectoryRepositoryTestUtils.java @@ -0,0 +1,104 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.Collection; + +import com.ibm.ws.repository.connections.DirectoryRepositoryConnection; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; + +/** + * + */ +public class DirectoryRepositoryTestUtils implements RepositoryTestUtils { + + private File _root; + + /** {@inheritDoc} */ + @Override + public void setUpClass() {} + + /** {@inheritDoc} */ + @Override + public void tearDownClass() {} + + private void deleteDir(File f) { + if (f.exists()) { + if (f.isDirectory()) { + for (File child : f.listFiles()) { + deleteDir(child); + } + if (!f.delete()) { + System.out.println("*** FAILED TO DELETE " + f.getAbsolutePath()); + } + } else { + if (!f.delete()) { + System.out.println("*** FAILED TO DELETE " + f.getAbsolutePath()); + } + } + } + System.out.println("Deleting " + f.getAbsolutePath()); + } + + /** + * {@inheritDoc} + * + * @return + */ + @Override + public DirectoryRepositoryConnection setUpTest(boolean wipeBeforeEachTest) throws Exception { + // A new sub directory is created for each test at the moment, so tests don't reuse the same directory + _root = File.createTempFile("repoTest", "test"); + _root.delete(); + _root.mkdir(); + System.out.println("testing using " + _root.getAbsolutePath()); + File testSubDir = new File(_root, "" + Math.random()); + testSubDir.mkdirs(); + return new DirectoryRepositoryConnection(testSubDir); + } + + /** {@inheritDoc} */ + @Override + public void tearDownTest(boolean wipeBeforeEachTest) throws Exception { + deleteDir(_root); + } + + /** {@inheritDoc} */ + @Override + public DirectoryRepositoryConnection createNewRepo() throws NoRepoAvailableException { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public Collection getAllResourcesWithDupes() throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, InstantiationException, IllegalArgumentException, InvocationTargetException { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public DirectoryRepositoryConnection getRepositoryConnection() { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public void refreshTextIndex(String lastAssetId) throws Exception { + // Do nothing, there's no text index to refresh for directory repo + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManager.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManager.java new file mode 100755 index 000000000000..a77b911ce5d1 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManager.java @@ -0,0 +1,140 @@ +package com.ibm.ws.repository.base; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.security.InvalidAlgorithmParameterException; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertPath; +import java.security.cert.CertPathValidator; +import java.security.cert.CertPathValidatorException; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.PKIXParameters; +import java.security.cert.TrustAnchor; +import java.security.cert.X509Certificate; +import java.util.Arrays; +import java.util.Collections; +import java.util.Set; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509TrustManager; + +/** + * An X509 trust manager which trusts the IBM Internal Root CA certificate. + *

+ * This class wraps another X509TrustManager which it delegates everything to, + * except that it additionally returns the IBM certificate from {@link #getAcceptedIssuers()}. + */ +public class IBMInternalTrustManager implements X509TrustManager { + + private final X509TrustManager realX509TM; + private X509Certificate ibmInternalRootCA = null; + private CertificateFactory certificateFactory; + private CertPathValidator validator; + + /** + * @param realX509TM the trust manager to delegate to + * @throws IBMInternalTrustManagerException if a problem occurs while creating the trust manager + */ + public IBMInternalTrustManager(X509TrustManager realX509TM) throws IBMInternalTrustManagerException { + this.realX509TM = realX509TM; + try { + certificateFactory = CertificateFactory.getInstance("X.509"); + FileInputStream stream = new FileInputStream(new File("lib/LibertyFATTestFiles/IBMInternalRootCA.der")); + ibmInternalRootCA = (X509Certificate) certificateFactory.generateCertificate(stream); + validator = CertPathValidator.getInstance("PKIX"); + } catch (CertificateException e) { + throw new IBMInternalTrustManagerException("Failed to create internal trust manager", e); + } catch (FileNotFoundException e) { + throw new IBMInternalTrustManagerException("Failed to load IBM Internal Root CA cert", e); + } catch (NoSuchAlgorithmException e) { + throw new IBMInternalTrustManagerException("Failed to create internal trust manager", e); + } + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + // Make a copy of the array of certificates and add the + // IBM Internal CA Cert to the end + X509Certificate[] certs = realX509TM.getAcceptedIssuers(); + X509Certificate[] newCerts = Arrays.copyOf(certs, certs.length + 1); + newCerts[newCerts.length - 1] = ibmInternalRootCA; + return newCerts; + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + // Set up a CertPath for validation with the IBM internal certificate as the only trust anchor + Set anchors = Collections.singleton(new TrustAnchor(ibmInternalRootCA, null)); + CertPath path = certificateFactory.generateCertPath(Arrays.asList(chain)); + try { + PKIXParameters params = new PKIXParameters(anchors); + params.setRevocationEnabled(false); + + validator.validate(path, params); + } catch (CertPathValidatorException e) { + // We couldn't validate the chain, let our parent have a go + // This is expected for any chains which don't end with the IBM internal root CA + realX509TM.checkServerTrusted(chain, authType); + } catch (InvalidAlgorithmParameterException e) { + throw new CertificateException(e); + } + + } + + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + realX509TM.checkClientTrusted(chain, authType); + } + + /** + * Create an SSLSocketFactory which uses an IBMInternalTrustManager. + * + * @return an SSLSocketFactory + * @throws IBMInternalTrustManagerException if the operation fails + */ + public static SSLSocketFactory getSSLSocketFactry() throws IBMInternalTrustManagerException { + + try { + // Initialize the trust manager factory + TrustManagerFactory tmFactory = TrustManagerFactory.getInstance("PKIX"); + tmFactory.init((KeyStore) null); + + // Find a real X509TrustManager that we can extend + TrustManager[] realTMs = tmFactory.getTrustManagers(); + X509TrustManager x509TM = null; + for (TrustManager tm : realTMs) { + if (tm instanceof X509TrustManager) { + x509TM = (X509TrustManager) tm; + break; + } + } + + // Create our new trust manager which trusts the IBM Root CA Cert + if (x509TM == null) { + throw new IBMInternalTrustManagerException("Couldn't find an existing Trust Manager to extend"); + } + + TrustManager internalTM = new IBMInternalTrustManager(x509TM); + + SSLContext sc = SSLContext.getInstance("TLS"); + sc.init(null, new TrustManager[] { internalTM }, null); + return sc.getSocketFactory(); + } catch (NoSuchAlgorithmException e) { + throw new IBMInternalTrustManagerException("Failed to create internal SSLSocketFactory", e); + } catch (KeyManagementException e) { + throw new IBMInternalTrustManagerException("Failed to create internal SSLSocketFactory", e); + } catch (KeyStoreException e) { + throw new IBMInternalTrustManagerException("Failed to create internal SSLSocketFactory", e); + } + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManagerException.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManagerException.java new file mode 100755 index 000000000000..cc9af599f150 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManagerException.java @@ -0,0 +1,12 @@ +package com.ibm.ws.repository.base; + +public class IBMInternalTrustManagerException extends Exception { + + public IBMInternalTrustManagerException(String message) { + super(message); + } + + public IBMInternalTrustManagerException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/JsonAnyOrderMatcher.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/JsonAnyOrderMatcher.java new file mode 100644 index 000000000000..e8335ada2f36 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/JsonAnyOrderMatcher.java @@ -0,0 +1,87 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* Copyright IBM Corp. 2017 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.repository.base; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import javax.json.JsonArray; +import javax.json.JsonObject; +import javax.json.JsonValue; + +import org.hamcrest.Description; +import org.hamcrest.Factory; +import org.hamcrest.TypeSafeMatcher; + +/** + * Matches JsonValues, ignoring any ordering of items in arrays or fields in objects. + */ +public class JsonAnyOrderMatcher extends TypeSafeMatcher { + + private final Object matchingObject; + + public JsonAnyOrderMatcher(JsonValue value) { + matchingObject = makeOrderInsensitive(value); + } + + /** {@inheritDoc} */ + @Override + public void describeTo(Description description) { + description.appendText("Json equivelent (ignoring order of array elements and fields) to ").appendValue(matchingObject); + + } + + /** {@inheritDoc} */ + @Override + protected boolean matchesSafely(JsonValue value) { + return matchingObject.equals(makeOrderInsensitive(value)); + } + + private static Object makeOrderInsensitive(JsonValue value) { + switch (value.getValueType()) { + case ARRAY: + return makeArrayOrderInsensitive((JsonArray) value); + case OBJECT: + return makeObjectOrderInsensitive((JsonObject) value); + default: + return value; + } + } + + private static Set makeArrayOrderInsensitive(JsonArray jsonArray) { + Set result = new HashSet(); + for (JsonValue value : jsonArray) { + result.add(makeOrderInsensitive(value)); + } + return result; + } + + private static Map makeObjectOrderInsensitive(JsonObject jsonObject) { + Map result = new HashMap(); + for (Entry entry : jsonObject.entrySet()) { + result.put(entry.getKey(), makeOrderInsensitive(entry.getValue())); + } + return result; + } + + /** + * Creates a matcher for JsonValues that matches if the examined JsonValue is equal to the specified JsonValue, ignoring the order of fields and array elements. + */ + @Factory + public static JsonAnyOrderMatcher matchesJsonInAnyOrder(JsonValue value) { + return new JsonAnyOrderMatcher(value); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/LoginInfoProvider.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/LoginInfoProvider.java new file mode 100755 index 000000000000..2656ccf9df7c --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/LoginInfoProvider.java @@ -0,0 +1,478 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package com.ibm.ws.repository.base; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.nio.charset.Charset; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Properties; +import java.util.Random; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.net.ssl.HttpsURLConnection; + +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.transport.client.DataModelSerializer; +import com.ibm.ws.repository.transport.client.JSONAssetConverter; +import com.ibm.ws.repository.transport.client.RestClient; +import com.ibm.ws.repository.transport.exceptions.BadVersionException; + +/** + * Creates a loginInfo object for the credentials listed in /com.ibm.ws.repository.test.utils/src/testLogin.properties. + *

+ * If testLogin.properties contains more than one set of server details, this class will try each of them in a random order until it finds one that is contactable. + */ +public class LoginInfoProvider { + + private String userId = null; + private String password = null; + private String softlayerUserId = null; + private String softlayerPassword = null; + + private List servers = null; + + private static final Logger logger = Logger.getLogger(LoginInfoProvider.class.getName()); + + private static class ServerInfo { + String url; + String apiKey; + } + + private RestRepositoryConnection cachedLoginInfo; + + private static final String TESTRUN_USER_ID = "repoBuilds@ibm.com"; + private static final String TESTRUN_PASSWORD = "T35tiN6!"; + + private static final String MARKETPLACE_PREFIX = "RepoTest_"; + + /** + * Match property keys which hold server urls and capture the name in group 1. + *

+ * E.g. "foo.url" matches and captures "foo" + */ + private static final Pattern URL_PROPERTY_KEY = Pattern.compile("(\\w+)\\.url"); + + /** + * Create a new LoginInfoProvider, loading the repository details and credentials from the given property file. + * + * @param propertiesFile the file containing the repository details + * @throws FileNotFoundException if the file does not exist + * @throws IOException if a problem is encountered reading the properties file + */ + public LoginInfoProvider(File propertiesFile) throws FileNotFoundException, IOException { + Properties props = new Properties(); + props.load(new FileInputStream(propertiesFile)); + loadProperties(props); + } + + public LoginInfoProvider(Properties props) { + loadProperties(props); + } + + /** + * Get a LoginInfo object for a valid server. This is only suitable for tests using a + * single LoginInfoResource in the LoginInfo (which covers all of the tests which + * are not multi repository specific) + *

+ * This method will take the following steps to find a valid server: + *

    + *
  • If a LoginInfo object has previously been created, it will check if it is still valid and, if so, return it.
  • + *
  • If not, it will attempt to contact each server in turn
  • + *
  • If apiKeys were provided in the properties file, it will attempt to access the marketplace associated with the apiKey
  • + *
  • If apiKeys were not provided in the properties file, it will attempt to create a test marketplace and apiKey and use that
  • + *
+ * + * @return a valid LoginInfo object + * @throws NoRepoAvailableException if no repository can be reached and so a valid LoginInfo object cannot be created + */ + public RestRepositoryConnection getLoginInfo() throws NoRepoAvailableException { + + if (cachedLoginInfo != null) { + try { + assertLoginInfoValid(cachedLoginInfo); + logger.log(Level.INFO, "Reusing cached loginInfo - " + cachedLoginInfo.getRepositoryUrl() + " - " + cachedLoginInfo.getApiKey()); + return cachedLoginInfo; + } catch (IOException e) { + // The cached login info is not valid. + // In this case continue on to create a new login info + } + } + + cachedLoginInfo = createLoginInfoResource(); + logger.log(Level.INFO, "Created new loginInfo - " + cachedLoginInfo.getRepositoryUrl() + " - " + cachedLoginInfo.getApiKey()); + return cachedLoginInfo; + } + + /** + * Used only by multi repository tests + * + * @return + * @throws NoRepoAvailableException + */ + public RestRepositoryConnection createNewRepoFromProperties() throws NoRepoAvailableException { + return createLoginInfoResource(); + } + + /** + * Load server details from the given properties object and clear the cached loginInfo. + *

+ * This method is only meant for testing. + * + * @param props the properties object + */ + private void loadProperties(Properties props) { + logger.log(Level.INFO, "loadProperties entry"); + // Load basic properties, set to null if blank + userId = normalizeProperty(props.getProperty("userId")); + password = normalizeProperty(props.getProperty("password")); + softlayerUserId = normalizeProperty(props.getProperty("softlayerUserId")); + softlayerPassword = normalizeProperty(props.getProperty("softlayerPassword")); + + servers = new ArrayList(); + boolean apiKeysPresent = false; + // Pull out pairs of properties which identify a repository (URL/apiKey pair) + // foo.url = "http://example.com" + // foo.apiKey = "123456" + for (String key : props.stringPropertyNames()) { + Matcher m = URL_PROPERTY_KEY.matcher(key); + if (m.matches()) { + String name = m.group(1); + ServerInfo server = new ServerInfo(); + server.url = props.getProperty(name + ".url"); + server.apiKey = props.getProperty(name + ".apiKey"); + if (server.apiKey != null) { + apiKeysPresent = true; + } + servers.add(server); + } + } + + if (servers.isEmpty()) { + logger.log(Level.INFO, "loadProperties exit"); + throw new IllegalArgumentException("No server details were provided"); + } + + // Check that if any apiKeys are provided, then all apiKeys have been provided + if (apiKeysPresent) { + for (ServerInfo server : servers) { + if (server.apiKey == null) { + logger.log(Level.INFO, "loadProperties exit"); + throw new IllegalArgumentException("LoginInfo contains apiKeys for some servers, but not for " + server.url); + } + } + } + + // Check whether we're using a user-defined API key or generating API keys + if (apiKeysPresent) { + if (userId == null || password == null) { + logger.log(Level.INFO, "loadProperties exit"); + throw new IllegalArgumentException("LoginInfo userId and password must be provided if a fixed apiKey is used"); + } + } else { + if (userId != null || password != null) { + logger.log(Level.INFO, "loadProperties exit"); + throw new IllegalArgumentException("LoginInfo userId, password and apiKey must all be empty to create a testrun apiKey"); + } + // Set the userId and password to the test credentials + userId = TESTRUN_USER_ID; + password = TESTRUN_PASSWORD; + } + + // Randomly choose the order we will contact servers + Collections.shuffle(servers); + logger.log(Level.INFO, "loadProperties exit"); + } + + /** + * Normalises property values by converting blank or whitespace values to null + * + * @param value the value to normalise + * @return null if value is blank or only contains whitespace, otherwise value + */ + private String normalizeProperty(String value) { + if (value != null) { + value = value.trim(); + if (value.isEmpty()) { + value = null; + } + } + return value; + } + + /** + * Checks that the repository referred to by loginInfo is valid and reachable. + *

+ * This method will throw an IOException containing the problem details if the server is not reachable. + * + * @param loginInfo the repository details and credentials + * @throws IOException if the repository cannot be contacted. + */ + private void assertLoginInfoValid(RestRepositoryConnection loginInfoResource) throws IOException { + logger.log(Level.INFO, "assertLoginInfoValid entry"); + HttpURLConnection connection = createConnectionFromLoginInfo("/assets", loginInfoResource); + connection.setRequestMethod("HEAD"); + connection.connect(); + if (connection.getResponseCode() != HttpURLConnection.HTTP_OK + && connection.getResponseCode() != HttpURLConnection.HTTP_NO_CONTENT) { + throw new IOException("Bad response code: " + connection.getResponseCode()); + } + logger.log(Level.INFO, "assertLoginInfoValid exit"); + } + + /** + * Find a working server and create a new LoginInfo object for it. + * + * @return a LoginInfo object for a working server + * @throws NoRepoAvailableException if we could not reach any server + */ + private RestRepositoryConnection createLoginInfoResource() throws NoRepoAvailableException { + logger.log(Level.INFO, "createLoginInfoResource entry"); + NoRepoAvailableException noRepoException = new NoRepoAvailableException(); + + // Failover between servers + for (ServerInfo server : servers) { + try { + // If the user has provided an API key, use it with the given server + if (server.apiKey != null) { + RestRepositoryConnection loginInfoResource = new RestRepositoryConnection(userId, password, server.apiKey, server.url, softlayerUserId, softlayerPassword); + assertLoginInfoValid(loginInfoResource); // Exception thrown if server is down + logger.log(Level.INFO, "createLoginInfoResource exit"); + return loginInfoResource; + } + // Otherwise, we need to try to create an API key + else { + String testApiKey = createApiKey(server.url); + RestRepositoryConnection loginInfoResource = new RestRepositoryConnection(userId, password, testApiKey, server.url, softlayerUserId, softlayerPassword); + logger.log(Level.INFO, "createLoginInfoResource exit"); + return loginInfoResource; + } + } catch (Exception ex) { + // Problem accessing server, collect the error to report if all servers fail + noRepoException.add(server.url, server.apiKey, ex); + // continue round the loop and try the next server + } + } + + // We've hit a problem contacting every server + // Throw the exception holding the problem details for each server + logger.log(Level.INFO, "createLoginInfoResource exit"); + throw noRepoException; + } + + /** + * Create a new marketplace and return the apiKey + * + * @param repositoryUrl the repository base API key + * @return the new apiKey + * @throws IOException if there is a problem communicating with the sever + * @throws BadVersionException + */ + private String createApiKey(String repositoryUrl) throws IOException, BadVersionException { + logger.log(Level.INFO, "createApiKey entry"); + String marketplaceID = createMarketplace(repositoryUrl); + + HttpURLConnection connection = createConnectionFromUrl(repositoryUrl, "/marketplaces/" + marketplaceID + "/apiKeys"); + connection.setRequestMethod("GET"); + connection.setDoOutput(false); + + List mak = DataModelSerializer.deserializeList(connection.getInputStream(), MarketplaceApiKey.class); + + String apiKey = mak.get(0).getKey(); + + logger.log(Level.INFO, "createApiKey exit"); + return apiKey; + } + + /** + * Create a marketplace on the server at the given URL. + * + * @param repositoryUrl the base URL of the server + * @return the id of the new marketplace + * @throws IOException if there's a problem contacting the server + * @throws BadVersionException + */ + private String createMarketplace(String repositoryUrl) throws IOException, BadVersionException { + + HttpURLConnection connection = createConnectionFromUrl(repositoryUrl, "/marketplaces"); + connection.setRequestMethod("POST"); + connection.setDoOutput(true); + + Marketplace marketplace = new Marketplace(); + marketplace.setName(createMarketPlaceName()); + marketplace.setDescription("Reposistory Testsuite test marketplace"); + + JSONAssetConverter.writeValue(connection.getOutputStream(), marketplace); + + Marketplace newMarketplace = DataModelSerializer.deserializeObject(connection.getInputStream(), Marketplace.class); + + return newMarketplace.get_id(); + } + + /** + * Create a (hopefully) unique name for the marketplace with a known prefix + * suffixed with the date and time down to current millisecond plus a random number + *

+ * Eg: RepoTest_YYDDD.hhmmssmmmrand + */ + private String createMarketPlaceName() { + DateFormat dateFormat = new SimpleDateFormat("yyyyDDD.HHmmssSSS"); + return MARKETPLACE_PREFIX + dateFormat.format(new Date()) + new Random().nextInt(1000); + } + + /** + * Create a HttpURLConnection using the credentials, repository and apiKey provided in the loginInfo object. + * + * @param urlString the path to request within the repository + * @param loginInfo the LoginInfo object holding the credentials + * @return the connection object + * @throws IOException if we are unable to open the connection + */ + private HttpURLConnection createConnectionFromLoginInfo(String path, RestRepositoryConnection loginInfoResource) throws IOException { + String connectingString = path.contains("?") ? "&" : "?"; + final String urlString = loginInfoResource.getRepositoryUrl() + path + connectingString + "apiKey=" + loginInfoResource.getApiKey(); + + URL url; + try { + url = AccessController.doPrivileged(new PrivilegedExceptionAction() { + + @Override + public URL run() throws MalformedURLException { + return new URL(urlString); + } + }); + } catch (PrivilegedActionException e) { + throw (MalformedURLException) e.getCause(); + } + + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + if (loginInfoResource.getSoftlayerUserId() != null) { + String userpass = loginInfoResource.getSoftlayerUserId() + ":" + loginInfoResource.getSoftlayerPassword(); + String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes(Charset.forName("UTF-8"))); + connection.setRequestProperty("Authorization", basicAuth); + } + + if (loginInfoResource.getUserId() != null) { + connection.addRequestProperty("userId", loginInfoResource.getUserId()); + } + if (loginInfoResource.getPassword() != null) { + connection.addRequestProperty("password", loginInfoResource.getPassword()); + } + return connection; + } + + /** + * Create a HttpURLConnection to the repository given by the repositoryUrl, using the authentication credentials provided in the properties file, or the test credentials if + * none were provided. + *

+ * This method will not add the apiKey to the urlString. + * + * @param repositoryUrl the base repository URL for the repository to connect to + * @param urlString path to request within the repository + * @return the connection object + * @throws IOException if we are unable to open the connection + */ + private HttpURLConnection createConnectionFromUrl(final String repositoryUrl, final String urlString) throws IOException { + URL url; + try { + url = AccessController.doPrivileged(new PrivilegedExceptionAction() { + + @Override + public URL run() throws MalformedURLException { + return new URL(repositoryUrl + urlString); + } + }); + } catch (PrivilegedActionException e) { + throw (MalformedURLException) e.getCause(); + } + + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + if (softlayerUserId != null) { + String userpass = softlayerUserId + ":" + softlayerPassword; + String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes(Charset.forName("UTF-8"))); + connection.setRequestProperty("Authorization", basicAuth); + } + + connection.addRequestProperty("userId", userId); + connection.addRequestProperty("password", password); + + return connection; + } + + /** + * This method returns the url for a file that is being hosted on one of the test servers. + * If SSLSocketFactory is required this should be set up before calling this method. + * + * @param file - file on test server which a url is required for + * @return The url for the file + * @throws Exception + */ + public static String getTestServerFileUrl(String file) throws Exception { + String fileUrl = null; + // Find an available test server hosting the test file + for (String hostname : LoginInfoProvider.getTestServerHostnames()) { + try { + String testFileUrl = "https://" + hostname + "/" + file; + HttpsURLConnection conn = (HttpsURLConnection) new URL(testFileUrl).openConnection(); + conn.setConnectTimeout(10000); + if (conn.getResponseCode() == 200) { + fileUrl = testFileUrl; + break; + } + } catch (IOException e) { + // IO exception trying to contact this test server, try the next one + } + } + + if (fileUrl == null) { + throw new FileNotFoundException("Could not find an available test server serving the test file"); + } + return fileUrl; + } + + public static List getTestServerHostnames() throws Exception { + List hostnames = new ArrayList(); + + Properties props = new Properties(); + props.load(RestClient.class.getResourceAsStream("/testLogin.properties")); + + for (String key : props.stringPropertyNames()) { + if (key.endsWith(".url")) { + URI uri = URI.create(props.getProperty(key)); + hostnames.add(uri.getHost()); + } + } + + return hostnames; + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/Marketplace.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/Marketplace.java new file mode 100755 index 000000000000..699c2f69c647 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/Marketplace.java @@ -0,0 +1,43 @@ +package com.ibm.ws.repository.base; + +import com.ibm.ws.repository.transport.model.AbstractJSON; + +public class Marketplace extends AbstractJSON { + + private String name; + private String description; + private String client_id; + private String _id; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getClient_id() { + return client_id; + } + + public void setClient_id(String client_id) { + this.client_id = client_id; + } + + public String get_id() { + return _id; + } + + public void set_id(String id) { + this._id = id; + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/MarketplaceApiKey.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/MarketplaceApiKey.java new file mode 100755 index 000000000000..02e3ddb58497 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/MarketplaceApiKey.java @@ -0,0 +1,25 @@ +package com.ibm.ws.repository.base; + +import com.ibm.ws.repository.transport.model.AbstractJSON; + +public class MarketplaceApiKey extends AbstractJSON { + + private String marketplaceId; + private String key; + + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/NoRepoAvailableException.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/NoRepoAvailableException.java new file mode 100755 index 000000000000..384c3f1aa4dd --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/NoRepoAvailableException.java @@ -0,0 +1,93 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import java.util.ArrayList; +import java.util.List; + +/** + * Used to indicate that we could not contact any servers. + */ +@SuppressWarnings("serial") +public class NoRepoAvailableException extends Exception { + + private class ServerProblem { + private String url; + private String apiKey; + private Exception exception; + } + + private List problems; + + public void add(String url, String apiKey, Exception cause) { + ServerProblem p = new ServerProblem(); + p.url = url; + p.apiKey = apiKey; + p.exception = cause; + + if (problems == null) { + problems = new ArrayList(); + } + problems.add(p); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Throwable#getCause() + */ + @Override + public Throwable getCause() { + if (problems != null) { + for (ServerProblem problem : problems) { + if (problem.exception != null) { + return problem.exception; + } + } + } + + return super.getCause(); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Throwable#getMessage() + */ + @Override + public String getMessage() { + StringBuilder b = new StringBuilder(); + b.append("Could not find an available server:\n"); + + if (problems == null) { + // No problems were added -> no servers were tried + b.append("There were no servers given to try\n"); + } else { + // Add the list of failed servers to the message + for (ServerProblem problem : problems) { + b.append(problem.url); + // Add the apiKey if one was provided + if (problem.apiKey != null) { + b.append(" - "); + b.append(problem.apiKey); + } + + if (problem.exception != null) { + b.append(": "); + b.append(problem.exception.toString()); + } + b.append("\n"); + } + } + return b.toString(); + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestBase.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestBase.java new file mode 100755 index 000000000000..1b70b9b65b0a --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestBase.java @@ -0,0 +1,299 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package com.ibm.ws.repository.base; + +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.junit.Before; + +import com.ibm.ws.repository.common.enums.ResourceType; +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.exceptions.RepositoryBackendException; +import com.ibm.ws.repository.exceptions.RepositoryException; +import com.ibm.ws.repository.exceptions.RepositoryResourceDeletionException; +import com.ibm.ws.repository.exceptions.RepositoryResourceException; +import com.ibm.ws.repository.resources.RepositoryResource; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; +import com.ibm.ws.repository.resources.internal.SampleResourceImpl; +import com.ibm.ws.repository.resources.writeable.RepositoryResourceWritable; +import com.ibm.ws.repository.strategies.writeable.UpdateInPlaceStrategy; +import com.ibm.ws.repository.transport.model.Asset; + +public abstract class RepositoryTestBase extends TestBaseClass { + + protected final static File _jarDir = new File("lib/LibertyFATTestFiles/JARs"); + protected final static File _licenseDir = new File("lib/LibertyFATTestFiles/licenses"); + protected final static File _archiveDir = new File("lib/LibertyFATTestFiles/archives"); + protected final static File _readmeDir = new File("lib/LibertyFATTestFiles/Readmes"); + + protected static final String PROVIDER_NAME = "Test Provider"; + + protected RestRepositoryConnection _restConnection; + + private static final Logger logger = Logger.getLogger(RepositoryTestBase.class.getName()); + + // Have to have this since base class throws exception + public RepositoryTestBase() { + super(); + } + + protected Collection _newTestAssetIds = new HashSet(); + + protected T _testObject; + + /** + * Create the object we are going to test, this object being one of the + * utility classes that extend AbstractResource + * + * @param userId + * Massive userid + * @param password + * Massive password + * @param apiKey + * Massive apikey + * @return + * @throws IOException + */ + protected abstract T createTestObject(RestRepositoryConnection loginInfo) throws IOException; + + /** + * Looks for features with symbolic names starting with com.ibm.ws.test and + * stores them in {@link #existingTestAssetIds}. It also creates the test + * object + * + * @throws IOException + */ + @Before + public void setup() throws IOException { + // TestCertTrust.trustAll(); + // TestCertTrust.disableSNIExtension(); + + _newTestAssetIds = new HashSet(); + _restConnection = (RestRepositoryConnection) _repoConnection; + _testObject = createTestObject(_restConnection); + } + + public void recordResource(RepositoryResourceWritable res) { + logger.log(Level.INFO, "Test resource added:"); + logger.log(Level.INFO, res.toString()); + if (!_newTestAssetIds.contains(res.getId())) { + _newTestAssetIds.add(res.getId()); + } + } + + public void removeResource(RepositoryResourceWritable res) { + _newTestAssetIds.remove(res.getId()); + } + + /** + * Delete all assets created with the tests provider name. We do a quickn blat before each test, do we need this anymore? + * + * @throws IOException + * @throws RepositoryResourceDeletionException + */ + public void deleteCreatedFeatures() + throws RepositoryResourceDeletionException, RepositoryException { + for (String id : _newTestAssetIds) { + RepositoryResourceImpl res = (RepositoryResourceImpl) _restConnection.getResource(id); + logger.log(Level.INFO, "Test cleanup deleting resource: " + + res.getId()); + res.delete(); + } + } + + public void uploadResource(RepositoryResourceImpl mr) + throws RepositoryResourceException, RepositoryBackendException { + mr.uploadToMassive(new UpdateInPlaceStrategy()); + recordResource(mr); + } + + public void updateResource(RepositoryResourceImpl mr) + throws RepositoryResourceException, RepositoryBackendException { + mr.uploadToMassive(new UpdateInPlaceStrategy()); + } + + public static void checkCopyFields(RepositoryResourceImpl left, RepositoryResourceImpl right) + throws IllegalArgumentException, IllegalAccessException, + InstantiationException, IOException, NoSuchMethodException, + SecurityException, InvocationTargetException { + + ArrayList methodsToIgnore = new ArrayList(); + methodsToIgnore.add("setState"); + methodsToIgnore.add("setType"); + methodsToIgnore.add("setLoginInfoEntry"); + for (Method m : left.getClass().getMethods()) { + if (m.getName().startsWith("set")) { + Class[] parameterss = m.getParameterTypes(); + + // Not a normal setter, ignore it + if (parameterss.length != 1) { + continue; + } + + if (methodsToIgnore.contains(m.getName())) { + continue; + } + + Class param = parameterss[0]; + + Object p = null; + if (param.isEnum()) { + p = param.getEnumConstants()[0]; + } else if (param.equals(Collection.class)) { + logger.log(Level.INFO, "got a collection"); + p = new ArrayList(); + } else if (param.isInterface()) { + continue; + } else if (param.isPrimitive()) { + p = new Integer(4); + } else if (param.equals(String.class)) { + p = new String("test string"); + } else if (param.equals(RepositoryConnection.class)) { + p = new RestRepositoryConnection("a", "b", "c", "d"); + } else { + p = param.newInstance(); + } + + m.invoke(left, p); + } + } + + Method m = null; + + try { + m = left.getClass().getDeclaredMethod("copyFieldsFrom", + RepositoryResourceImpl.class, boolean.class); + } catch (Exception e) { + m = left.getClass().getSuperclass().getDeclaredMethod("copyFieldsFrom", + RepositoryResourceImpl.class, boolean.class); + } + m.setAccessible(true); + m.invoke(right, left, true); + if (!left.equivalentWithoutAttachments(right)) { + logger.log(Level.INFO, "EQUIV FAILED: Left"); + left.dump(System.out); + logger.log(Level.INFO, "EQUIV FAILED: Right"); + right.dump(System.out); + fail("Check fields failed: the resources are not equivalent"); + } + + if (!right.equivalentWithoutAttachments(left)) { + logger.log(Level.INFO, "EQUIV FAILED: Left"); + left.dump(System.out); + logger.log(Level.INFO, "EQUIV FAILED: Right"); + right.dump(System.out); + fail("Check fields failed: the resources are not equivalent"); + } + } + + /** + * If we need to use the Type enum's createResource method then we can't use a TestResource object (as + * the enum doesn't know about them), so use a sample resource instead + * + * @throws URISyntaxException + */ + protected SampleResourceImpl createSampleResource() throws URISyntaxException { + SampleResourceImpl sampleRes = new SampleResourceImpl(_restConnection); + populateResource(sampleRes); + sampleRes.setType(ResourceType.PRODUCTSAMPLE); + return sampleRes; + } + + protected void populateResource(RepositoryResourceImpl res) throws URISyntaxException { + res.setName(name.getMethodName()); + + res.setProviderName(PROVIDER_NAME); + res.setProviderUrl("http://testhost/testfile"); + + res.setVersion("version 1"); + res.setDescription("This is a test resource"); + } + + /** + * Get Asset from MassiveResource reflectively as there is no external API for this + * + * @param mr + * @return an asset or an exception + * @throws ClassNotFoundException + * @throws SecurityException + * @throws NoSuchMethodException + * @throws InvocationTargetException + * @throws IllegalArgumentException + * @throws IllegalAccessException + */ + public static Asset getAssetReflective(RepositoryResource mr) throws ClassNotFoundException, NoSuchMethodException, + SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + + // Get MassiveResource + Class c = RepositoryResourceImpl.class; + + // Get MassiveResource.getAsset() + Method method = c.getDeclaredMethod("getAsset"); + + // Invoke MassiveResource.getAsset() + method.setAccessible(true); + Asset asset = (Asset) method.invoke(mr); + + return asset; + } + + /** + * Invoke a method reflectively that does not use primitive arguments + * + * @param targetObject + * @param methodName + * @param varargs + * @return + * @throws ClassNotFoundException + * @throws NoSuchMethodException + * @throws SecurityException + * @throws IllegalAccessException + * @throws InstantiationException + * @throws IllegalArgumentException + * @throws InvocationTargetException + */ + public static Object reflectiveCallNoPrimitives(Object targetObject, String methodName, Object... varargs) + throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, InstantiationException, + IllegalArgumentException, InvocationTargetException { + + // Usage example of this method + // int i = (Integer)reflectiveCallAnyTypes(targetObject,"methodName",1) + + // create a class array from the vararg object array + @SuppressWarnings("rawtypes") + Class[] classes; + if (varargs != null) { + classes = new Class[varargs.length]; + for (int i = 0; i < varargs.length; i++) { + classes[i] = varargs[i].getClass(); + } + } else { + classes = new Class[0]; + } + + return reflectiveCallAnyTypes(targetObject, methodName, classes, varargs); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtils.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtils.java new file mode 100755 index 000000000000..882fd76ab99e --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtils.java @@ -0,0 +1,43 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import java.lang.reflect.InvocationTargetException; +import java.util.Collection; + +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; + +/** + * + */ +public interface RepositoryTestUtils { + public enum TestType { + MASSIVE_REPO, DIRECTORY_REPO, ZIP_REPO + }; + + public void setUpClass() throws Exception; + + public void tearDownClass() throws Exception; + + public T setUpTest(boolean wipeBeforeEachTest) throws Exception; + + public void tearDownTest(boolean wipeBeforeEachTest) throws Exception; + + public T createNewRepo() throws NoRepoAvailableException; + + public Collection getAllResourcesWithDupes() throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, InstantiationException, IllegalArgumentException, InvocationTargetException; + + public T getRepositoryConnection(); + + public void refreshTextIndex(String lastAssetId) throws Exception; +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtilsFactory.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtilsFactory.java new file mode 100755 index 000000000000..574a8a1f6321 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtilsFactory.java @@ -0,0 +1,66 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import com.ibm.ws.repository.base.RepositoryTestUtils.TestType; +import com.ibm.ws.repository.connections.RepositoryConnection; + +/** + * + */ +public class RepositoryTestUtilsFactory { + + private static Object lock = new Object(); + private static RepositoryTestUtilsFactory instance; + + /** + * Get the singleton instance of the factory + * + * @return + */ + public static RepositoryTestUtilsFactory getInstance() { + synchronized (lock) { + if (null == instance) { + instance = new RepositoryTestUtilsFactory(); + } + } + return instance; + } + + /** + * Private constructor, obtain an instance by the static {@link RepositoryClientFactory#getInstance} method + */ + private RepositoryTestUtilsFactory() {} + + /** + * @param login + * @return + */ + @SuppressWarnings("unchecked") + public > T createTestUtils(TestType type) { + T utils = null; + switch (type) { + case MASSIVE_REPO: + utils = (T) new RestRepositoryTestUtils(); + break; + case DIRECTORY_REPO: + utils = (T) new DirectoryRepositoryTestUtils(); + break; + case ZIP_REPO: + utils = (T) new ZipRepositoryTestUtils(); + break; + default: + throw new UnsupportedOperationException("A repository connection of " + type + " is not currently supported"); + } + return utils; + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestRepositoryTestUtils.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestRepositoryTestUtils.java new file mode 100755 index 000000000000..ff0a4ee16680 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestRepositoryTestUtils.java @@ -0,0 +1,372 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import java.io.ByteArrayOutputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ibm.json.java.JSONArray; +import com.ibm.json.java.JSONObject; +import com.ibm.ws.repository.connections.RepositoryConnectionList; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.resources.RepositoryResource; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; +import com.ibm.ws.repository.transport.client.RestClient; + +/** + * + */ +public class RestRepositoryTestUtils implements RepositoryTestUtils { + + protected static LoginInfoProvider _loginInfoProvider; + + protected final static String LIVE_KEY = "75621234192"; + + protected RestRepositoryConnection _loginInfoEntry; + + private static final Logger logger = Logger.getLogger(RestRepositoryTestUtils.class.getName()); + + protected RestRepositoryConnection getLoginInfoEntry() throws IOException, NoRepoAvailableException { + if (_loginInfoProvider == null) { + // Set up LoginInfoProvider only once to reuse the test repo wherever possible + Properties props = new Properties(); + props.load(this.getClass().getResourceAsStream("/testLogin.properties")); + _loginInfoProvider = new LoginInfoProvider(props); + } + return _loginInfoProvider.getLoginInfo(); + } + + /** + * {@inheritDoc} + * + * @throws IOException + * @throws FileNotFoundException + * @throws NoRepoAvailableException + */ + @Override + public void setUpClass() throws FileNotFoundException, IOException, NoRepoAvailableException { + logger.log(Level.INFO, "MassiveRepositoryTestUtils.setUpClass entry"); + _loginInfoEntry = getLoginInfoEntry(); + blowUpIfUsingLiveSystem(_loginInfoEntry); + logger.log(Level.INFO, "MassiveRepositoryTestUtils.setUpClass exit"); + } + + /** {@inheritDoc} */ + @Override + public void tearDownClass() {} + + /** {@inheritDoc} */ + @Override + public RestRepositoryConnection setUpTest(boolean wipeBeforeEachTest) throws Exception { + logger.log(Level.INFO, "setUpTest entry"); + // Must refresh loginInfoEntry before every test in case we need to failover to another test server + _loginInfoEntry = getLoginInfoEntry(); + if (wipeBeforeEachTest) { + logger.log(Level.INFO, "Deleting before test"); + DeleteRepo.deleteRepo(_loginInfoEntry); + } + logger.log(Level.INFO, "setUpTest exit"); + return _loginInfoEntry; + } + + /** {@inheritDoc} */ + @Override + public void tearDownTest(boolean wipeBeforeEachTest) throws Exception { + if (wipeBeforeEachTest) { + logger.log(Level.INFO, "Deleting after test"); + DeleteRepo.deleteRepo(_loginInfoEntry); + } + } + + /** + * {@inheritDoc} + * + * @throws NoRepoAvailableException + */ + @Override + public RestRepositoryConnection createNewRepo() throws NoRepoAvailableException { + return _loginInfoProvider.createNewRepoFromProperties(); + } + + @Override + @SuppressWarnings("unchecked") + public Collection getAllResourcesWithDupes() throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, InstantiationException, IllegalArgumentException, InvocationTargetException { + return (Collection) TestBaseClass.reflectiveCallAnyTypes(_loginInfoEntry, "getAllResourcesWithDupes", + null, null); + } + + @Override + public RestRepositoryConnection getRepositoryConnection() { + return _loginInfoEntry; + } + + /** {@inheritDoc} */ + @Override + public void refreshTextIndex(String lastAssetId) throws Exception { + refreshElasticSearchIndex(_loginInfoEntry, lastAssetId); + } + + /** + *

Refreshes the elastic search index by calling POST on:

+ * http://{host}:9200/assets/_refresh + *

Where {host} is the host of the _loginInfoEntry being used. See the elasticsearch doc here for why this works:

+ *

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current + * /indices-refresh.html

+ * + * @param loginInfoEntry The repo to refresh + * @param assetId The last asset added, refresh will repeat until this asset appears + * + * @throws MalformedURLException + * @throws IOException + * @throws ProtocolException + * @throws InterruptedException + */ + public static void refreshElasticSearchIndex(RestRepositoryConnection loginInfoEntry, String assetId) throws MalformedURLException, IOException, ProtocolException { + + boolean refreshed = false; + int retryCount = 0; + while (!refreshed && retryCount < 5) { + try { + retryCount++; + // Trigger indexing on elastic search... + URL urlToRepo = new URL(loginInfoEntry.getRepositoryUrl()); + URL refreshUrl = new URL("http", urlToRepo.getHost(), 9200, "/assets/_refresh"); + HttpURLConnection urlCon = (HttpURLConnection) refreshUrl.openConnection(); + urlCon.setRequestMethod("POST"); + urlCon.getResponseCode(); + + URL checkIfRefreshed = new URL("http", urlToRepo.getHost(), 9200, "/assets/asset/" + assetId); + logger.log(Level.INFO, "Checking refresh on " + checkIfRefreshed); + HttpURLConnection checkUrlCon = (HttpURLConnection) checkIfRefreshed.openConnection(); + checkUrlCon.setDoInput(true); + checkUrlCon.setRequestMethod("GET"); + int respCode = checkUrlCon.getResponseCode(); + + if (respCode == 200) { + InputStream inputStream = checkUrlCon.getInputStream(); + String inputStreamString = null; + if (inputStream != null) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + int read = -1; + while ((read = inputStream.read()) != -1) { + outputStream.write(read); + } + inputStreamString = outputStream.toString(RestClient.getCharset(checkUrlCon.getContentType())); + + if (inputStreamString.contains("\"found\":true")) { + refreshed = true; + logger.log(Level.INFO, "Requested item found in index"); + } else { + logger.log(Level.INFO, "Got " + inputStreamString); + // Give up after 5 fails + if (retryCount >= 5) { + logger.log(Level.INFO, "Giving up waiting for indexing to complete."); + refreshed = true; + } else { + logger.log(Level.INFO, "Requested item NOT found in index - retrying index refresh."); + } + try { + // TODO this should be enough ... if it DOES happen again we might add an inner loop + // to retry the checkIfRefreshed URL + Thread.sleep(1000); + } catch (InterruptedException ie) { + // Just swallow this + } + } + } + } else { + logger.log(Level.INFO, "Response code was not 200, it was " + respCode); + } + + // Now validate that the index that elastic search has created is usable by Massive + if (refreshed) { + refreshed = verifyElasticSearchIndexThroughMassive(loginInfoEntry, assetId); + } + + } catch (IOException ex) { + // I think an exception can be thrown if the refresh hasn't finished, wait 1 second and retry. Give up after 5 times + // Give up after 5 fails and let exception propogate up + if (retryCount >= 5) { + throw ex; + } + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + // Just swallow this + } + + } finally { + if (retryCount >= 5 && !refreshed) { + throw new IOException("Failed to refresh elastic "); + } + } + + } + } + + /** + * This is called once elastic search has recreated an index to confirm that the a provided asset can be found + * through a massive find. + * + * @param loginInfoEntry + * @param assetId + * @return true if the specified asset can be read through Massive + */ + public static boolean verifyElasticSearchIndexThroughMassive(RestRepositoryConnection connection, String assetId) { + boolean refreshed = true; + try { + // check that we can get the target asset through a massive find + RepositoryResource mr = connection.getResource(assetId); + String name = mr.getName(); + Collection results = new RepositoryConnectionList(stripLoginAuthentication(connection)).findResources(name, null, null, null); + + boolean found = false; + // Loop through the results from the find to ensure the asset we are keying on is in the returned list + for (RepositoryResource result : results) { + if (result.getId().equals(assetId)) { + found = true; + break; + } + } + if (found) { + logger.log(Level.INFO, "Massive find found the key asset after elastic search refreshed...continuing"); + } else { + logger.log(Level.INFO, "Massive find could not find the key asset that elastic search said was indexed ... forcing an elastic search re-index"); + refreshed = false; // invalidate the index + } + } catch (Exception e) { + logger.log(Level.INFO, "Exception thrown retrieving a resource through massive find: " + e); + refreshed = false; + e.printStackTrace(); + } + + return refreshed; + } + + /** + * Run a query to get the weighting of search results back from elastic search based on a pre-prepared query + * + * @throws IOException + */ + public static void queryElasticSearchWeighting(String encodedSearchString, RestRepositoryConnection loginInfoEntry, String marketplaceId) throws IOException { + + // make the following rest call + // http://:9200/assets/_search?q=+description:(keyword1 keyword3) +marketplaceId:(); + URL urlToRepo = new URL(loginInfoEntry.getRepositoryUrl()); + URL queryUrl = new URL("http", urlToRepo.getHost(), 9200, "/assets/_search?q=%28" + encodedSearchString + "%29%20+marketplaceId:%28" + marketplaceId + "%29"); + logger.log(Level.INFO, "about to poke: " + queryUrl.toString()); + + HttpURLConnection urlCon = (HttpURLConnection) queryUrl.openConnection(); + urlCon.setRequestMethod("GET"); + int respCode = urlCon.getResponseCode(); + logger.log(Level.INFO, "RC=" + respCode); + + String inputStreamString = null; + if (respCode == 200) { + logger.log(Level.INFO, String.format("%nFormatted asset weighting from elastic search")); + InputStream inputStream = urlCon.getInputStream(); + if (inputStream != null) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + int read = -1; + while ((read = inputStream.read()) != -1) { + outputStream.write(read); + } + inputStreamString = outputStream.toString(RestClient.getCharset(urlCon.getContentType())); + logger.log(Level.INFO, "queryElasticSearchWeighting returned: " + inputStreamString); + } + + summarizeElasticSearchWeighting(inputStreamString); + logger.log(Level.INFO, ""); + } else { + logger.log(Level.INFO, "queryElasticSearchWeighting returned: rc" + respCode); + } + } + + /** + * Parse the JSON doc produced by the query and summarise the results to the log and to a List that is returned. + * + * @param jsonString + * @return a list of the results produced + * @throws IOException + */ + private static List summarizeElasticSearchWeighting(String jsonString) throws IOException { + /* + * This parses the output from a JSON query. The structure of that doc is + * { + * ..hits: { < JSONObject + * ....hits: [ < JSONArray + * ......{ JSONObject #1 }, < JSONObject + * ......{ JSONObject #2 } < JSONObject + * ....] + * ..} + * } + */ + List output = new ArrayList(); + + JSONObject doc = JSONObject.parse(jsonString); + JSONObject hits = (JSONObject) doc.get("hits"); + JSONArray hitsArray = (JSONArray) hits.get("hits"); + @SuppressWarnings("unchecked") + Iterator it = hitsArray.iterator(); + while (it.hasNext()) { + JSONObject jObject = it.next(); + Double score = (Double) jObject.get("_score"); + + JSONObject jSource = (JSONObject) jObject.get("_source"); + String description = (String) jSource.get("description"); + String name = (String) jSource.get("name"); + + String line = "score=" + score + ",name=" + name + ", description=" + description; + logger.log(Level.INFO, line); + output.add(line); + } + + // output list not used at the time of writing but it is there if needed. + return output; + } + + /** + * The find tests have to run with authentication stripped off due to a bug in massive. + * This is a convenience method to remove the username/password for the LoginInfoEntry + */ + public static RestRepositoryConnection stripLoginAuthentication(RestRepositoryConnection authenticated) { + + RestRepositoryConnection unauthenticatedLogin = new RestRepositoryConnection(null, null, authenticated.getApiKey(), authenticated.getRepositoryUrl(), + authenticated.getSoftlayerUserId(), authenticated.getSoftlayerPassword(), + authenticated.getAttachmentBasicAuthUserId(), authenticated.getAttachmentBasicAuthPassword()); + + return unauthenticatedLogin; + } + + public static void blowUpIfUsingLiveSystem(RestRepositoryConnection loginInfoEntry) { + if (loginInfoEntry.getApiKey().equals(LIVE_KEY)) { + throw new RuntimeException( + "YOU ARE RUNNING AGAINGST THE LIVE SYSTEM, ABORTING. If you want to run againgst the live system please override TestBaseClass.blowUpIfUsingLiveSystem in your test"); + } + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestoreTrustStoreRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestoreTrustStoreRule.java new file mode 100644 index 000000000000..c217b7021cb3 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestoreTrustStoreRule.java @@ -0,0 +1,48 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* Copyright IBM Corp. 2017 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.repository.base; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; + +import org.junit.rules.ExternalResource; + +/** + * Rule to restore the original SSLContext and the HttpsURLConnection defaultSSLSocketFactory and defaultHostnameVerifier at the end of the test. + *

+ * This allows any tests to change these values without interfering with other tests. + */ +public class RestoreTrustStoreRule extends ExternalResource { + + private SSLContext originalSslContext = null; + private SSLSocketFactory originalSocketFactory = null; + private HostnameVerifier originalHostnameVerifier = null; + + /** {@inheritDoc} */ + @Override + protected void before() throws Throwable { + originalSslContext = SSLContext.getDefault(); + originalSocketFactory = HttpsURLConnection.getDefaultSSLSocketFactory(); + originalHostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier(); + } + + /** {@inheritDoc} */ + @Override + protected void after() { + SSLContext.setDefault(originalSslContext); + HttpsURLConnection.setDefaultSSLSocketFactory(originalSocketFactory); + HttpsURLConnection.setDefaultHostnameVerifier(originalHostnameVerifier); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TempFileRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TempFileRule.java new file mode 100644 index 000000000000..07d45aa8f6c6 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TempFileRule.java @@ -0,0 +1,53 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* Copyright IBM Corp. 2017 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.repository.base; + +import java.io.File; + +import org.junit.rules.ExternalResource; + +/** + * Rule to allocate a temporary file and delete it at the end of the test + */ +public class TempFileRule extends ExternalResource { + + private final String prefix; + private final String suffix; + private File file; + + public TempFileRule(String prefix, String suffix) { + this.prefix = prefix; + this.suffix = suffix; + } + + /** + * @return the file + */ + public File getFile() { + return file; + } + + /** {@inheritDoc} */ + @Override + protected void before() throws Throwable { + file = File.createTempFile(prefix, suffix); + } + + /** {@inheritDoc} */ + @Override + protected void after() { + if (file.exists()) { + file.delete(); + } + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TestBaseClass.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TestBaseClass.java new file mode 100755 index 000000000000..1112bc935220 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TestBaseClass.java @@ -0,0 +1,213 @@ +package com.ibm.ws.repository.base; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.repository.base.RepositoryTestUtils.TestType; +import com.ibm.ws.repository.connections.RepositoryConnection; + +public abstract class TestBaseClass { + + protected static RepositoryTestUtils _utils; + protected RepositoryConnection _repoConnection; + + private static TestType testType; + + private static boolean wipeBeforeEachTest; + + private static final Logger logger = Logger.getLogger(TestBaseClass.class.getName()); + + @Rule + public TestName name = new TestName(); + + /** + * The test type for this test class. Subclasses can override this by defining a public static method with the same signature. + *

+ * The method named "getTestType" on the actual test class will be called reflectively to determine the test type. + */ + public static TestType getTestType() { + return TestType.MASSIVE_REPO; + } + + /** + * Whether the repository should be cleared before each test. Subclasses can override this by defining a public static method with the same signature. + *

+ * The method named "getWipeBeforeEachTest" on the actual test class will be called reflectively to determine whether to wipe the repository between tests. + */ + public static boolean getWipeBeforeEachTest() { + return true; + } + + @ClassRule + public static TestRule readSubclassParameters = new TestRule() { + + @Override + public Statement apply(Statement statement, Description description) { + try { + // Get the test class + Class testClass = description.getTestClass(); + + // Reflectively call the getTestType and getWipeBeforeEachTest methods on the actual test class + testType = (TestType) testClass.getMethod("getTestType").invoke(null); + wipeBeforeEachTest = (Boolean) testClass.getMethod("getWipeBeforeEachTest").invoke(null); + + } catch (Exception e) { + throw new RuntimeException(e); + } + return statement; + } + }; + + @BeforeClass + public static void setupUtils() throws Exception { + logger.log(Level.INFO, "Setup Utils"); + _utils = RepositoryTestUtilsFactory.getInstance().createTestUtils(testType); + _utils.setUpClass(); + } + + /** + * Some repository tests can have intermittent failures. + * This rule will retry any failing tests twice. + * + * @throws Exception + */ + + @Rule + public TestRule retry = new RetryRule(2); + + @Before + public void doSetup() throws Exception { + logger.log(Level.INFO, "TestBaseClass.Base setup"); + printTestStart(); + _repoConnection = _utils.setUpTest(wipeBeforeEachTest); + } + + public void printTestStart() { + logger.log(Level.INFO, "---"); + logger.log(Level.INFO, "--- Start of " + name.getMethodName()); + } + + @After + public void printTestEnd() throws Exception { + _utils.tearDownTest(wipeBeforeEachTest); + logger.log(Level.INFO, "--- End of " + name.getMethodName()); + } + + class RetryRule implements TestRule { + + private final int retryLimit; + + /** + * @param retryLimit the number of times to retry the test if it fails + */ + private RetryRule(int retryLimit) { + this.retryLimit = retryLimit; + } + + @Override + public Statement apply(Statement base, Description desc) { + final Statement baseStatement = base; + + return new Statement() { + @Override + public void evaluate() throws Throwable { + + int runTimes = 0; + while (true) { + runTimes++; + try { + baseStatement.evaluate(); + break; // Break out of retry loop when we succeed + } catch (Throwable t) { + + // If we've reached the retry limit, give up and rethrow the exception + if (runTimes > retryLimit) { + logger.log(Level.INFO, "Too many failures, giving up"); + throw t; + } else { + logger.log(Level.INFO, "Logged failure, retrying: " + t.getMessage()); + } + } + } + } + + }; + } + + } + + /** + * Invoke a method reflectively if that does not use primitive arguments + * + * @param targetObject + * @param methodName + * @param classes + * @param values + * @return + * @throws NoSuchMethodException + * @throws SecurityException + * @throws IllegalAccessException + * @throws IllegalArgumentException + * @throws InvocationTargetException + */ + public static Object reflectiveCallAnyTypes(Object targetObject, String methodName, @SuppressWarnings("rawtypes") Class[] classes, Object[] values) + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + + // Usage example of this method + // int i = (Integer)reflectiveCallAnyTypes(targetObject,"methodName", + // new Class[] {int.class}, + // new Object[] {9}); + + // Get the class of the targetObject + Class c = null; + if (targetObject instanceof Class) { + c = (Class) targetObject; + } else { + c = targetObject.getClass(); + } + + Method method = null; + boolean finished = false; + while (!finished) { + + try { + // get method + method = c.getDeclaredMethod(methodName, classes); + finished = true; + method.setAccessible(true); + } catch (NoSuchMethodException nsme) { + if (c.getName().equals("java.lang.Object")) { + throw nsme; + } else { + c = c.getSuperclass(); + } + } + } + + // Invoke MassiveResource.getAsset() + return method.invoke(targetObject, values); + } + + public static File getFile(String antBuildLocation, String junitLocation) { + File isRunningLocally = new File("../localoverride"); + if (isRunningLocally.exists()) { + return new File(antBuildLocation); + } else { + return new File(junitLocation); + } + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/ZipRepositoryTestUtils.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/ZipRepositoryTestUtils.java new file mode 100755 index 000000000000..74abfd74f014 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/ZipRepositoryTestUtils.java @@ -0,0 +1,91 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.Collection; + +import com.ibm.ws.repository.connections.ZipRepositoryConnection; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; + +/** + * + */ +public class ZipRepositoryTestUtils implements RepositoryTestUtils { + + private File _zip; + + /** {@inheritDoc} */ + @Override + public void setUpClass() {} + + /** {@inheritDoc} */ + @Override + public void tearDownClass() {} + + private void delete(File f) { + if (f.exists()) { + if (!f.delete()) { + System.out.println("*** FAILED TO DELETE " + f.getAbsolutePath()); + } + } + System.out.println("Deleting " + f.getAbsolutePath()); + } + + /** + * {@inheritDoc} + * + * @return + */ + @Override + public ZipRepositoryConnection setUpTest(boolean wipeBeforeEachTest) throws Exception { + // A new sub directory is created for each test at the moment, so tests don't reuse the same directory + _zip = File.createTempFile("repoTest", ".zip"); + System.out.println("testing using " + _zip.getAbsolutePath()); + return new ZipRepositoryConnection(_zip); + } + + /** {@inheritDoc} */ + @Override + public void tearDownTest(boolean wipeBeforeEachTest) throws Exception { + delete(_zip); + } + + /** {@inheritDoc} */ + @Override + public ZipRepositoryConnection createNewRepo() throws NoRepoAvailableException { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public Collection getAllResourcesWithDupes() throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, InstantiationException, IllegalArgumentException, InvocationTargetException { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public ZipRepositoryConnection getRepositoryConnection() { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public void refreshTextIndex(String lastAssetId) throws Exception { + // Nothing to do for zip repos + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/DirectoryConnectionRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/DirectoryConnectionRule.java new file mode 100755 index 000000000000..cbae1121dfc3 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/DirectoryConnectionRule.java @@ -0,0 +1,108 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base.servers; + +import java.io.File; +import java.io.IOException; + +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.repository.connections.DirectoryRepositoryConnection; +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.test.utils.clients.DirectoryWriteableClient; +import com.ibm.ws.repository.transport.client.RepositoryReadableClient; + +public class DirectoryConnectionRule implements RestRepositoryConnectionRule { + + DirectoryWriteableConnection connection; + + public DirectoryConnectionRule() {} + + @Override + public RestRepositoryConnection getRestConnection() { + return null; + } + + @Override + public RepositoryConnection getConnection() { + return connection; + } + + /** + * Empties the repository before and after the test. + */ + @Override + public Statement apply(final Statement statement, Description arg1) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + File tmpRepoRoot = File.createTempFile("tempRepoDir", null); + tmpRepoRoot.delete(); + File tmpRepoDir = new File(tmpRepoRoot.getPath()); + if (!tmpRepoDir.mkdir()) { + throw new IOException("Couldn't create directory for temp repo directory: " + tmpRepoDir); + } + tmpRepoDir.deleteOnExit(); + connection = new DirectoryWriteableConnection(tmpRepoDir); + try { + statement.evaluate(); + } finally { + recursiveDelete(tmpRepoDir); + } + } + }; + } + + /** + * Directory repos don't support updating of assets + */ + @Override + public boolean updatesAreSupported() { + return false; + } + + /** + * No-op for directory, the search index doesn't need updating. + */ + @Override + public void refreshSearchIndex(String assetId) {} + + private void recursiveDelete(File file) { + if (!file.exists()) { + return; + } + + if (file.isDirectory()) { + for (File child : file.listFiles()) { + recursiveDelete(child); + } + } + + file.delete(); + } + + private static class DirectoryWriteableConnection extends DirectoryRepositoryConnection { + + public DirectoryWriteableConnection(File root) { + super(root); + } + + @Override + public RepositoryReadableClient createClient() { + return new DirectoryWriteableClient(getRoot()); + } + + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsConnectionRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsConnectionRule.java new file mode 100755 index 000000000000..5dcf8eb0bee4 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsConnectionRule.java @@ -0,0 +1,91 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base.servers; + +import java.util.Collection; + +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.exceptions.RepositoryBackendException; +import com.ibm.ws.repository.exceptions.RepositoryResourceDeletionException; +import com.ibm.ws.repository.resources.RepositoryResource; +import com.ibm.ws.repository.resources.writeable.RepositoryResourceWritable; + +public class LarsConnectionRule implements RestRepositoryConnectionRule { + + private final RestRepositoryConnection repo; + + public LarsConnectionRule(LarsServerRule larsFixture) { + this.repo = larsFixture.getRestConnection(); + } + + @Override + public RestRepositoryConnection getRestConnection() { + return repo; + } + + @Override + public RepositoryConnection getConnection() { + return repo; + } + + /** + * Empties the repository before and after the test. + */ + @Override + public Statement apply(final Statement statement, Description arg1) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + deleteAllAssets(); + try { + statement.evaluate(); + } finally { + deleteAllAssets(); + } + } + }; + } + + /** + * If the repo can't be cleaned up, fail the test, as following tests + * will fail if there are extra assets there. + * + * @throws RepositoryBackendException + * @throws RepositoryResourceDeletionException + */ + private void deleteAllAssets() throws RepositoryBackendException, RepositoryResourceDeletionException { + Collection resources = repo.getAllResourcesWithDupes(); + for (RepositoryResource res : resources) { + RepositoryResourceWritable writable = (RepositoryResourceWritable) res; + writable.delete(); + } + } + + /** + * Lars doesn't support updating of assets + */ + @Override + public boolean updatesAreSupported() { + return false; + } + + /** + * No-op for lars, the search index doesn't need updating. + */ + @Override + public void refreshSearchIndex(String assetId) {} + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsServerRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsServerRule.java new file mode 100755 index 000000000000..02e789b06575 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsServerRule.java @@ -0,0 +1,261 @@ +package com.ibm.ws.repository.base.servers; + +import java.net.InetAddress; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Properties; +import java.util.TimeZone; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.config.ApplicationBnd; +import com.ibm.websphere.simplicity.config.BasicRegistry; +import com.ibm.websphere.simplicity.config.BasicRegistry.Group; +import com.ibm.websphere.simplicity.config.BasicRegistry.Group.Member; +import com.ibm.websphere.simplicity.config.BasicRegistry.User; +import com.ibm.websphere.simplicity.config.MongoDBElement; +import com.ibm.websphere.simplicity.config.MongoElement; +import com.ibm.websphere.simplicity.config.SecurityRole; +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import com.ibm.websphere.simplicity.config.SpecialSubject; +import com.ibm.websphere.simplicity.config.SpecialSubject.Type; +import com.ibm.websphere.simplicity.config.WebApplication; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.mongodb.BasicDBList; +import com.mongodb.BasicDBObject; +import com.mongodb.DB; +import com.mongodb.MongoClient; +import com.mongodb.ServerAddress; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Starts and stops a LARS server around a test. + *

+ * Handles installing the server, updating the configuration for the test environment, + * creating a new database for the test and dropping the database once the test is completed. + *

+ * Generally, this should be used as a ClassRule on the FATSuite class to ensure that the + * LARS server set up once, runs for the whole FAT bucket and is only cleaned up at the end. + *

+ * LARS requires a mongo database. The mongo database details must be provided in + * mongodb.properties + * + */ +public class LarsServerRule implements TestRule { + + private static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd-HHmmss"); + static { + DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC")); + } + + private LibertyServer larsServer; + + private MongoClient mongoClient; + private String dbName; + + private final List serverAddresses = new ArrayList(); + private String username; + private String password; + + private RestRepositoryConnection connection; + + @Override + public Statement apply(final Statement statement, Description description) { + return new Statement() { + + @Override + public void evaluate() throws Throwable { + // dbname must be less than 64chars and contains no '.' (from the mongodb spec) + String hostname = InetAddress.getLocalHost().getHostName(); + int dotIndex = hostname.indexOf('.'); + if (dotIndex > 0) { + hostname = hostname.substring(0, dotIndex); + } + dbName = "lars-" + DATE_FORMAT.format(new Date()) + "-" + hostname; + readProperties(); + + try { + // Set up LARS server + setUpDatabase(); + startLarsServer(); + // Run the tests + statement.evaluate(); + } finally { + // Do cleanup + if (larsServer != null) { + larsServer.stopServer(); + } + dropDatabase(); + } + } + }; + } + + private void readProperties() throws Exception { + + Properties mongoProperties = new Properties(); + + mongoProperties.load(this.getClass().getResourceAsStream("/mongodb.properties")); + + String hostsString = mongoProperties.getProperty("hosts"); + String portsString = mongoProperties.getProperty("ports"); + + if (hostsString != null && portsString != null) { + String[] hostStrings = hostsString.split(","); + String[] portStrings = portsString.split(","); + + if (hostStrings.length != portStrings.length) { + throw new Exception("Supplied hosts and ports for mongodb are different lengths"); + } + + for (int i = 0; i < hostStrings.length; i++) { + Integer port = new Integer(portStrings[i]); + serverAddresses.add(new ServerAddress(hostStrings[i], port)); + } + } + + String username = mongoProperties.getProperty("username"); + if (username != null && !username.isEmpty()) { + this.username = username; + } + + String password = mongoProperties.getProperty("password"); + if (password != null && !password.isEmpty()) { + this.password = password; + } + + } + + private void startLarsServer() throws Exception { + + larsServer = LibertyServerFactory.getLibertyServer("larsServer"); + + // Move the test server xml into sample.xml + RemoteFile sampleServerFile = LibertyFileManager.createRemoteFile(larsServer.getMachine(), larsServer.getServerRoot() + "/sample.xml"); + LibertyFileManager.moveLibertyFile(larsServer.getServerConfigurationFile(), sampleServerFile); + + // And upload the FAT server XML that will include sample.xml + LibertyFileManager.copyFileIntoLiberty(larsServer.getMachine(), larsServer.getServerRoot(), "server.xml", "productSampleServer.xml"); + + // Upload the FAT bootstrap.properties + LibertyFileManager.copyFileIntoLiberty(larsServer.getMachine(), larsServer.getServerRoot(), "bootstrap.properties", "productSample_noBootstrap.properties"); + + ServerConfiguration config = larsServer.getServerConfiguration(sampleServerFile); + + // Override the database configuration + MongoElement mongo = config.getMongos().get(0); + + List hostNames = mongo.getHostNamesElements(); + List ports = mongo.getPortsElements(); + + hostNames.clear(); + ports.clear(); + for (ServerAddress server : serverAddresses) { + hostNames.add(server.getHost()); + ports.add(server.getPort()); + } + + mongo.setUser(username); + mongo.setPassword(password); + + MongoDBElement mongodb = config.getMongoDBs().get(0); + mongodb.setDatabaseName(dbName); + + // Set up the user registry with admin user and group + config.getBasicRegistries().clear(); + BasicRegistry reg = new BasicRegistry(); + reg.setId("defaultRegistry"); + reg.setRealm("default"); + config.getBasicRegistries().add(reg); + + User adminUser = new User(); + adminUser.setName("admin"); + adminUser.setPassword("testPassword"); + reg.getUsers().add(adminUser); + + Group adminGroup = new Group(); + adminGroup.setName("Administrators"); + reg.getGroups().add(adminGroup); + + Member adminMember = new Member(); + adminMember.setName("admin"); + adminGroup.getMembers().add(adminMember); + + // Configure the application with the admin and user security roles + WebApplication app = config.getWebApplications().getById("com.ibm.ws.lars.rest"); + ApplicationBnd appBnd = app.getApplicationBnd(); + appBnd.getSecurityRoles().clear(); + + SecurityRole userRole = new SecurityRole(); + userRole.setName("User"); + appBnd.getSecurityRoles().add(userRole); + + SpecialSubject everyone = new SpecialSubject(); + everyone.set(Type.EVERYONE); + userRole.getSpecialSubjects().add(everyone); + + SecurityRole adminRole = new SecurityRole(); + adminRole.setName("Administrator"); + appBnd.getSecurityRoles().add(adminRole); + + SecurityRole.Group adminRoleGroup = new SecurityRole.Group(); + adminRoleGroup.setName("Administrators"); + adminRole.getGroups().add(adminRoleGroup); + + // remove the httpendpoint stanza, it's provided in fatTestPorts.xml + config.getHttpEndpoints().clear(); + + // Enable some logging + config.getLogging().setTraceSpecification("com.ibm.ws.lars.*=all"); + + larsServer.updateServerConfiguration(config, sampleServerFile); + + larsServer.startServer(); + } + + private void setUpDatabase() { + mongoClient = new MongoClient(serverAddresses); + + DB adminDb = mongoClient.getDB("admin"); + adminDb.authenticateCommand(username, password.toCharArray()).throwOnError(); + + DB db = mongoClient.getDB(dbName); + + // Create a user with the same username and password on the new database + // Needed because Liberty always authenticates against the DB it uses + BasicDBList roles = new BasicDBList(); + roles.add("readWrite"); + BasicDBObject createUser = new BasicDBObject("createUser", username) + .append("pwd", password) + .append("roles", roles); + db.command(createUser).throwOnError(); + } + + private void dropDatabase() { + if (mongoClient != null) { + if (mongoClient.getDatabaseNames().contains(dbName)) { + mongoClient.dropDatabase(dbName); + } + } + } + + public RestRepositoryConnection getRestConnection() { + if (connection == null) { + StringBuilder sb = new StringBuilder(); + sb.append("http://"); + sb.append(larsServer.getHostname()); + sb.append(":").append(larsServer.getHttpDefaultPort()); + sb.append("/ma/v1"); + connection = new RestRepositoryConnection("admin", "testPassword", "1", sb.toString()); + } + return connection; + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveConnectionRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveConnectionRule.java new file mode 100755 index 000000000000..75b5aa3ba937 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveConnectionRule.java @@ -0,0 +1,70 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base.servers; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.ProtocolException; + +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.repository.base.DeleteRepo; +import com.ibm.ws.repository.base.RestRepositoryTestUtils; +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RestRepositoryConnection; + +public class MassiveConnectionRule implements RestRepositoryConnectionRule { + + private final MassiveServerRule massiveFixture; + + public MassiveConnectionRule(MassiveServerRule massiveFixture) { + this.massiveFixture = massiveFixture; + } + + @Override + public RestRepositoryConnection getRestConnection() { + return massiveFixture.getRepositoryConnection(); + } + + @Override + public RepositoryConnection getConnection() { + return massiveFixture.getRepositoryConnection(); + } + + @Override + public Statement apply(final Statement statement, Description arg1) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + DeleteRepo.deleteRepo(massiveFixture.getRepositoryConnection()); + try { + statement.evaluate(); + } finally { + DeleteRepo.deleteRepo(massiveFixture.getRepositoryConnection()); + } + } + }; + } + + @Override + public boolean updatesAreSupported() { + return true; + } + + @Override + public void refreshSearchIndex(String assetId) throws MalformedURLException, ProtocolException, IOException { + RestRepositoryTestUtils.refreshElasticSearchIndex(massiveFixture.getRepositoryConnection(), assetId); + + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveServerRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveServerRule.java new file mode 100755 index 000000000000..ac2259d8ea7f --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveServerRule.java @@ -0,0 +1,57 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base.servers; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.repository.base.DeleteRepo; +import com.ibm.ws.repository.base.RepositoryTestUtils; +import com.ibm.ws.repository.base.RepositoryTestUtils.TestType; +import com.ibm.ws.repository.base.RepositoryTestUtilsFactory; +import com.ibm.ws.repository.connections.RestRepositoryConnection; + +/** + * A rule to setup and tear down a massive repository for use in the tests + * use as a class rule + */ +public class MassiveServerRule implements TestRule { + + private RepositoryTestUtils testUtils; + + @Override + public Statement apply(final Statement statement, Description description) { + return new Statement() { + + @Override + public void evaluate() throws Throwable { + + testUtils = RepositoryTestUtilsFactory.getInstance().createTestUtils(TestType.MASSIVE_REPO); + // This isn't great, it is working around the old structure where + // the tests all extended the TestBaseClass + testUtils.setUpClass(); + try { + statement.evaluate(); + } finally { + DeleteRepo.deleteRepo(testUtils.getRepositoryConnection()); + } + + } + }; + } + + public RestRepositoryConnection getRepositoryConnection() { + return testUtils.getRepositoryConnection(); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/RestRepositoryConnectionRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/RestRepositoryConnectionRule.java new file mode 100755 index 000000000000..22ccb3e2c756 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/RestRepositoryConnectionRule.java @@ -0,0 +1,37 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base.servers; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.ProtocolException; + +import org.junit.rules.TestRule; + +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RestRepositoryConnection; + +/** + * A test rule representing a connection to a repository. The repository will + * be emptied at the beginning and the end of the test. + */ +public interface RestRepositoryConnectionRule extends TestRule { + + RestRepositoryConnection getRestConnection(); + + RepositoryConnection getConnection(); + + boolean updatesAreSupported(); + + void refreshSearchIndex(String assetId) throws MalformedURLException, ProtocolException, IOException; + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/AbstractFileWriteableClient.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/AbstractFileWriteableClient.java new file mode 100755 index 000000000000..447974213057 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/AbstractFileWriteableClient.java @@ -0,0 +1,186 @@ +package com.ibm.ws.repository.test.utils.clients; +/******************************************************************************* + * Copyright (c) 2015 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import com.ibm.ws.repository.common.enums.AttachmentType; +import com.ibm.ws.repository.common.enums.FilterableAttribute; +import com.ibm.ws.repository.common.enums.ResourceType; +import com.ibm.ws.repository.common.enums.StateAction; +import com.ibm.ws.repository.common.enums.Visibility; +import com.ibm.ws.repository.transport.client.RepositoryReadableClient; +import com.ibm.ws.repository.transport.client.RepositoryWriteableClient; +import com.ibm.ws.repository.transport.exceptions.BadVersionException; +import com.ibm.ws.repository.transport.exceptions.ClientFailureException; +import com.ibm.ws.repository.transport.exceptions.RequestFailureException; +import com.ibm.ws.repository.transport.model.AppliesToFilterInfo; +import com.ibm.ws.repository.transport.model.Asset; +import com.ibm.ws.repository.transport.model.Attachment; +import com.ibm.ws.repository.transport.model.AttachmentSummary; +import com.ibm.ws.repository.transport.model.FilterVersion; + +/** + * + */ +public abstract class AbstractFileWriteableClient implements RepositoryWriteableClient, RepositoryReadableClient { + + protected RepositoryReadableClient _readClient; + + /** + * {@inheritDoc} + * + * @throws IllegalAccessException + * @throws IllegalArgumentException + */ + @Override + public Asset addAsset(Asset asset) throws IOException, BadVersionException, RequestFailureException, SecurityException, ClientFailureException { + + StringBuffer relative = new StringBuffer(); + if (asset.getType() != null) { + relative.append(asset.getType().getURLForType()); + relative.append(File.separator); + } + FilterVersion minVer = null; + if (asset.getWlpInformation() != null) { + Collection appliesTo = asset.getWlpInformation().getAppliesToFilterInfo(); + if (appliesTo != null && !appliesTo.isEmpty()) { + minVer = appliesTo.iterator().next().getMinVersion(); + } + if (minVer != null) { + relative.append(minVer.getValue()); + relative.append(File.separator); + } + } + + Collection attachs = asset.getAttachments(); + String mainAttachmentName = null; + if (attachs != null) { + for (Attachment at : attachs) { + if (at.getType() == AttachmentType.CONTENT) { + mainAttachmentName = at.getName(); + break; + } + } + } + + if (mainAttachmentName != null) { + relative.append(mainAttachmentName); + } else if (asset.getName() != null) { + String assetName = asset.getName().replace("/", ""); + assetName = assetName.replace(":", ""); + relative.append(assetName); + } else { + // No where to get the name from so create a random one + relative.append("unnamed" + Math.random()); + } + asset.set_id(relative.toString()); + + try { + writeJson(asset, relative.toString()); + } catch (IllegalArgumentException e) { + throw new ClientFailureException("Failed to write the asset to disk", asset.get_id(), e); + } catch (IllegalAccessException e) { + throw new ClientFailureException("Failed to write the asset to disk", asset.get_id(), e); + } + + // For some reason the file.io operations aren't always finished....why dont they block? + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignore it + } + return _readClient.getAsset(asset.get_id()); + } + + /** + * {@inheritDoc} + * + * @throws ClientFailureException + */ + @Override + public Asset updateAsset(final Asset asset) throws IOException, BadVersionException, RequestFailureException, SecurityException, ClientFailureException { + deleteAssetAndAttachments(asset.get_id()); + return addAsset(asset); + } + + /** {@inheritDoc} */ + @Override + public Attachment updateAttachment(String assetId, AttachmentSummary summary) throws IOException, BadVersionException, RequestFailureException, SecurityException { + deleteAttachment(assetId, summary.getAttachment().get_id()); + return addAttachment(assetId, summary); + } + + /** {@inheritDoc} */ + @Override + public void updateState(String assetId, StateAction action) throws IOException, RequestFailureException { + // null op for file based repos + } + + public abstract void writeJson(Asset asset, String path) throws IOException, IllegalArgumentException, IllegalAccessException; + + @Override + public Asset getAsset(String assetId) throws IOException, BadVersionException, RequestFailureException { + return _readClient.getAsset(assetId); + } + + @Override + public Collection getAllAssets() throws IOException, RequestFailureException { + return _readClient.getAllAssets(); + } + + @Override + public Collection getAssets(ResourceType type) throws IOException, RequestFailureException { + return _readClient.getAssets(type); + } + + @Override + public Collection getAssets(Collection types, Collection productIds, Visibility visibility, Collection productVersions) throws IOException, RequestFailureException { + return _readClient.getAssets(types, productIds, visibility, productVersions); + } + + @Override + public Collection getAssetsWithUnboundedMaxVersion(Collection types, Collection rightProductIds, Visibility visibility) throws IOException, RequestFailureException { + return _readClient.getAssetsWithUnboundedMaxVersion(types, rightProductIds, visibility); + } + + @Override + public InputStream getAttachment(Asset asset, Attachment attachment) throws IOException, BadVersionException, RequestFailureException { + return _readClient.getAttachment(asset, attachment); + } + + @Override + public List findAssets(String searchString, Collection types) throws IOException, RequestFailureException { + return _readClient.findAssets(searchString, types); + } + + @Override + public Collection getFilteredAssets(Map> filters) throws IOException, RequestFailureException { + return _readClient.getFilteredAssets(filters); + } + + @Override + public void checkRepositoryStatus() throws IOException, RequestFailureException { + _readClient.checkRepositoryStatus(); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/DirectoryWriteableClient.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/DirectoryWriteableClient.java new file mode 100755 index 000000000000..6930bf2d09a7 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/DirectoryWriteableClient.java @@ -0,0 +1,192 @@ +package com.ibm.ws.repository.test.utils.clients; + +/******************************************************************************* + * Copyright (c) 2015 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ + +import java.io.File; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.util.Calendar; + +import com.ibm.ws.repository.transport.client.DirectoryClient; +import com.ibm.ws.repository.transport.client.DirectoryUtils; +import com.ibm.ws.repository.transport.exceptions.BadVersionException; +import com.ibm.ws.repository.transport.exceptions.RequestFailureException; +import com.ibm.ws.repository.transport.model.Asset; +import com.ibm.ws.repository.transport.model.Attachment; +import com.ibm.ws.repository.transport.model.AttachmentSummary; + +/** + * + */ +public class DirectoryWriteableClient extends AbstractFileWriteableClient { + + private final File _root; + + public DirectoryWriteableClient(File root) { + _root = root; + _readClient = new DirectoryClient(_root); + } + + public static void writeDiskRepoJSONToFile(Asset asset, final File writeJsonTo) throws IllegalArgumentException, IllegalAccessException, IOException { + FileOutputStream fos = null; + DirectoryUtils.mkDirs(writeJsonTo.getParentFile()); + try { + fos = DirectoryUtils.createFileOutputStream(writeJsonTo); + asset.dumpMinimalAsset(fos); + } finally { + if (fos != null) { + fos.close(); + } + } + + } + + @Override + public void writeJson(Asset asset, String path) throws IllegalArgumentException, IllegalAccessException, IOException { + File targetFile = new File(_root, path.toString() + ".json"); + writeDiskRepoJSONToFile(asset, targetFile); + } + + public void downloadToFile(InputStream is, final File fileToWriteTo) throws IOException { + FileOutputStream fos = null; + try { + fos = DirectoryUtils.createFileOutputStream(fileToWriteTo); + + byte[] buffer = new byte[1024]; + int read = 0; + while ((read = is.read(buffer)) != -1) { + fos.write(buffer, 0, read); + } + } finally { + if (null != fos) { + fos.close(); + } + if (null != is) { + is.close(); + } + } + } + + /** {@inheritDoc} */ + @Override + public Attachment addAttachment(String assetId, AttachmentSummary attSummary) throws IOException, BadVersionException, RequestFailureException, SecurityException { + File source = attSummary.getFile(); + Attachment att = attSummary.getAttachment(); + StringBuffer targetPath = new StringBuffer(assetId); + switch (attSummary.getAttachment().getType()) { + case CONTENT: + // target path is right for the main attachment + break; + case DOCUMENTATION: + case ILLUSTRATION: + case THUMBNAIL: + targetPath.append("."); + targetPath.append(attSummary.getAttachment().getType().toString()); + + // Create directory at this point + new File(_root, targetPath.toString()).mkdir(); + + targetPath.append(File.separator); + targetPath.append(attSummary.getName()); + break; + case LICENSE: + case LICENSE_AGREEMENT: + case LICENSE_INFORMATION: + targetPath.append(".licenses"); + targetPath.append(File.separator); + targetPath.append(attSummary.getName()); + + // Create directory at this point + new File(_root, targetPath.toString()).mkdir(); + + break; + } + + att.setAssetId(assetId); + att.set_id(targetPath.toString()); + // We don't really use the URL but to be consistent with massive we can set it to the supplied value or create one if not specified + att.setUrl(attSummary.getURL() == null ? targetPath.toString() : attSummary.getURL()); + att.setUploadOn(Calendar.getInstance()); + + // This is done to give a random value to the attachment, it is only used as a way of ensuring that each time this method is called + // there is some unique value stored in the attachment. + att.setGridFSId("" + Math.random()); + InputStream is = DirectoryUtils.createFileInputStream(source); + downloadToFile(is, new File(_root, targetPath.toString())); + + return att; + } + + /** {@inheritDoc} */ + @Override + public void deleteAttachment(String assetId, String attachmentId) throws IOException, RequestFailureException { + DirectoryUtils.delete(createFromRelative(attachmentId)); + } + + /** {@inheritDoc} */ + @Override + public void deleteAssetAndAttachments(String assetId) throws IOException, RequestFailureException { + final File main = new File(_root, assetId); + final String mainName = main.getName(); + File parent = main.getParentFile(); + File[] toDelete = DirectoryUtils.listFiles(parent, new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + if (mainName.equals(name)) { + return true; + } + if ((mainName + ".json").equals(name)) { + return true; + } + if ((mainName + ".license").equals(name)) { + return true; + } + if (name.contains(mainName + ".") && DirectoryUtils.isDirectory(dir)) + { + // TODO: Is this one we should delete? Another attachment type? + } + return false; + } + }); + + if (toDelete != null) { + for (File f : toDelete) { + if (DirectoryUtils.isDirectory(f)) { + recursivelyDelete(f); + } + DirectoryUtils.delete(f); + } + } + } + + private void recursivelyDelete(File f) { + if (DirectoryUtils.isDirectory(f)) { + File[] children = DirectoryUtils.listFiles(f); + for (File child : children) { + recursivelyDelete(child); + } + } + DirectoryUtils.delete(f); + } + + private File createFromRelative(final String relative) { + return new File(_root, relative); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/mongodb.properties b/dev/com.ibm.ws.repository.test.utils/src/mongodb.properties new file mode 100755 index 000000000000..654f9e9011fb --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/mongodb.properties @@ -0,0 +1,4 @@ +hosts=ltestl91.hursley.ibm.com,ltestl94.hursley.ibm.com,ltestl62.hursley.ibm.com +ports=28017,28017,28017 +username=repoBuilds +password=T35tiN6!Lars \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.test.utils_test/.classpath b/dev/com.ibm.ws.repository.test.utils_test/.classpath new file mode 100755 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.test.utils_test/.classpath.gradle b/dev/com.ibm.ws.repository.test.utils_test/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.test.utils_test/.gitignore b/dev/com.ibm.ws.repository.test.utils_test/.gitignore new file mode 100644 index 000000000000..27e131e35a6b --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.repository.test.utils_test/.project b/dev/com.ibm.ws.repository.test.utils_test/.project new file mode 100755 index 000000000000..352138bc1686 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.repository.test.utils_test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c92277a371a9 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd b/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd new file mode 100644 index 000000000000..5f1bb46e5503 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd @@ -0,0 +1,12 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.test.utils;version=latest diff --git a/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd.gradle b/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd.gradle new file mode 100644 index 000000000000..5f1bb46e5503 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd.gradle @@ -0,0 +1,12 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.test.utils;version=latest diff --git a/dev/com.ibm.ws.repository.test.utils_test/build-test.xml b/dev/com.ibm.ws.repository.test.utils_test/build-test.xml new file mode 100755 index 000000000000..df2a6311de98 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/build-test.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.test.utils_test/build.gradle b/dev/com.ibm.ws.repository.test.utils_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.repository.test.utils_test/fat/src/com/ibm/ws/repository/base/FATTest.java b/dev/com.ibm.ws.repository.test.utils_test/fat/src/com/ibm/ws/repository/base/FATTest.java new file mode 100755 index 000000000000..b7b40cb2a7d0 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/fat/src/com/ibm/ws/repository/base/FATTest.java @@ -0,0 +1,174 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Collection; +import java.util.Properties; + +import org.junit.Assert; +import org.junit.Test; + +import com.ibm.ws.repository.connections.RepositoryConnectionList; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.exceptions.RepositoryBackendException; +import com.ibm.ws.repository.resources.RepositoryResource; + +public class FATTest { + + Properties dynamicApiKeyProps; + Properties staticApiKeyProps; + Properties staticApiKeyPropsInvalidRespositories; + private final static File resourcesDir = new File("lib/LibertyFATTestFiles"); + + public FATTest() throws FileNotFoundException, IOException { + dynamicApiKeyProps = new Properties(); + dynamicApiKeyProps.load(this.getClass().getResourceAsStream("/testLogin.properties")); + staticApiKeyProps = new Properties(); + staticApiKeyProps.load(new FileInputStream(new File(resourcesDir, "staticApiKeys.props"))); + staticApiKeyPropsInvalidRespositories = new Properties(); + staticApiKeyPropsInvalidRespositories.load(new FileInputStream(new File(resourcesDir, "staticApiKeysInvalidRepositories.props"))); + } + + @Test + public void testDynamicApiKey() throws NoRepoAvailableException { + LoginInfoProvider provider = new LoginInfoProvider(dynamicApiKeyProps); + RestRepositoryConnection info = provider.getLoginInfo(); + + assertNotNull(info.getApiKey()); + assertNotNull(info.getRepositoryUrl()); + assertNotNull(info.getUserId()); + assertNotNull(info.getPassword()); + + assertNotNull(info.getClientLoginInfo().getApiKey()); + assertNotNull(info.getClientLoginInfo().getRepositoryUrl()); + assertNotNull(info.getClientLoginInfo().getUserId()); + assertNotNull(info.getClientLoginInfo().getPassword()); + + // Check that we're caching the loginInfo + RestRepositoryConnection info2 = provider.getLoginInfo(); + assertSame("Login info should be cached", info, info2); + } + + /** + * Test that we are returned a working server which is one of the two in the + * properties file and that the fields in the LoginInfo are set as expected. + * + * @throws NoRepoAvailableException + */ + @Test + public void testStaticApiKey() throws NoRepoAvailableException { + LoginInfoProvider provider = new LoginInfoProvider(staticApiKeyProps); + RestRepositoryConnection info = provider.getLoginInfo(); + + if (staticApiKeyProps.get("test1.url").equals(info.getRepositoryUrl())) { + Assert.assertEquals(staticApiKeyProps.get("test1.apiKey"), info.getApiKey()); + } else { + Assert.assertEquals(staticApiKeyProps.get("test2.apiKey"), info.getApiKey()); + } + + assertNotNull(info.getApiKey()); + assertNotNull(info.getRepositoryUrl()); + assertNotNull(info.getUserId()); + assertNotNull(info.getPassword()); + + assertNotNull(info.getClientLoginInfo().getApiKey()); + assertNotNull(info.getClientLoginInfo().getRepositoryUrl()); + assertNotNull(info.getClientLoginInfo().getUserId()); + assertNotNull(info.getClientLoginInfo().getPassword()); + } + + /** + * Given a list of massive servers, that contains both of the valid ones (for failover) and a number + * of invalid ones, that the only servers returned to us are the genuine ones (ie one that we can + * talk to that give valid results). + * + * @throws NoRepoAvailableException + * @throws RepositoryBackendException + */ + @Test + public void testStaticApiKeyInvalidRespositories() throws NoRepoAvailableException, RepositoryBackendException { + + for (int i = 0; i < 10; i++) { + LoginInfoProvider provider = new LoginInfoProvider(staticApiKeyPropsInvalidRespositories); + RestRepositoryConnection info = provider.getLoginInfo(); + + Collection resources = new RepositoryConnectionList(info).getAllResources(); + assertEquals("We were able to read from massive but did not get the expected result", 0, resources.size()); + } + } + + @Test + public void testInvalidServer() { + Properties invalid = new Properties(); + invalid.setProperty("bad.url", "hxxp://www.example.com"); + + LoginInfoProvider provider = new LoginInfoProvider(invalid); + try { + provider.getLoginInfo(); + fail(); + } catch (NoRepoAvailableException ex) { + // Expected exception + } + } + + @Test + public void testUserNoApiKey() { + Properties invalid = new Properties(dynamicApiKeyProps); + invalid.setProperty("userId", "testUser"); + + try { + new LoginInfoProvider(invalid); + fail(); + } catch (IllegalArgumentException ex) { + // Expected exception + } + } + + @Test + public void testNoUserApiKey() { + Properties invalid = new Properties(); + invalid.setProperty("server.url", "baz"); + invalid.setProperty("server.apiKey", "123456789"); + + try { + new LoginInfoProvider(invalid); + fail(); + } catch (IllegalArgumentException ex) { + // Expected exception + } + } + + @Test + public void testSomeMissingApiKey() { + // Copy static apiKey settings + Properties invalid = new Properties(staticApiKeyProps); + // Add a new server, but no apiKey + invalid.setProperty("missingapi.url", "http://www.example.com"); + + try { + new LoginInfoProvider(invalid); + fail(); + } catch (IllegalArgumentException ex) { + // Expected exception + } + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeys.props b/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeys.props new file mode 100755 index 000000000000..253e27a27d18 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeys.props @@ -0,0 +1,17 @@ +# This file points to some repositories using fixed apiKeys. +# It is used to test the LoginInfoProvider +# There should be two servers configured named "test1" and "test2" and both should exist. + +# Leave these blank to use the test repo credentials and create test repositories +# If userId and password are blank then an apiKey must not be supplied +userId=massiveClientTest@ibm.com +password=cT3st9 + +test1.url=http://ltestl94.hursley.ibm.com:9002/ma/v1 +test1.apiKey=68059479864 +test2.url=http://ltestl91.hursley.ibm.com:9002/ma/v1 +test2.apiKey=96999462158 + +# Basic auth credentials needed to access an authenticated server on softlayer +# softlayerUserId= +# softlayerPassword= \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeysInvalidRepositories.props b/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeysInvalidRepositories.props new file mode 100755 index 000000000000..abad9532cc7c --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeysInvalidRepositories.props @@ -0,0 +1,34 @@ +# This file points to some repositories using fixed apiKeys. +# It is used to test the LoginInfoProvider +# There should a number of servers configured including BOTH the real servers and a number of +# invalid ones. + +# Leave these blank to use the test repo credentials and create test repositories +# If userId and password are blank then an apiKey must not be supplied +userId=massiveClientTest@ibm.com +password=cT3st9 + +test1.url=http://ltestl94.hursley.ibm.com:9002/ma/v1 +test1.apiKey=68059479864 +test2.url=http://ltestl91.hursley.ibm.com:9002/ma/v1 +test2.apiKey=96999462158 +test3.url=hxxp://invalid.server1.com +test3.apiKey=1 +test4.url=hxxp://invalid.server2.com +test4.apiKey=2 +test5.url=hxxp://invalid.server3.com +test5.apiKey=3 +test6.url=hxxp://invalid.server4.com +test6.apiKey=4 +test7.url=hxxp://invalid.server5.com +test7.apiKey=5 +test8.url=hxxp://invalid.server6.com +test8.apiKey=6 +test9.url=hxxp://invalid.server7.com +test9.apiKey=7 +test10.url=hxxp://invalid.server8.com +test10.apiKey=8 + +# Basic auth credentials needed to access an authenticated server on softlayer +# softlayerUserId= +# softlayerPassword= \ No newline at end of file diff --git a/dev/com.ibm.ws.runtime.update_bvt/.classpath b/dev/com.ibm.ws.runtime.update_bvt/.classpath index c80797438ab6..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.runtime.update_bvt/.classpath +++ b/dev/com.ibm.ws.runtime.update_bvt/.classpath @@ -1,24 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.runtime.update_bvt/.classpath.gradle b/dev/com.ibm.ws.runtime.update_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_bvt/.project b/dev/com.ibm.ws.runtime.update_bvt/.project index 672a44c98974..11ebff39295c 100755 --- a/dev/com.ibm.ws.runtime.update_bvt/.project +++ b/dev/com.ibm.ws.runtime.update_bvt/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.runtime.update_bvt/bnd.bnd b/dev/com.ibm.ws.runtime.update_bvt/bnd.bnd new file mode 100755 index 000000000000..1f480d55bcce --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_bvt/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.runtime.update;version=latest diff --git a/dev/com.ibm.ws.runtime.update_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.runtime.update_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..1f480d55bcce --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_bvt/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.runtime.update;version=latest diff --git a/dev/com.ibm.ws.runtime.update_bvt/build.gradle b/dev/com.ibm.ws.runtime.update_bvt/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.runtime.update_fat/.classpath b/dev/com.ibm.ws.runtime.update_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/.classpath.gradle b/dev/com.ibm.ws.runtime.update_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/.gitignore b/dev/com.ibm.ws.runtime.update_fat/.gitignore new file mode 100644 index 000000000000..76077afaec28 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.gitignore @@ -0,0 +1,3 @@ +dropins +bundles +/bootstrapping.properties diff --git a/dev/com.ibm.ws.runtime.update_fat/.project b/dev/com.ibm.ws.runtime.update_fat/.project new file mode 100755 index 000000000000..84bf672dd2f6 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.runtime.update_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..845c3083c7df --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c874b5816985 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.runtime.update_fat/bnd.bnd b/dev/com.ibm.ws.runtime.update_fat/bnd.bnd new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.runtime.update_fat/bnd.bnd.gradle b/dev/com.ibm.ws.runtime.update_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.runtime.update_fat/build-test.xml b/dev/com.ibm.ws.runtime.update_fat/build-test.xml new file mode 100755 index 000000000000..b09f9391954b --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/build-test.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.runtime.update_fat/build.gradle b/dev/com.ibm.ws.runtime.update_fat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/ConfigUpdateDeliveryTest.java b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/ConfigUpdateDeliveryTest.java new file mode 100755 index 000000000000..997bc25af5ab --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/ConfigUpdateDeliveryTest.java @@ -0,0 +1,168 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.runtime.update.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.ProtocolException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Tests that applications on the Liberty profile can access the RuntimeUpdateNotificationMBean, register + * a NotificationListener and receive notifications for updates to the server.xml configuration. + */ +public class ConfigUpdateDeliveryTest { + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.runtime.update.fat"); + private static final String urlPrefix = "http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/mbean"; + private final Class c = ConfigUpdateDeliveryTest.class; + + @Rule + public final TestName method = new TestName(); + + @Test + public void configUpdatesDelivered() throws Exception { + Log.info(c, method.getMethodName(), "Entering test: " + method.getMethodName()); + + // Add a notification listener to the MBeanServer. + URL url = new URL(urlPrefix + "?setupNotificationListener"); + Log.info(c, "testConfigUpdatesDelivered", "Calling JMX Servlet with URL=" + url.toString()); + testServlet(url); + + // Replace the server.xml configuration file to trigger a notification for the delivery of config updates. + Log.info(c, method.getMethodName(), "Replacing: " + server.getServerName() + + " server.xml to trigger a runtime update notification."); + server.setServerConfigurationFile("local-connector-server.xml"); + // Wait for the configuration update to take effect + assertNotNull("FAIL: " + server.getServerName() + " did not complete the server configuration update", + server.waitForStringInLog("CWWKG0017I:.*")); + + // Wait for the notification to be received for the configuration update. + url = new URL(urlPrefix + "?checkForNotifications"); + Log.info(c, "testConfigUpdatesDelivered", "Calling JMX Servlet with URL=" + url.toString()); + testServlet(url); + + Log.info(c, method.getMethodName(), "Exiting test: " + method.getMethodName()); + } + + @BeforeClass + public static void setUp() throws Exception { + server.startServer(); + } + + @AfterClass + public static void tearDown() throws Exception { + if (server != null && server.isStarted()) { + server.stopServer(); + } + } + + private void testServlet(URL url) throws IOException { + HttpURLConnection con = getHttpConnection(url); + BufferedReader br = getConnectionStream(con); + + try { + // read the page contents + String line = br.readLine(); + List lines = new ArrayList(); + while (line != null) { + lines.add(line); + line = br.readLine(); + } + con.disconnect(); + + // log the output lines so we can debug + System.out.println("Output: "); + for (String msg : lines) { + System.out.println(msg); + } + + // check the first line to be sure we at least got to the servlet + assertEquals("This is a servlet for the RuntimeUpdateNotificationMBean.", lines.get(0)); + + boolean foundPass = false; + + // Pass criteria: + // - No FAIL: lines + // - at least one PASS line + + for (String msg : lines) { + if (msg.startsWith("FAIL: ")) { + // When there is a fail log the whole output + StringBuilder builder = new StringBuilder(); + for (String lineForMessage : lines) { + builder.append(lineForMessage); + builder.append("\n"); + } + fail(builder.toString()); + } + if (msg.startsWith("PASS")) { + foundPass = true; + } + } + if (!foundPass) { + fail("Did not see PASS from servlet invocation at " + url); + } + + } finally { + br.close(); + } + } + + /** + * This method is used to get a connection stream from an HTTP connection. It + * gives the output from the webpage that it gets from the connection + * + * @param con The connection to the HTTP address + * @return The Output from the webpage + */ + private BufferedReader getConnectionStream(HttpURLConnection con) throws IOException { + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + return br; + } + + /** + * This method creates a connection to a webpage and then reutrns the connection + * + * @param url The Http Address to connect to + * @return The connection to the http address + */ + private HttpURLConnection getHttpConnection(URL url) throws IOException, ProtocolException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + return con; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/FATSuite.java b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/FATSuite.java new file mode 100755 index 000000000000..ecffa18771ea --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/FATSuite.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.runtime.update.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ + ConfigUpdateDeliveryTest.class, + RuntimeQuiesceTest.class +}) +public class FATSuite { + +} diff --git a/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/RuntimeQuiesceTest.java b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/RuntimeQuiesceTest.java new file mode 100755 index 000000000000..88abc830fe4d --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/RuntimeQuiesceTest.java @@ -0,0 +1,246 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.runtime.update.fat; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.ExpectedFFDC; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This class is a little odd: + * We're testing the behavior of server stop. One server will be used for all test methods. + * The server will be started and stopped within each test method, BUT.. + * when the server is stopped within the tests, the logs will not be collected. + * + * The server logs will be collected at the end, in the tearDown. + */ +public class RuntimeQuiesceTest { + private static final Class c = RuntimeQuiesceTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.runtime.quiesce.fat"); + + @Rule + public final TestName method = new TestName(); + + @AfterClass + public static void tearDownClass() throws Exception { + try { + // make sure server is torn down -- don't collect archive + if (server != null && server.isStarted()) { + server.stopServer(false); + } + } finally { + // ONE archive for the whole run (multiple starts/stops of the server) + server.postStopServerArchive(); + } + } + + boolean throwException = false; + boolean takeForever = false; + + @Before + public void setup() { + Log.info(c, method.getMethodName(), "**** ENTER: " + method.getMethodName()); + } + + @After + public void tearDown() throws Exception { + try { + // make sure server is torn down -- don't collect archive + if (server.isStarted()) { + server.stopServer(false); + } + + server.renameLibertyServerRootFile("logs/trace.log", "logs/" + method.getMethodName() + ".trace.log"); + server.renameLibertyServerRootFile("logs/messages.log", "logs/" + method.getMethodName() + ".messages.log"); + server.resetLogOffsets(); + + // Always ensure that the installed resources are cleaned up between runs.. + server.uninstallSystemBundle("test.server.quiesce_1.0.0"); + server.uninstallSystemFeature("quiescelistener-1.0"); + server.uninstallUserBundle("test.server.quiesce_1.0.0"); + server.uninstallUserFeature("quiescelistener-1.0"); + } finally { + Log.info(c, method.getMethodName(), "**** EXIT: " + method.getMethodName()); + } + } + + // Note: methods can execute in any order. We do (sadly) have to clean start the server + // because the same feature and bundle are moved between the system (wlp/lib) and + // the user extension (usr/extension/lib). + + /** + * If there are no quiesce listeners registered (and no pending notifications), we shouldn't + * see any messages about quiesce processing.. + * + * @throws Exception + */ + @Test + public void testNoQuiesceListeners() throws Exception { + + server.setServerConfigurationFile("no-quiesce-listener.server.xml"); + // start the server, do not clean-start, and do not pre-clean the logs dir + server.startServer(method.getMethodName() + ".console.log", true, false); + + // stop the server, do not clean up the archive + server.stopServer(false); + + // These messages flat out shouldn't be in there! + Assert.assertNull("FAIL: for " + method.getMethodName() + ", " + server.getServerName() + " should not contain information about server quiesce", + server.waitForStringInLog("CWWKE1100I", 1)); + } + + /** + * If there are no quiesce listeners registered (and no pending notifications), we shouldn't + * see any messages about quiesce processing.. + * + * @throws Exception + */ + @Test + public void testForceStop() throws Exception { + // Add a single quiesce listener as a runtime feature/bundle (internal) + server.setServerConfigurationFile("quiesce-listener.server.xml"); + server.installSystemBundle("test.server.quiesce_1.0.0"); + server.installSystemFeature("quiescelistener-1.0"); + + // start the server, do not clean-start, and do not pre-clean the logs dir + server.startServer(method.getMethodName() + ".console.log", true, false); + + // stop the server, do not clean up the archive, and FORCE STOP (no queisce) + server.stopServer(false, true); + + // These messages flat out shouldn't be in there! + Assert.assertNull("FAIL: for " + method.getMethodName() + ", " + server.getServerName() + " should not contain information about server quiesce", + server.waitForStringInLog("CWWKE1100I", 1)); + } + + /** + * Define/invoke a runtime-level quiesce listener + * + * @throws Exception + */ + @Test + public void testSingleRuntimeQuiesceListener() throws Exception { + // Add a single quiesce listener as a runtime feature/bundle (internal) + server.setServerConfigurationFile("quiesce-listener.server.xml"); + server.installSystemBundle("test.server.quiesce_1.0.0"); + server.installSystemFeature("quiescelistener-1.0"); + + startStopServer(); + } + + /** + * Make sure a user feature/product extension can provide a quiesce listener + * (SPI is defined properly). + * + * @throws Exception + */ + @Test + public void testSingleUserQuiesceListener() throws Exception { + // Add a single quiesce listener as a usr feature/bundle (SPI) + server.setServerConfigurationFile("user-quiesce-listener.server.xml"); + server.installUserBundle("test.server.quiesce_1.0.0"); + server.installUserFeature("quiescelistener-1.0"); + + startStopServer(); + } + + /** + * Try a quiesce service that throws an exception, and make sure that doesn't + * prevent the quiesce activity from completing. + * + * @throws Exception + */ + @Test + @ExpectedFFDC("java.lang.RuntimeException") + public void testQuiesceListenerException() throws Exception { + // Add a single quiesce listener as a usr feature/bundle (SPI) + server.setServerConfigurationFile("bad-quiesce-listener.server.xml"); + server.installSystemBundle("test.server.quiesce_1.0.0"); + server.installSystemFeature("quiescelistener-1.0"); + + throwException = true; + startStopServer(); + } + + /** + * Long running test (at least 30s), push this into the full bucket. + * This triggers a quiesce listener that takes longer than 30s to complete. + * Make sure we get a warning that not all quiesce activity completed (and that + * we don't see the message indicating that it did). + * + * @throws Exception + */ + @Test + @Mode(TestMode.FULL) + public void testLongRunningQuiesceListener() throws Exception { + // Add a single quiesce listener as a usr feature/bundle (SPI) + server.setServerConfigurationFile("longrunning-quiesce-listener.server.xml"); + server.installSystemBundle("test.server.quiesce_1.0.0"); + server.installSystemFeature("quiescelistener-1.0"); + + takeForever = true; + startStopServer(); + } + + private void startStopServer() throws Exception { + // start the server, do a clean start, and do not pre-clean the logs dir + server.startServer(method.getMethodName() + ".console.log", true, false); + + // wait for port to start + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain info msg about open port", + server.waitForStringInLog("CWWKO0219I", 0)); + + // stop the server, do not clean up the archive + server.setMarkToEndOfLog(server.getDefaultLogFile()); + server.stopServer(false); + + // Make sure stop has completed + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain warning msg about the failure to complete server quiesce", + server.waitForStringInLog("CWWKE0036I")); + + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain info msg about the start of server quiesce", + server.waitForStringInLog("CWWKE1100I", 0)); + + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain WHEE! because the test quiesce listener was called", + server.waitForStringInLog("WHEE!", 0)); + + if (throwException) { + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + + " should contain WOOPS! because the test quiesce listener threw an exception", + server.waitForStringInLog("WOOPS!", 0)); + } + + if (takeForever) { + Assert.assertNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should NOT contain info msg about the completion of server quiesce", + server.waitForStringInLog("CWWKE1101I", 0)); + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain warning msg about the failure to complete server quiesce", + server.waitForStringInLog("CWWKE1102W", 0)); + } else { + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain information about the completion of server quiesce", + server.waitForStringInLog("CWWKE1101I", 0)); + Assert.assertNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should NOT contain information about the failure to complete server quiesce", + server.waitForStringInLog("CWWKE1102W", 0)); + } + } + +} diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/features/quiescelistener-1.0.mf b/dev/com.ibm.ws.runtime.update_fat/publish/features/quiescelistener-1.0.mf new file mode 100755 index 000000000000..a880ebb23787 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/features/quiescelistener-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: quiescelistener-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.server.quiesce; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/bad-quiesce-listener.server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/bad-quiesce-listener.server.xml new file mode 100755 index 000000000000..43519eb45bb4 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/bad-quiesce-listener.server.xml @@ -0,0 +1,12 @@ + + + + servlet-3.0 + quiescelistener-1.0 + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/local-connector-server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/local-connector-server.xml new file mode 100755 index 000000000000..3d6794d516ef --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/local-connector-server.xml @@ -0,0 +1,10 @@ + + + + servlet-3.0 + localConnector-1.0 + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/longrunning-quiesce-listener.server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/longrunning-quiesce-listener.server.xml new file mode 100755 index 000000000000..e46b28115ebc --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/longrunning-quiesce-listener.server.xml @@ -0,0 +1,12 @@ + + + + servlet-3.0 + quiescelistener-1.0 + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/no-quiesce-listener.server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/no-quiesce-listener.server.xml new file mode 100755 index 000000000000..b500ad4a5044 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/no-quiesce-listener.server.xml @@ -0,0 +1,8 @@ + + + + timedexit-1.0 + quiescelistener-1.0 + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/quiesce-listener.server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/quiesce-listener.server.xml new file mode 100755 index 000000000000..7d33a124f991 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/quiesce-listener.server.xml @@ -0,0 +1,10 @@ + + + + servlet-3.0 + quiescelistener-1.0 + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/user-quiesce-listener.server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/user-quiesce-listener.server.xml new file mode 100755 index 000000000000..50996b8a6227 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/user-quiesce-listener.server.xml @@ -0,0 +1,10 @@ + + + + servlet-3.0 + usr:quiescelistener-1.0 + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/bootstrap.properties b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/bootstrap.properties new file mode 100755 index 000000000000..4f1ae5a2e104 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/server.xml new file mode 100755 index 000000000000..009285e6bd00 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/server.xml @@ -0,0 +1,9 @@ + + + + servlet-3.0 + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/bootstrap.properties b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/bootstrap.properties new file mode 100755 index 000000000000..4f1ae5a2e104 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/server.xml new file mode 100755 index 000000000000..009285e6bd00 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/server.xml @@ -0,0 +1,9 @@ + + + + servlet-3.0 + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/META-INF/permissions.xml b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/META-INF/permissions.xml new file mode 100755 index 000000000000..a5ca0dc2ed06 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/META-INF/permissions.xml @@ -0,0 +1,19 @@ + + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + javax.management.MBeanPermission + * + removeNotificationListener + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/WEB-INF/web.xml b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..b3ddded7f602 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/WEB-INF/web.xml @@ -0,0 +1,21 @@ + + + + + MBean + This is a servlet designed to test the command line tools mbean. + + + + MBean Servlet + MBean Servlet + web.MBeanServlet + + + + + + MBean Servlet + /* + + diff --git a/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/src/web/MBeanServlet.java b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/src/web/MBeanServlet.java new file mode 100755 index 000000000000..f00b10734b1e --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/src/web/MBeanServlet.java @@ -0,0 +1,254 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package web; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.management.ManagementFactory; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; + +import javax.management.InstanceNotFoundException; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanServer; +import javax.management.MBeanServerConnection; +import javax.management.MBeanServerDelegate; +import javax.management.MBeanServerNotification; +import javax.management.Notification; +import javax.management.NotificationListener; +import javax.management.ObjectName; +import javax.management.relation.MBeanServerNotificationFilter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.ibm.websphere.runtime.update.RuntimeUpdateNotificationMBean; + +@SuppressWarnings("serial") +public class MBeanServlet extends HttpServlet { + + private static ObjectName MBEAN_NAME; + static { + try { + MBEAN_NAME = new ObjectName(RuntimeUpdateNotificationMBean.OBJECT_NAME); + } catch (Exception e) { + System.out.println("exception while making object name: " + e); + } + } + + public static final String MBeanMessage = "This is a servlet for the RuntimeUpdateNotificationMBean."; + private static final AtomicReference notificationListener = new AtomicReference(); + private static final String PASS = "PASS"; + private static final String FAIL = "FAIL: "; + + /** + * A simple servlet that when it received a request it simply outputs the message + * as defined by the static field. + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + response.setStatus(HttpServletResponse.SC_OK); + response.setContentType("text/plain"); + writer.println(MBeanMessage); + + String test = request.getQueryString(); + + try { + + if (test.equals("setupNotificationListener")) { + setupNotificationListener(writer); + } + else if (test.equals("checkForNotifications")) { + checkForNotifications(writer); + } + else { + writer.println(FAIL + "Unrecognized test name"); + } + + } catch (Exception e) { + writer.println(FAIL + e.getMessage()); + e.printStackTrace(writer); + } + + writer.flush(); + writer.close(); + } + + private void setupNotificationListener(PrintWriter writer) throws Exception { + MBeanServer mbs = getMBS(); + MBeanRegistrationCheckAndWait.waitForRegistrationForMBean(mbs, MBEAN_NAME); + RuntimeUpdateNotificationListener listener = new RuntimeUpdateNotificationListener(); + notificationListener.set(listener); + mbs.addNotificationListener(MBEAN_NAME, listener, null, null); + writer.println(PASS); + } + + private void checkForNotifications(PrintWriter writer) throws Exception { + final RuntimeUpdateNotificationListener listener = notificationListener.get(); + if (listener == null) { + writer.println(FAIL + "The notification listener stored in the servlet is null."); + return; + } + notificationListener.set(null); + try { + final boolean latchReleased = waitOnLatchRelease(listener); + if (!latchReleased) { + writer.println(FAIL + "ConfigUpdatesDelivered notification was not received."); + return; + } + if (!listener.configUpdatesDelivered()) { + writer.println(FAIL + "ConfigUpdatesDelivered notification was received but the server.xml updates did not complete successfully."); + return; + } + } + finally { + MBeanServer mbs = getMBS(); + try { + mbs.removeNotificationListener(MBEAN_NAME, listener); + } + // No listener was registered. Ignore it. + catch (ListenerNotFoundException e) {} + } + writer.println(PASS); + } + + private boolean waitOnLatchRelease(RuntimeUpdateNotificationListener listener) { + boolean done = false; + boolean countDownLatchReachZero = false; + do { + try { + countDownLatchReachZero = listener.latchForListener.await(120, TimeUnit.SECONDS); + done = true; + } catch (InterruptedException e) { + } + } while (!done); + return countDownLatchReachZero; + } + + private MBeanServer getMBS() { + return ManagementFactory.getPlatformMBeanServer(); + } + + public static class RuntimeUpdateNotificationListener implements NotificationListener { + + private boolean configUpdatesDelivered = false; + public final CountDownLatch latchForListener = new CountDownLatch(1); + + @Override + public synchronized void handleNotification(Notification notification, Object handback) { + if (RuntimeUpdateNotificationMBean.RUNTIME_UPDATE_NOTIFICATION_TYPE.equals(notification.getType()) && latchForListener.getCount() > 0) { + // UserData for "com.ibm.websphere.runtime.update.notification" type will always be a Map + @SuppressWarnings("unchecked") + Map userData = (Map)notification.getUserData(); + // Filter on runtime update notifications with the "ConfigUpdatesDelivered" name. + if (userData != null && + "ConfigUpdatesDelivered".equals(userData.get(RuntimeUpdateNotificationMBean.RUNTIME_UPDATE_NOTIFICATION_KEY_NAME))) { + configUpdatesDelivered = Boolean.TRUE.equals(userData.get(RuntimeUpdateNotificationMBean.RUNTIME_UPDATE_NOTIFICATION_KEY_STATUS)); + configUpdatesDelivered = configUpdatesDelivered && + userData.get(RuntimeUpdateNotificationMBean.RUNTIME_UPDATE_NOTIFICATION_KEY_MESSAGE) == null; + latchForListener.countDown(); + } + } + } + public boolean configUpdatesDelivered() { + return configUpdatesDelivered; + } + } + + public static class MBeanServerNotificationListener implements NotificationListener { + + private boolean registered = false; + public final CountDownLatch latchForListener = new CountDownLatch(1); + + @Override + public void handleNotification(Notification notification, Object handback) { + if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notification.getType())) { + registered = true; + latchForListener.countDown(); + } + } + public boolean isRegistered() { + return registered; + } + } + + public static class MBeanRegistrationCheckAndWait { + + public static void waitForRegistrationForMBean(MBeanServerConnection mbsc, ObjectName objName) throws InstanceNotFoundException, IOException { + (new MBeanRegistrationCheckAndWait()).waitOnMBeanRegistration(mbsc, objName); + } + + private MBeanServerNotificationListener listener; + + private MBeanRegistrationCheckAndWait() {} + + private boolean waitOnLatchRelease(MBeanServerNotificationListener listener) { + boolean done = false; + boolean countDownLatchReachZero = false; + do { + try { + countDownLatchReachZero = listener.latchForListener.await(120, TimeUnit.SECONDS); + done = true; + } catch (InterruptedException e) { + } + } while (!done); + return countDownLatchReachZero; + } + + private synchronized boolean needToWaitForListener(MBeanServerConnection mbsc, ObjectName objName) throws IOException, InstanceNotFoundException { + + listener = new MBeanServerNotificationListener(); + // MBeanServerDelegate.DELEGATE_NAME; + MBeanServerNotificationFilter registerFilter = new MBeanServerNotificationFilter(); + registerFilter.enableObjectName(objName); + registerFilter.disableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION); + + mbsc.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener, registerFilter, null); + // check again right after the listener is added + if (mbsc.isRegistered(objName)) { + return false; + } + return true; + } + + private void waitOnMBeanRegistration(MBeanServerConnection mbsc, ObjectName objName) throws InstanceNotFoundException, IOException { + if (mbsc.isRegistered(objName)) { + return; + } + try { + boolean waitForListener = needToWaitForListener(mbsc, objName); + if (!waitForListener) { + return; + } + if (!waitOnLatchRelease(listener)) { + String exMessage = "The MBean with object name" + objName + ", cannot be registered."; + throw new IOException(exMessage); + } + } + finally { + if (listener != null) { + try { + mbsc.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener); + listener = null; + } + // No listener was registered. Ignore it. + catch (ListenerNotFoundException e) {} + } + } + } + } +} diff --git a/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/bnd.bnd b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/bnd.bnd new file mode 100755 index 000000000000..88799b4d7be3 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/bnd.bnd @@ -0,0 +1,19 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test bundle providing a quiesce listener +Bundle-SymbolicName: test.server.quiesce +Bundle-Description: Test bundle providing a server quiesce listener; version=${bVersion} + +# hide the implementation packages +Private-Package: \ + test.server.quiesce + +-dsannotations: \ + test.server.quiesce.TestQuiesceListener + +# test bundle build scripts copy things in the resources directory to the classpath.. +Include-Resource: \ + OSGI-INF=resources/OSGI-INF diff --git a/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/resources/OSGI-INF/metatype/metatype.xml b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/resources/OSGI-INF/metatype/metatype.xml new file mode 100755 index 000000000000..351c5b9fa20a --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/resources/OSGI-INF/metatype/metatype.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/src/test/server/quiesce/TestQuiesceListener.java b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/src/test/server/quiesce/TestQuiesceListener.java new file mode 100755 index 000000000000..5907c7669522 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/src/test/server/quiesce/TestQuiesceListener.java @@ -0,0 +1,57 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.quiesce; + +import java.util.Map; + +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; + +import com.ibm.wsspi.kernel.service.utils.ServerQuiesceListener; + +/** + * + */ +@Component(immediate = true, configurationPid = "test.server.quiesce") +public class TestQuiesceListener implements ServerQuiesceListener { + + boolean throwException = false; + boolean takeForever = false; + + @Activate + protected void activate(Map newConfig) { + System.out.println("TEST CONFIGURATION: " + newConfig); + + throwException = (Boolean) newConfig.get("throwException"); + takeForever = (Boolean) newConfig.get("takeForever"); + } + + @Override + public void serverStopping() { + + System.out.println("WHEE! THE SERVER IS STOPPING AND I GOT TOLD!"); + + if (throwException) { + throw new RuntimeException("WOOPS! I was told to do this, honest."); + } + + if (takeForever) { + System.out.println("MUAHAHA.. I will now take forever to quiesce (literally)!"); + + //Rather than deal with slow hardware or possible timing windows, just wait forever + //The server will still stop. But this gives it ample time to get to the timeout + //without having to worry about failures that aren't really failures + //This now relies on the quiesce thread pool to hit the timeout and shutdown + while (true) {} + } + } +} diff --git a/dev/com.ibm.ws.runtime.update_test/.classpath b/dev/com.ibm.ws.runtime.update_test/.classpath index 9f7d66da4719..bd880329225d 100755 --- a/dev/com.ibm.ws.runtime.update_test/.classpath +++ b/dev/com.ibm.ws.runtime.update_test/.classpath @@ -1,23 +1,7 @@ - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.runtime.update_test/.classpath.gradle b/dev/com.ibm.ws.runtime.update_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_test/.project b/dev/com.ibm.ws.runtime.update_test/.project index 83d581d47e86..2faa4752be93 100755 --- a/dev/com.ibm.ws.runtime.update_test/.project +++ b/dev/com.ibm.ws.runtime.update_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.runtime.update_test/bnd.bnd b/dev/com.ibm.ws.runtime.update_test/bnd.bnd new file mode 100755 index 000000000000..cc5c746fafb9 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_test/bnd.bnd @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.ws.threading;version=latest, \ + com.ibm.ws.runtime.update;version=latest diff --git a/dev/com.ibm.ws.runtime.update_test/bnd.bnd.gradle b/dev/com.ibm.ws.runtime.update_test/bnd.bnd.gradle new file mode 100755 index 000000000000..cc5c746fafb9 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_test/bnd.bnd.gradle @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.ws.threading;version=latest, \ + com.ibm.ws.runtime.update;version=latest diff --git a/dev/com.ibm.ws.runtime.update_test/build.gradle b/dev/com.ibm.ws.runtime.update_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/.classpath b/dev/com.ibm.ws.security.thread.zos.hooks/.classpath new file mode 100644 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/.classpath.gradle b/dev/com.ibm.ws.security.thread.zos.hooks/.classpath.gradle new file mode 100644 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/.gitignore b/dev/com.ibm.ws.security.thread.zos.hooks/.gitignore new file mode 100644 index 000000000000..9b1c8b133c96 --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/.gitignore @@ -0,0 +1 @@ +/dist diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/.project b/dev/com.ibm.ws.security.thread.zos.hooks/.project new file mode 100644 index 000000000000..44bae270af9a --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.security.thread.zos.hooks + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.security.thread.zos.hooks/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000000..169aea7eabe7 --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Wed Aug 17 16:19:12 BST 2011 +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.security.thread.zos.hooks/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000000..95719ae3709c --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.security.thread.zos.hooks/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000000..13e9e1f92c53 --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,116 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.remove_trailing_whitespaces=true +cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.add_missing_nls_tags=false +org.eclipse.jdt.ui.staticondemandthreshold=99 +cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_blocks=false +sp_cleanup.make_private_fields_final=true +org.eclipse.jdt.ui.ignorelowercasenames=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.remove_private_constructors=true +sp_cleanup.never_use_parentheses_in_expressions=true +cleanup.remove_unnecessary_casts=true +sp_cleanup.organize_imports=true +sp_cleanup.never_use_blocks=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_fields=true +org.eclipse.jdt.ui.text.custom_code_templates= +cleanup.always_use_parentheses_in_expressions=false +cleanup.use_parentheses_in_expressions=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.always_use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.correct_indentation=true +cleanup.make_private_fields_final=false +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.correct_indentation=false +cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +org.eclipse.jdt.ui.ondemandthreshold=99 +sp_cleanup.sort_members_all=false +sp_cleanup.use_this_for_non_static_field_access=false +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +org.eclipse.jdt.ui.exception.name=e +sp_cleanup.format_source_code=true +org.eclipse.jdt.ui.javadoc=true +cleanup.format_source_code=false +cleanup.remove_unused_imports=true +cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_methods=true +cleanup.add_missing_annotations=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_private_methods=true +cleanup.always_use_this_for_non_static_method_access=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.sort_members=false +sp_cleanup.use_parentheses_in_expressions=false +cleanup.add_missing_override_annotations=true +org.eclipse.jdt.ui.gettersetter.use.is=false +cleanup.convert_to_enhanced_for_loop=false +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.overrideannotation=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.add_missing_annotations=true +cleanup.make_variable_declarations_final=false +cleanup.remove_unused_private_types=true +cleanup.use_blocks=true +cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.remove_unused_imports=true +cleanup.add_missing_deprecated_annotations=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.convert_to_enhanced_for_loop=false +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.sort_members=false +sp_cleanup.remove_unused_private_members=false +org.eclipse.jdt.ui.importorder=java;javax;org;com; +cleanup.remove_unused_private_members=false +sp_cleanup.format_source_code_changes_only=false +cleanup.never_use_blocks=false +cleanup.organize_imports=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_generated_serial_version_id=false +cleanup.make_parameters_final=true +org.eclipse.jdt.ui.keywordthis=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.always_use_blocks=true +cleanup.add_serial_version_id=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.always_use_blocks=true +cleanup.remove_unused_local_variables=false +cleanup.sort_members_all=false +sp_cleanup.remove_trailing_whitespaces=true +cleanup.format_source_code_changes_only=false +cleanup.add_generated_serial_version_id=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.remove_private_constructors=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_local_variable_final=false +cleanup.make_local_variable_final=false +sp_cleanup.add_serial_version_id=false +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.add_default_serial_version_id=false +cleanup.add_missing_methods=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.add_missing_methods=false diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/bnd.bnd b/dev/com.ibm.ws.security.thread.zos.hooks/bnd.bnd new file mode 100644 index 000000000000..2707f4042051 --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/bnd.bnd @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: Thread Identity Module Adapter +Bundle-SymbolicName: com.ibm.ws.security.thread.zos.hooks +Bundle-Description: Thread Identity Module Adapter for loading bundles + +Private-Package: com.ibm.ws.security.thread.zos.hooks.internal + +Fragment-Host: org.eclipse.osgi +Import-Package: !* + +Include-Resource: \ + hookconfigurators.properties=resources/hookconfigurators.properties + +-buildpath: \ + org.eclipse.osgi;version=latest, \ + com.ibm.ws.kernel.security.thread;version=latest diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/build.gradle b/dev/com.ibm.ws.security.thread.zos.hooks/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/build.xml b/dev/com.ibm.ws.security.thread.zos.hooks/build.xml new file mode 100644 index 000000000000..057b18fda7d1 --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/build.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/resources/hookconfigurators.properties b/dev/com.ibm.ws.security.thread.zos.hooks/resources/hookconfigurators.properties new file mode 100644 index 000000000000..686f97deefa9 --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/resources/hookconfigurators.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2005, 2010 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +hook.configurators= \ + com.ibm.ws.security.thread.zos.hooks.internal.ThreadIdentityBundleFileWrapperFactoryHook diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/src/com/ibm/ws/security/thread/zos/hooks/internal/ThreadIdentityBundleFileWrapper.java b/dev/com.ibm.ws.security.thread.zos.hooks/src/com/ibm/ws/security/thread/zos/hooks/internal/ThreadIdentityBundleFileWrapper.java new file mode 100644 index 000000000000..3a562075ba7c --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/src/com/ibm/ws/security/thread/zos/hooks/internal/ThreadIdentityBundleFileWrapper.java @@ -0,0 +1,113 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.security.thread.zos.hooks.internal; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.Enumeration; + +import org.eclipse.osgi.container.Module; +import org.eclipse.osgi.storage.bundlefile.BundleEntry; +import org.eclipse.osgi.storage.bundlefile.BundleFile; +import org.eclipse.osgi.storage.bundlefile.BundleFileWrapper; + +import com.ibm.ws.kernel.security.thread.ThreadIdentityManager; + +/** + * BundleFileWrapper used to wrap OSGi bundles so that bundle access operations are done as the server identity. + */ +public class ThreadIdentityBundleFileWrapper extends BundleFileWrapper { + public ThreadIdentityBundleFileWrapper(BundleFile bundleFile) { + super(bundleFile); + } + + @Override + public File getFile(String path, boolean nativeCode) { + Object token = ThreadIdentityManager.runAsServer(); + try { + return super.getFile(path, nativeCode); + } finally { + ThreadIdentityManager.reset(token); + } + } + + @Override + public BundleEntry getEntry(String path) { + Object token = ThreadIdentityManager.runAsServer(); + try { + return super.getEntry(path); + } finally { + ThreadIdentityManager.reset(token); + } + } + + @Override + public Enumeration getEntryPaths(String path) { + Object token = ThreadIdentityManager.runAsServer(); + try { + return super.getEntryPaths(path); + } finally { + ThreadIdentityManager.reset(token); + } + } + + @Override + public Enumeration getEntryPaths(String path, boolean recurse) { + Object token = ThreadIdentityManager.runAsServer(); + try { + return super.getEntryPaths(path, recurse); + } finally { + ThreadIdentityManager.reset(token); + } + } + + @Override + public void close() throws IOException { + Object token = ThreadIdentityManager.runAsServer(); + try { + super.close(); + } finally { + ThreadIdentityManager.reset(token); + } + } + + @Override + public void open() throws IOException { + Object token = ThreadIdentityManager.runAsServer(); + try { + super.open(); + } finally { + ThreadIdentityManager.reset(token); + } + } + + @Override + public boolean containsDir(String dir) { + Object token = ThreadIdentityManager.runAsServer(); + try { + return super.containsDir(dir); + } finally { + ThreadIdentityManager.reset(token); + } + } + + @Override + protected URL createResourceURL(BundleEntry bundleEntry, Module hostModule, int index, String path) { + Object token = ThreadIdentityManager.runAsServer(); + try { + return super.createResourceURL(bundleEntry, hostModule, index, path); + } finally { + ThreadIdentityManager.reset(token); + } + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.security.thread.zos.hooks/src/com/ibm/ws/security/thread/zos/hooks/internal/ThreadIdentityBundleFileWrapperFactoryHook.java b/dev/com.ibm.ws.security.thread.zos.hooks/src/com/ibm/ws/security/thread/zos/hooks/internal/ThreadIdentityBundleFileWrapperFactoryHook.java new file mode 100644 index 000000000000..e6a5b3926565 --- /dev/null +++ b/dev/com.ibm.ws.security.thread.zos.hooks/src/com/ibm/ws/security/thread/zos/hooks/internal/ThreadIdentityBundleFileWrapperFactoryHook.java @@ -0,0 +1,31 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* WLP Copyright IBM Corp. 2016 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.security.thread.zos.hooks.internal; + +import org.eclipse.osgi.internal.hookregistry.BundleFileWrapperFactoryHook; +import org.eclipse.osgi.internal.hookregistry.HookConfigurator; +import org.eclipse.osgi.internal.hookregistry.HookRegistry; +import org.eclipse.osgi.storage.BundleInfo.Generation; +import org.eclipse.osgi.storage.bundlefile.BundleFile; +import org.eclipse.osgi.storage.bundlefile.BundleFileWrapper; + +public class ThreadIdentityBundleFileWrapperFactoryHook implements BundleFileWrapperFactoryHook, HookConfigurator { + @Override + public void addHooks(HookRegistry hookRegistry) { + hookRegistry.addBundleFileWrapperFactoryHook(this); + } + + @Override + public BundleFileWrapper wrapBundleFile(final BundleFile bundleFile, final Generation generation, final boolean base) { + return new ThreadIdentityBundleFileWrapper(bundleFile); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.security.utility_bvt/.classpath b/dev/com.ibm.ws.security.utility_bvt/.classpath index e3fa0a94441e..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.security.utility_bvt/.classpath +++ b/dev/com.ibm.ws.security.utility_bvt/.classpath @@ -1,15 +1,7 @@ - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.security.utility_bvt/.classpath.gradle b/dev/com.ibm.ws.security.utility_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.security.utility_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.security.utility_bvt/.project b/dev/com.ibm.ws.security.utility_bvt/.project index 7612c477e84a..4f273b3f6cfc 100755 --- a/dev/com.ibm.ws.security.utility_bvt/.project +++ b/dev/com.ibm.ws.security.utility_bvt/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.security.utility_bvt/bnd.bnd b/dev/com.ibm.ws.security.utility_bvt/bnd.bnd new file mode 100755 index 000000000000..35ad2fb0cabb --- /dev/null +++ b/dev/com.ibm.ws.security.utility_bvt/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.security.utility;version=latest diff --git a/dev/com.ibm.ws.security.utility_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.security.utility_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..35ad2fb0cabb --- /dev/null +++ b/dev/com.ibm.ws.security.utility_bvt/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.security.utility;version=latest diff --git a/dev/com.ibm.ws.security.utility_bvt/build.gradle b/dev/com.ibm.ws.security.utility_bvt/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.security.utility_fat/.classpath b/dev/com.ibm.ws.security.utility_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.security.utility_fat/.classpath.gradle b/dev/com.ibm.ws.security.utility_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.security.utility_fat/.gitignore b/dev/com.ibm.ws.security.utility_fat/.gitignore new file mode 100644 index 000000000000..3c46c3e084e6 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.gitignore @@ -0,0 +1,2 @@ +/bootstrapping.properties +/publish diff --git a/dev/com.ibm.ws.security.utility_fat/.project b/dev/com.ibm.ws.security.utility_fat/.project new file mode 100755 index 000000000000..0f96aa7f641c --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.security.utility_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c92277a371a9 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.security.utility_fat/bnd.bnd b/dev/com.ibm.ws.security.utility_fat/bnd.bnd new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.security.utility_fat/bnd.bnd.gradle b/dev/com.ibm.ws.security.utility_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.security.utility_fat/build-test.xml b/dev/com.ibm.ws.security.utility_fat/build-test.xml new file mode 100755 index 000000000000..759686ab2f83 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/build-test.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.security.utility_fat/build.gradle b/dev/com.ibm.ws.security.utility_fat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/FATSuite.java b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/FATSuite.java new file mode 100755 index 000000000000..f111fd394c72 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/FATSuite.java @@ -0,0 +1,25 @@ +package com.ibm.ws.security.utility.test; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ SecurityUtilityEncodeTest.class }) +/** + * Purpose: This suite collects and runs all known good test suites. + */ +public class FATSuite { + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityEncodeTest.java b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityEncodeTest.java new file mode 100755 index 000000000000..44cc52e2c12c --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityEncodeTest.java @@ -0,0 +1,122 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.security.utility.test; + +import java.util.Arrays; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class SecurityUtilityEncodeTest { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("PasswordUtilityEncodeTest"); + private final static String CUSTOM_PASSWORD_ENCRYPTION_BUNDLE_NAME = "com.ibm.websphere.crypto.sample.customencryption_1.0"; + private final static String CUSTOM_PASSWORD_ENCRYPTION_FEATURE_NAME = "customEncryption-1.0"; + private final static String CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_ROOT = "bin/tools/extensions"; + private final static String CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_PATH = CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_ROOT + "/ws-customPasswordEncryption"; + private final static String CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_NAME = "customEncryption.jar"; + private final static String PROPERTY_KEY_INSTALL_DIR = "install.dir"; + private static String installDir = null; + + /** + * Updates the sample, which is expected to be at the hard-coded path. + * If this test is failing, check this path is correct. + */ + @BeforeClass + public static void setUp() throws Exception { + server.installUserBundle(CUSTOM_PASSWORD_ENCRYPTION_BUNDLE_NAME); + server.installUserFeature(CUSTOM_PASSWORD_ENCRYPTION_FEATURE_NAME); + server.installUserFeatureL10N(CUSTOM_PASSWORD_ENCRYPTION_FEATURE_NAME); + server.copyFileToLibertyInstallRoot(CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_PATH, CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_NAME); + installDir = System.setProperty(PROPERTY_KEY_INSTALL_DIR, server.getInstallRoot()); + } + + @AfterClass + public static void tearDown() throws Exception { + server.uninstallUserBundle(CUSTOM_PASSWORD_ENCRYPTION_BUNDLE_NAME); + server.uninstallUserFeature(CUSTOM_PASSWORD_ENCRYPTION_FEATURE_NAME); + server.uninstallUserFeatureL10N(CUSTOM_PASSWORD_ENCRYPTION_FEATURE_NAME); + server.deleteDirectoryFromLibertyInstallRoot(CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_ROOT); + if (installDir == null) { + System.clearProperty(PROPERTY_KEY_INSTALL_DIR); + } else { + System.setProperty(PROPERTY_KEY_INSTALL_DIR, installDir); + } + } + + /** + * Tests that the help text contains the custom encryption feature name + * if the custom password encryption is installed. + */ + @Test + public void testCustomHelp() throws Exception { + // load custom.. + List output = SecurityUtilityScriptUtils.execute(null, Arrays.asList("help", "encode")); + Assert.assertTrue("Help for encode should contain custom encoding feature name.", + SecurityUtilityScriptUtils.findMatchingLine(output, "\\s*usr:customEncryption-1.0*")); + } + + /** + * Tests that the listCustom option + */ + @Test + public void testListCustom() throws Exception { + String expected = "\\[\\{\"name\"\\:\"custom\"\\,\"featurename\"\\:\"usr\\:customEncryption-1\\.0\"\\,\"description\"\\:\"this sample custom encryption code uses AES encryption with the predefined key\\.\"\\}\\]"; + + List output = SecurityUtilityScriptUtils.execute(null, Arrays.asList("encode", "--listCustom")); + Assert.assertTrue("The output contains the contents of listCustom", SecurityUtilityScriptUtils.findMatchingLine(output, expected)); + } + + /** + * Tests that the password is being encrypted by using the custom encryption. + */ + @Test + public void testCustomEncode() throws Exception { + final String textToEncode = "textToEncode"; + final String encodedText = "\\{xor\\}KzonKwswGjE8MDs6"; + final String customEncodedText = "\\{custom\\}NkshbYjxhL2z1Yc5dv\\+wDg\\=\\="; + + // make sure that the default is still xor. + List output = SecurityUtilityScriptUtils.execute(null, Arrays.asList("encode", textToEncode)); + Assert.assertTrue("encode arg result", SecurityUtilityScriptUtils.findMatchingLine(output, encodedText)); + + // Now try custom. + output = SecurityUtilityScriptUtils.execute(null, Arrays.asList("encode", "--encoding=custom", textToEncode)); + Assert.assertTrue("encode arg result", SecurityUtilityScriptUtils.findMatchingLine(output, customEncodedText)); + } + + /** + * Tests that the appropriate error is reported when the code detects the error condition. + * Some negative tests have done by the bvt, so in here run some additional test to broaden the coverage. + * The English locale is used for this test since the error messages might be translated. + */ + @Test + public void testEncodeError() throws Exception { + final String invalidArgument = "Error: Invalid argument --unknown."; + final String invalidAlgorithm = "com.ibm.websphere.crypto.UnsupportedCryptoAlgorithmException"; + + // check invalid argument error. + List output = SecurityUtilityScriptUtils.execute(Arrays.asList(new SecurityUtilityScriptUtils.EnvVar("JVM_ARGS", "-Duser.language=en")), + Arrays.asList("encode", "--unknown=invalid", "aaa"), true); + Assert.assertTrue("The invalid argument message should be reported.", SecurityUtilityScriptUtils.findMatchingLine(output, invalidArgument)); + + // check invalid encoding error. + output = SecurityUtilityScriptUtils.execute(Arrays.asList(new SecurityUtilityScriptUtils.EnvVar("JVM_ARGS", "-Duser.language=en")), + Arrays.asList("encode", "--encoding=invalid", "aaa"), true); + Assert.assertTrue("The UnsupportedCryptoAlgorithmException should be reported.", SecurityUtilityScriptUtils.findMatchingLine(output, invalidAlgorithm)); + } +} diff --git a/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityScriptUtils.java b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityScriptUtils.java new file mode 100755 index 000000000000..9c03e24fbd1c --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityScriptUtils.java @@ -0,0 +1,166 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.security.utility.test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.regex.Pattern; + +public class SecurityUtilityScriptUtils { + /** + * Install directory property set by bvt.xml. + */ + private static final String WLP_INSTALL_DIR = System.getProperty("install.dir"); + + /** + * True if running on Windows and the .bat file should be used. + */ + private static final boolean isWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win"); + + /** + * Environment variable that can be set to test the UNIX script on Windows. + */ + private static final String WLP_CYGWIN_HOME = System.getenv("WLP_CYGWIN_HOME"); + + protected static class EnvVar { + String name; + final String value; + + EnvVar(String name, String value) { + this.name = name; + this.value = value; + } + } + + protected static List execute(List envVars, List args) throws IOException, InterruptedException { + return execute(envVars, args, false); + } + + protected static List execute(List envVars, List args, boolean ignoreError) throws IOException, InterruptedException { + if (envVars == null) { + envVars = Collections.emptyList(); + } + + List command = new ArrayList(); + if (isWindows && WLP_CYGWIN_HOME == null) { + command.add(WLP_INSTALL_DIR + "/bin/securityUtility.bat"); + } else { + if (WLP_CYGWIN_HOME == null) { + command.add("/bin/sh"); + } else { + command.add(WLP_CYGWIN_HOME + "/bin/sh"); + } + command.add("-x"); + command.add(WLP_INSTALL_DIR + "/bin/securityUtility"); + } + command.addAll(args); + + System.out.println("Executing " + command); + for (EnvVar envVar : envVars) { + System.out.println(" " + envVar.name + '=' + envVar.value); + } + + ProcessBuilder builder = new ProcessBuilder(); + builder.command(command); + for (EnvVar envVar : envVars) { + builder.environment().put(envVar.name, envVar.value); + } + + final Process p = builder.start(); + List output = new ArrayList(); + + Thread stderrCopier = new Thread(new OutputStreamCopier(p.getErrorStream(), output)); + stderrCopier.start(); + new OutputStreamCopier(p.getInputStream(), output).run(); + + stderrCopier.join(); + p.waitFor(); + + if (!ignoreError) { + int exitValue = p.exitValue(); + if (exitValue != 0) { + throw new IOException(command.get(0) + " failed (" + exitValue + "): " + output); + } + } + + return output; + } + + private static class OutputStreamCopier implements Runnable { + private final InputStream in; + private final List output; + + OutputStreamCopier(InputStream in, List lines) { + this.in = in; + this.output = lines; + } + + @Override + public void run() { + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + boolean inEval = false; + int carryover = 0; + + for (String line; (line = reader.readLine()) != null;) { + // Filter empty lines and sh -x trace output. + if (inEval) { + System.out.println("(trace eval) " + line); + if (line.trim().equals("'")) { + inEval = false; + } + } else if (line.equals("+ eval '")) { + inEval = true; + System.out.println("(trace eval) " + line); + } else if (carryover > 0) { + carryover--; + System.out.println("(trace) " + line); + } else if (line.startsWith("+") || line.equals("'")) { + int index = 0; + index = line.indexOf("+", index + 1); + while (index != -1) { + index = line.indexOf("+", index + 1); + carryover++; + } + System.out.println("(trace) " + line); + } else if (!line.isEmpty()) { + synchronized (output) { + output.add(line); + } + System.out.println(line); + } + } + } catch (IOException ex) { + throw new Error(ex); + } + } + } + + protected static boolean findMatchingLine(List lines, String regex) { + Pattern pattern = Pattern.compile(regex); + for (String line : lines) { + if (pattern.matcher(line).matches()) { + System.out.println("Found line matching regex " + regex + ": " + line); + return true; + } + } + + System.out.println("Did not find line matching " + regex); + return false; + } +} diff --git a/dev/com.ibm.ws.security.utility_test/.classpath b/dev/com.ibm.ws.security.utility_test/.classpath index 0dbd57590556..bd880329225d 100755 --- a/dev/com.ibm.ws.security.utility_test/.classpath +++ b/dev/com.ibm.ws.security.utility_test/.classpath @@ -1,14 +1,7 @@ - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.security.utility_test/.classpath.gradle b/dev/com.ibm.ws.security.utility_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.security.utility_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.security.utility_test/.project b/dev/com.ibm.ws.security.utility_test/.project index d084593efe7c..65c5764cae6a 100755 --- a/dev/com.ibm.ws.security.utility_test/.project +++ b/dev/com.ibm.ws.security.utility_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.security.utility_test/bnd.bnd b/dev/com.ibm.ws.security.utility_test/bnd.bnd new file mode 100755 index 000000000000..8f9b855da38c --- /dev/null +++ b/dev/com.ibm.ws.security.utility_test/bnd.bnd @@ -0,0 +1,21 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6},\ + ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file,\ + ../build.sharedResources/lib/hamcrest-all.jar;version=file,\ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file,\ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file,\ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file,\ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file,\ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file,\ + com.ibm.ws.crypto.certificateutil;version=latest,\ + com.ibm.ws.crypto.ltpakeyutil;version=latest,\ + com.ibm.ws.security.utility;version=latest diff --git a/dev/com.ibm.ws.security.utility_test/bnd.bnd.gradle b/dev/com.ibm.ws.security.utility_test/bnd.bnd.gradle new file mode 100755 index 000000000000..8f9b855da38c --- /dev/null +++ b/dev/com.ibm.ws.security.utility_test/bnd.bnd.gradle @@ -0,0 +1,21 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6},\ + ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file,\ + ../build.sharedResources/lib/hamcrest-all.jar;version=file,\ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file,\ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file,\ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file,\ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file,\ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file,\ + com.ibm.ws.crypto.certificateutil;version=latest,\ + com.ibm.ws.crypto.ltpakeyutil;version=latest,\ + com.ibm.ws.security.utility;version=latest diff --git a/dev/com.ibm.ws.security.utility_test/build.gradle b/dev/com.ibm.ws.security.utility_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.threading_bvt/.classpath b/dev/com.ibm.ws.threading_bvt/.classpath index 8792f9439a1a..c8c4cd4a46ce 100755 --- a/dev/com.ibm.ws.threading_bvt/.classpath +++ b/dev/com.ibm.ws.threading_bvt/.classpath @@ -1,13 +1,7 @@ - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.threading_bvt/.classpath.gradle b/dev/com.ibm.ws.threading_bvt/.classpath.gradle new file mode 100644 index 000000000000..c8c4cd4a46ce --- /dev/null +++ b/dev/com.ibm.ws.threading_bvt/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.threading_bvt/.project b/dev/com.ibm.ws.threading_bvt/.project index 369105822086..7f346df88b17 100755 --- a/dev/com.ibm.ws.threading_bvt/.project +++ b/dev/com.ibm.ws.threading_bvt/.project @@ -11,13 +11,13 @@ - com.ibm.ws.rasplugin.RASValidationBuilder + bndtools.core.bndbuilder org.eclipse.jdt.core.javanature - com.ibm.ws.rasplugin.RASValidationNature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.threading_bvt/bnd.bnd b/dev/com.ibm.ws.threading_bvt/bnd.bnd new file mode 100755 index 000000000000..df45604f2727 --- /dev/null +++ b/dev/com.ibm.ws.threading_bvt/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.threading;version=latest diff --git a/dev/com.ibm.ws.threading_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.threading_bvt/bnd.bnd.gradle new file mode 100755 index 000000000000..df45604f2727 --- /dev/null +++ b/dev/com.ibm.ws.threading_bvt/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.threading;version=latest diff --git a/dev/com.ibm.ws.threading_bvt/build.gradle b/dev/com.ibm.ws.threading_bvt/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.threading_fat/.classpath b/dev/com.ibm.ws.threading_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.threading_fat/.classpath.gradle b/dev/com.ibm.ws.threading_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.threading_fat/.gitignore b/dev/com.ibm.ws.threading_fat/.gitignore new file mode 100644 index 000000000000..27e131e35a6b --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.threading_fat/.project b/dev/com.ibm.ws.threading_fat/.project new file mode 100755 index 000000000000..6a2c872c2af4 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.threading_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c92277a371a9 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.threading_fat/bnd.bnd b/dev/com.ibm.ws.threading_fat/bnd.bnd new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.threading_fat/bnd.bnd.gradle b/dev/com.ibm.ws.threading_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.threading_fat/build-test.xml b/dev/com.ibm.ws.threading_fat/build-test.xml new file mode 100755 index 000000000000..fca9f1ee710d --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/build-test.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/build.gradle b/dev/com.ibm.ws.threading_fat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.threading_fat/delivery.sets b/dev/com.ibm.ws.threading_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/FATSuite.java b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/FATSuite.java new file mode 100755 index 000000000000..1330a7c7d0a4 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/FATSuite.java @@ -0,0 +1,75 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.threading.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Collection of all example tests + */ +@RunWith(Suite.class) +/* + * The classes specified in the @SuiteClasses annotation + * below should represent all of the test cases for this FAT. + */ +@SuiteClasses({ ThreadingExtensionFAT.class, MemLeakTest.class }) +public class FATSuite { + static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.threading_fat_server"); + + /** + * Installs any custom features necessary for this test. + * + * @throws Exception + */ + @BeforeClass + public static void installTestFeatures() throws Exception { + server.copyFileToLibertyInstallRoot("lib/features/", "features/threadingTestFeature-1.0.mf"); + assertTrue("threadingTestFeature-1.0.mf should have been copied to lib/features", + server.fileExistsInLibertyInstallRoot("lib/features/threadingTestFeature-1.0.mf")); + server.copyFileToLibertyInstallRoot("lib/", "bundles/test.bundle.threading_1.0.0.jar"); + assertTrue("test.bundle.threading_1.0.0.jar should have been copied to lib", + server.fileExistsInLibertyInstallRoot("lib/test.bundle.threading_1.0.0.jar")); + + server.copyFileToLibertyInstallRoot("lib/features/", "features/threadingMemLeakTestFeature-1.0.mf"); + assertTrue("threadingMemLeakTestFeature-1.0.mf should have been copied to lib/features", + server.fileExistsInLibertyInstallRoot("lib/features/threadingMemLeakTestFeature-1.0.mf")); + server.copyFileToLibertyInstallRoot("lib/", "bundles/test.bundle.threading.memleak_1.0.0.jar"); + assertTrue("test.bundle.threading.memleak_1.0.0.jar should have been copied to lib", + server.fileExistsInLibertyInstallRoot("lib/test.bundle.threading.memleak_1.0.0.jar")); + } + + @AfterClass + public static void removeTestFeatures() throws Exception { + server.deleteFileFromLibertyInstallRoot("lib/features/threadingTestFeature-1.0.mf"); + assertFalse("Failed to clean up installed file: lib/features/threadingTestFeature-1.0.mf", + server.fileExistsInLibertyInstallRoot("lib/features/threadingTestFeature-1.0.mf")); + server.deleteFileFromLibertyInstallRoot("lib/test.bundle.threading_1.0.0.jar"); + assertFalse("Failed to clean up installed file: lib/test.bundle.threading_1.0.0.jar", server.fileExistsInLibertyInstallRoot("lib/test.bundle.threading_1.0.0.jar")); + + server.deleteFileFromLibertyInstallRoot("lib/features/threadingMemLeakTestFeature-1.0.mf"); + assertFalse("Failed to clean up installed file: lib/features/threadingMemLeakTestFeature-1.0.mf", + server.fileExistsInLibertyInstallRoot("lib/features/threadingMemLeakTestFeature-1.0.mf")); + server.deleteFileFromLibertyInstallRoot("lib/test.bundle.threading.memleak_1.0.0.jar"); + assertFalse("Failed to clean up installed file: lib/test.bundle.threading.memleak_1.0.0.jar", + server.fileExistsInLibertyInstallRoot("lib/test.bundle.threading.memleak_1.0.0.jar")); + } +} diff --git a/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/MemLeakTest.java b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/MemLeakTest.java new file mode 100755 index 000000000000..29d28bbc230c --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/MemLeakTest.java @@ -0,0 +1,94 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.threading.fat; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +@Mode(TestMode.FULL) +public class MemLeakTest { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.threading.memleak_fat_server"); + private static final Class c = MemLeakTest.class; + + @BeforeClass + public static void beforeClass() throws Exception { + final String method = "beforeClass"; + Log.entering(c, method); + + boolean serverWasStarted = false; + + if (server != null && !server.isStarted()) { + server.startServer(); + serverWasStarted = true; + } + + Log.exiting(c, method, serverWasStarted); + } + + @AfterClass + public static void afterClass() throws Exception { + final String method = "afterClass"; + Log.entering(c, method); + + boolean serverWasStopped = false; + + if (server != null && server.isStarted()) { + server.stopServer(); + serverWasStopped = true; + } + + Log.exiting(c, method, serverWasStopped); + } + + /** + * Starting the server with this configuration memLeakTest=true will enabled the + * MemLeakChecker class to activate and run tests to see if we are leaking memory. + * + * This test checks to see if we leak memory by scheduling and then canceling + * a large number of tasks. + */ + @Test + public void testScheduleCancel() throws Exception { + final String method = "testScheduleCancel"; + Log.entering(c, method); + + assertNotNull("Expected message indicating the test passed on the server was not found.", server.waitForStringInLog("runScheduleCancelTest PASSED")); + + Log.exiting(c, method); + } + + /** + * Starting the server with this configuration memLeakTest=true will enabled the + * MemLeakChecker class to activate and run tests to see if we are leaking memory. + * + * This test checks to see if we leak memory by scheduling and then running + * a large number of tasks. + */ + @Test + public void testScheduleExecute() throws Exception { + final String method = "testScheduleExecute"; + Log.entering(c, method); + + assertNotNull("Expected message indicating the test passed on the server was not found.", server.waitForStringInLog("runScheduleExecuteTest PASSED")); + + Log.exiting(c, method); + } +} diff --git a/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/ThreadingExtensionFAT.java b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/ThreadingExtensionFAT.java new file mode 100755 index 000000000000..e30a1c5b357a --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/ThreadingExtensionFAT.java @@ -0,0 +1,128 @@ +package com.ibm.ws.threading.fat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ThreadingExtensionFAT { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.threading_fat_server"); + private static String threadingTestServletURL = "http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/threadingtestapp/ThreadingTestServlet"; + private final Class c = ThreadingExtensionFAT.class; + + @Before + public void beforeTest() throws Exception { + final String method = "beforeTest"; + Log.entering(c, method); + + boolean serverWasStarted = false; + + if (server != null && !server.isStarted()) { + server.startServer(); + serverWasStarted = true; + } + + Log.exiting(c, method, serverWasStarted); + } + + @After + public void afterTest() throws Exception { + final String method = "afterTest"; + Log.entering(c, method); + + boolean serverWasStopped = false; + + if (server != null && server.isStarted()) { + server.stopServer(); + serverWasStopped = true; + } + + Log.exiting(c, method, serverWasStopped); + } + + /** + * Verifies that registering a java.util.concurrent.ThreadFactory implementation into the + * OSGi registry with property "com.ibm.ws.threading.defaultExecutorThreadFactory=true" + * results in all default executor threads being created by that factory. The test + * ThreadFactory that we registered prefixes the thread name of every thread it creates + * with "com.ibm.ws.threading_fat_ThreadFactoryImpl". The test servlet returns the name + * of the thread it executed on. We just need to invoke the servlet and verify that the + * returned thread name matches one created by our factory. + */ + @Test + public void testThreadFactoryExtension() throws Exception { + final String method = "testThreadFactoryExtension"; + Log.entering(c, method); + + String line = invokeURL(threadingTestServletURL).readLine(); + + Log.info(c, method, "Return data from test servlet: " + line); + + assertTrue("The response did not start with com.ibm.ws.threading_fat_ThreadFactoryImpl-thread-", line.startsWith("com.ibm.ws.threading_fat_ThreadFactoryImpl-thread-")); + + Log.exiting(c, method); + } + + /** + * Verifies that registering a com.ibm.wsspi.threading.ExecutorServiceTaskInterceptor implementation + * into the OSGi service registry results in all tasks submitted to the executor being wrapped by + * our interceptor. To verify this, we invoke a test URL (just to get work run) and then look in the + * log for System.out.printlns printed by a task created by our interceptor. + */ + @Test + public void testTaskInterceptorExtension() throws Exception { + final String method = "testTaskInterceptorExtension"; + Log.entering(c, method); + + invokeURL(threadingTestServletURL).readLine(); + + // verify that the task interceptor ran by looking for the System.out.printlns it puts in the server log + assertTrue("Did not find 'com.ibm.ws.threading_fat_beforeTask' in log file", server.findStringsInLogs("com.ibm.ws.threading_fat_beforeTask").size() > 0); + assertTrue("Did not find 'com.ibm.ws.threading_fat_afterTask' in log file", server.findStringsInLogs("com.ibm.ws.threading_fat_afterTask").size() > 0); + + Log.exiting(c, method); + } + + /** + * Invokes the specified URL and returns a BufferedReader to the returned content. + * + * @param urlString The URL to invoke + * @return a BufferedReader to the content returned from the invoked URL + * @throws Exception + */ + private BufferedReader invokeURL(String urlString) throws Exception { + final String method = "invokeURL"; + Log.entering(c, method, urlString); + + HttpURLConnection con = (HttpURLConnection) new URL(urlString).openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream())); + + Log.exiting(c, method, br); + return br; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/publish/.gitignore b/dev/com.ibm.ws.threading_fat/publish/.gitignore new file mode 100644 index 000000000000..0968b1bceb64 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.threading_fat/publish/files/.gitignore b/dev/com.ibm.ws.threading_fat/publish/files/.gitignore new file mode 100644 index 000000000000..0968b1bceb64 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/files/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.threading_fat/publish/files/features/threadingMemLeakTestFeature-1.0.mf b/dev/com.ibm.ws.threading_fat/publish/files/features/threadingMemLeakTestFeature-1.0.mf new file mode 100755 index 000000000000..2fa190b772ff --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/files/features/threadingMemLeakTestFeature-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: threadingMemLeakTestFeature-1.0 +Subsystem-SymbolicName: test.feature.threading.threadingMemLeakTestFeature-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Content: test.bundle.threading.memleak; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/publish/files/features/threadingTestFeature-1.0.mf b/dev/com.ibm.ws.threading_fat/publish/files/features/threadingTestFeature-1.0.mf new file mode 100755 index 000000000000..265855017dc1 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/files/features/threadingTestFeature-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: threadingTestFeature-1.0 +Subsystem-SymbolicName: test.feature.threading.threadingTestFeature-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Content: test.bundle.threading; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/bootstrap.properties b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/server.xml b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/server.xml new file mode 100755 index 000000000000..62b6b2d12fbb --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/server.xml @@ -0,0 +1,9 @@ + + + servlet-3.0 + threadingMemLeakTestFeature-1.0 + + + + + diff --git a/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/.gitignore b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/.gitignore new file mode 100644 index 000000000000..f3f483d82c07 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/.gitignore @@ -0,0 +1 @@ +/dropins diff --git a/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/bootstrap.properties b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/server.xml b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/server.xml new file mode 100755 index 000000000000..6397d1f4318a --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/server.xml @@ -0,0 +1,9 @@ + + + servlet-3.0 + threadingTestFeature-1.0 + + + + + diff --git a/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/.gitignore b/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/.gitignore new file mode 100644 index 000000000000..e47e1b33a748 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/.gitignore @@ -0,0 +1 @@ +/resources diff --git a/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/src/web/ThreadingTestServlet.java b/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/src/web/ThreadingTestServlet.java new file mode 100755 index 000000000000..e5033c6a803b --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/src/web/ThreadingTestServlet.java @@ -0,0 +1,46 @@ +package web; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet implementation class TestServlet + */ +@WebServlet("/ThreadingTestServlet") +public class ThreadingTestServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public ThreadingTestServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + doGetPost(request, response); + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + doGetPost(request, response); + } + + private void doGetPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + System.out.println("IBMDEBUG: Servlet invoked!"); + response.getOutputStream().println(Thread.currentThread().getName()); + response.flushBuffer(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/bnd.bnd b/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/bnd.bnd new file mode 100755 index 000000000000..7d72acf85fbc --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/bnd.bnd @@ -0,0 +1,12 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: ThreadingMemLeakTestBundle +Bundle-SymbolicName: test.bundle.threading.memleak; singleton:=true +Bundle-Description: Bundle that tests that Liberty's threading model - particularly the ScheduledExecutorService - does not leak things like classloaders + +Export-Package: test.bundle.threading + +-dsannotations=test.bundle.threading.MemLeakChecker \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/src/test/bundle/threading/MemLeakChecker.java b/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/src/test/bundle/threading/MemLeakChecker.java new file mode 100755 index 000000000000..381597c792dc --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/src/test/bundle/threading/MemLeakChecker.java @@ -0,0 +1,144 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.bundle.threading; + +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +@Component +public class MemLeakChecker { + private static final int MAX = 10000; + + private ScheduledExecutorService scheduledExecutorService; + + @Reference + protected void setScheduledExecutorService(ScheduledExecutorService ses) { + scheduledExecutorService = ses; + } + + protected void unsetScheduledExecutorService(ScheduledExecutorService ses) { + scheduledExecutorService = null; + } + + @Activate + protected void activate() { + runScheduleCancelTest(); + runScheduleExecuteTest(); + } + + private void runScheduleCancelTest() { + List>> list = new ArrayList>>(MAX); + for (int i = 0; i < MAX; i++) { + ScheduledFuture schedFuture = scheduledExecutorService.schedule(new Task("CancelMe", i, null), 10, TimeUnit.MINUTES); + list.add(new WeakReference>(schedFuture)); + if (!schedFuture.cancel(false)) { + System.out.println("Failed to cancel " + schedFuture); + return; + } + } + + gc(); + for (int i = 0; i < MAX; i++) { + WeakReference> weakRef = list.get(i); + ScheduledFuture schedFuture = weakRef.get(); + if (schedFuture != null) { + System.out.println("runScheduleCancelTest FAILED - scheduledFuture[" + i + "] not GC'd"); + return; + } + } + System.out.println(scheduledExecutorService.toString() + " executed and canceled " + MAX + " tasks"); + System.out.println("runScheduleCancelTest PASSED"); + } + + private void runScheduleExecuteTest() { + // use a lower maximum since this test will actually be executing tasks + final int MAX = MemLeakChecker.MAX / 100; + + final CountDownLatch latch = new CountDownLatch(MAX); + List>> list = new ArrayList>>(MAX); + for (int i = 0; i < MAX; i++) { + ScheduledFuture schedFuture = scheduledExecutorService.schedule(new Task("RunMe", i, latch), 100, TimeUnit.MICROSECONDS); + list.add(new WeakReference>(schedFuture)); + schedFuture = null; + } + + try { + latch.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + gc(); + + for (int i = 0; i < MAX; i++) { + WeakReference> weakRef = list.get(i); + ScheduledFuture schedFuture = weakRef.get(); + if (schedFuture != null) { + System.out.println("runScheduleExecuteTest FAILED - scheduledFuture[" + i + "] not GC'd"); + return; + } + } + System.out.println("runScheduleExecuteTest PASSED"); + } + + private static void gc() { + System.gc(); + System.gc(); + Runtime.getRuntime().runFinalization(); + System.gc(); + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + System.gc(); + System.gc(); + Runtime.getRuntime().runFinalization(); + System.gc(); + } + + private static class Task implements Runnable { + private final String name; + private final int id; + private final CountDownLatch latch; + + Task(String name, int id, CountDownLatch latch) { + this.name = name; + this.id = id; + this.latch = latch; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Runnable#run() + */ + @Override + public void run() { + if (latch != null) { + latch.countDown(); + } + if (id % 1000 == 0) + System.out.println(name + id + " executed"); + + } + } +} diff --git a/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/bnd.bnd b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/bnd.bnd new file mode 100755 index 000000000000..bf496d45cb5c --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/bnd.bnd @@ -0,0 +1,23 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: ThreadingTestBundle +Bundle-SymbolicName: test.bundle.threading; singleton:=true +Bundle-Description: Bundle that provides executor overrides for ThreadFactory and TaskInterceptor; version=${bVersion} + +Export-Package: test.bundle.threading + +Import-Package: com.ibm.wsspi.threading + +Private-Package: test.bundle.threading.internal.* + +Service-Component:\ + test.bundle.threading.ThreadFactoryImpl;\ + implementation:=test.bundle.threading.ThreadFactoryImpl;\ + provide:=java.util.concurrent.ThreadFactory;\ + properties:="com.ibm.ws.threading.defaultExecutorThreadFactory=true",\ + test.bundle.threading.TaskInterceptorImpl;\ + implementation:=test.bundle.threading.TaskInterceptorImpl;\ + provide:=com.ibm.wsspi.threading.ExecutorServiceTaskInterceptor diff --git a/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/TaskInterceptorImpl.java b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/TaskInterceptorImpl.java new file mode 100755 index 000000000000..ee919ef53744 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/TaskInterceptorImpl.java @@ -0,0 +1,44 @@ +package test.bundle.threading; + +import java.util.concurrent.Callable; + +import com.ibm.wsspi.threading.ExecutorServiceTaskInterceptor; + +public class TaskInterceptorImpl implements ExecutorServiceTaskInterceptor { + @Override + public Runnable wrap(final Runnable oldTask) { + Runnable newTask = new Runnable() { + @Override + public void run() { + try { + System.out.println("com.ibm.ws.threading_fat_beforeTask"); + oldTask.run(); + } + finally { + System.out.println("com.ibm.ws.threading_fat_afterTask"); + } + } + }; + return newTask; + } + + @Override + public Callable wrap(final Callable oldTask) { + Callable newTask = new Callable() { + @Override + public T call() { + try { + System.out.println("com.ibm.ws.threading_fat_beforeTask"); + return oldTask.call(); + } + catch (Exception e) { + return null; + } + finally { + System.out.println("com.ibm.ws.threading_fat_afterTask"); + } + } + }; + return newTask; + } +} diff --git a/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/ThreadFactoryImpl.java b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/ThreadFactoryImpl.java new file mode 100755 index 000000000000..d9ae47900dcd --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/ThreadFactoryImpl.java @@ -0,0 +1,47 @@ +package test.bundle.threading; + +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicInteger; + +public class ThreadFactoryImpl implements ThreadFactory { + private final AtomicInteger createdThreadCount = new AtomicInteger(); + private final ThreadGroup threadGroup; + private final ClassLoader contextClassLoader; + + public ThreadFactoryImpl() { + this.threadGroup = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public ThreadGroup run() { + return new ThreadGroup("testThreadGroup"); + } + }); + this.contextClassLoader = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public ClassLoader run() { + return Thread.currentThread().getContextClassLoader(); + } + }); + } + + @Override + public Thread newThread(final Runnable runnable) { + int threadId = createdThreadCount.incrementAndGet(); + final String name = "com.ibm.ws.threading_fat_ThreadFactoryImpl-thread-" + threadId; + // The AccessControlContext is implicitly copied from the creating + // thread, so use doPrivileged to prevent that. + return AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Thread run() { + Thread thread = new Thread(threadGroup, runnable, name); + // The daemon, priority, and context class loader are implicitly + // copied from the creating thread, so reset them all. + thread.setDaemon(true); + thread.setPriority(Thread.NORM_PRIORITY); + thread.setContextClassLoader(contextClassLoader); + return thread; + } + }); + } +} diff --git a/dev/com.ibm.ws.threading_test/.classpath b/dev/com.ibm.ws.threading_test/.classpath index 76c1da8b9d83..bd880329225d 100755 --- a/dev/com.ibm.ws.threading_test/.classpath +++ b/dev/com.ibm.ws.threading_test/.classpath @@ -1,12 +1,7 @@ - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.threading_test/.classpath.gradle b/dev/com.ibm.ws.threading_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.threading_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.threading_test/.project b/dev/com.ibm.ws.threading_test/.project index 64445ff4c1ca..15ff87002f72 100755 --- a/dev/com.ibm.ws.threading_test/.project +++ b/dev/com.ibm.ws.threading_test/.project @@ -11,13 +11,13 @@ - com.ibm.ws.rasplugin.RASValidationBuilder + bndtools.core.bndbuilder org.eclipse.jdt.core.javanature - com.ibm.ws.rasplugin.RASValidationNature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.threading_test/bnd.bnd b/dev/com.ibm.ws.threading_test/bnd.bnd new file mode 100755 index 000000000000..91151cb880d0 --- /dev/null +++ b/dev/com.ibm.ws.threading_test/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.threading;version=latest diff --git a/dev/com.ibm.ws.threading_test/bnd.bnd.gradle b/dev/com.ibm.ws.threading_test/bnd.bnd.gradle new file mode 100755 index 000000000000..91151cb880d0 --- /dev/null +++ b/dev/com.ibm.ws.threading_test/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.threading;version=latest diff --git a/dev/com.ibm.ws.threading_test/build.gradle b/dev/com.ibm.ws.threading_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.timer/.classpath b/dev/com.ibm.ws.timer/.classpath index c9b72176c699..2876090f9036 100755 --- a/dev/com.ibm.ws.timer/.classpath +++ b/dev/com.ibm.ws.timer/.classpath @@ -1,7 +1,7 @@ - - - + + + diff --git a/dev/com.ibm.ws.timer/.classpath.gradle b/dev/com.ibm.ws.timer/.classpath.gradle new file mode 100644 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.timer/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.timer/bnd.bnd b/dev/com.ibm.ws.timer/bnd.bnd new file mode 100755 index 000000000000..efa0c822ce41 --- /dev/null +++ b/dev/com.ibm.ws.timer/bnd.bnd @@ -0,0 +1,19 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: WAS Timers +Bundle-Description: WAS Timers, version ${bVersion} +Bundle-SymbolicName: com.ibm.ws.timer; singleton:=true + +WS-TraceGroup: timer + +Export-Package: com.ibm.wsspi.timer;provide:=true + +Private-Package: com.ibm.ws.timer.internal + +-dsannotations: com.ibm.ws.timer.internal.QuickApproxTimeImpl + +-buildpath: \ + com.ibm.ws.logging.core,\ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0, \ + com.ibm.ws.org.osgi.annotation.versioning.1.0.0;version=latest diff --git a/dev/com.ibm.ws.timer/build.gradle b/dev/com.ibm.ws.timer/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.timer/build.xml b/dev/com.ibm.ws.timer/build.xml new file mode 100755 index 000000000000..dc7c5a99fa62 --- /dev/null +++ b/dev/com.ibm.ws.timer/build.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.transport.http/.classpath b/dev/com.ibm.ws.transport.http/.classpath index 128dca127d5b..2876090f9036 100755 --- a/dev/com.ibm.ws.transport.http/.classpath +++ b/dev/com.ibm.ws.transport.http/.classpath @@ -1,14 +1,7 @@ - - - - - - - - - - + + + diff --git a/dev/com.ibm.ws.transport.http/.classpath.gradle b/dev/com.ibm.ws.transport.http/.classpath.gradle new file mode 100644 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.transport.http/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.transport.http/bnd.bnd b/dev/com.ibm.ws.transport.http/bnd.bnd new file mode 100755 index 000000000000..c7aefd6aed74 --- /dev/null +++ b/dev/com.ibm.ws.transport.http/bnd.bnd @@ -0,0 +1,76 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-SymbolicName: com.ibm.ws.transport.http; singleton:=true +Bundle-Name: HTTP Transport + +Bundle-Description: HTTP protocol implementation bundle. This provides \ +an HTTP dispatcher for multiple containers to hook into to receive a standard \ +inbound HTTP connection interface, as well as the HTTP channel \ +for direct and exclusive access of traffic for specific appplication channels. \ +An outbound HTTP channel is also implemented for client traffic, version ${bVersion}. + +Bundle-Activator: com.ibm.ws.http.internal.HttpChannelProvider + +WS-TraceGroup: HttpTransport + +IBM-Default-Config: OSGI-INF/wlp/defaultInstances.xml + +# For each exported package, create (in that package) a package-info.java +# file, and place an @version javadoc tag in package-level javadoc. +# Append ";provide:=true" if this bundle also provides an implementation +# for the exported API. +Export-Package: \ + com.ibm.wsspi.genericbnf*;provide:=true, \ + com.ibm.wsspi.http*;provide:=true, \ + com.ibm.wsspi.http.ee7*;provide:=true, \ + com.ibm.ws.transport.access*;provide:=true, \ + com.ibm.ws.genericbnf, \ + com.ibm.ws.http.dispatcher.classify, \ + com.ibm.ws.http.channel.outstream + +Private-Package: \ + com.ibm.ws.http.*, \ + com.ibm.ws.http.dispatcher*, \ + com.ibm.ws.http.channel*, \ + com.ibm.ws.http.logging.internal, \ + com.ibm.ws.genericbnf.internal, \ + com.ibm.ws.http.dispatcher.classify + +-dsannotations: com.ibm.ws.http.channel.internal.inbound.HttpPipelineEventHandler,\ + com.ibm.ws.http.dispatcher.internal.HttpDispatcher,\ + com.ibm.ws.http.internal.DefaultMimeTypesImpl,\ + com.ibm.ws.http.internal.EncodingUtilsImpl,\ + com.ibm.ws.http.internal.HttpDateFormatImpl,\ + com.ibm.ws.http.internal.HttpEndpointImpl,\ + com.ibm.ws.http.internal.VirtualHostImpl,\ + com.ibm.ws.http.logging.internal.AccessLogger,\ + com.ibm.ws.http.internal.HttpProxyRedirect + +Service-Component: \ + com.ibm.ws.http.options; \ + implementation:=com.ibm.wsspi.channelfw.ChannelConfiguration; \ + provide:=com.ibm.wsspi.channelfw.ChannelConfiguration; \ + modified:='modified';\ + immediate:=true;\ + properties:="service.vendor=IBM,service.ranking:Integer=0" + +Include-Resource: \ + OSGI-INF=resources/OSGI-INF, \ + {OSGI-INF/welcome/index.html=resources/OSGI-INF/welcome/index.html} + +DynamicImport-Package: com.ibm.wsspi.request.probe.bci + +-buildpath: \ + com.ibm.ws.logging.core,\ + com.ibm.ws.channelfw;version=latest,\ + com.ibm.ws.event,\ + com.ibm.websphere.org.osgi.core.6.0.0,\ + com.ibm.websphere.org.osgi.service.component.1.3.0,\ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0,\ + com.ibm.ws.kernel.service,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.ws.timer;version=latest,\ + com.ibm.ws.runtime.update,\ + com.ibm.ws.threading,\ + com.ibm.ws.org.osgi.annotation.versioning.1.0.0;version=latest diff --git a/dev/com.ibm.ws.transport.http/bnd.bnd.gradle b/dev/com.ibm.ws.transport.http/bnd.bnd.gradle new file mode 100644 index 000000000000..c7aefd6aed74 --- /dev/null +++ b/dev/com.ibm.ws.transport.http/bnd.bnd.gradle @@ -0,0 +1,76 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-SymbolicName: com.ibm.ws.transport.http; singleton:=true +Bundle-Name: HTTP Transport + +Bundle-Description: HTTP protocol implementation bundle. This provides \ +an HTTP dispatcher for multiple containers to hook into to receive a standard \ +inbound HTTP connection interface, as well as the HTTP channel \ +for direct and exclusive access of traffic for specific appplication channels. \ +An outbound HTTP channel is also implemented for client traffic, version ${bVersion}. + +Bundle-Activator: com.ibm.ws.http.internal.HttpChannelProvider + +WS-TraceGroup: HttpTransport + +IBM-Default-Config: OSGI-INF/wlp/defaultInstances.xml + +# For each exported package, create (in that package) a package-info.java +# file, and place an @version javadoc tag in package-level javadoc. +# Append ";provide:=true" if this bundle also provides an implementation +# for the exported API. +Export-Package: \ + com.ibm.wsspi.genericbnf*;provide:=true, \ + com.ibm.wsspi.http*;provide:=true, \ + com.ibm.wsspi.http.ee7*;provide:=true, \ + com.ibm.ws.transport.access*;provide:=true, \ + com.ibm.ws.genericbnf, \ + com.ibm.ws.http.dispatcher.classify, \ + com.ibm.ws.http.channel.outstream + +Private-Package: \ + com.ibm.ws.http.*, \ + com.ibm.ws.http.dispatcher*, \ + com.ibm.ws.http.channel*, \ + com.ibm.ws.http.logging.internal, \ + com.ibm.ws.genericbnf.internal, \ + com.ibm.ws.http.dispatcher.classify + +-dsannotations: com.ibm.ws.http.channel.internal.inbound.HttpPipelineEventHandler,\ + com.ibm.ws.http.dispatcher.internal.HttpDispatcher,\ + com.ibm.ws.http.internal.DefaultMimeTypesImpl,\ + com.ibm.ws.http.internal.EncodingUtilsImpl,\ + com.ibm.ws.http.internal.HttpDateFormatImpl,\ + com.ibm.ws.http.internal.HttpEndpointImpl,\ + com.ibm.ws.http.internal.VirtualHostImpl,\ + com.ibm.ws.http.logging.internal.AccessLogger,\ + com.ibm.ws.http.internal.HttpProxyRedirect + +Service-Component: \ + com.ibm.ws.http.options; \ + implementation:=com.ibm.wsspi.channelfw.ChannelConfiguration; \ + provide:=com.ibm.wsspi.channelfw.ChannelConfiguration; \ + modified:='modified';\ + immediate:=true;\ + properties:="service.vendor=IBM,service.ranking:Integer=0" + +Include-Resource: \ + OSGI-INF=resources/OSGI-INF, \ + {OSGI-INF/welcome/index.html=resources/OSGI-INF/welcome/index.html} + +DynamicImport-Package: com.ibm.wsspi.request.probe.bci + +-buildpath: \ + com.ibm.ws.logging.core,\ + com.ibm.ws.channelfw;version=latest,\ + com.ibm.ws.event,\ + com.ibm.websphere.org.osgi.core.6.0.0,\ + com.ibm.websphere.org.osgi.service.component.1.3.0,\ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0,\ + com.ibm.ws.kernel.service,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.ws.timer;version=latest,\ + com.ibm.ws.runtime.update,\ + com.ibm.ws.threading,\ + com.ibm.ws.org.osgi.annotation.versioning.1.0.0;version=latest diff --git a/dev/com.ibm.ws.transport.http/build-api-spi.xml b/dev/com.ibm.ws.transport.http/build-api-spi.xml new file mode 100755 index 000000000000..5fc0411fae3a --- /dev/null +++ b/dev/com.ibm.ws.transport.http/build-api-spi.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.transport.http/build.gradle b/dev/com.ibm.ws.transport.http/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.transport.http/build.xml b/dev/com.ibm.ws.transport.http/build.xml new file mode 100755 index 000000000000..11f350fe52e8 --- /dev/null +++ b/dev/com.ibm.ws.transport.http/build.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/outbound/HttpOutboundServiceContext.java b/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/outbound/HttpOutboundServiceContext.java index 6243ee02fbb6..e931a8a86282 100755 --- a/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/outbound/HttpOutboundServiceContext.java +++ b/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/outbound/HttpOutboundServiceContext.java @@ -8,9 +8,9 @@ import java.io.IOException; -import com.ibm.ws.http.channel.internal.outbound.HttpOutboundLink; import com.ibm.wsspi.bytebuffer.WsByteBuffer; import com.ibm.wsspi.channelfw.InterChannelCallback; +import com.ibm.wsspi.channelfw.OutboundConnectionLink; import com.ibm.wsspi.channelfw.VirtualConnection; import com.ibm.wsspi.genericbnf.exception.IllegalRequestObjectException; import com.ibm.wsspi.genericbnf.exception.MessageSentException; @@ -586,7 +586,7 @@ public interface HttpOutboundServiceContext extends HttpServiceContext { */ VirtualConnection getRawResponseBodyBuffers(InterChannelCallback cb, boolean bForce) throws BodyCompleteException; - HttpOutboundLink getLink(); + OutboundConnectionLink getLink(); TCPConnectionContext getTSC(); diff --git a/dev/com.ibm.ws.zos.channel.console/.classpath b/dev/com.ibm.ws.zos.channel.console/.classpath new file mode 100644 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.channel.console/.classpath.gradle b/dev/com.ibm.ws.zos.channel.console/.classpath.gradle new file mode 100644 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.channel.console/.gitignore b/dev/com.ibm.ws.zos.channel.console/.gitignore new file mode 100644 index 000000000000..a7ffc85d87a1 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/.gitignore @@ -0,0 +1,2 @@ +*.class +/build/ diff --git a/dev/com.ibm.ws.zos.channel.console/.project b/dev/com.ibm.ws.zos.channel.console/.project new file mode 100644 index 000000000000..9786500f6011 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.zos.channel.console + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.zos.channel.console/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.zos.channel.console/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000000..169aea7eabe7 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Wed Aug 17 16:19:12 BST 2011 +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.zos.channel.console/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.zos.channel.console/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000000..95719ae3709c --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert diff --git a/dev/com.ibm.ws.zos.channel.console/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.zos.channel.console/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000000..13e9e1f92c53 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,116 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.remove_trailing_whitespaces=true +cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.add_missing_nls_tags=false +org.eclipse.jdt.ui.staticondemandthreshold=99 +cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_blocks=false +sp_cleanup.make_private_fields_final=true +org.eclipse.jdt.ui.ignorelowercasenames=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.remove_private_constructors=true +sp_cleanup.never_use_parentheses_in_expressions=true +cleanup.remove_unnecessary_casts=true +sp_cleanup.organize_imports=true +sp_cleanup.never_use_blocks=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_fields=true +org.eclipse.jdt.ui.text.custom_code_templates= +cleanup.always_use_parentheses_in_expressions=false +cleanup.use_parentheses_in_expressions=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.always_use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.correct_indentation=true +cleanup.make_private_fields_final=false +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.correct_indentation=false +cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +org.eclipse.jdt.ui.ondemandthreshold=99 +sp_cleanup.sort_members_all=false +sp_cleanup.use_this_for_non_static_field_access=false +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +org.eclipse.jdt.ui.exception.name=e +sp_cleanup.format_source_code=true +org.eclipse.jdt.ui.javadoc=true +cleanup.format_source_code=false +cleanup.remove_unused_imports=true +cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_methods=true +cleanup.add_missing_annotations=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_private_methods=true +cleanup.always_use_this_for_non_static_method_access=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.sort_members=false +sp_cleanup.use_parentheses_in_expressions=false +cleanup.add_missing_override_annotations=true +org.eclipse.jdt.ui.gettersetter.use.is=false +cleanup.convert_to_enhanced_for_loop=false +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.overrideannotation=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.add_missing_annotations=true +cleanup.make_variable_declarations_final=false +cleanup.remove_unused_private_types=true +cleanup.use_blocks=true +cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.remove_unused_imports=true +cleanup.add_missing_deprecated_annotations=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.convert_to_enhanced_for_loop=false +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.sort_members=false +sp_cleanup.remove_unused_private_members=false +org.eclipse.jdt.ui.importorder=java;javax;org;com; +cleanup.remove_unused_private_members=false +sp_cleanup.format_source_code_changes_only=false +cleanup.never_use_blocks=false +cleanup.organize_imports=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_generated_serial_version_id=false +cleanup.make_parameters_final=true +org.eclipse.jdt.ui.keywordthis=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.always_use_blocks=true +cleanup.add_serial_version_id=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.always_use_blocks=true +cleanup.remove_unused_local_variables=false +cleanup.sort_members_all=false +sp_cleanup.remove_trailing_whitespaces=true +cleanup.format_source_code_changes_only=false +cleanup.add_generated_serial_version_id=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.remove_private_constructors=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_local_variable_final=false +cleanup.make_local_variable_final=false +sp_cleanup.add_serial_version_id=false +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.add_default_serial_version_id=false +cleanup.add_missing_methods=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.add_missing_methods=false diff --git a/dev/com.ibm.ws.zos.channel.console/bnd.bnd b/dev/com.ibm.ws.zos.channel.console/bnd.bnd new file mode 100644 index 000000000000..872aba6d0635 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: Channel Framework CommandHandler for z/OS +Bundle-SymbolicName: com.ibm.ws.zos.channel.console +Bundle-Description: z/OS Command Processing for Channel Framework; version=${bVersion} + +#Bundle-Activator: com.ibm.ws.zos.channel.console.ZosCHFWConsoleBundleActivator + +WS-TraceGroup: zConsole + +#Export-Package: com.ibm.ws.zos.channel.console;provide:=true + + +Private-Package: \ + com.ibm.ws.zos.channel.console, \ + com.ibm.ws.zos.channel.console.internal* + +-dsannotations: \ + com.ibm.ws.zos.channel.console.PauseResumeCommandHandler + +-buildpath: \ + com.ibm.ws.org.osgi.annotation.versioning.1.0.0;version=latest, \ + com.ibm.websphere.appserver.spi.logging;version=latest, \ + com.ibm.ws.kernel.boot.nested;version=latest, \ + com.ibm.ws.kernel.service;version=latest, \ + com.ibm.ws.zos.core;version=latest, \ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0;version=latest diff --git a/dev/com.ibm.ws.zos.channel.console/build.gradle b/dev/com.ibm.ws.zos.channel.console/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.zos.channel.console/build.xml b/dev/com.ibm.ws.zos.channel.console/build.xml new file mode 100644 index 000000000000..817116ef3f60 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/build.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.channel.console/findbugs.exclude.xml b/dev/com.ibm.ws.zos.channel.console/findbugs.exclude.xml new file mode 100644 index 000000000000..3626b38bdad1 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/findbugs.exclude.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages.nlsprops new file mode 100644 index 000000000000..023101802b3d --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: A server {0} command was received, but the infrastructure for pausing components is not available. The request cannot be processed. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=A user issued a command that is processed by the infrastructure for pausing components. However, the command could not be processed. The server might be initializing or shutting down. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=Verify that the server has fully initialized and is not in the process of shutting down. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_cs.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_cs.nlsprops new file mode 100644 index 000000000000..7e2ee0328d4c --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_cs.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: Byl p\u0159ijat p\u0159\u00edkaz {0} serveru, ale infrastruktura pro pozastaven\u00ed komponent nen\u00ed dostupn\u00e1. Po\u017eadavek nelze zpracovat. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=U\u017eivatel vydal p\u0159\u00edkaz, kter\u00fd je zpracov\u00e1n infrastrukturou pro pozastaven\u00ed komponent. Tento p\u0159\u00edkaz v\u0161ak nelze zpracovat. Server m\u016f\u017ee b\u00fdt inicializov\u00e1n nebo vypnut. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=Ov\u011b\u0159te, \u017ee server je pln\u011b inicializov\u00e1n a nen\u00ed v procesu vypnut\u00ed. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_de.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_de.nlsprops new file mode 100644 index 000000000000..313a673ebcb6 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_de.nlsprops @@ -0,0 +1,33 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: Es wurde ein Serverbefehl vom Typ {0} empfangen, die Infrastruktur zum Anhalten von Komponenten ist jedoch nicht verf\u00fcgbar. Die Anforderung kann nicht verarbeitet werden. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=Ein Benutzer hat einen Befehl abgesetzt, der von der Infrastruktur zum Anhalten von Komponenten verarbeitet wird. Dieser Befehl konnte jedoch nicht verarbeitet werden. Der Server hat m\u00f6glicherweise die Initialisierung noch nicht abgeschlossen oder wird heruntergefahren. + +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=\u00dcberpr\u00fcfen Sie, dass die Initialisierung des Servers vollst\u00e4ndig abgeschlossen ist und das System nicht gerade heruntergefahren wird. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_es.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_es.nlsprops new file mode 100644 index 000000000000..51216e130b13 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_es.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: Se ha recibido un mandato del servidor {0}, pero la infraestructura para poner en pausa componentes no est\u00e1 disponible. La solicitud no se puede procesar. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=Un usuario ha emitido un mandato que procesa la infraestructura para poner en pausa componentes. Sin embargo, el mandato no se ha podido procesar. Es posible que el servidor se est\u00e9 inicializando o cerrando. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=Compruebe que el servidor est\u00e9 completamente inicializado y que no est\u00e9 en proceso de cerrarse. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_fr.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_fr.nlsprops new file mode 100644 index 000000000000..eb597d2f82e0 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_fr.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: La commande serveur {0} a \u00e9t\u00e9 re\u00e7ue, mais l''infrastructure de mise en pause de composants n''est pas disponible. Impossible de traiter la demande. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=Un utilisateur a lanc\u00e9 une commande dont le traitement revient \u00e0 l'infrastructure de mise en pause de composants. Toutefois, la commande n'a pas pu \u00eatre trait\u00e9e. Il se peut que le serveur soit en cours d'initialisation ou d'arr\u00eat. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=V\u00e9rifiez que l'initialisation du serveur est termin\u00e9e et qu'il n'est pas en cours d'arr\u00eat. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_hu.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_hu.nlsprops new file mode 100644 index 000000000000..4847ef102377 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_hu.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: {0} kiszolg\u00e1l\u00f3i parancs \u00e9rkezett, de az \u00f6sszetev\u0151k v\u00e1rakoztat\u00e1s\u00e1t lehet\u0151v\u00e9 tev\u0151 infrastrukt\u00fara nem \u00e1ll rendelkez\u00e9sre. A k\u00e9r\u00e9s nem feldolgozhat\u00f3. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=Egy felhaszn\u00e1l\u00f3 kiadott egy parancsot, amelyet az \u00f6sszetev\u0151k v\u00e1rakoztat\u00e1s\u00e1t kezel\u0151 infrastrukt\u00fara dolgozott fel. A parancsot azonban nem lehetett feldolgozni. Lehet, hogy a kiszolg\u00e1l\u00f3 m\u00e9g inicializ\u00e1l vagy \u00e9ppen le\u00e1ll. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=Ellen\u0151rizze, hogy a kiszolg\u00e1l\u00f3 teljesen inicializ\u00e1lt \u00e1llapotban van-e, illetve nincs-e le\u00e1ll\u00e1s folyamatban. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_it.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_it.nlsprops new file mode 100644 index 000000000000..e75d07de2e90 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_it.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: \u00c8 stato ricevuto un comando {0}, ma l''infrastruttura per sospendere i componenti non \u00e8 disponibile. Impossibile elaborare la richiesta. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=Un utente ha emesso un comando elaborato dall'infrastruttura per sospendere i componenti. Tuttavia, il comando non pu\u00f2 essere elaborato. Il server potrebbe essere in fase di inizializzazione o arresto. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=Verificare che il server abbia completato l'inizializzazione e non sia in fase di arresto. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ja.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ja.nlsprops new file mode 100644 index 000000000000..fca1d33950b2 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ja.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: \u30b5\u30fc\u30d0\u30fc {0} \u30b3\u30de\u30f3\u30c9\u3092\u53d7\u3051\u53d6\u308a\u307e\u3057\u305f\u304c\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4e00\u6642\u505c\u6b62\u3059\u308b\u305f\u3081\u306e\u30a4\u30f3\u30d5\u30e9\u30b9\u30c8\u30e9\u30af\u30c1\u30e3\u30fc\u304c\u4f7f\u7528\u53ef\u80fd\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u8981\u6c42\u306f\u51e6\u7406\u3067\u304d\u307e\u305b\u3093\u3002 +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4e00\u6642\u505c\u6b62\u3059\u308b\u305f\u3081\u306e\u30a4\u30f3\u30d5\u30e9\u30b9\u30c8\u30e9\u30af\u30c1\u30e3\u30fc\u304c\u51e6\u7406\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3092\u30e6\u30fc\u30b6\u30fc\u304c\u767a\u884c\u3057\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u3001\u30b3\u30de\u30f3\u30c9\u3092\u51e6\u7406\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u30b5\u30fc\u30d0\u30fc\u304c\u521d\u671f\u5316\u4e2d\u307e\u305f\u306f\u30b7\u30e3\u30c3\u30c8\u30c0\u30a6\u30f3\u4e2d\u3067\u3042\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=\u30b5\u30fc\u30d0\u30fc\u304c\u5b8c\u5168\u306b\u521d\u671f\u5316\u6e08\u307f\u3067\u3001\u30b7\u30e3\u30c3\u30c8\u30c0\u30a6\u30f3\u306e\u51e6\u7406\u4e2d\u3067\u306f\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ko.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ko.nlsprops new file mode 100644 index 000000000000..66d37c051b66 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ko.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: \uc11c\ubc84 {0} \uba85\ub839\uc744 \uc218\uc2e0\ud588\uc9c0\ub9cc \ucef4\ud3ec\ub10c\ud2b8 \uc77c\uc2dc\uc815\uc9c0\ub97c \uc704\ud55c \uc778\ud504\ub77c\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc694\uccad\uc744 \ucc98\ub9ac\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=\uc0ac\uc6a9\uc790\uac00 \ucef4\ud3ec\ub10c\ud2b8 \uc77c\uc2dc\uc815\uc9c0\ub97c \uc704\ud55c \uc778\ud504\ub77c\uc5d0\uc11c \ucc98\ub9ac\ud558\ub294 \uba85\ub839\uc744 \ubc1c\ud589\ud588\uc2b5\ub2c8\ub2e4. \uadf8\ub7ec\ub098 \uba85\ub839\uc744 \ucc98\ub9ac\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc11c\ubc84\uac00 \ucd08\uae30\ud654 \uc911\uc774\uac70\ub098 \uc2dc\uc2a4\ud15c \uc885\ub8cc \uc911\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=\uc11c\ubc84\uac00 \uc644\uc804\ud788 \ucd08\uae30\ud654\ub418\uc5c8\uace0 \uc2dc\uc2a4\ud15c \uc885\ub8cc \uc9c4\ud589 \uc911\uc774 \uc544\ub2cc\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_pl.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_pl.nlsprops new file mode 100644 index 000000000000..60a746e7e2d8 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_pl.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: Odebrano komend\u0119 serwera {0}, ale infrastruktura wstrzymywania komponent\u00f3w nie jest dost\u0119pna. Nie mo\u017cna przetworzy\u0107 \u017c\u0105dania. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=U\u017cytkownik wprowadzi\u0107 komend\u0119, kt\u00f3ra jest przetwarzana przez infrastruktur\u0119 wstrzymywania komponent\u00f3w. Jednak nie mo\u017cna przetworzy\u0107 tej komendy. Serwer mo\u017ce by\u0107 inicjowany lub zamykany. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=Sprawd\u017a, czy serwer zosta\u0142 w pe\u0142ni zainicjowany i czy nie jest w\u0142a\u015bnie zamykany. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_pt_BR.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_pt_BR.nlsprops new file mode 100644 index 000000000000..eef381fea5eb --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_pt_BR.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: Um comando do servidor {0} foi recebido, mas a infraestrutura para pausar componentes n\u00e3o est\u00e1 dispon\u00edvel. A solicita\u00e7\u00e3o n\u00e3o pode ser processada. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=Um usu\u00e1rio emitiu um comando que \u00e9 processado pela infraestrutura para pausar componentes. Entretanto, o comando n\u00e3o p\u00f4de ser processado. O servidor pode estar sendo inicializado ou sendo encerrado. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=Verifique se o servidor foi totalmente inicializado e se n\u00e3o est\u00e1 no processo de encerramento. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ro.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ro.nlsprops new file mode 100644 index 000000000000..9b7e92a110be --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ro.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: A fost primit\u0103 o comand\u0103 {0} de server, dar infrastructura pentru trecerea \u00een pauz\u0103 a componentelor nu este disponibil\u0103. Cererea nu a putut fi procesat\u0103. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=Un utilizator a lansat o comand\u0103 care este procesat\u0103 de infrastructura de trecere \u00een pauz\u0103 a componentelor. Totu\u015fi. comanda a putut fi procesat\u0103. Serverul s-ar putea s\u0103 se ini\u0163ializeze sau s\u0103 fie \u00een curs de oprire. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=Verifica\u0163i c\u0103 serverul s-a ini\u0163ializat complet \u015fi c\u0103 nu este \u00een procesul de oprire. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ru.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ru.nlsprops new file mode 100644 index 000000000000..600296631aa2 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_ru.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 {0}, \u043e\u0434\u043d\u0430\u043a\u043e \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430. \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0437\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0438 \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b. diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_zh.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_zh.nlsprops new file mode 100644 index 000000000000..fe81a9a3462c --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_zh.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: \u63a5\u6536\u5230\u670d\u52a1\u5668 {0} \u547d\u4ee4\uff0c\u4f46\u662f\u6682\u505c\u7ec4\u4ef6\u7684\u57fa\u7840\u7ed3\u6784\u4e0d\u53ef\u7528\u3002\u65e0\u6cd5\u5904\u7406\u8bf7\u6c42\u3002 +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=\u7528\u6237\u53d1\u51fa\u4e86\u7531\u6682\u505c\u7ec4\u4ef6\u7684\u57fa\u7840\u7ed3\u6784\u5904\u7406\u7684\u547d\u4ee4\u3002\u4f46\u662f\uff0c\u672a\u80fd\u5904\u7406\u8be5\u547d\u4ee4\u3002\u670d\u52a1\u5668\u53ef\u80fd\u6b63\u5728\u521d\u59cb\u5316\u6216\u8005\u6b63\u5728\u5173\u95ed\u3002 +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=\u8bf7\u9a8c\u8bc1\u670d\u52a1\u5668\u662f\u5426\u5df2\u5b8c\u5168\u521d\u59cb\u5316\u5e76\u4e14\u672a\u5728\u5173\u95ed\u8fc7\u7a0b\u4e2d\u3002 diff --git a/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_zh_TW.nlsprops b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_zh_TW.nlsprops new file mode 100644 index 000000000000..c7ef91e1fdd0 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/resources/com/ibm/ws/zos/channel/console/internal/resources/ZConsoleChannelMessages_zh_TW.nlsprops @@ -0,0 +1,32 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2017. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +# # {0} description of each insert field +# MSG_DESCRIPTIVE_NAME_CWSJX0000=CWSJX0000I: This is a message with inserts {0} +# MSG_DESCRIPTIVE_NAME_CWSJX0000.explanation=Explanation text for the message +# MSG_DESCRIPTIVE_NAME_CWSJX0000.useraction=User action text for the message +# +#CMVCPATHNAME com.ibm.ws.zos.channel.console/resources/com.ibm.ws.zos.channel.console.internal.resources/ZConsoleChannelMessages.nlsprops +#COMPONENTPREFIX CWWKE +#COMPONENTNAMEFOR CWWKE zOS Pause and Resume Console Command +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). +# +# ------------------------------------------------------------------------------------------------- +#0651-0700: zOS Console Channel +# ------------------------------------------------------------------------------------------------- + +#{0} is the command type. +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE=CWWKE0651E: \u6536\u5230\u4f3a\u670d\u5668 {0} \u6307\u4ee4\uff0c\u4f46\u8ca0\u8cac\u66ab\u505c\u5143\u4ef6\u7684\u57fa\u790e\u67b6\u69cb\u7121\u6cd5\u4f7f\u7528\u3002\u7121\u6cd5\u8655\u7406\u8981\u6c42\u3002 +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.explanation=\u4f7f\u7528\u8005\u767c\u51fa\u4e00\u500b\u7531\u57fa\u790e\u67b6\u69cb\u8655\u7406\u4f86\u66ab\u505c\u5143\u4ef6\u7684\u6307\u4ee4\u3002\u4f46\u7121\u6cd5\u8655\u7406\u8a72\u6307\u4ee4\u3002\u4f3a\u670d\u5668\u53ef\u80fd\u6b63\u5728\u8d77\u59cb\u8a2d\u5b9a\u6216\u95dc\u9589\u3002 +ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE.useraction=\u8acb\u9a57\u8b49\u4f3a\u670d\u5668\u5df2\u5b8c\u5168\u8d77\u59cb\u8a2d\u5b9a\uff0c\u800c\u4e14\u4e0d\u662f\u6b63\u5728\u95dc\u9589\u3002 diff --git a/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/PauseResumeCommandHandler.java b/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/PauseResumeCommandHandler.java new file mode 100644 index 000000000000..6857f6aa1a26 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/PauseResumeCommandHandler.java @@ -0,0 +1,337 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.channel.console; + +import java.util.ArrayList; +import java.util.List; + +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ConfigurationPolicy; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; +import org.osgi.service.component.annotations.ReferencePolicyOption; + +import com.ibm.websphere.ras.Tr; +import com.ibm.websphere.ras.TraceComponent; +import com.ibm.ws.kernel.launch.service.PauseableComponentController; +import com.ibm.ws.zos.channel.console.internal.PauseResumeConsoleSupport; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; +import com.ibm.wsspi.zos.command.processing.CommandHandler; +import com.ibm.wsspi.zos.command.processing.ModifyResults; + +/** + * An implementation of an MVS console command handler that allows a + * system operator to pause or resume the server. + */ +@Component(name = "com.ibm.ws.zos.channel.console.PauseResumeCommandHandler", service = { CommandHandler.class }, immediate = true, configurationPolicy = ConfigurationPolicy.IGNORE, property = { + "modify.filter.regex=((?i)(pause|resume|status).*)", + "display.command.help=TRUE", + "service.vendor=IBM" }) +public class PauseResumeCommandHandler implements CommandHandler { + /** + * trace variable + */ + private static final TraceComponent tc = Tr.register(PauseResumeCommandHandler.class); + + /** + * A reference to the PauseableComponentController service. It handles delivering the pause/resume requests to + * interested server components. + */ + private PauseableComponentController m_pauseableComponentController; + + /** + * A reference to obtain the server's name. + */ + private WsLocationAdmin m_locationAdmin; + + /** + * A human readable name for this handler. + */ + final static String NAME = "Pause/Resume Command Handler"; + + /** + * Help text. + */ + final static List HELP_TEXT = buildHelpText(); + + private static final String PAUSE_COMMAND = "pause"; + private static final String PAUSE_COMMAND_WITH_TARGET = "pause,target="; + private static final int PAUSE_COMMAND_WITH_TARGET_LENGTH = PAUSE_COMMAND_WITH_TARGET.length(); + + private static final String RESUME_COMMAND = "resume"; + private static final String RESUME_COMMAND_WITH_TARGET = "resume,target="; + private static final int RESUME_COMMAND_WITH_TARGET_LENGTH = RESUME_COMMAND_WITH_TARGET.length(); + + private static final String STATUS_COMMAND = "status"; + private static final String STATUS_COMMAND_WITH_TARGET = "status,target="; + private static final int STATUS_COMMAND_WITH_TARGET_LENGTH = STATUS_COMMAND_WITH_TARGET.length(); + private static final String STATUS_COMMAND_WITH_DETAILS = "status,details"; + private static final int STATUS_COMMAND_WITH_DETAILS_LENGTH = STATUS_COMMAND_WITH_DETAILS.length(); + + /** + * DS method to activate this component. + */ + protected void activate() {} + + /** + * DS method to deactivate this component. + */ + protected void deactivate() {} + + /** + * Set the PauseableComponentController reference. + * + * @param m_pauseableComponentController the PauseableComponentController to set + * + * Note: We want to this CommandHandler to be activated even if the PauseableComponentController is not + * around to perform all the functions. The reason is that we want to be able to provide the z/OS Command + * help. If we are not registered as a CommandHandler then a "f ,help" will not be able to obtain + * out help information (getHelp()). + */ + @Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY) + protected void setPauseableComponentController(PauseableComponentController pauseableComponentController) { + this.m_pauseableComponentController = pauseableComponentController; + + PauseResumeConsoleSupport.INSTANCE.setPauseableComponentController(this.m_pauseableComponentController); + } + + /** + * Unset the PauseableComponentController reference. + * + * @param PauseableComponentController the PauseableComponentController to unset + */ + protected void unsetPauseableComponentController(PauseableComponentController pauseableComponentController) { + if (this.m_pauseableComponentController == pauseableComponentController) { + this.m_pauseableComponentController = null; + + PauseResumeConsoleSupport.INSTANCE.setPauseableComponentController(this.m_pauseableComponentController); + } + } + + /** + * Sets the WsLocationAdmin reference. + * + * Note: We want to this CommandHandler to be activated even if the PauseableComponentController is not + * around to perform all the functions. The reason is that we want to be able to provide the z/OS Command + * help. If we are not registered as a CommandHandler then a "f ,help" will not be able to obtain + * out help information (getHelp()). + */ + @Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY) + protected void setLocationAdmin(WsLocationAdmin locationAdmin) { + this.m_locationAdmin = locationAdmin; + } + + /** + * Clears the WsLocationAdmin reference. + */ + protected void unsetLocationAdmin(WsLocationAdmin locationAdmin) { + this.m_locationAdmin = null; + } + + /** + * {@inheritDoc} + */ + @Override + public List getHelp() { + return HELP_TEXT; + } + + /** + * Get the name of this console command handler. + */ + @Override + public String getName() { + return NAME; + } + + /** + * {@inheritDoc} + */ + @Override + public void handleModify(String command, ModifyResults results) { + List responses = new ArrayList(); + + if (command.toLowerCase().startsWith("pause")) { + pause(command, responses, results); + } else if (command.toLowerCase().startsWith("resume")) { + resume(command, responses, results); + } else if (command.toLowerCase().startsWith("status")) { + serverStatus(command, responses, results); + } else { + results.setCompletionStatus(ModifyResults.UNKNOWN_COMMAND); + } + + results.setResponsesContainMSGIDs(false); + results.setResponses(responses); + } + + /** + * Process "f ,pause[,target=]". Deliver the pause request to all registered + * PauseableComponents. + * + * @param command Command string. + * @param responses Command response strings. + * @param results processing results (ie. sort of success, error, ...) + */ + private void pause(String command, List responses, ModifyResults results) { + int result = ModifyResults.PROCESSED_COMMAND; + + String targetIds = null; + if (!!!command.equalsIgnoreCase(PAUSE_COMMAND)) { + if (command.toLowerCase().startsWith(PAUSE_COMMAND_WITH_TARGET)) { + targetIds = getTargetIds(command.substring(PAUSE_COMMAND_WITH_TARGET_LENGTH)); + + if (targetIds == null || targetIds.isEmpty()) { + // Error: invalid target= syntax. f bbgzsrv,pause,target='' + responses.add("Could not parse target= parameter: \"" + command + "\""); + results.setCompletionStatus(ModifyResults.ERROR_PROCESSING_COMMAND); + return; + } + } else { + // Invalid pause syntax like: f bbgzsrv,pauseit or ...pause, or ...pause,target + responses.add("Could not parse command: \"" + command + "\""); + results.setCompletionStatus(ModifyResults.ERROR_PROCESSING_COMMAND); + return; + } + } + + if (PauseResumeConsoleSupport.INSTANCE.pause(targetIds) > 0) { + result = ModifyResults.ERROR_PROCESSING_COMMAND; + } + + results.setCompletionStatus(result); + } + + /** + * Process "f ,resume[,target=]". Deliver the resume request to all registered + * PauseableComponents. + * + * @param command Command string. + * @param responses Command response strings. + * @param results processing results (ie. sort of success, error, ...) + */ + private void resume(String command, List responses, ModifyResults results) { + int result = ModifyResults.PROCESSED_COMMAND; + + String targetIds = null; + if (!!!command.equalsIgnoreCase(RESUME_COMMAND)) { + if (command.toLowerCase().startsWith(RESUME_COMMAND_WITH_TARGET)) { + targetIds = getTargetIds(command.substring(RESUME_COMMAND_WITH_TARGET_LENGTH)); + + if (targetIds == null || targetIds.isEmpty()) { + // Error: invalid target= syntax. f bbgzsrv,resume,target='' + responses.add("Could not parse target= parameter: \"" + command + "\""); + results.setCompletionStatus(ModifyResults.ERROR_PROCESSING_COMMAND); + return; + } + } else { + // invalid resume syntax: f bbgzsrv,resumeit or ...resume, or ...resume,target + responses.add("Could not parse command: \"" + command + "\""); + results.setCompletionStatus(ModifyResults.ERROR_PROCESSING_COMMAND); + return; + } + } + + if (PauseResumeConsoleSupport.INSTANCE.resume(targetIds) > 0) { + result = ModifyResults.ERROR_PROCESSING_COMMAND; + } + + results.setCompletionStatus(result); + } + + /** + * Process "f ,status[,target='id,...'|details]" command. Deliver the display information on all registered + * PauseableComponents. + * + * @param command Command string. + * @param responses Command response strings. + * @param results processing results (ie. sort of success, error, ...) + */ + private void serverStatus(String command, List responses, ModifyResults results) { + int result = ModifyResults.PROCESSED_COMMAND; + + String targetIds = null; + if (!!!command.equalsIgnoreCase(STATUS_COMMAND)) { + if (command.toLowerCase().startsWith(STATUS_COMMAND_WITH_TARGET)) { + targetIds = getTargetIds(command.substring(STATUS_COMMAND_WITH_TARGET_LENGTH)); + + if (targetIds == null || targetIds.isEmpty()) { + // Error: invalid target= syntax. f bbgzsrv,status,target='' + responses.add("Could not parse target= parameter: \"" + command + "\""); + result = ModifyResults.ERROR_PROCESSING_COMMAND; + } else { + if (PauseResumeConsoleSupport.INSTANCE.statusTarget(responses, targetIds) > 0) { + result = ModifyResults.ERROR_PROCESSING_COMMAND; + } + } + } else if (command.toLowerCase().startsWith(STATUS_COMMAND_WITH_DETAILS)) { + // "f ,status,details" -- displays information on all currently registered PauseableComponents. + if (PauseResumeConsoleSupport.INSTANCE.details(responses) > 0) { + result = ModifyResults.ERROR_PROCESSING_COMMAND; + } + } else { + // invalid resume syntax: f bbgzsrv,statusit or ...status, or ...status,target + responses.add("Could not parse command options: \"" + command + "\""); + result = ModifyResults.ERROR_PROCESSING_COMMAND; + } + } else { + // "f ,status" -- displays information on all currently registered PauseableComponents. + int pauseRC = PauseResumeConsoleSupport.INSTANCE.status(); + + String serverName = (this.m_locationAdmin != null) ? this.m_locationAdmin.getServerName() : "unknown"; + + if (pauseRC == 0) { + responses.add("server " + serverName + " is paused."); + } else if (pauseRC == 4) { + responses.add("server " + serverName + " is active."); + } else { + result = ModifyResults.ERROR_PROCESSING_COMMAND; + } + } + + results.setCompletionStatus(result); + } + + private static List buildHelpText() { + List responses = new ArrayList(); + + responses.add("Issue \"MODIFY identifier,pause<,target='target1,...'>\""); + responses.add(" to pause server components accepting work"); + responses.add("Issue \"MODIFY identifier,resume<,target='target1,...'>\""); + responses.add(" to resume server components to accept work"); + responses.add("Issue \"MODIFY identifier,status<,target='target1,...'>\""); + responses.add(" to display the server status or targeted status"); + responses.add("Issue \"MODIFY identifier,status,details\""); + responses.add(" to display information on the pause capable components"); + return responses; + } + + /** + * Parses the "target=" parameter. + * + * @param targetIds the "target=" parameter string + * @return String of target ids for the targeted request, or null if the command + * string contains a syntax error. + */ + private String getTargetIds(String targetIds) { + + if (targetIds == null) { + return null; + } + + // Remove leading and/or trailing single quote. + String ids = targetIds.replaceAll("^\'|\'$", ""); + + return ids; + } +} diff --git a/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/internal/PauseResumeConsoleSupport.java b/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/internal/PauseResumeConsoleSupport.java new file mode 100644 index 000000000000..58ea0fdddc3a --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/internal/PauseResumeConsoleSupport.java @@ -0,0 +1,317 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.channel.console.internal; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import com.ibm.websphere.ras.Tr; +import com.ibm.websphere.ras.TraceComponent; +import com.ibm.ws.ffdc.annotation.FFDCIgnore; +import com.ibm.ws.kernel.launch.service.PauseableComponent; +import com.ibm.ws.kernel.launch.service.PauseableComponentController; +import com.ibm.ws.kernel.launch.service.PauseableComponentControllerRequestFailedException; + +/** + * Support various z/OS console commands affecting PauseableComponents. + * + * serialized singleton. + */ +public enum PauseResumeConsoleSupport { + + INSTANCE; + + /** + * trace variable + */ + //private static final TraceComponent tc = Tr.register(PauseResumeConsoleSupport.class, "zConsole"); + private static final TraceComponent tc = Tr.register(PauseResumeConsoleSupport.class); + + /** + * PauseableComponentController to manage pause/resume for PauseableComponents.. + */ + private PauseableComponentController m_pauseableComponentController; + + /** + * Deliver pause request to interested PauseableComponents. + * + * @param args optional PauseableComponent targets. + * @return 0 if all went well, 8 if an error was encountered. + */ + @FFDCIgnore(PauseableComponentControllerRequestFailedException.class) + public int pause(String args) { + if (this.m_pauseableComponentController == null) { + if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { + Tr.debug(tc, "pause: PauseableComponentController not yet injected"); + } + + Tr.error(tc, "ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE", "pause"); + return 8; + } + + // FYI: the passed parms to Controller should be just the string of ids. + // So, if "f ,pause,target='id1,id2,id3'", we should pass a String of (id1,id2,id3). No target= + // wrapping single quotes. The caller should've stripped them. + + if (args == null) { + // Pause on server + try { + this.m_pauseableComponentController.pause(); + } catch (PauseableComponentControllerRequestFailedException e) { + if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { + Tr.debug(tc, "pause(): PauseableComponentController threw to us:" + e); + } + return 8; + } + } else { + // Pause with target(s) + try { + this.m_pauseableComponentController.pause(args); + } catch (PauseableComponentControllerRequestFailedException e) { + if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { + Tr.debug(tc, "pause(target): PauseableComponentController threw to us:" + e); + } + return 8; + } + } + + return 0; + } + + /** + * Deliver the resume request to interested PauseableComponents. + * + * @param args optional parameters. + * @return 0 if all went well, 8 if an error was encountered. + */ + @FFDCIgnore(PauseableComponentControllerRequestFailedException.class) + public int resume(String args) { + if (this.m_pauseableComponentController == null) { + if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { + Tr.debug(tc, "resume: PauseableComponentController not yet injected"); + } + + Tr.error(tc, "ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE", "resume"); + return 8; + } + + if (args == null) { + // Resume on server + try { + this.m_pauseableComponentController.resume(); + } catch (PauseableComponentControllerRequestFailedException e) { + if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { + Tr.debug(tc, "resume: PauseableComponentController threw to us:" + e); + } + return 8; + } + } else { + try { + // Resume with target(s) + this.m_pauseableComponentController.resume(args); + } catch (PauseableComponentControllerRequestFailedException e) { + if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { + Tr.debug(tc, "resume(target): PauseableComponentController threw to us:" + e); + } + return 8; + } + } + + return 0; + } + + /** + * Deliver status request to PauseableComponentController. + * + * @return 0 if all went well, 4 if server status is active, 8 if an error was encountered. + */ + public int status() { + if (this.m_pauseableComponentController == null) { + if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { + Tr.debug(tc, "status: PauseableComponentController not yet injected"); + } + + Tr.error(tc, "ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE", "status"); + + return 8; + } + + // f bbgzsrv,status call for server status + if (this.m_pauseableComponentController.isPaused()) { + return 0; + } else { + return 4; + } + } + + /** + * Get display information about specific participating PauseableComponents. + * + * @param args target components. + * @return 0 if all went, 8 if an error was encountered. + */ + public int statusTarget(List responses, String targetArg) { + if (this.m_pauseableComponentController == null) { + if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { + Tr.debug(tc, "status,target: PauseableComponentController not yet injected"); + } + + Tr.error(tc, "ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE", "status,target"); + + return 8; + } + + LinkedHashMap targetMap = new LinkedHashMap(); + + if (targetArg != null && !targetArg.equals("")) { + String targetsList[] = targetArg.split(","); + + // Prime the status for each target with the "not found" message. + for (String target : targetsList) { + StringBuffer pcNotFound = new StringBuffer(); + pcNotFound.append("TARGET ").append(target).append(" was not found."); + + targetMap.put(target, pcNotFound.toString()); + } + } else { + if (targetMap.isEmpty()) { + responses.add("parsed targets resulted in an empty list"); + return 8; + } + } + + // Add each pauseable component to this list. If the List of pauseable components get modified + // while we are iterating we start over, skip anyone already in this list. + Set processedList = new LinkedHashSet(); + + while (true) { + String currentPC_name = null; + try { + + for (PauseableComponent pauseableComponent : this.m_pauseableComponentController.getPauseableComponents()) { + + currentPC_name = pauseableComponent.getName(); + if (processedList.add(pauseableComponent)) { + + // Remove from target list...returns true if found and removed + if (targetMap.containsKey(currentPC_name)) { + + // myHttpEndpoint is paused|active. + String pausedState = pauseableComponent.isPaused() ? "paused" : "active"; + + StringBuffer pcStatus = new StringBuffer(); + pcStatus.append("TARGET ").append(currentPC_name).append(" is ").append(pausedState).append("."); + + targetMap.put(currentPC_name, pcStatus.toString()); + } + } + } + // At this point, the pauseable components were found and processed. Push built status back. + for (String response : targetMap.values()) { + responses.add(response); + } + + break; + + } catch (Throwable te) { + // Someone modified our list of services or something else. Build a response for the current PC in case we don't + // process it on the our retry to process the remaining PCs. + if (currentPC_name != null) { + StringBuffer pcException = new StringBuffer(); + pcException.append("TARGET ").append(currentPC_name).append(" failure occurred obtaining status. Check server logs for details."); + + targetMap.put(currentPC_name, pcException.toString()); + } + } + } + + return 0; + } + + /** + * Get display information about current participating PauseableComponents. + * + * @param args optional parameters. + * @return 0 if all went, 8 if an error was encountered. + */ + public int details(List responses) { + if (this.m_pauseableComponentController == null) { + if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { + Tr.debug(tc, "status,details: PauseableComponentController not yet injected"); + } + + Tr.error(tc, "ERROR.PAUSEABLE.COMPONENT.NOTAVAILABLE", "status,details"); + + return 8; + } + + List pcResponses = new ArrayList(); + + // Add each pauseable component to this list. If the List of pauseable components get modified + // while we are iterating we start over, skip anyone already in this list. + Set processedList = new HashSet(); + + while (true) { + try { + + for (PauseableComponent pauseableComponent : this.m_pauseableComponentController.getPauseableComponents()) { + + if (processedList.add(pauseableComponent)) { + + // myHttpEndpoint(PAUSED): host:*, state:4, httpsPort:38811, httpPort:38801 + HashMap extendedInfo = pauseableComponent.getExtendedInfo(); + + String pausedState = pauseableComponent.isPaused() ? "paused" : "active"; + + StringBuffer pcStatus = new StringBuffer(); + pcStatus.append(pauseableComponent.getName()).append("(").append(pausedState).append("):"); + String separator = " "; + + for (String key : extendedInfo.keySet()) { + pcStatus.append(separator).append(key).append(":").append(extendedInfo.get(key)); + separator = ", "; + } + + pcResponses.add(pcStatus.toString()); + } + } + // At this point, there were pauseable components found and all are paused. + break; + + } catch (Throwable te) { + // Someone modified our list of services or something else. Retry to process remaining PCs. + } + } + + if (pcResponses == null || pcResponses.isEmpty()) { + responses.add("No results returned from pauseable components\n"); + } else { + responses.addAll(pcResponses); + } + + return 0; + } + + /** + * Save reference to the pause/resume request coordinator. + * + * @param m_pauseableComponentController + */ + public void setPauseableComponentController(PauseableComponentController m_pauseableComponentController) { + this.m_pauseableComponentController = m_pauseableComponentController; + } +} diff --git a/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/internal/package-info.java b/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/internal/package-info.java new file mode 100644 index 000000000000..11e7b0fb4ba1 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/internal/package-info.java @@ -0,0 +1,19 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.0 + */ +@org.osgi.annotation.versioning.Version("1.0") +@TraceOptions(traceGroup = "zConsole", messageBundle = "com.ibm.ws.zos.channel.console.internal.resources.ZConsoleChannelMessages") +package com.ibm.ws.zos.channel.console.internal; + +import com.ibm.websphere.ras.annotation.TraceOptions; diff --git a/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/package-info.java b/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/package-info.java new file mode 100644 index 000000000000..7d4a7a48f938 --- /dev/null +++ b/dev/com.ibm.ws.zos.channel.console/src/com/ibm/ws/zos/channel/console/package-info.java @@ -0,0 +1,19 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.0 + */ +@org.osgi.annotation.versioning.Version("1.0") +@TraceOptions(traceGroup = "zConsole", messageBundle = "com.ibm.ws.zos.channel.console.internal.resources.ZConsoleChannelMessages") +package com.ibm.ws.zos.channel.console; + +import com.ibm.websphere.ras.annotation.TraceOptions; diff --git a/dev/com.ibm.ws.zos.command.processing_test/.classpath b/dev/com.ibm.ws.zos.command.processing_test/.classpath index 99444f2df53f..bd880329225d 100755 --- a/dev/com.ibm.ws.zos.command.processing_test/.classpath +++ b/dev/com.ibm.ws.zos.command.processing_test/.classpath @@ -1,12 +1,7 @@ - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_test/.classpath.gradle b/dev/com.ibm.ws.zos.command.processing_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_test/.project b/dev/com.ibm.ws.zos.command.processing_test/.project index a4dd7d34571d..4072f4049ecc 100755 --- a/dev/com.ibm.ws.zos.command.processing_test/.project +++ b/dev/com.ibm.ws.zos.command.processing_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.zos.command.processing_test/bnd.bnd b/dev/com.ibm.ws.zos.command.processing_test/bnd.bnd new file mode 100755 index 000000000000..fffb3bb0326f --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_test/bnd.bnd @@ -0,0 +1,23 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + org.eclipse.osgi;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.command.processing;version=latest diff --git a/dev/com.ibm.ws.zos.command.processing_test/bnd.bnd.gradle b/dev/com.ibm.ws.zos.command.processing_test/bnd.bnd.gradle new file mode 100755 index 000000000000..fffb3bb0326f --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_test/bnd.bnd.gradle @@ -0,0 +1,23 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + org.eclipse.osgi;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.command.processing;version=latest diff --git a/dev/com.ibm.ws.zos.command.processing_test/build.gradle b/dev/com.ibm.ws.zos.command.processing_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/.classpath b/dev/com.ibm.ws.zos.command.processing_zfat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/.classpath.gradle b/dev/com.ibm.ws.zos.command.processing_zfat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/.project b/dev/com.ibm.ws.zos.command.processing_zfat/.project new file mode 100755 index 000000000000..ba2cb4c904a7 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.zos.command.processing_zfat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..e88c46cebca5 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Thu Dec 15 11:10:06 EST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.ltk.core.refactoring.prefs b/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100755 index 000000000000..5391abcacb31 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,3 @@ +#Thu Dec 15 11:56:18 EST 2011 +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd b/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd.gradle b/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd.gradle new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/build-ztest.xml b/dev/com.ibm.ws.zos.command.processing_zfat/build-ztest.xml new file mode 100755 index 000000000000..dcadaa86ac1f --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/build-ztest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/build.gradle b/dev/com.ibm.ws.zos.command.processing_zfat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATSuite.java b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATSuite.java new file mode 100644 index 000000000000..fc762afc6cd8 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATSuite.java @@ -0,0 +1,78 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.command.processing.zfat; + +import static org.junit.Assert.assertTrue; + +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import com.ibm.websphere.simplicity.log.Log; + +@RunWith(Suite.class) +@SuiteClasses({ FATTest.class, + ZosCommandHandlerTest.class }) +/** + * Suite. + */ +public class FATSuite { + + /** + * For use with logging + */ + private static final Class c = FATSuite.class; + // User product extension variables. + public static final String USER_FEATURE_PATH = "usr/extension/lib/features/"; + public static final String USER_BUNDLE_PATH = "usr/extension/lib"; + public static final String USER_FEATURE_PRODTEST_MF = "productExtensions/features/userProdtest-1.0.mf"; + public static final String USER_BUNDLE_JAR = "bundles/test.user.prod.extension_1.0.0.jar"; + + + /** + * Pre FAT processing. + * + * @throws Exception + */ + @BeforeClass + public static void setup() throws Exception { + final String METHOD_NAME = "setup"; + Log.info(c, METHOD_NAME, "Entry."); + + // Install user extension. + installUserProductExtension(); + + Log.info(c, METHOD_NAME, "Exit."); + } + + /** + * Installs a specific product extension if the default USR location. + * + * @throws Exception + */ + public static void installUserProductExtension() throws Exception { + String method = "installUserProductExtension"; + Log.info(c, method, "Entry. Intalling user product extension."); + + ZosCommandHandlerTest.server.copyFileToLibertyInstallRoot(USER_FEATURE_PATH, USER_FEATURE_PRODTEST_MF); + assertTrue("User product feature: " + USER_FEATURE_PRODTEST_MF + " should have been copied to: " + USER_FEATURE_PATH, + ZosCommandHandlerTest.server.fileExistsInLibertyInstallRoot(USER_FEATURE_PATH + "userProdtest-1.0.mf")); + + ZosCommandHandlerTest.server.copyFileToLibertyInstallRoot(USER_BUNDLE_PATH, USER_BUNDLE_JAR); + assertTrue("User product bundle: " + USER_BUNDLE_JAR + " should have been copied to: " + USER_BUNDLE_PATH, + ZosCommandHandlerTest.server.fileExistsInLibertyInstallRoot(USER_BUNDLE_PATH + "/test.user.prod.extension_1.0.0.jar")); + + Log.info(c, method, "Exit. User product extension using feature: " + USER_FEATURE_PRODTEST_MF + " has been installed."); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATTest.java b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATTest.java new file mode 100755 index 000000000000..78962dd2e73f --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATTest.java @@ -0,0 +1,157 @@ +package com.ibm.ws.zos.command.processing.zfat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import test.common.zos.ZosOperationsFat; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Verify that command processing works by default + * and that it does not with the bootstrap.properties update + */ +public class FATTest { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("COM.IBM.WS.ZOS.COMMAND.PROCESSING"); + private static String serverName; + private static String installDir; + private static File pidFile; + private static String serversDir; + + /** + * For use with logging + */ + private static final Class c = FATTest.class; + private static final String WASJobName = "BBGZSRV"; + private int waitTime = 10; + private String startMsgID = "CWWKF0011I"; + + /** + * Start a server from the MVS console + * @throws Exception + */ + private void startServerViaMVS() throws Exception { + String mName = "startServerViaMVS"; + String cmd = "S " + WASJobName + ",PARMS=" + serverName; + Log.info(c, mName, "MVS Console Command: " + cmd); + new ZosOperationsFat().executeMVSConsoleCommand(cmd); + } + + /** + * Start a server + * Stop it via the MVS Console + * Verify it stopped + */ + @Test + public void testStopViaMVS() throws Exception { + String mName = "testStopViaMVS"; + + Log.info(c, mName, "Verify " + serverName + " is not running."); + assertFalse(pidFile.exists()); + + Log.info(c, mName, "Starting a new server to stop"); + startServerViaMVS(); + + Log.info(c, mName, "Verify " + serverName + " started"); + ZosOperationsFat zosOp = new ZosOperationsFat(); + String result = zosOp.waitForStringInJobLog(WASJobName, waitTime, startMsgID); + assertTrue(pidFile.exists()); + assertTrue(result != null); + + Log.info(c, mName, "Verify that we can stop server " + serverName); + zosOp.stopWASProcess(WASJobName); + assertFalse(pidFile.exists()); + } + + /** + * Update bootstrap.properties + * Start the server + * Attempt to stop it via the MVS Console + * Verify that it did not stop + */ + @Test + public void testNoStopViaMVS() throws Exception { + String mName = "testNoStopViaMVS"; + Log.info(c, mName, "Starting a new server not to stop"); + + server.copyFileToLibertyServerRoot("/NoConsole/bootstrap.properties"); + + Log.info(c, mName, "Verify " + serverName + " is not running."); + assertFalse(pidFile.exists()); + + Log.info(c, mName, "Starting a new server NOT to stop"); + startServerViaMVS(); + + + Log.info(c, mName, "Verify " + serverName + " started"); + ZosOperationsFat zosOp = new ZosOperationsFat(); + String result = zosOp.waitForStringInJobLog(WASJobName, waitTime, startMsgID); + assertTrue(pidFile.exists()); + assertTrue(result != null); + + Log.info(c, mName, "Verify that we CANNOT stop server " + serverName); + zosOp.stopWASProcess(WASJobName); + assertTrue(pidFile.exists()); + + // should still be able to cancel the job without talking to the server + zosOp.executeMVSConsoleCommand("C " + WASJobName); + + server.deleteFileFromLibertyServerRoot("bootstrap.properties"); + server.copyFileToLibertyServerRoot("/bootstrap.properties"); + } + + /** + * Prepare for test + * @throws Exception + */ + @Before + public void before() throws Exception { + String mName = "before"; + Log.info(c, mName, "Preparing for test..."); + + // precondition: no server or angel should be started. Stop if if there exist + // either + Log.info(c, mName, "Shutting down any existing angels and servers first"); + ZosOperationsFat zosOp = new ZosOperationsFat(); + zosOp.stopWASProcess(WASJobName); + zosOp.stopAngel(true); + + installDir = server.getInstallRoot(); + serverName = server.getServerName(); + serversDir = installDir + File.separatorChar + "usr" + File.separatorChar + "servers"; + String pidFileName = serversDir + File.separatorChar + ".pid" + File.separatorChar + serverName + ".pid"; + pidFile = new File(pidFileName); + Log.info(c, mName, "Expected PID file: " + pidFile.getAbsolutePath()); + } + + /** + * Cancel the server, just in case... + * + * @throws Exception + */ + @After + public void after() throws Exception { + String mName = "after"; + Log.info(c, mName, "Cleaning up..."); + new ZosOperationsFat().executeMVSConsoleCommand("C " + WASJobName); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerTest.java b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerTest.java new file mode 100644 index 000000000000..1d55431e47f7 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerTest.java @@ -0,0 +1,109 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.command.processing.zfat; + +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.zos.ZosOperationsFat; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ZosCommandHandlerTest { + + private static test.common.zos.ZosOperationsFat zops = null; + + private static final Class c = ZosCommandHandlerTest.class; + + private static ZosCommandHandlerUtility util = null; + + private static String servrStcId; + + protected static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.zos.command.feature"); + + @BeforeClass + public static void setUp() throws Exception { + Log.info(c, "setup", "Entry"); + + servrStcId = null; + + util = new ZosCommandHandlerUtility(server); + + zops = new ZosOperationsFat(); + + zops.executeMVSConsoleCommand("stop bbgzsrv"); + + Thread.sleep(5000); + + zops.executeMVSConsoleCommand("s \"bbgzsrv,parms='com.ibm.ws.zos.command.feature'\""); + servrStcId = ZosOperationsFat.waitForSTC(zops, "BBGZSRV", 10); + util.waitForOutputInLog(servrStcId, "CWWKF0011I", 10); + + + Log.info(c, "setup", "Exit"); + } + + @Test + public void testCommandHandler() throws Exception { + Log.info(c, "testCommandHandler", "Entry"); + boolean success = false; + // Test command + if (servrStcId != null && servrStcId.length() > 0) { + zops.executeMVSConsoleCommand("F \"bbgzsrv,'test.command'\""); + String servrJoblog = util.waitForOutputInLog(servrStcId, "UserProductExtensionCommandHandler_handleModify_respondingToModifyCommand: test.command", 10); + if (servrJoblog.indexOf("COMPLETED SUCCESSFULLY") >= 0) + success = true; + } else { + Log.info(c, "testCommandHandler", "unable to determine BBGZSRV job id"); + } + assertTrue("Successful completion message not found", success); + + } + + @Test + public void testCommandHandlerHelp() throws Exception { + Log.info(c, "testCommandHandlerHelp", "Entry"); + boolean success = false; + // test for help + if (servrStcId != null && servrStcId.length() > 0) { + zops.executeMVSConsoleCommand("F \"bbgzsrv,help\""); + String servrJoblog = util.waitForOutputInLog(servrStcId, "CWWKB0012I: Test Command Handler has no help.", 10); + if (servrJoblog.indexOf("CWWKB0012I: Test Command Handler has no help.") >= 0) { + success = true; + Log.info(c, "testCommandHandler", "help failed"); + } + } else { + Log.info(c, "testCommandHandlerHelp", "unable to determine BBGZSRV job id"); + } + assertTrue("Help message not found", success); + + + } + @AfterClass + public static void tearDown() { + if (zops != null) { + try { + zops.executeMVSConsoleCommand("stop bbgzsrv"); + } catch (Exception e) { + Log.info(c, "tearDown", "Error stopping server " + e.toString()); + } + } + + } + +} diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerUtility.java b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerUtility.java new file mode 100644 index 000000000000..d2dd7ab2ffc4 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerUtility.java @@ -0,0 +1,78 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.command.processing.zfat; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; + +/** + * + */ +public class ZosCommandHandlerUtility { + + private static final Class c = ZosCommandHandlerUtility.class; + + private final LibertyServer server; + + private static final int JOB_SEARCH_TIMEOUT = 5; // seconds + + protected ZosCommandHandlerUtility(LibertyServer server) { + this.server = server; + } + + /** + * Wait for some text to appear in a joblog / STC log, up to a timeout. + * + * @return the entire joblog + */ + protected String waitForOutputInLog(String jobId, String text, int timeoutInSeconds) throws Exception { + // This loop is somewhat silly, unfortunately. We want to loop until we have + // job output. However, sometimes the job output will seem available, but is + // not complete (sections are missing). If the caller has provided text to + // search for, we will wait to see if that text appears in the log, and if not, + // we'll keep waiting, up to our timeout. The caller still needs to check if + // that output appears in the log. + int i = 0; + String myJobLog = getRecentJoblog(jobId); + String textClue = (text != null) ? text : " "; + while (((myJobLog == null) || (myJobLog.isEmpty()) || (myJobLog.contains(textClue) == false)) + && (i++ < JOB_SEARCH_TIMEOUT)) { // give it a few seconds even though our methods are 100% foolproof + Thread.sleep(1000); + myJobLog = getRecentJoblog(jobId); + } + return myJobLog; + } + + /** + * Get joblog with jobId + * should this return ZWASJoblogReader ?? instead of String + * + * @param jobId JobID of the job + * @throws Exception + */ + private String getRecentJoblog(String jobId) throws Exception { + Log.info(c, "getJoblog", "get job log of most recent finished job"); + String joblog = null; + Machine machine = Machine.getLocalMachine(); + + if (jobId != null) { + ProgramOutput jobout = machine.execute("sysout", + new String[] { "-o", jobId }, + "/usr/local/bin"); + joblog = jobout.getStdout(); + } + return joblog; + } + +} diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/NoConsole/bootstrap.properties b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/NoConsole/bootstrap.properties new file mode 100755 index 000000000000..de6844a1cbc9 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/NoConsole/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +websphere.os.extension=zosNoConsoleExtensions-1.0 \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bootstrap.properties b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bundles/.gitignore b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bundles/.gitignore new file mode 100644 index 000000000000..357e41093ccb --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bundles/.gitignore @@ -0,0 +1 @@ +/test.user.prod.extension_1.0.0.jar diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/productExtensions/features/userProdtest-1.0.mf b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/productExtensions/features/userProdtest-1.0.mf new file mode 100644 index 000000000000..c7dd53a1cd6d --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/productExtensions/features/userProdtest-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:userProdtest-1.0 +Subsystem-SymbolicName: userProdtest-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.user.prod.extension; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/server.xml b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/server.xml new file mode 100755 index 000000000000..aa6e0aa65cd9 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/server.xml @@ -0,0 +1,13 @@ + + + + + jsp-2.2 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/bootstrap.properties b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/server.xml b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/server.xml new file mode 100755 index 000000000000..aa6e0aa65cd9 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/server.xml @@ -0,0 +1,13 @@ + + + + + jsp-2.2 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/bootstrap.properties b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/bootstrap.properties new file mode 100644 index 000000000000..d2d997b6acbf --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +ds.logLevel=debug \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/server.xml b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/server.xml new file mode 100644 index 000000000000..0163d54469e6 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/server.xml @@ -0,0 +1,12 @@ + + + + + + + + timedexit-1.0 + usr:userProdtest-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/bnd.bnd b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/bnd.bnd new file mode 100644 index 000000000000..32fe637834c9 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/bnd.bnd @@ -0,0 +1,20 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: User Product Extension Service +Bundle-SymbolicName: test.user.prod.extension; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +# export the interface packages +Export-Package: \ + test.user.prod.extension;provide:=true + +Private-Package: test.user.prod.extension.internal.* + +Include-Resource:\ + OSGI-INF/metatype/metatype.xml=resources/metatype.xml + +-dsannotations: \ + test.user.prod.extension.internal.commandhandler.UserProductExtensionCommandHandler diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/resources/metatype.xml b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/resources/metatype.xml new file mode 100644 index 000000000000..678f1c5ea8b9 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/resources/metatype.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/src/test/user/prod/extension/internal/commandhandler/UserProductExtensionCommandHandler.java b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/src/test/user/prod/extension/internal/commandhandler/UserProductExtensionCommandHandler.java new file mode 100644 index 000000000000..bbb56c9a0f8a --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/src/test/user/prod/extension/internal/commandhandler/UserProductExtensionCommandHandler.java @@ -0,0 +1,108 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.user.prod.extension.internal.commandhandler; + +import java.util.ArrayList; + +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ConfigurationPolicy; + +import com.ibm.wsspi.zos.command.processing.CommandHandler; +import com.ibm.wsspi.zos.command.processing.ModifyResults; + +/** + * User extension command handler + */ +@Component(configurationPid = "user.prod.extension.commandHandler", + configurationPolicy = ConfigurationPolicy.IGNORE, + property = { "modify.filter.regex=((?i)(test.command).*)", + "display.command.help=TRUE", + "service.vendor=IBM" }) +public class UserProductExtensionCommandHandler implements CommandHandler { + + protected String filterExpresson = null; + protected boolean getHelp = true; + + private ArrayList helpText = null; + + private final String name = "CommandHandlerTest"; + + /** + * This is the declarative services activate method. This gets driven + * when the runtime decides it actually needs our service (as opposed to + * when the bundle is activated). The metatype will be provided to us + * in the config parameter. + * + * @param cc The OSGi component context. + * @param config The configuration (metatype) + */ + protected void activate(ComponentContext cc, java.util.Map config) { + filterExpresson = (String) config.get(MODIFY_FILTER); + getHelp = Boolean.parseBoolean((String) config.get(DISPLAY_HELP)); + } + + /** + * This is the declarative services deactivate method. + * + * @param cc + */ + protected void deactivate(ComponentContext cc) { + filterExpresson = null; + getHelp = false; + } + + /** + * This is the declarative services modified method. When the + * configuration changes dynamically, this method is driven to + * give us the updated configuration. + * + * @param config The configuration (metatype). + */ + protected void modified(java.util.Map config) { + filterExpresson = (String) config.get(MODIFY_FILTER); + getHelp = Boolean.parseBoolean((String) config.get(DISPLAY_HELP)); + } + + @Override + public ArrayList getHelp() { + + if (helpText == null) { + helpText = new ArrayList(); + helpText.add("Test Command Handler has no help"); + } + return helpText; + } + + @Override + public String getName() { + return name; + } + + @Override + public void handleModify(String handle, ModifyResults mod) { + if (handle.equals("test.command")) { + ArrayList response = new ArrayList(); + response.add("UserProductExtensionCommandHandler_handleModify_respondingToModifyCommand: " + handle); + mod.setResponses(response); + mod.setCompletionStatus(ModifyResults.PROCESSED_COMMAND); + mod.setResponsesContainMSGIDs(false); + } else { + ArrayList response = new ArrayList(); + response.add("Test Failed command " + handle + " not valid"); + mod.setResponses(response); + mod.setCompletionStatus(ModifyResults.ERROR_PROCESSING_COMMAND); + mod.setResponsesContainMSGIDs(false); + } + + } +} diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.classpath b/dev/com.ibm.ws.zos.command.processing_ztest/.classpath new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.classpath.gradle b/dev/com.ibm.ws.zos.command.processing_ztest/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.gitignore b/dev/com.ibm.ws.zos.command.processing_ztest/.gitignore new file mode 100644 index 000000000000..9c10d02b4539 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.gitignore @@ -0,0 +1,4 @@ +/dist +/bundles +/lib +/*.log* diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.project b/dev/com.ibm.ws.zos.command.processing_ztest/.project new file mode 100755 index 000000000000..09a8e588f02a --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.zos.command.processing_ztest + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..2d37f3472a86 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +encoding/=UTF-8 +eclipse.preferences.version=1 diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..95719ae3709c --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..6da3e89478aa --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.remove_trailing_whitespaces=true +cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.add_missing_nls_tags=false +org.eclipse.jdt.ui.staticondemandthreshold=99 +cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_blocks=false +sp_cleanup.make_private_fields_final=true +org.eclipse.jdt.ui.ignorelowercasenames=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.remove_private_constructors=true +sp_cleanup.never_use_parentheses_in_expressions=true +cleanup.remove_unnecessary_casts=true +sp_cleanup.organize_imports=true +sp_cleanup.never_use_blocks=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_fields=true +org.eclipse.jdt.ui.text.custom_code_templates= +cleanup.always_use_parentheses_in_expressions=false +cleanup.use_parentheses_in_expressions=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.always_use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.correct_indentation=true +cleanup.make_private_fields_final=false +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.correct_indentation=false +cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +org.eclipse.jdt.ui.ondemandthreshold=99 +sp_cleanup.sort_members_all=false +sp_cleanup.use_this_for_non_static_field_access=false +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +org.eclipse.jdt.ui.exception.name=e +sp_cleanup.format_source_code=true +org.eclipse.jdt.ui.javadoc=true +cleanup.format_source_code=false +cleanup.remove_unused_imports=true +cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_methods=true +cleanup.add_missing_annotations=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_private_methods=true +cleanup.always_use_this_for_non_static_method_access=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.sort_members=false +sp_cleanup.use_parentheses_in_expressions=false +cleanup.add_missing_override_annotations=true +org.eclipse.jdt.ui.gettersetter.use.is=false +cleanup.convert_to_enhanced_for_loop=false +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.overrideannotation=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.add_missing_annotations=true +cleanup.make_variable_declarations_final=false +cleanup.remove_unused_private_types=true +cleanup.use_blocks=true +eclipse.preferences.version=1 +cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.remove_unused_imports=true +cleanup.add_missing_deprecated_annotations=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.convert_to_enhanced_for_loop=false +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.sort_members=false +sp_cleanup.remove_unused_private_members=false +org.eclipse.jdt.ui.importorder=java;javax;org;com; +cleanup.remove_unused_private_members=false +sp_cleanup.format_source_code_changes_only=false +cleanup.never_use_blocks=false +cleanup.organize_imports=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_generated_serial_version_id=false +cleanup.make_parameters_final=true +org.eclipse.jdt.ui.keywordthis=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.always_use_blocks=true +cleanup.add_serial_version_id=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.always_use_blocks=true +cleanup.remove_unused_local_variables=false +cleanup.sort_members_all=false +sp_cleanup.remove_trailing_whitespaces=true +cleanup.format_source_code_changes_only=false +cleanup.add_generated_serial_version_id=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.remove_private_constructors=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_local_variable_final=false +cleanup.make_local_variable_final=false +sp_cleanup.add_serial_version_id=false +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.add_default_serial_version_id=false +cleanup.add_missing_methods=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.add_missing_methods=false diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd b/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd new file mode 100755 index 000000000000..fffb3bb0326f --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd @@ -0,0 +1,23 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + org.eclipse.osgi;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.command.processing;version=latest diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd.gradle b/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd.gradle new file mode 100755 index 000000000000..fffb3bb0326f --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd.gradle @@ -0,0 +1,23 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + org.eclipse.osgi;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.command.processing;version=latest diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/build-zunittest.xml b/dev/com.ibm.ws.zos.command.processing_ztest/build-zunittest.xml new file mode 100755 index 000000000000..78ec5e5bc1ee --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/build-zunittest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/build.gradle b/dev/com.ibm.ws.zos.command.processing_ztest/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/unittest/src/com/ibm/ws/zos/command/processing/internal/UnitTest.java b/dev/com.ibm.ws.zos.command.processing_ztest/unittest/src/com/ibm/ws/zos/command/processing/internal/UnitTest.java new file mode 100755 index 000000000000..ab6118340425 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/unittest/src/com/ibm/ws/zos/command/processing/internal/UnitTest.java @@ -0,0 +1,230 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.command.processing.internal; + +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import test.common.SharedOutputManager; +import test.common.zos.NativeLibraryUtils; +import test.common.zos.ZosOperations; + +/** + * + */ +public class UnitTest { + private static SharedOutputManager outputMgr; + private static boolean registeredWithAngel = false; + + /** + * Capture stdout/stderr output to the manager. + * + * @throws Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // There are variations of this constructor: + // e.g. to specify a log location or an enabled trace spec. Ctrl-Space + // for suggestions + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + + new ZosOperations().restartAngel(); + + NativeLibraryUtils.loadUnauthorized(); + if (!registeredWithAngel) { + registeredWithAngel = (NativeLibraryUtils.registerServer() == 0); + } + NativeLibraryUtils.registerNatives(CommandProcessor.class); + } + + /** + * Final teardown work when class is exiting. + * + * @throws Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + + NativeLibraryUtils.reset(); + + if (registeredWithAngel) { + registeredWithAngel = (NativeLibraryUtils.deregisterServer() != 0); + } + + new ZosOperations().cancelAngel(); + + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + /** + * Individual teardown after each test. + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + // Clear the output generated after each method invocation + outputMgr.resetStreams(); + } + + /** + * Test CommandProcessor.ntv_getIEZCOMReference returns a CIB + * pointer. + */ + @Test + public void test_ntv_getIEZCOMReference() { + final String m = "test_ntv_getIEZCOMReference"; + try { + // Do stuff here. The outputMgr catches all output issued to stdout + // or stderr + // unless/until an unexpected exception occurs. failWithThrowable + // will copy + // all captured output back to the original streams before failing + // the testcase. + CommandProcessor cp = new CommandProcessor(); + long iezcom = cp.ntv_getIEZCOMReference(); + assertTrue(iezcom != 0); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * Call to stop listening + * + */ + @Test + public void test_ntv_stopListeningForCommands() { + final String m = "test_ntv_stopListeningForCommands"; + try { + CommandProcessor cp = new CommandProcessor(); + long iezcom = cp.ntv_getIEZCOMReference(); + assertTrue(iezcom != 0); + cp.ntv_stopListeningForCommands(); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * To test the "Call to native code to wait for a Command" (ntv_getCommand) + * we would need another thread to issue the method and this + * thread to then monitor it. We could then either issue a + * command to break it out or issue the ntv_stopListeningForCommands + * method to break it out. + * TODO: + */ + @Ignore + @Test + public void test_ntv_getCommand() { + // TODO: + } + + /** + * Test issuing command responses + * + * + */ + @Test + public void test_ntv_issueCommandResponse() { + final String m = "test_ntv_issueCommandResponse"; + try { + CommandProcessor cp = new CommandProcessor(); + long iezcom = cp.ntv_getIEZCOMReference(); + assertTrue(iezcom != 0); + + //int ntv_issueCommandResponse(byte[] response, long cart, int consid); + + int masterConid = 1; + long cart = 0; + byte[] response = "TSTCP0001: simple message, no cart, consid(1)".getBytes("Cp1047"); + int rc = cp.ntv_issueCommandResponse(response, cart, masterConid); + assertTrue(rc == 0); + + rc = cp.ntv_issueCommandResponse((byte[]) null, cart, masterConid); + assertTrue(rc == -1); + + response = "TSTCP0003: simple message, cart(12345678), consid(1)".getBytes("Cp1047"); + rc = cp.ntv_issueCommandResponse(response, cart, masterConid); + assertTrue(rc == 0); + + cp.ntv_stopListeningForCommands(); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * Test issuing command responses + * + * + */ + @Test + public void test_ntv_issueCommandResponse_ml() { + final String m = "test_ntv_issueCommandResponse"; + try { + CommandProcessor cp = new CommandProcessor(); + long iezcom = cp.ntv_getIEZCOMReference(); + assertTrue(iezcom != 0); + + // 1 2 3 4 5 6 7 + String longMsg = "TSTCP0004I: This message should be split just about almost here, " + + "thenthenextlinewillcomeouttobesplithere " + + "becauseoftheblankIputinthetext,you know it would be nice to split " + + "near some data like this that has a lot of blanks in the line " + + " like this, the end "; + // 1 2 3 4 5 6 7 + String longMsg2 = "TSTCP0005I: extemelylongmessagetoexceedthetenlinesofMultline1234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567ENDOFTENLINES" + + "Eleventhline"; + int masterConid = 1; + long cart = 0; + byte[] response = longMsg.getBytes("Cp1047"); + int rc = cp.ntv_issueCommandResponse(response, cart, masterConid); + assertTrue(rc == 0); + + response = longMsg2.getBytes("Cp1047"); + rc = cp.ntv_issueCommandResponse(response, cart, masterConid); + assertTrue(rc == 0); + + // Generate a message that will exceed the 1,000 continuation limit. + int i = 0; + String tooLong = ""; + for (; i < 1001; i++) { + tooLong = tooLong + longMsg2; + } + response = tooLong.getBytes("Cp1047"); + rc = cp.ntv_issueCommandResponse(response, cart, masterConid); + + // Assert that we truncated the response + assertTrue(rc == -12); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } +} diff --git a/dev/com.ibm.ws.zos.core_test/.classpath b/dev/com.ibm.ws.zos.core_test/.classpath index 31a7e51b6f78..bd880329225d 100755 --- a/dev/com.ibm.ws.zos.core_test/.classpath +++ b/dev/com.ibm.ws.zos.core_test/.classpath @@ -1,12 +1,7 @@ - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.zos.core_test/.classpath.gradle b/dev/com.ibm.ws.zos.core_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.zos.core_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.core_test/.project b/dev/com.ibm.ws.zos.core_test/.project index fa05fe92d159..3bae75cb5bc3 100755 --- a/dev/com.ibm.ws.zos.core_test/.project +++ b/dev/com.ibm.ws.zos.core_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.zos.core_test/bnd.bnd b/dev/com.ibm.ws.zos.core_test/bnd.bnd new file mode 100755 index 000000000000..62137bce10e0 --- /dev/null +++ b/dev/com.ibm.ws.zos.core_test/bnd.bnd @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.zos.core;version=latest diff --git a/dev/com.ibm.ws.zos.core_test/bnd.bnd.gradle b/dev/com.ibm.ws.zos.core_test/bnd.bnd.gradle new file mode 100755 index 000000000000..62137bce10e0 --- /dev/null +++ b/dev/com.ibm.ws.zos.core_test/bnd.bnd.gradle @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.zos.core;version=latest diff --git a/dev/com.ibm.ws.zos.core_test/build.gradle b/dev/com.ibm.ws.zos.core_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.zos.diagnostics_test/.classpath b/dev/com.ibm.ws.zos.diagnostics_test/.classpath index 31a7e51b6f78..bd880329225d 100644 --- a/dev/com.ibm.ws.zos.diagnostics_test/.classpath +++ b/dev/com.ibm.ws.zos.diagnostics_test/.classpath @@ -1,12 +1,7 @@ - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.zos.diagnostics_test/.classpath.gradle b/dev/com.ibm.ws.zos.diagnostics_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.zos.diagnostics_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.diagnostics_test/.project b/dev/com.ibm.ws.zos.diagnostics_test/.project index a1c5f831f3aa..f910f8d6ffa4 100644 --- a/dev/com.ibm.ws.zos.diagnostics_test/.project +++ b/dev/com.ibm.ws.zos.diagnostics_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.zos.diagnostics_test/bnd.bnd b/dev/com.ibm.ws.zos.diagnostics_test/bnd.bnd new file mode 100755 index 000000000000..47c5ab965aaa --- /dev/null +++ b/dev/com.ibm.ws.zos.diagnostics_test/bnd.bnd @@ -0,0 +1,21 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.ws.zos.command.processing;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.diagnostics;version=latest diff --git a/dev/com.ibm.ws.zos.diagnostics_test/bnd.bnd.gradle b/dev/com.ibm.ws.zos.diagnostics_test/bnd.bnd.gradle new file mode 100755 index 000000000000..47c5ab965aaa --- /dev/null +++ b/dev/com.ibm.ws.zos.diagnostics_test/bnd.bnd.gradle @@ -0,0 +1,21 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.ws.zos.command.processing;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.diagnostics;version=latest diff --git a/dev/com.ibm.ws.zos.diagnostics_test/build.gradle b/dev/com.ibm.ws.zos.diagnostics_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.zos.logging_test/.classpath b/dev/com.ibm.ws.zos.logging_test/.classpath index cfcf8bc27572..bd880329225d 100755 --- a/dev/com.ibm.ws.zos.logging_test/.classpath +++ b/dev/com.ibm.ws.zos.logging_test/.classpath @@ -1,16 +1,7 @@ - - - - - - - - - - - - - + + + + diff --git a/dev/com.ibm.ws.zos.logging_test/.classpath.gradle b/dev/com.ibm.ws.zos.logging_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_test/.project b/dev/com.ibm.ws.zos.logging_test/.project index 9da0e7907c8d..fe88dec8ef99 100755 --- a/dev/com.ibm.ws.zos.logging_test/.project +++ b/dev/com.ibm.ws.zos.logging_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/com.ibm.ws.zos.logging_test/bnd.bnd b/dev/com.ibm.ws.zos.logging_test/bnd.bnd new file mode 100755 index 000000000000..d4f9800081d4 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_test/bnd.bnd @@ -0,0 +1,26 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.websphere.appserver.spi.zosCommandProcessing;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.logging;version=latest diff --git a/dev/com.ibm.ws.zos.logging_test/bnd.bnd.gradle b/dev/com.ibm.ws.zos.logging_test/bnd.bnd.gradle new file mode 100755 index 000000000000..d4f9800081d4 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_test/bnd.bnd.gradle @@ -0,0 +1,26 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.websphere.appserver.spi.zosCommandProcessing;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.logging;version=latest diff --git a/dev/com.ibm.ws.zos.logging_test/build.gradle b/dev/com.ibm.ws.zos.logging_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.zos.logging_zfat/.classpath b/dev/com.ibm.ws.zos.logging_zfat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_zfat/.classpath.gradle b/dev/com.ibm.ws.zos.logging_zfat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_zfat/.gitignore b/dev/com.ibm.ws.zos.logging_zfat/.gitignore new file mode 100644 index 000000000000..27e131e35a6b --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.zos.logging_zfat/.project b/dev/com.ibm.ws.zos.logging_zfat/.project new file mode 100755 index 000000000000..ba8488e3ced0 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.zos.logging_zfat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.zos.logging_zfat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.zos.logging_zfat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..7341ab1683c4 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd b/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd.gradle b/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd.gradle new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.zos.logging_zfat/build-ztest.xml b/dev/com.ibm.ws.zos.logging_zfat/build-ztest.xml new file mode 100755 index 000000000000..6d67fbd47495 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/build-ztest.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_zfat/build.gradle b/dev/com.ibm.ws.zos.logging_zfat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/EbcdicUtils.java b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/EbcdicUtils.java new file mode 100755 index 000000000000..e44e0417994a --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/EbcdicUtils.java @@ -0,0 +1,133 @@ +package com.ibm.ws.zos.logging.zfat; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; + +import componenttest.topology.impl.LibertyServer; + +public class EbcdicUtils { + + /** + * The given fileName is copied from the files/ dir to ${server.config.dir} + * and converted to EBCDIC. + * + * @returns the fileName (absolute path) of the ebcdic version of the file. + */ + public static String convertToEbcdic(LibertyServer server, String fileName) throws Exception { + + // Copy to server root so that the jbatch utility can find it + server.copyFileToLibertyServerRoot( fileName ); + String absFileName = StringUtils.join( Arrays.asList( server.getServerRoot(), fileName ), File.separator); + String absFileNameEbc = absFileName + ".ebc"; + + // Convert to ebcdic. + IOUtils.convertFile(absFileName, + Charset.forName("UTF-8"), + absFileNameEbc, + Charset.forName("IBM-1047")); + + return absFileNameEbc; + } + +} + +/** + * + * Could have imported apache.commons.lang3, but only needed a few methods. + */ +class StringUtils { + + /** + * @return the given strs joined on the given delim. + */ + public static String join(Collection strs, String delim) { + StringBuffer retMe = new StringBuffer(); + String d = ""; + for (String str : ( (strs != null) ? strs : new ArrayList() ) ) { + retMe.append(d).append(str); + d = delim; + } + return retMe.toString(); + } + + /** + * @return true if the string is null or "" or nothing but whitespace. + */ + public static boolean isEmpty(String s) { + return s == null || s.trim().length() == 0; + } +} + +/** + * IO utilities. + */ +class IOUtils { + + /** + * Copy the given InputStream to the given OutputStream. + * + * Note: the InputStream is closed when the copy is complete. The OutputStream + * is left open. + */ + public static void copyStream(InputStream from, OutputStream to) throws IOException { + byte buffer[] = new byte[2048]; + int bytesRead; + while ((bytesRead = from.read(buffer)) != -1) { + to.write(buffer, 0, bytesRead); + } + from.close(); + } + + /** + * Copy the given Reader to the given Writer. + * + * This method is basically the same as copyStream; however Reader and Writer + * objects are cognizant of character encoding, whereas InputStream and OutputStreams + * objects deal only with bytes. + * + * Note: the Reader is closed when the copy is complete. The Writer + * is left open. The Write is flushed when the copy is complete. + */ + public static void copyReader(Reader from, Writer to) throws IOException { + + char buffer[] = new char[2048]; + int charsRead; + while ((charsRead = from.read(buffer)) != -1) { + to.write(buffer, 0, charsRead); + } + from.close(); + to.flush(); + } + + /** + * Copy and convert from the given file and charset to the given file and charset. + * + * @return File(toFileName) + */ + public static File convertFile(String fromFileName, + Charset fromCharset, + String toFileName, + Charset toCharset) throws IOException { + + Reader reader = new InputStreamReader( new FileInputStream(fromFileName), fromCharset); + Writer writer = new OutputStreamWriter( new FileOutputStream(toFileName), toCharset) ; + + copyReader(reader, writer); + writer.close(); + + return new File(toFileName); + } + +} diff --git a/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/FATSuite.java b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/FATSuite.java new file mode 100755 index 000000000000..2fb8c1242ee7 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/FATSuite.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.logging.zfat; + +import static org.junit.Assert.assertNotNull; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import componenttest.topology.impl.LibertyServer; + +/** + * Collection of all example tests + */ +@RunWith(Suite.class) +/* + * The classes specified in the @SuiteClasses annotation + * below should represent all of the test cases for this FAT. + */ +@SuiteClasses( { ZosLoggingTest.class }) +public class FATSuite { + + /** + * Wait for the "smarter planet" message in the log. + * + * Note: this method resets the log marks before searching the log. + */ + public static void waitForSmarterPlanet(LibertyServer server) { + + server.resetLogMarks(); + assertNotNull("The CWWKF0011I smarter planet message not found for server: " + server.getServerRoot(), + server.waitForStringInLog("CWWKF0011I")); + } + +} diff --git a/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/ZosLoggingTest.java b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/ZosLoggingTest.java new file mode 100755 index 000000000000..452fbabdafba --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/ZosLoggingTest.java @@ -0,0 +1,366 @@ +package com.ibm.ws.zos.logging.zfat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2016 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.List; + +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.zos.ZosOperationsFat; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class ZosLoggingTest { + + /** + * Default server. + */ + private static LibertyServer server = LibertyServerFactory.getLibertyServer("defaultServer"); + + /** + * z/OS Operations utility class instance. + */ + private static ZosOperationsFat zosOperationsFat = new ZosOperationsFat(); + + /** + * Default server job name. + */ + private static final String SERVER_JOBNAME_DEFAULT = "BBGZSRV"; + + /** + * Custom server job name. + */ + private static final String SERVER_JOBNAME_CUSTOM1 = "BBGZSRV1"; + + /** + * Log helper. + */ + private static void log(String method, String msg) { + Log.info(ZosLoggingTest.class, method, msg); + } + + /** + * Pre-FAT execution setup. + * + * @throws Exception + */ + @BeforeClass + public static void setUp() throws Exception { + log("setUp", "Entry."); + + // Try to stop/cancel any active jobs left around by this or other FATs. + stopProcess(SERVER_JOBNAME_DEFAULT, 1, true); + stopProcess(SERVER_JOBNAME_CUSTOM1, 1, true); + server.stopServer(); + + log("setUp", "Exit."); + } + + /** + * + */ + @Test + public void testStartedTaskProc() throws Exception { + + String prevJobId = zosOperationsFat.getMostRecentJobId(SERVER_JOBNAME_DEFAULT); + + zosOperationsFat.startWASProcess(SERVER_JOBNAME_DEFAULT); + + try { + String newJobId = zosOperationsFat.waitForNewJobId(SERVER_JOBNAME_DEFAULT, prevJobId, 30); + + zosOperationsFat.waitForStringInJobLog(newJobId, + "CWWKF0011I: The server defaultServer is ready to run a smarter planet", + 30); + + stopProcess(SERVER_JOBNAME_DEFAULT, 30, false); + + List joblog = ZosOperationsFat.getJoblogRaw(newJobId); + + assertNotNull("Joblog is null; job must have failed to start", joblog); + + log("testStartedTaskProc", "joblog: "); + for (String s : joblog) { + log("testStartedTaskProc", s); + } + + // These are routed to hardcopy by LoggingWtoLogHandler + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKE0001I: The server defaultServer has been launched.", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKF0011I: The server defaultServer is ready to run a smarter planet.", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKB0001I: Stop command received for server defaultServer.", joblog)); + + // These are routed to hardcopy by LoggingHardcopyLogHandler + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0001I: Application userRegistry started", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0009I: The application userRegistry has stopped successfully.", joblog)); + + // Issued to STDOUT + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0001I: The server defaultServer has been launched", joblog)); + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0036I: The server defaultServer stopped after", joblog)); + } finally { + stopProcess(SERVER_JOBNAME_DEFAULT, 5, true); + } + } + + /** + * + */ + @Test + public void testSubmittedJob() throws Exception { + + String prevJobId = zosOperationsFat.getMostRecentJobId(SERVER_JOBNAME_CUSTOM1); + + ProgramOutput po = server.getMachine().execute("/bin/submit", + new String[] { EbcdicUtils.convertToEbcdic(server, "bbgzsrv1.jcl") }, + server.getServerRoot(), + null); + + try { + log("testSubmittedJob", "JCL submit: RC: " + po.getReturnCode()); + log("testSubmittedJob", "JCL submit: stdout:\n" + po.getStdout()); + log("testSubmittedJob", "JCL submit: stderr:\n" + po.getStderr()); + + assertEquals(0, po.getReturnCode()); + + String newJobId = zosOperationsFat.waitForNewJobId(SERVER_JOBNAME_CUSTOM1, prevJobId, 30); + + zosOperationsFat.waitForStringInJobLog(newJobId, + "CWWKF0011I: The server defaultServer is ready to run a smarter planet", + 30); + + stopProcess(SERVER_JOBNAME_CUSTOM1, 30, false); + + List joblog = ZosOperationsFat.getJoblogRaw(newJobId); + + assertNotNull("Joblog is null; job must have failed to start", joblog); + + log("testSubmittedJob", "joblog: "); + for (String s : joblog) { + log("testSubmittedJob", s); + } + + // These are routed to hardcopy by LoggingHardcopyLogHandler + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0001I: Application userRegistry started", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0009I: The application userRegistry has stopped successfully.", joblog)); + + // Issued to STDOUT + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0001I: The server defaultServer has been launched", joblog)); + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0036I: The server defaultServer stopped after", joblog)); + } finally { + stopProcess(SERVER_JOBNAME_CUSTOM1, 5, true); + } + } + + /** + * + */ + @Test + public void testMsgLog() throws Exception { + + String prevJobId = zosOperationsFat.getMostRecentJobId(SERVER_JOBNAME_CUSTOM1); + + ProgramOutput po = server.getMachine().execute("/bin/submit", + new String[] { EbcdicUtils.convertToEbcdic(server, "bbgzsrv1.msglog.jcl") }, + server.getServerRoot(), + null); + + try { + log("testMsgLog", "JCL submit: RC: " + po.getReturnCode()); + log("testMsgLog", "JCL submit: stdout:\n" + po.getStdout()); + log("testMsgLog", "JCL submit: stderr:\n" + po.getStderr()); + + assertEquals(0, po.getReturnCode()); + + String newJobId = zosOperationsFat.waitForNewJobId(SERVER_JOBNAME_CUSTOM1, prevJobId, 30); + + zosOperationsFat.waitForStringInJobLog(newJobId, + "CWWKF0011I: The server defaultServer is ready to run a smarter planet", + 30); + + stopProcess(SERVER_JOBNAME_CUSTOM1, 30, false); + + List joblog = ZosOperationsFat.getJoblogRaw(newJobId); + + assertNotNull("Joblog is null; job must have failed to start", joblog); + + log("testMsgLog", "joblog: "); + for (String s : joblog) { + log("testMsgLog", s); + } + + // These are routed to hardcopy by LoggingHardcopyLogHandler + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0001I: Application userRegistry started", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0009I: The application userRegistry has stopped successfully.", joblog)); + + // Issued to STDOUT + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0001I: The server defaultServer has been launched", joblog)); + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0036I: The server defaultServer stopped after", joblog)); + + // MsgLogLogHandler messages + assertTrue(zosOperationsFat.isStringInLog(" TRAS0018I: The trace state has been changed.", joblog)); + assertTrue(zosOperationsFat.isStringInLog(" CWWKB0104I: Authorized service group ", joblog)); + } finally { + stopProcess(SERVER_JOBNAME_CUSTOM1, 5, true); + } + } + + /** + * + */ + @Test + public void testMsgLogSegmented() throws Exception { + + String prevJobId = zosOperationsFat.getMostRecentJobId(SERVER_JOBNAME_CUSTOM1); + + ProgramOutput po = server.getMachine().execute("/bin/submit", + new String[] { EbcdicUtils.convertToEbcdic(server, "bbgzsrv1.msglog.segment.jcl") }, + server.getServerRoot(), + null); + + try { + log("testMsgLogSegmented", "JCL submit: RC: " + po.getReturnCode()); + log("testMsgLogSegmented", "JCL submit: stdout:\n" + po.getStdout()); + log("testMsgLogSegmented", "JCL submit: stderr:\n" + po.getStderr()); + + assertEquals(0, po.getReturnCode()); + + String newJobId = zosOperationsFat.waitForNewJobId(SERVER_JOBNAME_CUSTOM1, prevJobId, 30); + + zosOperationsFat.waitForStringInJobLog(newJobId, + "CWWKF0011I: The server defaultServer is ready to run a smarter planet", + 30); + + stopProcess(SERVER_JOBNAME_CUSTOM1, 30, false); + + List joblog = ZosOperationsFat.getJoblogRaw(newJobId); + + assertNotNull("Joblog is null; job must have failed to start", joblog); + + log("testMsgLogSegmented", "joblog: "); + for (String s : joblog) { + log("testMsgLogSegmented", s); + } + + // These are routed to hardcopy by LoggingHardcopyLogHandler + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0001I: Application userRegistry started", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0009I: The application userRegistry has stopped successfully.", joblog)); + + // Issued to STDOUT + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0001I: The server defaultServer has been launched", joblog)); + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0036I: The server defaultServer stopped after", joblog)); + + // MsgLogLogHandler messages + assertTrue(zosOperationsFat.isStringInLog(" TRAS0018I: The trace state has been changed.", joblog)); + assertTrue(zosOperationsFat.isStringInLog(" CWWKB0104I: Authorized service group ", joblog)); + } finally { + stopProcess(SERVER_JOBNAME_CUSTOM1, 5, true); + } + } + + @Test + public void testMsgRouterConfig() throws Exception { + String method = "testMsgRouterConfig"; + String wtoMsg = "TRAS0042I: The message routing group WTO contains the following messages: CWWKG9999E CWWKE4445I"; + String hardcopyMsg = "TRAS0042I: The message routing group HARDCOPY contains the following messages: CWWKG3333E CWWKG4444E CWWKG6666E CWWKG7777E"; + String wtoMsg2 = "TRAS0042I: The message routing group WTO contains the following messages: CWWKE4445I"; + String hardcopyMsg2 = "TRAS0042I: The message routing group HARDCOPY contains the following messages:"; + + log(method, "Starting server with message router config"); + server.setServerConfigurationFile("msgRouterConfig.xml"); + server.startServerAndValidate(true, true, true); + try { + validateStringInLog(wtoMsg, method); + validateStringInLog(hardcopyMsg, method); + + log(method, "Changing server configuration to secondary message router config"); + server.setServerConfigurationFile("msgRouterConfig2.xml"); + validateStringInLog(wtoMsg2, method); + validateStringInLog(hardcopyMsg2, method); + + log(method, "Changing server configuration back to first message router config"); + server.setServerConfigurationFile("msgRouterConfig.xml"); + validateStringInLog(wtoMsg, method); + validateStringInLog(hardcopyMsg, method); + + dumpLogFile(method); + } finally { + server.stopServer(); + } + } + + private void validateStringInLog(String searchString, String method) throws Exception { + String match = server.waitForStringInLogUsingLastOffset(searchString); + if (match != null) { + log(method, match); + } else { + // Did not find an expected string: dump the log and fail the test + dumpLogFile(method); + server.stopServer(); + fail(method + ": Expected string was not found in server log: " + searchString); + } + } + + private void dumpLogFile(String method) throws Exception { + RemoteFile log = server.getDefaultLogFile(); + BufferedReader reader = new BufferedReader(new InputStreamReader(log.openForReading())); + String line; + while ((line = reader.readLine()) != null) { + log(method, line); + } + } + + /** + * Stops the process/job identified by the input jobname. If the process/job cannot be verified to be stopped, a cancel command is issued. + * + * @param jobName The job name that identifies the process/job to be stopped. + * @param timeout The time, in seconds, to wait for the job to become inactive. + * @param force If true, the process is cancelled after an unsuccessful stop. If False, we just print a message. + * @throws Exception + */ + private static void stopProcess(String jobName, int timeout, boolean force) throws Exception { + int iterations = (timeout <= 0) ? 1 : timeout; + + zosOperationsFat.stopWASProcess(jobName); + String activeJobId = null; + for (int i = 0; i < iterations; i++) { + activeJobId = zosOperationsFat.getActiveJobId(jobName); + + // If there is no active jobid with the specified jobname, we are done. + if (activeJobId == null) { + return; + } + + Thread.sleep(1000); + } + + // We waited for "timeout" seconds. Cancel the process or just print a message. + if (force) { + zosOperationsFat.cancelWASProcess(jobName); + } else { + Log.warning(ZosLoggingTest.class, "stopProcess: Server with jobID: " + activeJobId + " did not stop. Time waited: " + timeout + " seconds."); + } + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/.gitignore b/dev/com.ibm.ws.zos.logging_zfat/publish/.gitignore new file mode 100644 index 000000000000..343032067df4 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/.gitignore @@ -0,0 +1,3 @@ +dropins +/bundles +/resourceadapters diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.jcl b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.jcl new file mode 100755 index 000000000000..56da9628201b --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.jcl @@ -0,0 +1,51 @@ +//BBGZSRV1 JOB +//*------------------------------------------------------------------ +//* This proc may be overwritten by fixpacks or iFixes. +//* You must copy to another location before customizing. +//*------------------------------------------------------------------ +//* INSTDIR - the path to the WebSphere Liberty Profile install. +//* This path is used to find the product code and is +//* equivalent to the WLP_INSTALL_DIR environment variable +//* in the Unix shell. +//* USERDIR - the path to the WebSphere Liberty Profile user area. +//* This path is used to store shared and server specific +//* configuration information and is equivalent to the +//* WLP_USER_DIR environment variable in the Unix shell. +//*------------------------------------------------------------------ +// SET INSTDIR='/u/MSTONE1/wlp' +// SET USERDIR='/u/MSTONE1/wlp/usr' +//*------------------------------------------------------------------ +//* Start the Liberty server +//* +//* WLPUDIR - PATH DD that points to the Liberty Profile's "user" +//* directory. If the DD is not allocated, the user +//* directory location defaults to the wlp/usr directory +//* in the install tree. +//* STDOUT - Destination for stdout (System.out) +//* STDERR - Destination for stderr (System.err) +//* STDENV - Initial Unix environment - read by the system. The +//* installation default and server specific server +//* environment files will be merged into this environment +//* before the JVM is launched. +//*------------------------------------------------------------------ +//STEP1 EXEC PGM=BPXBATSL,REGION=0M, +// PARM='PGM &INSTDIR./lib/native/zos/s390x/bbgzsrv' +//WLPUDIR DD PATH='&USERDIR.' +//STDOUT DD SYSOUT=* +//STDERR DD SYSOUT=* +//*STDENV DD PATH='/etc/system.env',PATHOPTS=(ORDONLY) +//*STDOUT DD PATH='&ROOT/std.out', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//*STDERR DD PATH='&ROOT/std.err', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//* ================================================================ */ +//* PROPRIETARY-STATEMENT: */ +//* Licensed Material - Property of IBM */ +//* */ +//* (C) Copyright IBM Corp. 2011, 2012 */ +//* All Rights Reserved */ +//* US Government Users Restricted Rights - Use, duplication or */ +//* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.*/ +//* ================================================================ */ diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.jcl b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.jcl new file mode 100755 index 000000000000..db6a525d9f77 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.jcl @@ -0,0 +1,52 @@ +//BBGZSRV1 JOB +//*------------------------------------------------------------------ +//* This proc may be overwritten by fixpacks or iFixes. +//* You must copy to another location before customizing. +//*------------------------------------------------------------------ +//* INSTDIR - the path to the WebSphere Liberty Profile install. +//* This path is used to find the product code and is +//* equivalent to the WLP_INSTALL_DIR environment variable +//* in the Unix shell. +//* USERDIR - the path to the WebSphere Liberty Profile user area. +//* This path is used to store shared and server specific +//* configuration information and is equivalent to the +//* WLP_USER_DIR environment variable in the Unix shell. +//*------------------------------------------------------------------ +// SET INSTDIR='/u/MSTONE1/wlp' +// SET USERDIR='/u/MSTONE1/wlp/usr' +//*------------------------------------------------------------------ +//* Start the Liberty server +//* +//* WLPUDIR - PATH DD that points to the Liberty Profile's "user" +//* directory. If the DD is not allocated, the user +//* directory location defaults to the wlp/usr directory +//* in the install tree. +//* STDOUT - Destination for stdout (System.out) +//* STDERR - Destination for stderr (System.err) +//* STDENV - Initial Unix environment - read by the system. The +//* installation default and server specific server +//* environment files will be merged into this environment +//* before the JVM is launched. +//*------------------------------------------------------------------ +//STEP1 EXEC PGM=BPXBATSL,REGION=0M, +// PARM='PGM &INSTDIR./lib/native/zos/s390x/bbgzsrv' +//WLPUDIR DD PATH='&USERDIR.' +//STDOUT DD SYSOUT=* +//STDERR DD SYSOUT=* +//MSGLOG DD SYSOUT=* +//*STDENV DD PATH='/etc/system.env',PATHOPTS=(ORDONLY) +//*STDOUT DD PATH='&ROOT/std.out', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//*STDERR DD PATH='&ROOT/std.err', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//* ================================================================ */ +//* PROPRIETARY-STATEMENT: */ +//* Licensed Material - Property of IBM */ +//* */ +//* (C) Copyright IBM Corp. 2011, 2012 */ +//* All Rights Reserved */ +//* US Government Users Restricted Rights - Use, duplication or */ +//* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.*/ +//* ================================================================ */ diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.segment.jcl b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.segment.jcl new file mode 100755 index 000000000000..aab884afc53b --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.segment.jcl @@ -0,0 +1,52 @@ +//BBGZSRV1 JOB +//*------------------------------------------------------------------ +//* This proc may be overwritten by fixpacks or iFixes. +//* You must copy to another location before customizing. +//*------------------------------------------------------------------ +//* INSTDIR - the path to the WebSphere Liberty Profile install. +//* This path is used to find the product code and is +//* equivalent to the WLP_INSTALL_DIR environment variable +//* in the Unix shell. +//* USERDIR - the path to the WebSphere Liberty Profile user area. +//* This path is used to store shared and server specific +//* configuration information and is equivalent to the +//* WLP_USER_DIR environment variable in the Unix shell. +//*------------------------------------------------------------------ +// SET INSTDIR='/u/MSTONE1/wlp' +// SET USERDIR='/u/MSTONE1/wlp/usr' +//*------------------------------------------------------------------ +//* Start the Liberty server +//* +//* WLPUDIR - PATH DD that points to the Liberty Profile's "user" +//* directory. If the DD is not allocated, the user +//* directory location defaults to the wlp/usr directory +//* in the install tree. +//* STDOUT - Destination for stdout (System.out) +//* STDERR - Destination for stderr (System.err) +//* STDENV - Initial Unix environment - read by the system. The +//* installation default and server specific server +//* environment files will be merged into this environment +//* before the JVM is launched. +//*------------------------------------------------------------------ +//STEP1 EXEC PGM=BPXBATSL,REGION=0M, +// PARM='PGM &INSTDIR./lib/native/zos/s390x/bbgzsrv' +//WLPUDIR DD PATH='&USERDIR.' +//STDOUT DD SYSOUT=* +//STDERR DD SYSOUT=* +//MSGLOG DD SYSOUT=*,FREE=CLOSE,SPIN=(UNALLOC,1M) +//*STDENV DD PATH='/etc/system.env',PATHOPTS=(ORDONLY) +//*STDOUT DD PATH='&ROOT/std.out', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//*STDERR DD PATH='&ROOT/std.err', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//* ================================================================ */ +//* PROPRIETARY-STATEMENT: */ +//* Licensed Material - Property of IBM */ +//* */ +//* (C) Copyright IBM Corp. 2011, 2012 */ +//* All Rights Reserved */ +//* US Government Users Restricted Rights - Use, duplication or */ +//* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.*/ +//* ================================================================ */ diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig.xml b/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig.xml new file mode 100755 index 000000000000..0a099bd7f3d6 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig.xml @@ -0,0 +1,10 @@ + + + jsp-2.2 + osgiConsole-1.0 + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig2.xml b/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig2.xml new file mode 100755 index 000000000000..6ecc8dff624c --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig2.xml @@ -0,0 +1,10 @@ + + + jsp-2.2 + osgiConsole-1.0 + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/bootstrap.properties b/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/bootstrap.properties new file mode 100755 index 000000000000..4bed6a27bb60 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +# osgi.console=bossxxxx:5678 \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/server.xml b/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/server.xml new file mode 100755 index 000000000000..b79f713d3720 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/server.xml @@ -0,0 +1,8 @@ + + + jsp-2.2 + osgiConsole-1.0 + + + + diff --git a/dev/com.ibm.ws.zos.logging_ztest/.classpath b/dev/com.ibm.ws.zos.logging_ztest/.classpath new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_ztest/.classpath.gradle b/dev/com.ibm.ws.zos.logging_ztest/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_ztest/.gitignore b/dev/com.ibm.ws.zos.logging_ztest/.gitignore new file mode 100644 index 000000000000..9c10d02b4539 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.gitignore @@ -0,0 +1,4 @@ +/dist +/bundles +/lib +/*.log* diff --git a/dev/com.ibm.ws.zos.logging_ztest/.project b/dev/com.ibm.ws.zos.logging_ztest/.project new file mode 100755 index 000000000000..ead8f1ae68c7 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.zos.logging_ztest + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..2d37f3472a86 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +encoding/=UTF-8 +eclipse.preferences.version=1 diff --git a/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..95719ae3709c --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert diff --git a/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..6da3e89478aa --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.remove_trailing_whitespaces=true +cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.add_missing_nls_tags=false +org.eclipse.jdt.ui.staticondemandthreshold=99 +cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_blocks=false +sp_cleanup.make_private_fields_final=true +org.eclipse.jdt.ui.ignorelowercasenames=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.remove_private_constructors=true +sp_cleanup.never_use_parentheses_in_expressions=true +cleanup.remove_unnecessary_casts=true +sp_cleanup.organize_imports=true +sp_cleanup.never_use_blocks=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_fields=true +org.eclipse.jdt.ui.text.custom_code_templates= +cleanup.always_use_parentheses_in_expressions=false +cleanup.use_parentheses_in_expressions=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.always_use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.correct_indentation=true +cleanup.make_private_fields_final=false +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.correct_indentation=false +cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +org.eclipse.jdt.ui.ondemandthreshold=99 +sp_cleanup.sort_members_all=false +sp_cleanup.use_this_for_non_static_field_access=false +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +org.eclipse.jdt.ui.exception.name=e +sp_cleanup.format_source_code=true +org.eclipse.jdt.ui.javadoc=true +cleanup.format_source_code=false +cleanup.remove_unused_imports=true +cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_methods=true +cleanup.add_missing_annotations=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_private_methods=true +cleanup.always_use_this_for_non_static_method_access=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.sort_members=false +sp_cleanup.use_parentheses_in_expressions=false +cleanup.add_missing_override_annotations=true +org.eclipse.jdt.ui.gettersetter.use.is=false +cleanup.convert_to_enhanced_for_loop=false +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.overrideannotation=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.add_missing_annotations=true +cleanup.make_variable_declarations_final=false +cleanup.remove_unused_private_types=true +cleanup.use_blocks=true +eclipse.preferences.version=1 +cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.remove_unused_imports=true +cleanup.add_missing_deprecated_annotations=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.convert_to_enhanced_for_loop=false +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.sort_members=false +sp_cleanup.remove_unused_private_members=false +org.eclipse.jdt.ui.importorder=java;javax;org;com; +cleanup.remove_unused_private_members=false +sp_cleanup.format_source_code_changes_only=false +cleanup.never_use_blocks=false +cleanup.organize_imports=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_generated_serial_version_id=false +cleanup.make_parameters_final=true +org.eclipse.jdt.ui.keywordthis=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.always_use_blocks=true +cleanup.add_serial_version_id=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.always_use_blocks=true +cleanup.remove_unused_local_variables=false +cleanup.sort_members_all=false +sp_cleanup.remove_trailing_whitespaces=true +cleanup.format_source_code_changes_only=false +cleanup.add_generated_serial_version_id=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.remove_private_constructors=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_local_variable_final=false +cleanup.make_local_variable_final=false +sp_cleanup.add_serial_version_id=false +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.add_default_serial_version_id=false +cleanup.add_missing_methods=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.add_missing_methods=false diff --git a/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd b/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd new file mode 100755 index 000000000000..d4f9800081d4 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd @@ -0,0 +1,26 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.websphere.appserver.spi.zosCommandProcessing;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.logging;version=latest diff --git a/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd.gradle b/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd.gradle new file mode 100755 index 000000000000..d4f9800081d4 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd.gradle @@ -0,0 +1,26 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.websphere.appserver.spi.zosCommandProcessing;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.logging;version=latest diff --git a/dev/com.ibm.ws.zos.logging_ztest/build-zunittest.xml b/dev/com.ibm.ws.zos.logging_ztest/build-zunittest.xml new file mode 100755 index 000000000000..49c6f1a8c59f --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/build-zunittest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/dev/com.ibm.ws.zos.logging_ztest/build.gradle b/dev/com.ibm.ws.zos.logging_ztest/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/LoggingHardcopyLogHandlerTest.java b/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/LoggingHardcopyLogHandlerTest.java new file mode 100755 index 000000000000..b88df5ea8cf8 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/LoggingHardcopyLogHandlerTest.java @@ -0,0 +1,170 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.logging.internal; + +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.ws.zos.jni.NativeMethodUtils; + +import test.common.SharedOutputManager; +import test.common.zos.NativeLibraryUtils; +import test.common.zos.ZosOperations; + +/** + * + */ +public class LoggingHardcopyLogHandlerTest { + private static SharedOutputManager outputMgr; + private static Class testClass = LoggingHardcopyLogHandler.class; + private static boolean registeredWithAngel = false; + + /** + * Capture stdout/stderr output to the manager. + * + * @throws Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // There are variations of this constructor: + // e.g. to specify a log location or an enabled trace spec. Ctrl-Space + // for suggestions + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + + new ZosOperations().restartAngel(); + + NativeLibraryUtils.loadUnauthorized(); + if (!registeredWithAngel) { + registeredWithAngel = (NativeLibraryUtils.registerServer() == 0); + } + if (testClass != null) { + NativeLibraryUtils.registerNatives(testClass); + } + + } + + /** + * Final teardown work when class is exiting. + * + * @throws Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + + NativeLibraryUtils.reset(); + + if (testClass != null) { + NativeLibraryUtils.deregisterNatives(testClass); + } + + if (registeredWithAngel) { + registeredWithAngel = (NativeLibraryUtils.deregisterServer() != 0); + } + + new ZosOperations().cancelAngel(); + + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + /** + * Individual teardown after each test. + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + // Clear the output generated after each method invocation + outputMgr.resetStreams(); + } + + /** + * Test write to programmer and hardcopy + * + * + */ + @Test + public void test_ntv_WriteToOperatorProgrammerAndHardcopy() { + final String m = "test_ntv_WriteToOperatorProgrammerAndHardcopy"; + try { + LoggingHardcopyLogHandler loggingHardcopyLogHandler = new LoggingHardcopyLogHandler(); + + int rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy(NativeMethodUtils.convertToEBCDIC("CWWKF0001I: This is a programmer and hardcopy test", + false)); + assertTrue(rc == 0); + + byte[] msg = null; + rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy(msg); + assertTrue(rc == -102); + + rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy(NativeMethodUtils.convertToEBCDIC("", false)); + assertTrue(rc == 4); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * Test write to programmer and hardcopy multiple line message + * + * + */ + @Test + public void test_ntv_WriteToOperatorProgrammerAndHardcopy_ml() { + final String m = "test_ntv_WriteToOperatorProgrammerAndHardcopy_ml"; + try { + LoggingHardcopyLogHandler loggingHardcopyLogHandler = new LoggingHardcopyLogHandler(); + // 1 2 3 4 5 6 7 + String longMsg = "TSTCP0004I: This message should be split just about almost here, " + + "thenthenextlinewillcomeouttobesplithere " + + "becauseoftheblankIputinthetext,you know it would be nice to split " + + "near some data like this that has a lot of blanks in the line " + + " like this, the end "; + // 1 2 3 4 5 6 7 + String longMsg2 = "TSTCP0005I: extemelylongmessagetoexceedthetenlinesofMultline1234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567ENDOFTENLINES" + + "Eleventhline"; + int rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy((longMsg + '\0').getBytes("Cp1047")); + assertTrue(rc == 0); + + rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy((longMsg2 + '\0').getBytes("Cp1047")); + assertTrue(rc == 0); + + // Generate a message that will exceed the 1,000 continuation limit. + int i = 0; + String tooLong = ""; + for (; i < 1001; i++) { + tooLong = tooLong + longMsg2; + } + rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy((tooLong + '\0').getBytes("Cp1047")); + // Assert that we truncated the response + assertTrue(rc == -12); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + +} diff --git a/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/ZosLoggingBundleActivatorTest.java b/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/ZosLoggingBundleActivatorTest.java new file mode 100755 index 000000000000..57a5f42581f4 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/ZosLoggingBundleActivatorTest.java @@ -0,0 +1,176 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.logging.internal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.ws.zos.jni.NativeMethodUtils; + +import test.common.SharedOutputManager; +import test.common.zos.NativeLibraryUtils; +import test.common.zos.ZosOperations; + +/** + * + */ +public class ZosLoggingBundleActivatorTest { + + private static SharedOutputManager outputMgr; + + /** + * Capture stdout/stderr output to the manager. + * + * @throws Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // There are variations of this constructor: + // e.g. to specify a log location or an enabled trace spec. Ctrl-Space + // for suggestions + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + + new ZosOperations().restartAngel(); + + NativeLibraryUtils.loadUnauthorized(); + NativeLibraryUtils.registerServer(); + NativeLibraryUtils.registerNatives(ZosLoggingBundleActivator.class); + } + + /** + * Final teardown work when class is exiting. + * + * @throws Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + + NativeLibraryUtils.reset(); + + NativeLibraryUtils.deregisterNatives(ZosLoggingBundleActivator.class); + NativeLibraryUtils.deregisterServer(); + + new ZosOperations().cancelAngel(); + + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + /** + * Individual teardown after each test. + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + // Clear the output generated after each method invocation + outputMgr.resetStreams(); + } + + /** + * Test write to operator console + * + * + */ + @Test + public void test_ntv_WriteToOperatorConsole() { + final String m = "test_ntv_WriteToOperatorConsole"; + try { + ZosLoggingBundleActivator zosLoggingBundleActivator = new ZosLoggingBundleActivator(); + + int rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole(NativeMethodUtils.convertToEBCDIC("CWWKF0000I: This is a operator console test", false)); + assertTrue(rc == 0); + + byte[] msg = null; + rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole(msg); + assertTrue(rc == -102); + + rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole(NativeMethodUtils.convertToEBCDIC("", false)); + assertTrue(rc == 4); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * Test write to operator console multiple line message + * + * + */ + @Test + public void test_ntv_WriteToOperatorConsole_ml() { + final String m = "test_ntv_WriteToOperatorConsole_ml"; + try { + ZosLoggingBundleActivator zosLoggingBundleActivator = new ZosLoggingBundleActivator(); + // 1 2 3 4 5 6 7 + String longMsg = "TSTCP0004I: This message should be split just about almost here, " + + "thenthenextlinewillcomeouttobesplithere " + + "becauseoftheblankIputinthetext,you know it would be nice to split " + + "near some data like this that has a lot of blanks in the line " + + " like this, the end "; + // 1 2 3 4 5 6 7 + String longMsg2 = "TSTCP0005I: extemelylongmessagetoexceedthetenlinesofMultline1234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567ENDOFTENLINES" + + "Eleventhline"; + int rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole((longMsg + '\0').getBytes("Cp1047")); + assertTrue(rc == 0); + + rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole((longMsg2 + '\0').getBytes("Cp1047")); + assertTrue(rc == 0); + + // Generate a message that will exceed the 1,000 continuation limit. + int i = 0; + String tooLong = ""; + for (; i < 1001; i++) { + tooLong = tooLong + longMsg2; + } + rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole((tooLong + '\0').getBytes("Cp1047")); + // Assert that we truncated the response + assertTrue(rc == -12); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * This test expects the the JVM not to have been launched as a started task. + */ + @Test + public void test_ntv_isLaunchContextShell_true() { + ZosLoggingBundleActivator zosLoggingBundleActivator = new ZosLoggingBundleActivator(); + assertTrue(zosLoggingBundleActivator.ntv_isLaunchContextShell()); + } + + /** + * The unit-testing environment does not have the MSGLOG dd defined. + */ + @Test + public void test_ntv_isMsgLogDDDefined() { + ZosLoggingBundleActivator zosLoggingBundleActivator = new ZosLoggingBundleActivator(); + assertFalse(zosLoggingBundleActivator.ntv_isMsgLogDDDefined()); + } +} diff --git a/dev/fattest.simplicity/.classpath b/dev/fattest.simplicity/.classpath new file mode 100755 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/fattest.simplicity/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/fattest.simplicity/.classpath.gradle b/dev/fattest.simplicity/.classpath.gradle new file mode 100755 index 000000000000..2876090f9036 --- /dev/null +++ b/dev/fattest.simplicity/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/fattest.simplicity/.gitignore b/dev/fattest.simplicity/.gitignore new file mode 100644 index 000000000000..848aca22ec04 --- /dev/null +++ b/dev/fattest.simplicity/.gitignore @@ -0,0 +1,2 @@ +*.class +/autoFVT/ \ No newline at end of file diff --git a/dev/fattest.simplicity/.project b/dev/fattest.simplicity/.project new file mode 100755 index 000000000000..5e16795a3de6 --- /dev/null +++ b/dev/fattest.simplicity/.project @@ -0,0 +1,23 @@ + + + fattest.simplicity + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/fattest.simplicity/.settings/org.eclipse.core.resources.prefs b/dev/fattest.simplicity/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/fattest.simplicity/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/fattest.simplicity/.settings/org.eclipse.jdt.core.prefs b/dev/fattest.simplicity/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..f48ecd6cc608 --- /dev/null +++ b/dev/fattest.simplicity/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/fattest.simplicity/.settings/org.eclipse.jdt.ui.prefs b/dev/fattest.simplicity/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..c92277a371a9 --- /dev/null +++ b/dev/fattest.simplicity/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/fattest.simplicity/.settings/org.eclipse.ltk.core.refactoring.prefs b/dev/fattest.simplicity/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100755 index 000000000000..0c58c37ccba4 --- /dev/null +++ b/dev/fattest.simplicity/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,3 @@ +#Wed Mar 16 12:40:16 GMT 2011 +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/dev/fattest.simplicity/autoFVT-defaults/.gitignore b/dev/fattest.simplicity/autoFVT-defaults/.gitignore new file mode 100755 index 000000000000..77408bdb8742 --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/.gitignore @@ -0,0 +1,3 @@ +bootstrapping.properties +simplicity.properties +local.properties diff --git a/dev/fattest.simplicity/autoFVT-defaults/TestBuild.xml b/dev/fattest.simplicity/autoFVT-defaults/TestBuild.xml new file mode 100755 index 000000000000..51dc17271b37 --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/TestBuild.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + EXAMPLE USAGE: (only these combinations are valid) + ant -f TestBuild.xml [execute] + ant -f TestBuild.xml -Dsuite=(TestSuite class) + ant -f TestBuild.xml -Dsetup=(TestSetup class) + ant -f TestBuild.xml -Dsetup=(TestSetup class) -Dphase=(Test phase) + ant -f TestBuild.xml -Dtest=(TestCase class) + ant -f TestBuild.xml -Dtest=(TestCase class) -Dmethod=(Test method) + ant -f TestBuild.xml -Dtest=(TestCase class) -Dmethod=(Test method) -Dphase=(Test phase) + DEFINITIONS: + (TestSuite class) = The full package and class name of a Class that + features a public, static, no-argument suite() method + that returns a "junit.framework.Test". + If the class name is supplied without the package name, + "com.ibm.ws.fat.suites" is assumed. + If no suite is defined, the suite defined in + configuration.properties is used. + (TestSetup class) = The full package and class name of a Class that + extends commons.utils.junit.PhasedTestSetup. + If the class name is supplied without the package name, + "com.ibm.ws.fat.setup" is assumed. + (TestCase class) = The full package and class name of a Class that + extends commons.utils.junit.PhasedTestCase. + If the class name is supplied without the package name, + "com.ibm.ws.fat.tests" is assumed. + (Test phase) = The specific test phase you want to run. + If no phase is supplied, then all phases are run. + Valid phases include: "SetUp", "TearDown", and "RunTests" + (not case sensitive). + (Test method) = The specific test method you want to run. + If no method is supplied, then all public no-argument methods + starting with "test" that have a void return type are run. + NOTES: + 1. If no command line arguments are supplied, a full regression is performed + 2. The "execute" target can be specified in addition to any of the other command + line options, but since "execute" is the default target, it has no effect. + 3. The supplied TestCase is evaluated first, followed by the TestSetup, + followed by the TestSuite. In other words, if you define both a TestCase and + a TestSetup, the TestCase will be run. + 4. If a test phase is supplied with no test method for a TestCase, + that specific phase is run for each "test" method (you probably don't want to do this) + ASSUMPTIONS: + 1. A standard WebSphere topology must already be installed on the system under test + (For details, see: http://wasautomation.austin.ibm.com/xwiki/bin/view/TestingCollab/functionalAcceptanceTests) + + diff --git a/dev/fattest.simplicity/autoFVT-defaults/configuration.properties b/dev/fattest.simplicity/autoFVT-defaults/configuration.properties new file mode 100755 index 000000000000..0b2ea69843dc --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/configuration.properties @@ -0,0 +1,93 @@ +########################################################################################## +# configuration.properties +########################################################################################## +# This properties file describes special configuration properties for your test bucket. +# +# When you want to provide extra (optional) control to the tester regarding the way +# that your test bucket executes, you can provide those controls through this file. +# Properties contained in this file must not have anything to do with the environment +# under test; those properties must be contained in bootstrapping.properties. In other +# words, testers should not need to understand how to use this file to control your bucket; +# use of this file should be targeted for advanced users who desire additional controls. +# All properties in this file should be referenced through Props.java +# +# This file is also referenced by launch.xml to generate a Simplicity configuration file. +# These properties can be updated to control the normal operation modes of Simplicity. +# +########################################################################################## + + +############################################## +# Simplicity properties +############################################## + +# This property sets the WebSphere operations provider. The WebSphere operations +# provider provides WebSphere administration access to the Java api. Valid property +# values are JMX and WSADMIN. Default value is JMX (but only WSADMIN really works) +simplicity.webSphereOperationsProvider=WSADMIN + +# This property sets the command line provider. The command line provider provides +# command line execution capabilities. Some providers such as the RXA provider allow +# for remote execution and machine to machine file transfers. Valid property values +# are RXA, JMX, and LOCAL. Default value is JMX (but only RXA really works) +simplicity.commandLineProvider=RXA + +# This property enables and disables topology caching. If caching is enabled, information +# about the topology is gathered up front and cached to the bootstrapping properties +# file. On subsequent invocations, the Object model is then built from the cache without +# incurring the cost of making an administrative connection. Valid property values +# are true and false. Default value is false. +simplicity.useTopologyCaching=false + +# This property allows the user to set the port number to use when using the JIIWS +# protocol to make wsadmin connections. The JIIWS tool is used to facilitate and managed +# wsadmin connections (http://ausgsa.ibm.com/projects/m/moonstone/distributions/jiiws/). +# JIIWS supports several protocols including a local protocol (no remote connection), +# RXA, and the JIIWS protocol. The JIIWS protocol is used when making a remote wsadmin +# connection if RXA is not being used as the command line provider, or if preferJIIWSWsAdmin +# is set to true. Integer values are valid. Default value is port 1982. +simplicity.jiiwsPort=1982 + +# This property allows the user to set the inactivity timeout for the JIIWS protocol +# in milliseconds. See the the jiiwsPort property description for more information +# about the protocol. If no wsadmin requests are received within the timeout period, +# the remote JIIWS listener stops. Integer values are valid. Default value is 10 minutes +# (10*60*1000 milliseconds). +simplicity.jiiwsInactivityTimeout=600000 + +# This property specifies whether or not to use the JIIWS protocol. See the the jiiwsPort +# property description for more information about the protocol. By default, the JIIWS +# protocol is only used when making a remote wsadmin connection if the RXA is not being +# used as the command line provider. Valid property values are true and false. Default +# value is false. +simplicity.preferJIIWSWsAdmin=false + + +############################################## +# Test bucket properties +############################################## + +# Default test suite to be run, if nothing else is specified on the command line +# Usage notes: +# 1) If no "suite" is defined on the command line, the value of this property is used +# 2) If a "suite" is defined on the command line, the value of this property is overriden +# 3) A Moonstone standard explains that the default behavior of every bucket must +# be to run a full regression test if no other options are specified, so "FullRegression" +# is consistent with this standard +# Default: FullRegression +#suite=jspOne + +# Default suitedef +suitedef=fullregression + +# Separator characters used to distinguish related blocks of output in test bucket trace files +# Small logging breaks are typically encapsulated by larger logging breaks +logging.break.large=------------------------------------------------------------------------ +logging.break.medium=---------------------------------------------------------------- +logging.break.small=----------------------------------------- +logging.break.error=****************************************************************** + +# When ApplicationServers are created, virtual host aliases are automatically created +# for the WC_defaulthost and WC_defaulthost_secure ports. This property controls +# which virtual host alias to associate those host aliases with. Default is default_host +nd.virtualHostName=default_host diff --git a/dev/fattest.simplicity/autoFVT-defaults/fatTestCommon.xml b/dev/fattest.simplicity/autoFVT-defaults/fatTestCommon.xml new file mode 100755 index 000000000000..d62f37136add --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/fatTestCommon.xml @@ -0,0 +1,5 @@ + + + timedexit-1.0 + + diff --git a/dev/fattest.simplicity/autoFVT-defaults/fatTestPorts.xml b/dev/fattest.simplicity/autoFVT-defaults/fatTestPorts.xml new file mode 100755 index 000000000000..2f90fa5ce151 --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/fatTestPorts.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/dev/fattest.simplicity/autoFVT-defaults/ignoredFFDCs.xml b/dev/fattest.simplicity/autoFVT-defaults/ignoredFFDCs.xml new file mode 100755 index 000000000000..4f5e27fcdd47 --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/ignoredFFDCs.xml @@ -0,0 +1,20 @@ + + + + com.ibm.wsspi.channelfw.exception.ChannelException + com.ibm.wsspi.channelfw.exception.ChannelException: TCP Channel detected a possible loop on thread: + + + org.osgi.framework.ServiceException + Exception in org.apache.felix.scr.impl.manager.DelayedComponentManager.ungetService() + at org.eclipse.osgi.internal.serviceregistry.ServiceUse.releaseService(ServiceUse.java:287) + at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.releaseService(ServiceRegistrationImpl.java:562) + at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:245) + + + + java.lang.IllegalStateException + BundleContext is no longer valid + at org.eclipse.osgi.framework.internal.core.BundleContextImpl.checkValid(BundleContextImpl.java:931) + + \ No newline at end of file diff --git a/dev/fattest.simplicity/autoFVT-defaults/lib/fat.util.jar b/dev/fattest.simplicity/autoFVT-defaults/lib/fat.util.jar new file mode 100755 index 000000000000..3b5262a31182 Binary files /dev/null and b/dev/fattest.simplicity/autoFVT-defaults/lib/fat.util.jar differ diff --git a/dev/fattest.simplicity/autoFVT-defaults/logging.properties b/dev/fattest.simplicity/autoFVT-defaults/logging.properties new file mode 100755 index 000000000000..029081d49845 --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/logging.properties @@ -0,0 +1,74 @@ +############################################################ +# Logging Configuration File +# +# You can use a different file by specifying a filename +# with the java.util.logging.config.file system property. +# For example java -Djava.util.logging.config.file=myfile +############################################################ + +############################################################ +# Global properties +############################################################ + +# "handlers" specifies a comma separated list of log Handler +# classes. These handlers will be installed during VM startup. +# Note that these classes must be on the system classpath. +# By default we only configure a ConsoleHandler, which will only +# show messages at the INFO and above levels. +handlers=com.ibm.ws.fat.util.GenericHandler, java.util.logging.FileHandler + +# Default global logging level. +# This specifies which kinds of events are logged across +# all loggers. For any given facility this global level +# can be overriden by a facility specific level +# Note that the GenericHandler also has a separate level +# setting to limit messages printed to the underlying stream. +.level=INFO + +############################################################ +# Handler specific properties. +# Describes specific configuration info for Handlers. +############################################################ + +# The GenericHandler will log all messages printed at any logging level +com.ibm.ws.fat.util.GenericHandler.level=ALL +com.ibm.ws.fat.util.GenericHandler.formatter=com.ibm.ws.fat.util.GenericFormatter +com.ibm.ws.fat.util.GenericHandler.stream=system.out +com.ibm.ws.fat.util.GenericHandler.flush=true + +# The FileHandler will log all messages printed at any logging level to exactly one file located in results/output.txt +java.util.logging.FileHandler.level=ALL +java.util.logging.FileHandler.formatter=com.ibm.ws.fat.util.GenericFormatter +java.util.logging.FileHandler.limit=0 +java.util.logging.FileHandler.count=1 +java.util.logging.FileHandler.pattern=results/output.txt +java.util.logging.FileHandler.append=true + +############################################################ +# Formatter specific properties. +# Describes specific configuration info for Formatters. +############################################################ + +com.ibm.ws.fat.util.GenericFormatter.class.full=false +com.ibm.ws.fat.util.GenericFormatter.class.length=30 +com.ibm.ws.fat.util.GenericFormatter.class.log=true +com.ibm.ws.fat.util.GenericFormatter.level.log=true +com.ibm.ws.fat.util.GenericFormatter.method.length=30 +com.ibm.ws.fat.util.GenericFormatter.method.log=true +com.ibm.ws.fat.util.GenericFormatter.thread.length=3 +com.ibm.ws.fat.util.GenericFormatter.thread.log=true +com.ibm.ws.fat.util.GenericFormatter.time.format=[MM/dd/yyyy HH:mm:ss:SSS z] +com.ibm.ws.fat.util.GenericFormatter.time.log=true + +############################################################ +# Facility specific properties. +# Provides extra control for each logger. +############################################################ +com.ibm.ws.webcontainer.fvt.level=INFO +com.ibm.websphere.simplicity.level=INFO +#componenttest.common.apiservices.cmdline.LocalProvider.level=ALL +#componenttest.common.apiservices.cmdline.RXAProvider.level=ALL +#com.ibm.websphere.jiiws.level=FINER +#httpclient.wire.level=FINEST +#httpclient.wire.header.level=FINEST +#org.apache.commons.httpclient.level=FINEST diff --git a/dev/fattest.simplicity/autoFVT-defaults/productSample.properties b/dev/fattest.simplicity/autoFVT-defaults/productSample.properties new file mode 100755 index 000000000000..a9f79cfedab4 --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/productSample.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties,sample.properties diff --git a/dev/fattest.simplicity/autoFVT-defaults/productSampleServer.xml b/dev/fattest.simplicity/autoFVT-defaults/productSampleServer.xml new file mode 100755 index 000000000000..7d76607cdbb0 --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/productSampleServer.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/fattest.simplicity/autoFVT-defaults/productSample_noBootstrap.properties b/dev/fattest.simplicity/autoFVT-defaults/productSample_noBootstrap.properties new file mode 100755 index 000000000000..4f1ae5a2e104 --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/productSample_noBootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/fattest.simplicity/autoFVT-defaults/src/ant/launch.xml b/dev/fattest.simplicity/autoFVT-defaults/src/ant/launch.xml new file mode 100755 index 000000000000..7a8216215578 --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/src/ant/launch.xml @@ -0,0 +1,751 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deleting existing properties files + + + + Generating a local properties file that contains all the properties from Ant and configuration.properties + + + + + Created ${local.properties} + + Generating the Simplicity config.props file based on configuration.properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Initializing the classpath for ${test.bucket.name} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Initializing JRE logging + + + + + + + + + + + Running ${test.bucket.name} + Timeout: ${fattest.timeout} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + embedded.trace is active + + + + + + + + + + + + + + + + + + + Coverage settings: + test.coverage: ${test.coverage} + exec.data.file: ${exec.data.file} + jacocoant.file: ${jacocoant.file} + jacocoagent.file: ${jacocoagent.file} + + + + + + framework.maxheap=${framework.maxheap} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Failure running ${test.bucket.name}, attempting to copy logs from servers that did not stop properly : ${serverFile} + + + + + + + + + + + + + + + + + Finished running ${test.bucket.name} + XML report is available at ${dir.log.xml} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + stopServer for ${serverFile} + + + + + + + + + + + + + + + + + + + + + + + + + + + + Generating an HTML report based on the existing XML report + + + + + + + + + HTML report is available at ${dir.log.html} + + + + + + + + + + + + + + + + + + + Base dir is: ${basedir} + Liberty dir is: ${liberty.dir} + libertyInstallPath is: ${libertyInstallPath} + + + + + liberty.location is: ${liberty.location} + + + + + install.location is: ${install.location} + + + + + + + + + + + + + + + + + + + + + + + + + + Check ports are available + + + + + + + + + + + + + + + + + + + + + + For first ldap Non-SSL port : ${ldap.1.port} and SSL port : ${ldap.1.ssl.port} + For second ldap Non-SSL port : ${ldap.2.port} and SSL port : ${ldap.2.ssl.port} + For third ldap Non-SSL port : ${ldap.3.port} and SSL port : ${ldap.3.ssl.port} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Debug Data: + libertyInstallPath: ${libertyInstallPath} + jacocoant.file: ${jacocoant.file} + exec.data.file: ${exec.data.file} + is.exec.data.file.avialable: ${is.exec.data.file.avialable} + dir.log.coverage: ${dir.log.coverage} + project.name: ${project.name} + project.under.test: ${project.under.test} + project.under.test.bundles.path: ${project.under.test.bundles.path} + is.project.under.test.bundles.available: ${is.project.under.test.bundles.available} + project.under.test.source.path: ${project.under.test.source.path} + is.project.under.test.source.available: ${is.project.under.test.source.available} + generateFatJaCoCoReport.run: ${generateFatJaCoCoReport.run} + + + + The jacoco.exec file is unavaialbe: ${exec.data.file} + This can happen if: + 1. The FAT project overrides the default execution targets. + 2. The FAT tests did not actually run. + + + + The project under test's bundles are unavailable: ${libertyInstallPath}/lib/${project.under.test}*.jar + This can happen if: + 1. The test project deviates from the standard naming pattern: project / project_[test|fat]. + 2. The production code project deviates from the standard bundle naming pattern: project.*jar. + 3. The FAT target is invoked from a non-production project + + + + No FAT coverage report will be generated for ${project.under.test}. See the log for earlier reasons. + + + + Generating the FAT coverage report for component ${project.under.test} + + + + + + + + + + + + + + + + + + + + + + + + + Generating the FAT coverage report for component ${project.under.test} (no source) + + + + + + + + + + + + + + + + + + + + + + + + + HTML report for code coverage is available at ${dir.log.coverage}/index.html + CSV report for code coverage is available at ${dir.log.coverage}/report.csv + XML report for code coverage is available at ${dir.log.coverage}/report.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/fattest.simplicity/autoFVT-defaults/src/ant/properties.xml b/dev/fattest.simplicity/autoFVT-defaults/src/ant/properties.xml new file mode 100755 index 000000000000..0fea97a3f4ed --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/src/ant/properties.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/fattest.simplicity/autoFVT-defaults/testports.properties b/dev/fattest.simplicity/autoFVT-defaults/testports.properties new file mode 100755 index 000000000000..3d9f188ff269 --- /dev/null +++ b/dev/fattest.simplicity/autoFVT-defaults/testports.properties @@ -0,0 +1,172 @@ +# Main test port used by both tests and framework +# The ports set here will be updated if they are not available immediately +# before the tests run. +# The 'bvt.prop.' prefix is required for the value to be exported to the test +# client JVM, e.g. bvt.prop.HTTP_default -> HTTP_default +bvt.prop.JMXREST_default=8880 + +bvt.prop.IIOP=2809 +bvt.prop.IIOP.secure=2810 + +bvt.prop.IIOP.secondary=2819 +bvt.prop.IIOP.secondary.secure=2820 + +bvt.prop.IIOP.tertiary=2829 +bvt.prop.IIOP.tertiary.secure=2830 + +bvt.prop.IIOP.client=2811 +bvt.prop.IIOP.client.secure=2812 + +bvt.prop.UDPTest=18004 +bvt.prop.SSL_bvt=18005 + +bvt.prop.HTTP_default=8010 +bvt.prop.HTTP_default.secure=8020 + +bvt.prop.HTTP_secondary=8030 +bvt.prop.HTTP_secondary.secure=8040 + +bvt.prop.httpFAT_1=18080 +bvt.prop.httpFAT_2=18082 +bvt.prop.httpFAT_3=18443 +bvt.prop.httpFAT_4=19030 + +bvt.prop.http.0=${bvt.prop.HTTP_default} +bvt.prop.http.0.ssl=${bvt.prop.HTTP_default.secure} +bvt.prop.http.1=${bvt.prop.HTTP_secondary} +bvt.prop.http.1.ssl=${bvt.prop.HTTP_secondary.secure} + +bvt.prop.jms.0=7276 +bvt.prop.jms.0.ssl=7286 +bvt.prop.jms.1=17010 +bvt.prop.jms.1.ssl=17510 +bvt.prop.jms.2=17020 +bvt.prop.jms.2.ssl=17520 +bvt.prop.jms.3=17030 +bvt.prop.jms.3.ssl=17530 +bvt.prop.jms.4=17040 +bvt.prop.jms.4.ssl=17540 +bvt.prop.jms.5=17050 +bvt.prop.jms.5.ssl=17550 +bvt.prop.jms.6=17060 +bvt.prop.jms.6.ssl=17560 +bvt.prop.jms.7=17070 +bvt.prop.jms.7.ssl=17570 +bvt.prop.jms.8=17080 +bvt.prop.jms.8.ssl=17580 +bvt.prop.jms=${bvt.prop.jms.0} +bvt.prop.jms.ssl=${bvt.prop.jms.0.ssl} + +bvt.prop.mockservice.http=9111 + +# Test ports used for System Management scenarios +# These ports provide up to: +# -- 5 members with HTTP and HTTPS ports +# -- 5 controllers with HTTP, HTTPS and REPLICA ports +# ________ +# / \ +# / _ ___ _ _ \ DO NOT ADD +# |(_` | / \|_)| ANY MORE PORTS +# |._) | \_/| | TO THIS LIST +# \ / +# \__________/ +# +# Helpful Tips: +# -- HTTP ports are even numbers +# -- HTTPS ports are odd numbers +# -- Member ports start at 8080 +# -- Controller ports start at 9080 +# -- Replica ports start at 10010 + +bvt.prop.member.alternateElectionPort=40572 + +# Ports for Member 1 +bvt.prop.member_1.http=8080 +bvt.prop.member_1.https=8081 +# Ports for Member 2 +bvt.prop.member_2.http=8082 +bvt.prop.member_2.https=8083 +# Ports for Member 3 +bvt.prop.member_3.http=8084 +bvt.prop.member_3.https=8085 +# Ports for Member 4 +bvt.prop.member_4.http=8086 +bvt.prop.member_4.https=8087 +# Ports for Member 5 +bvt.prop.member_5.http=8088 +bvt.prop.member_5.https=8089 +# Ports for Member 6 +bvt.prop.member_6.http=8090 +bvt.prop.member_6.https=8091 +# Ports for Controller 1 +bvt.prop.controller_1.http=9080 +bvt.prop.controller_1.https=9081 +bvt.prop.controller_1.replica=10010 +# Ports for Controller 2 +bvt.prop.controller_2.http=9082 +bvt.prop.controller_2.https=9083 +bvt.prop.controller_2.replica=10011 +# Ports for Controller 3 +bvt.prop.controller_3.http=9084 +bvt.prop.controller_3.https=9085 +bvt.prop.controller_3.replica=10012 +# Ports for Controller 4 +bvt.prop.controller_4.http=9086 +bvt.prop.controller_4.https=9087 +bvt.prop.controller_4.replica=10013 +# Ports for Controller 5 +bvt.prop.controller_5.http=9088 +bvt.prop.controller_5.https=9089 +bvt.prop.controller_5.replica=10014 + +# Test ports used for the javaMail-1.5 feature +bvt.prop.smtp_port=3025 +bvt.prop.imap_port=6663 +bvt.prop.pop3_port=3110 + +# property expected by OSGI framework must be the same as the default http +org.osgi.service.http.port=${bvt.prop.HTTP_default} + +# Console listens on this port +osgi.console=5678 + +com.ibm.ws.logging.max.file.size=0 + +#Most BVT tests will override this +com.ibm.ws.logging.trace.specification=*=info=enabled:logservice=all=enabled +ds.loglevel=debug + +# property for the file containing the FFDCs that need to be ignored +bvt.prop.fileFFDC=ignoredFFDCs.xml + +# enable summary file updates after each FFDC +com.ibm.ws.logging.ffdc.summary.policy=immediate + +# Ports for Local LDAP server +ldap.1.port=10389 +ldap.2.port=20389 +ldap.3.port=30389 + +# SSL ports for local LDAP server +ldap.1.ssl.port=10636 +ldap.2.ssl.port=20636 +ldap.3.ssl.port=30636 + +# Test ports used for Security multiple server scenarios +# These ports provide up to: +bvt.prop.OP_HTTP_default=8940 +bvt.prop.OP_HTTP_default.secure=8945 +bvt.prop.RP_HTTP_default=8941 +bvt.prop.RP_HTTP_default.secure=8946 + +# Test ports used Batch multiple server scenarios +# These ports provide up to: +bvt.prop.batch.dispatcher_1_HTTP_default=8942 +bvt.prop.batch.dispatcher_1_HTTP_default.secure=8950 +bvt.prop.batch.dispatcher_2_HTTP_default=8943 +bvt.prop.batch.dispatcher_2_HTTP_default.secure=8951 +bvt.prop.batch.endpoint_1_HTTP_default=8944 +bvt.prop.batch.endpoint_1_HTTP_default.secure=8952 +bvt.prop.batch.endpoint_2_HTTP_default=8945 +bvt.prop.batch.endpoint_2_HTTP_default.secure=8953 + diff --git a/dev/fattest.simplicity/bnd.bnd b/dev/fattest.simplicity/bnd.bnd new file mode 100755 index 000000000000..575b414813f8 --- /dev/null +++ b/dev/fattest.simplicity/bnd.bnd @@ -0,0 +1,65 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: FAT infrastructure +Bundle-SymbolicName: fattest.simplicity +Bundle-Description: FAT infrastructure; version=${bVersion} + +Export-Package: \ + com.ibm.websphere.simplicity;version=1.0.16,\ + com.ibm.websphere.simplicity.application;version=1.0.16,\ + com.ibm.websphere.simplicity.application.loose;version=1.0.16,\ + com.ibm.websphere.simplicity.application.tasks;version=1.0.16,\ + com.ibm.websphere.simplicity.cloudfoundry;version=1.0.16,\ + com.ibm.websphere.simplicity.cloudfoundry.util;version=1.0.16,\ + com.ibm.websphere.simplicity.config;version=1.0.16,\ + com.ibm.websphere.simplicity.config.context;version=1.0.16,\ + com.ibm.websphere.simplicity.config.dsprops;version=1.0.16,\ + com.ibm.websphere.simplicity.config.dsprops.testrules;version=1.0.16,\ + com.ibm.websphere.simplicity.product;version=1.0.16,\ + com.ibm.websphere.simplicity.wsadmin;version=1.0.16,\ + com.ibm.websphere.soe_reporting;version=1.0.16,\ + com.ibm.ws.fat.jcdi.util.html;version=1.0.16,\ + com.ibm.ws.fat.util;version=1.0.16,\ + com.ibm.ws.fat.util.browser;version=1.0.16,\ + com.ibm.ws.fat.util.jmx;version=1.0.16,\ + com.ibm.ws.fat.util.jmx.mbeans;version=1.0.16,\ + componenttest.annotation;version=1.0.16,\ + componenttest.aries;version=1.0.16,\ + componenttest.common.apiservices;version=1.0.16,\ + componenttest.common.apiservices.cmdline;version=1.0.16,\ + componenttest.custom.junit.runner;version=1.0.16,\ + componenttest.exception;version=1.0.16,\ + componenttest.logging.ffdc;version=1.0.16,\ + componenttest.rules;version=1.0.16,\ + componenttest.topology.database;version=1.0.16,\ + componenttest.topology.impl;version=1.0.16,\ + componenttest.topology.ldap;version=1.0.16,\ + componenttest.topology.utils;version=1.0.16,\ + componenttest.vulnerability;version=1.0.16 + +-buildpath: \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ + lib/com.ibm.componenttest.common.jar;version=file,\ + lib/com.ibm.ws.topology.helper.jar;version=file,\ + lib/commons-httpclient-3.1.jar;version=file,\ + lib/httpunit.jar;version=file,\ + lib/jlanclient.jar;version=file,\ + lib/jtidy-r938.jar;version=file,\ + lib/provider.api.jar;version=file,\ + lib/public.api.jar;version=file,\ + lib/remoteaccess.jar;version=file,\ + lib/shrinkwrap-api-1.2.3.jar;version=file,\ + lib/shrinkwrap-impl-base-1.2.3.jar;version=file,\ + lib/shrinkwrap-spi-1.2.3.jar;version=file,\ + lib/ssh.jar;version=file,\ + autoFVT-defaults/lib/fat.util.jar;version=file,\ + jdbc/derby/derbynet.jar;version=file,\ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file,\ + ../build.sharedResources/lib/hamcrest-all.jar;version=file,\ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file,\ + com.ibm.websphere.javaee.servlet.3.1;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0;version=latest,\ + com.ibm.ws.jmx.connector.client.rest;version=latest diff --git a/dev/fattest.simplicity/bnd.bnd.gradle b/dev/fattest.simplicity/bnd.bnd.gradle new file mode 100755 index 000000000000..575b414813f8 --- /dev/null +++ b/dev/fattest.simplicity/bnd.bnd.gradle @@ -0,0 +1,65 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: FAT infrastructure +Bundle-SymbolicName: fattest.simplicity +Bundle-Description: FAT infrastructure; version=${bVersion} + +Export-Package: \ + com.ibm.websphere.simplicity;version=1.0.16,\ + com.ibm.websphere.simplicity.application;version=1.0.16,\ + com.ibm.websphere.simplicity.application.loose;version=1.0.16,\ + com.ibm.websphere.simplicity.application.tasks;version=1.0.16,\ + com.ibm.websphere.simplicity.cloudfoundry;version=1.0.16,\ + com.ibm.websphere.simplicity.cloudfoundry.util;version=1.0.16,\ + com.ibm.websphere.simplicity.config;version=1.0.16,\ + com.ibm.websphere.simplicity.config.context;version=1.0.16,\ + com.ibm.websphere.simplicity.config.dsprops;version=1.0.16,\ + com.ibm.websphere.simplicity.config.dsprops.testrules;version=1.0.16,\ + com.ibm.websphere.simplicity.product;version=1.0.16,\ + com.ibm.websphere.simplicity.wsadmin;version=1.0.16,\ + com.ibm.websphere.soe_reporting;version=1.0.16,\ + com.ibm.ws.fat.jcdi.util.html;version=1.0.16,\ + com.ibm.ws.fat.util;version=1.0.16,\ + com.ibm.ws.fat.util.browser;version=1.0.16,\ + com.ibm.ws.fat.util.jmx;version=1.0.16,\ + com.ibm.ws.fat.util.jmx.mbeans;version=1.0.16,\ + componenttest.annotation;version=1.0.16,\ + componenttest.aries;version=1.0.16,\ + componenttest.common.apiservices;version=1.0.16,\ + componenttest.common.apiservices.cmdline;version=1.0.16,\ + componenttest.custom.junit.runner;version=1.0.16,\ + componenttest.exception;version=1.0.16,\ + componenttest.logging.ffdc;version=1.0.16,\ + componenttest.rules;version=1.0.16,\ + componenttest.topology.database;version=1.0.16,\ + componenttest.topology.impl;version=1.0.16,\ + componenttest.topology.ldap;version=1.0.16,\ + componenttest.topology.utils;version=1.0.16,\ + componenttest.vulnerability;version=1.0.16 + +-buildpath: \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ + lib/com.ibm.componenttest.common.jar;version=file,\ + lib/com.ibm.ws.topology.helper.jar;version=file,\ + lib/commons-httpclient-3.1.jar;version=file,\ + lib/httpunit.jar;version=file,\ + lib/jlanclient.jar;version=file,\ + lib/jtidy-r938.jar;version=file,\ + lib/provider.api.jar;version=file,\ + lib/public.api.jar;version=file,\ + lib/remoteaccess.jar;version=file,\ + lib/shrinkwrap-api-1.2.3.jar;version=file,\ + lib/shrinkwrap-impl-base-1.2.3.jar;version=file,\ + lib/shrinkwrap-spi-1.2.3.jar;version=file,\ + lib/ssh.jar;version=file,\ + autoFVT-defaults/lib/fat.util.jar;version=file,\ + jdbc/derby/derbynet.jar;version=file,\ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file,\ + ../build.sharedResources/lib/hamcrest-all.jar;version=file,\ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file,\ + com.ibm.websphere.javaee.servlet.3.1;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0;version=latest,\ + com.ibm.ws.jmx.connector.client.rest;version=latest diff --git a/dev/fattest.simplicity/build-noship.xml b/dev/fattest.simplicity/build-noship.xml new file mode 100755 index 000000000000..208e450ae76c --- /dev/null +++ b/dev/fattest.simplicity/build-noship.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/fattest.simplicity/build.gradle b/dev/fattest.simplicity/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/fattest.simplicity/componenttest.framework.component.async.loadproperties b/dev/fattest.simplicity/componenttest.framework.component.async.loadproperties new file mode 100755 index 000000000000..57df80e5b2d4 --- /dev/null +++ b/dev/fattest.simplicity/componenttest.framework.component.async.loadproperties @@ -0,0 +1,6 @@ +# This file is used to determine which files in the build component get loaded when running an async build. +# All we're after is a thin bootstrapping layer. + +versionableName=/fattest.simplicity/ +versionableName=/test_prereqs/ +versionableName=/test_build/ diff --git a/dev/fattest.simplicity/componenttest.framework.withjdbc.component.async.loadproperties b/dev/fattest.simplicity/componenttest.framework.withjdbc.component.async.loadproperties new file mode 100755 index 000000000000..979a46895632 --- /dev/null +++ b/dev/fattest.simplicity/componenttest.framework.withjdbc.component.async.loadproperties @@ -0,0 +1,7 @@ +# This file is used to determine which files in the build component get loaded when running an async build. +# All we're after is a thin bootstrapping layer. + +versionableName=/fattest.simplicity/ +versionableName=/test_prereqs/ +versionableName=/test_build/ +versionableName=/prereq.dbtest/ diff --git a/dev/fattest.simplicity/delivery.sets b/dev/fattest.simplicity/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/fattest.simplicity/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/fattest.simplicity/jdbc/derby/derby.jar b/dev/fattest.simplicity/jdbc/derby/derby.jar new file mode 100755 index 000000000000..f01ce42907ab Binary files /dev/null and b/dev/fattest.simplicity/jdbc/derby/derby.jar differ diff --git a/dev/fattest.simplicity/jdbc/derby/derbyclient.jar b/dev/fattest.simplicity/jdbc/derby/derbyclient.jar new file mode 100755 index 000000000000..fd8eed6ce482 Binary files /dev/null and b/dev/fattest.simplicity/jdbc/derby/derbyclient.jar differ diff --git a/dev/fattest.simplicity/jdbc/derby/derbynet.jar b/dev/fattest.simplicity/jdbc/derby/derbynet.jar new file mode 100755 index 000000000000..a7e1d9de1726 Binary files /dev/null and b/dev/fattest.simplicity/jdbc/derby/derbynet.jar differ diff --git a/dev/fattest.simplicity/jdbc/derby/derbytools.jar b/dev/fattest.simplicity/jdbc/derby/derbytools.jar new file mode 100755 index 000000000000..ae270bab4189 Binary files /dev/null and b/dev/fattest.simplicity/jdbc/derby/derbytools.jar differ diff --git a/dev/fattest.simplicity/jdbc/oracle/ojdbc6_g.jar b/dev/fattest.simplicity/jdbc/oracle/ojdbc6_g.jar new file mode 100755 index 000000000000..6862ecca76da Binary files /dev/null and b/dev/fattest.simplicity/jdbc/oracle/ojdbc6_g.jar differ diff --git a/dev/fattest.simplicity/lib/com.ibm.componenttest.common.jar b/dev/fattest.simplicity/lib/com.ibm.componenttest.common.jar new file mode 100755 index 000000000000..b4af18f52798 Binary files /dev/null and b/dev/fattest.simplicity/lib/com.ibm.componenttest.common.jar differ diff --git a/dev/fattest.simplicity/lib/com.ibm.ws.topology.helper.jar b/dev/fattest.simplicity/lib/com.ibm.ws.topology.helper.jar new file mode 100755 index 000000000000..52e2317c7240 Binary files /dev/null and b/dev/fattest.simplicity/lib/com.ibm.ws.topology.helper.jar differ diff --git a/dev/fattest.simplicity/lib/commons-httpclient-3.1.jar b/dev/fattest.simplicity/lib/commons-httpclient-3.1.jar new file mode 100755 index 000000000000..7c59774aed4f Binary files /dev/null and b/dev/fattest.simplicity/lib/commons-httpclient-3.1.jar differ diff --git a/dev/fattest.simplicity/lib/httpunit.jar b/dev/fattest.simplicity/lib/httpunit.jar new file mode 100755 index 000000000000..dd2404fca91e Binary files /dev/null and b/dev/fattest.simplicity/lib/httpunit.jar differ diff --git a/dev/fattest.simplicity/lib/jlanclient.jar b/dev/fattest.simplicity/lib/jlanclient.jar new file mode 100755 index 000000000000..73ae6a60685f Binary files /dev/null and b/dev/fattest.simplicity/lib/jlanclient.jar differ diff --git a/dev/fattest.simplicity/lib/jtidy-r938.jar b/dev/fattest.simplicity/lib/jtidy-r938.jar new file mode 100755 index 000000000000..efde902f3e9b Binary files /dev/null and b/dev/fattest.simplicity/lib/jtidy-r938.jar differ diff --git a/dev/fattest.simplicity/lib/provider.api.jar b/dev/fattest.simplicity/lib/provider.api.jar new file mode 100755 index 000000000000..6c5621abb3fc Binary files /dev/null and b/dev/fattest.simplicity/lib/provider.api.jar differ diff --git a/dev/fattest.simplicity/lib/public.api.jar b/dev/fattest.simplicity/lib/public.api.jar new file mode 100755 index 000000000000..edf6ecdc4e64 Binary files /dev/null and b/dev/fattest.simplicity/lib/public.api.jar differ diff --git a/dev/fattest.simplicity/lib/remoteaccess.jar b/dev/fattest.simplicity/lib/remoteaccess.jar new file mode 100755 index 000000000000..038039373581 Binary files /dev/null and b/dev/fattest.simplicity/lib/remoteaccess.jar differ diff --git a/dev/fattest.simplicity/lib/shrinkwrap-api-1.2.3.jar b/dev/fattest.simplicity/lib/shrinkwrap-api-1.2.3.jar new file mode 100755 index 000000000000..7c502bc824e1 Binary files /dev/null and b/dev/fattest.simplicity/lib/shrinkwrap-api-1.2.3.jar differ diff --git a/dev/fattest.simplicity/lib/shrinkwrap-impl-base-1.2.3.jar b/dev/fattest.simplicity/lib/shrinkwrap-impl-base-1.2.3.jar new file mode 100755 index 000000000000..59061b48d74a Binary files /dev/null and b/dev/fattest.simplicity/lib/shrinkwrap-impl-base-1.2.3.jar differ diff --git a/dev/fattest.simplicity/lib/shrinkwrap-spi-1.2.3.jar b/dev/fattest.simplicity/lib/shrinkwrap-spi-1.2.3.jar new file mode 100755 index 000000000000..506196b61d34 Binary files /dev/null and b/dev/fattest.simplicity/lib/shrinkwrap-spi-1.2.3.jar differ diff --git a/dev/fattest.simplicity/lib/ssh.jar b/dev/fattest.simplicity/lib/ssh.jar new file mode 100755 index 000000000000..fa3e237d8eb4 Binary files /dev/null and b/dev/fattest.simplicity/lib/ssh.jar differ diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/ApplicationServer.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/ApplicationServer.java new file mode 100755 index 000000000000..1963643abef4 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/ApplicationServer.java @@ -0,0 +1,196 @@ +package com.ibm.websphere.simplicity; + +import java.util.HashSet; +import java.util.Set; + +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.websphere.simplicity.provider.OperationsProviderFactory; +import com.ibm.websphere.simplicity.provider.websphere.ConfigurationOperationsProvider; +import com.ibm.websphere.simplicity.runtime.ProcessStatus; +import componenttest.topology.impl.LibertyServer; + +/** + * This class represents a WebSphere application server. This is the parent class for specialized + * application servers such as {@link Dmgr}. + */ +public class ApplicationServer extends Server { + + private static final Class c = ApplicationServer.class; + + /** + * Constructor to create an existing instance + * + * @param configId The {@link ConfigIdentifier} for the ApplicationServer + * @param scope The {@link Cell} that this ApplicationServer belongs to + * @param node The {@link Node} that the ApplicationServer belongs to + */ + protected ApplicationServer(LibertyServer server, Node node) throws Exception { + this(server, node.getCell(), node, ServerType.APPLICATION_SERVER); + } + + /** + * Constructor to create a new ApplicationServer + * + * @param configId The {@link ConfigIdentifier} for the ApplicationServer + * @param cell The {@link Cell} that this ApplicationServer belongs to + * @param node The {@link Node} that the ApplicationServer belongs to + * @param serverType The type of server + */ + protected ApplicationServer(LibertyServer server, Cell cell, Node node, ServerType serverType) throws Exception { + super(cell, node, server, serverType); + } + + /** + * Starts the server using the underlying com.ibm.alpine.Server instance. + * + * @throws Exception If the server did not start successfully and is not already started. + */ + @Override + public void start() throws Exception { + this.instance.startServer(); + } + + /** + * Starts the server using the underlying com.ibm.alpine.Server instance. + * + * @param mbeanWaitDuration This value is ignored. + * + * @throws Exception If the server did not start successfully and is not already started. + */ + @Override + public void start(int mbeanWaitDuration) throws Exception { + this.instance.startServer(); + } + + /** + * Stops the server using the underlying com.ibm.alpine.Server instance. + * + * @throws Exception If the server did not stop successfully and is not already stopped. + */ + @Override + public void stop() throws Exception { + this.instance.stopServer(); + } + + /** + * Stops the server using the underlying com.ibm.alpine.Server instance. + * + * @param timeout This value is ignored. + * + * @throws Exception If the server did not stop successfully and is not already stopped. + */ + @Override + public void stop(long timeout) throws Exception { + this.instance.stopServer(); + } + + /** + * Equivalent to calling stop() followed by start() + * + * @throws Exception + */ + public void restart() throws Exception { + this.stop(); + this.start(); + } + + /** + * Equivalent to calling stop() followed by start() + * + * @param timeout This value is ignored. + * @throws Exception + */ + public void restart(long timeout) throws Exception { + this.restart(); + } + + public Set getClusters() throws Exception { + Set ret = new HashSet(); + return ret; + } + + @Override + public ProcessStatus getServerStatus() throws Exception { + ////return ProcessStatus.convert(this.instance.getServerStatus()); + return null; + } + + /** + * Get the short name of this server. This name can contain one to eight + * uppercase alphanumeric characters, but it cannot start with a numeral. + * This field only applies to the z/OS(R) platform. On other platforms, this + * method will typically return null. + * + * @return The process ID + */ + public String getShortName() throws Exception { + final String method = "getShortName"; + Log.entering(c, method); + String name; + try { + ConfigurationOperationsProvider provider = + OperationsProviderFactory.getProvider().getConfigurationOperationsProvider(); + // AbstractSession session = getWorkspace().getSession(); + ConfigIdentifier configId = this.getConfigId(); + Object attribute = provider.getAttribute(getNode(), null, configId, "shortName"); + name = (String) attribute; + } catch (Exception e) { + throw new Exception("Unable to detect the shortName of the Server named " + this + .getName(), e); + } + Log.exiting(c, method, name); + return name; + } + + public String getMappingName() { + return "WebSphere:cell=" + getCellName() + ",node=" + getNode().getName() + ",server=" + getName(); + } + + /** + * Get the OS process ID for this ApplicationServer + * + * @return The process ID + */ + public int getProcessID() throws Exception { + return 0; + } + + /** + * Causes the current Thread to sleep until a specific set of ports + * associated with this Server are listening. + * + * @param timeout + * The number of milliseconds to wait for port activation before + * timing out + * @param pollInterval + * The number of milliseconds to wait between each round of + * status checking + * @param ports + * The ports to wait for + * @return true if all ports started listening before the timeout expired, + * otherwise false + * @throws Exception + * if port status cannot be established, or if this thread is + * interrupted + */ + public boolean waitForPortActivation(long timeout, long pollInterval, Set ports) throws Exception { + final String method = "waitForPortActivation"; + Log.entering(c, method, new Object[] { timeout, pollInterval, ports }); + if (ports == null) { + throw new IllegalArgumentException("Unable to determine if ports are listening since the input Set of PortType objects was null"); + } + long start = System.currentTimeMillis(); + while ((System.currentTimeMillis() - start) < timeout) { + if (this.isPortListening(ports)) { + Log.exiting(c, method, true); + return true; + } + Thread.sleep(pollInterval); + Log.finer(c, method, "This thread has waited " + (System.currentTimeMillis() - start) + " milliseconds for the ports to become active. Will wait up to " + timeout + + " milliseconds."); + } + Log.exiting(c, method, false); + return false; + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/AsyncProgramOutput.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/AsyncProgramOutput.java new file mode 100755 index 000000000000..d2b1a986c402 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/AsyncProgramOutput.java @@ -0,0 +1,168 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * A version of program output which handles asynchronous commands. + * If something wants to know what output the program has produced, + * the output up to that point (which might be large) will be + * returned. + */ +public class AsyncProgramOutput extends ProgramOutput { + + private final StreamCapturingThread stdErr; + private final StreamCapturingThread stdOut; + + public AsyncProgramOutput(String command, String[] parameters, Process process) { + super(stringify(command, parameters), 0, null, null); + // The javadoc for process says that on some platforms if the + // output isn't consumed, it will block, so consume pre-emptively. + stdErr = new StreamCapturingThread(process.getErrorStream()); + stdOut = new StreamCapturingThread(process.getInputStream()); + + stdErr.start(); + stdOut.start(); + } + + /** + * @param command + * @param parameters + * @return + */ + private static String stringify(String command, String[] parameters) { + StringBuilder cmd = new StringBuilder(command); + cmd.append(" "); + for (String parameter : parameters) { + cmd.append(parameter); + cmd.append(" "); + } + return cmd.toString(); + } + + /** + * Get the output written to stderr + * + * @return stderr + */ + @Override + public String getStderr() { + return stdErr.getContents(); + } + + /** + * Get all of the output written to stdout so far. + * + * @return stdout + */ + @Override + public String getStdout() { + return stdOut.getContents(); + } + + private class StreamCapturingThread extends Thread { + /** + * We probably won't ever want to capture more than 2kb of console + * output, since the server should be logging anyway. + */ + private static final int BUFFER_SIZE = 2 * 1024; + private BoundedByteArrayOutputStream bytes; + private BufferedWriter writer; + private final InputStream stream; + + private StreamCapturingThread(InputStream stream) { + this.stream = stream; + // Run as a daemon thread so we don't keep things alive + setDaemon(true); + } + + /** + * @return + */ + public String getContents() { + if (writer != null) { + try { + writer.flush(); + } catch (IOException e) { + Log.warning(AsyncProgramOutput.class, "Could not flush process output: " + e.toString()); + } + } + if (bytes != null) { + return bytes.toString(); + } else { + return "(no output)"; + } + } + + @Override + public void run() { + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); + + String line = reader.readLine(); + while (line != null) { + BufferedWriter writer = getWriter(); + writer.write(line); + writer.newLine(); + line = reader.readLine(); + } + } catch (IOException e) { + Log.warning(AsyncProgramOutput.class, "Could not read process output: " + e.toString()); + } + } + + /** + * @throws IOException + */ + private BufferedWriter getWriter() throws IOException { + if (bytes == null) { + bytes = new BoundedByteArrayOutputStream(BUFFER_SIZE); + } + // If we're near the limit of our buffer, wrap around + if (bytes.size() > 0 && (bytes.count() + 400) >= bytes.size()) { + int size = bytes.size(); + bytes.reset(); + writer = new BufferedWriter(new OutputStreamWriter(bytes)); + writer.write("[" + size / 1024 + " KB OF EARLIER OUTPUT TRIMMED FOR LENGTH]"); + } else if (writer == null) { + writer = new BufferedWriter(new OutputStreamWriter(bytes)); + } + + return writer; + } + } + + /** + * A byte array stream whose maximum size is (vaguely) bounded. + */ + class BoundedByteArrayOutputStream extends ByteArrayOutputStream { + /** + * @param bufferSize + */ + public BoundedByteArrayOutputStream(int bufferSize) { + super(bufferSize); + } + + public int count() { + return count; + } + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Cell.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Cell.java new file mode 100755 index 000000000000..ed620c3d9afb --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Cell.java @@ -0,0 +1,516 @@ +package com.ibm.websphere.simplicity; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import com.ibm.websphere.simplicity.application.Application; +import com.ibm.websphere.simplicity.application.ApplicationManager; +import com.ibm.websphere.simplicity.config.SecurityConfiguration; +import com.ibm.websphere.simplicity.config.securitydomain.SecurityDomain; +import com.ibm.websphere.simplicity.exception.NotImplementedException; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.websphere.simplicity.provider.OperationsProviderFactory; +import com.ibm.websphere.simplicity.provider.websphere.ConfigurationOperationsProvider; +import componenttest.topology.impl.LibertyServer; + +/** + * This class represents a WebSphere cell. The Cell instance of {@link Scope}, being the highest, + * can see and affect all other scopes in the topology. A Cell is logical structural entity used to + * group other entities such as {@link Node}s, {@link Cluster}s, and {@link NodeGroup}s. + */ +public class Cell extends Scope { + + private static Class c = Cell.class; + + private Set nodes; + private SecurityConfiguration securityConfiguration; + private ApplicationManager applicationManager = null; + protected Workspace workspace; + + /** + * Constructor + * + * @param configId The {@link ConfigIdentifier} that uniquely identifies this Cell + * @param connInfo The {@link ConnectionInfo} that holds data on how to connect to the Cell + */ + public Cell(ConnectionInfo connInfo) { + super(connInfo, null); + this.cell = this; + } + + @Override + public String getObjectNameFragment() { + return "WebSphere:cell=" + this.getName(); + } + + /** + * Get the {@link ApplicationManager} for the cell. The ApplicationManager can be used to obtain {@link Application} instances. + * + * @return The {@link ApplicationManager} for the cell. + * @throws Exception + */ + public ApplicationManager getApplicationManager() throws Exception { + if (applicationManager == null) + applicationManager = new ApplicationManager(this); + return applicationManager; + } + + public void initApplicationManager(LibertyServer ls) throws Exception { + applicationManager = new ApplicationManager(ls); + } + + public WebSphereTopologyType getTopologyType() { + return WebSphereTopologyType.BASE; + } + + /** + * Get the {@link Server}s that exist in this cell across all {@link Node}s in the cell. + * + * @return A Set of {@link Server}s in the cell + * @throws Exception + */ + public Set getServers() throws Exception { + final String method = "getServers"; + Log.entering(c, method); + Set ret = new HashSet(); + for (Node n : this.getNodes()) { + ret.addAll(n.getServers()); + } + Log.exiting(c, method, ret); + return ret; + } + + public Set getClusters() throws Exception { + return new HashSet(); + } + + public ApplicationServer getManager() throws Exception { + return (ApplicationServer) getServers().iterator().next(); + } + + /** + * Get a specific {@link Server} + * + * @param name The name of the server to get + * @return The {@link Server} with the specified name or null if no Server with the name exists + * @throws Exception + */ + public Server getServerByName(String name) throws Exception { + final String method = "getServerByName"; + Log.entering(c, method, name); + Set servers = getServers(); + for (Server server : servers) { + if (server.getName().equals(name)) { + Log.exiting(c, method, server); + return server; + } + } + Log.exiting(c, method, null); + return null; + } + + /** + * Retrieves all servers in the cell that match a certain server type. + * + * @param name The name of the server to get + * @return The {@link Server} with the specified name or null if no Server with the name exists + * @throws Exception + */ + public List getServersByType(ServerType type) throws Exception { + final String method = "getServerByType"; + Log.entering(c, method, type); + List ret = new ArrayList(); + Set nodes = getNodes(); + for (Node node : nodes) { + ret.addAll(node.getServersByType(type)); + } + Log.exiting(c, method, ret); + return ret; + } + + /** + * Get the {@link Node}s that exist in this cell + * + * @return A Set of {@link Node}s in the cell + * @throws Exception + */ + public Set getNodes() throws Exception { + final String method = "getNodes"; + Log.entering(c, method); + if (this.nodes == null) { + Log.finer(c, method, "Initializing nodes."); + loadNodes(); + } + Log.exiting(c, method, this.nodes); + return this.nodes; + } + + /** + * Get a specific {@link Node} in this cell that has the specified name + * + * @param name The name of the node to get + * @return The existing {@link Node} in this cell that has the specified name or null if there + * is no {@link Node} with the name + * @throws Exception + */ + public Node getNodeByName(String name) throws Exception { + final String method = "getNodeByName"; + Log.entering(c, method, name); + for (Node n : this.getNodes()) { + Log.finest(c, method, "Current node name: " + n.getName()); + if (n.getName().equalsIgnoreCase(name)) { + Log.finer(c, method, "Found a node with matching name."); + Log.exiting(c, method, n); + return n; + } + } + Log.finer(c, method, "No node found with matching name."); + Log.exiting(c, method, null); + return null; + } + + /** + * Get the {@link SecurityConfiguration} for this cell. The {@link SecurityConfiguration} can be used to configure security settings + * for the cell + * + * @return A {@link SecurityConfiguration} instance + */ + public SecurityConfiguration getSecurityConfiguration() throws Exception { + if (this.securityConfiguration == null) + this.securityConfiguration = new SecurityConfiguration(this); + return this.securityConfiguration; + } + + /** + * Start all the servers in the cell. The Cell manager is started first. For each node, the node + * manager is started followed by the remaining servers on the node. + * + * @throws Exception + */ + public void start() throws Exception { + final String method = "start"; + Log.entering(c, method); + + for (Node node : this.getNodes()) { + for (Server server : node.getServers()) + server.start(); + } + Log.exiting(c, method); + } + + /** + * Start all the servers in the cell. The Cell manager is started first. For + * each node, the node manager is started followed by the remaining servers + * on the node. + * + * @param mbeanWaitDuration The maximum time to wait (in seconds) for the + * server to activate mbeans (slower servers take longer). This + * is a per server value + * @throws Exception + */ + public void start(int mbeanWaitDuration) throws Exception { + final String method = "start"; + Log.entering(c, method, mbeanWaitDuration); + + Log.finer(c, method, "Starting Cell " + this.getName() + "."); + Exception e1 = null; + + // first start the cell manager + Log.finer(c, method, "Staring the cell manager."); + ApplicationServer cellManager = this.getManager(); + try { + cellManager.start(mbeanWaitDuration); + } catch (Exception e) { + e1 = e; + } + + ApplicationServer nodeManager = null; + for (Node node : this.getNodes()) { + nodeManager = node.getManager(); + // first start the node manager + if (nodeManager != cellManager) { + Log.finer(c, method, "Starting the manager for node " + node.getName()); + try { + nodeManager.start(mbeanWaitDuration); + } catch (Exception e) { + if (e1 == null) + e1 = e; + } + } + Log.finer(c, method, "Starting any remaining servers on the node."); + for (Server server : node.getServers()) { + if (server != nodeManager && server != cellManager) { + try { + server.start(mbeanWaitDuration); + } catch (Exception e) { + if (e1 == null) + e1 = e; + } + } + } + } + + if (e1 != null) + throw e1; + + Log.finer(c, method, "Cell " + this.getName() + " started."); + + Log.exiting(c, method); + } + + /** + * Stop all the servers in the cell. + * + * @throws Exception + */ + public void stop() throws Exception { + final String method = "stop"; + Log.entering(c, method); + + for (Node node : this.getNodes()) { + Log.finer(c, method, "Stopping all the non-manager servers for node " + node.getName()); + for (Server server : node.getServers()) { + server.stop(); + } + } + // lastly the cell manager + Log.exiting(c, method); + } + + /** + * Stop all the servers in the cell. + * + * @param timeout The time to wait (in seconds). This is a per server value. + * @throws Exception + */ + public void stop(long timeout) throws Exception { + final String method = "stop"; + Log.entering(c, method, timeout); + + Log.finer(c, method, "Stopping Cell " + this.getName()); + Exception e1 = null; + + // this is going to make us lose our admin connection. We need to stop + // non-managers first, followed by node managers, followed by the cell + // manager + ApplicationServer cellManager = this.getManager(); + ApplicationServer nodeManager = null; + + for (Node node : this.getNodes()) { + nodeManager = node.getManager(); + // first non-manager servers + Log.finer(c, method, "Stopping all the non-manager servers for node " + node.getName()); + for (Server server : node.getServers()) { + if (server != nodeManager && server != cellManager) { + try { + server.stop(timeout); + } catch (Exception e) { + if (e1 == null) + e1 = e; + } + } + } + // now the node manager + if (nodeManager != cellManager) { + Log.finer(c, method, "Stopping the manager for node " + node.getName()); + try { + nodeManager.stop(timeout); + } catch (Exception e) { + if (e1 == null) + e1 = e; + } + } + } + // lastly the cell manager + Log.finer(c, method, "Stopping the cell manager."); + try { + cellManager.stop(timeout); + } catch (Exception e) { + if (e1 == null) + e1 = e; + } + + if (e1 != null) + throw e1; + + Log.finer(c, method, "Cell " + this.getName() + " stopped."); + + Log.exiting(c, method); + } + + /** + * Returns true if there is currently a live connection to administer the Cell + * + * @return true If there is currently a live connection to administer the Cell + * @throws Exception + */ + public boolean isConnected() throws Exception { + final String method = "isConnected"; + Log.entering(c, method); + throw new NotImplementedException(); + // Log.exiting(c, method, connected); + // return connected; + } + + /** + * + */ + public void popAllConnections() { + // do nothing + + } + + /** + * @param none + * @param user + * @param password + */ + public void pushConnection(ConnectorType none, String user, String password) { + // do nothing + } + + public void pushConnection(ConnectionInfo info) { + // do nothing + } + + public void pushConnection(ConnectorType connType, + Integer port, + String username, + String password) throws Exception { +// do nothing + } + + @Override + public Workspace getWorkspace() throws Exception { + return new Workspace(this); + } + + /** + * This method clears all cached data for this Cell. Further requests for + * information will be loaded fresh from the WAS instance. + *

+ * WARNING!!! Calling this method invalidates all pointers to any Simplicity + * objects obtained from the Cell and its children. Only call this method if + * you absolutely want to reset the topology object model underneath this Cell. + * + * @throws Exception + */ + public void resetCell() throws Exception { + final String method = "resetCell"; + Log.entering(c, method); + + Log.finer(c, method, "Resetting all the \"child\" private data of this Cell."); + this.nodes = null; + + Log.exiting(c, method); + } + + @Override + public SecurityDomain getSecurityDomain() throws Exception { + return super.getSecurityDomain(); + } + + /** + * Translates a predefined variable into its corresponding string value. + * + * @param variable The variable to translate. + * @return The value of the variable, or null if it does not exist. + * @throws Exception + */ + public String expandVariable(VariableType variable) throws Exception { + return expandVariable(variable.getValue()); + } + + /** + * Translates a custom variable into its corresponding string value. + * + * @param variable The variable name to translate. + * @return The value of the variable, or null if it does not exist. + * @throws Exception + */ + public String expandVariable(String variable) throws Exception { + // Remove the standard prefix & postfix, if any + variable = variable.replace("${", "").replace("$(", "").replace("}", "").replace(")", ""); + throw new NotImplementedException(); + } + + /** + * Recursively expands all variables in the string to the corresponding value + * from the server, and replaces backslashes with forward slashes. The + * resulting string does not contain any variables. + *

+ * Note that the cell does not contain many variables, so most expansions + * will result in empty values. + * + * @param str A string that contains zero or more variables. + * @return The fully-expanded version of the string. + * @throws Exception + */ + public String expandString(String str) throws Exception { + return Scope.expandString(this, str); + } + + /** + * Add a {@link Node} to this cells private Set + * + * @param node The {@link Node} to add + * @throws Exception + */ + protected void addNode(Node node) throws Exception { + if (this.getNodeByName(node.getName()) != null) + return; + + this.nodes.add(node); + } + + /** + * Delegate to the {@link ConfigurationOperationsProvider} to obtain a list of {@link ConfigIdentifier}s + * for the {@link Node}s in the cell + * + * @throws Exception + */ + private void loadNodes() throws Exception { + final String method = "loadNodes"; + Log.entering(c, method); + if (this.nodes == null) + this.nodes = new HashSet(); + Log.exiting(c, method); + } + + public void commit(HashMap values) throws Exception {} + + public void rollback(HashMap values) throws Exception {} + + /** + * Shut down the administrative connection to manage the Cell.
+ * Note that if the administrative connection is closed and a method call is + * made in which a connection is needed, the providers will implicitly open + * a connection using the current connection information. + * + * @throws Exception + */ + public void disconnect() throws Exception { + final String method = "disconnect"; + Log.entering(c, method); + if (isConnected()) { + Log.finer(c, method, "Disconnecting the cell."); + OperationsProviderFactory.getProvider().getCellOperationsProvider() + .disconnect(this, getConnInfo()); + } + Log.exiting(c, method); + } + + public void connect() { + // do nothing + + } + + public void deleteCluster(String name) { + // do nothing + + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Client.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Client.java new file mode 100755 index 000000000000..4cdd61af8cf5 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Client.java @@ -0,0 +1,75 @@ +package com.ibm.websphere.simplicity; + +import com.ibm.websphere.simplicity.exception.NotImplementedException; +import componenttest.topology.impl.LibertyClient; + +/** + * This abstract class is the parent for all Clients in the Topology. This includes application + * Clients, web Clients, and generic Clients. + */ +public abstract class Client extends Scope { + + private static final Class c = Client.class; + + protected LibertyClient instance; + protected Node node = null; + + /** + * Constructor to create a new Client + * + * @param cell The {@link Cell} that this Client belongs to + * @param node The {@link Node} that the Client belongs to + * @param Client The underlying Client instance + */ + protected Client(Cell cell, Node node, componenttest.topology.impl.LibertyClient client) throws Exception { + super(node, cell); + this.node = node; + this.instance = client; + } + + @Override + public String getObjectNameFragment() { + return this.node.getObjectNameFragment() + ",process=" + this.getName(); + } + + public componenttest.topology.impl.LibertyClient getBackend() { + return this.instance; + } + + /** + * Translates a predefined variable into its corresponding string value. + * + * @param variable The variable to translate. + * @return The value of the variable, or null if it does not exist. + * @throws Exception + */ + public String expandVariable(VariableType variable) throws Exception { + return expandVariable(variable.getValue()); + } + + /** + * Translates a custom variable into its corresponding string value. + * + * @param variable The variable name to translate. + * @return The value of the variable, or null if it does not exist. + * @throws Exception + */ + public String expandVariable(String variable) throws Exception { + // Remove the standard prefix & postfix, if any + variable = variable.replace("${", "").replace("$(", "").replace("}", "").replace(")", ""); + throw new NotImplementedException(); + } + + /** + * Recursively expands all variables in the string to the corresponding value + * from the Client, and replaces backslashes with forward slashes. The + * resulting string does not contain any variables. + * + * @param str A string that contains zero or more variables. + * @return The fully-expanded version of the string. + * @throws Exception + */ + public String expandString(String str) throws Exception { + return Scope.expandString(this, str); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Machine.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Machine.java new file mode 100755 index 000000000000..1e0ca1393d66 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Machine.java @@ -0,0 +1,724 @@ +package com.ibm.websphere.simplicity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.ExecutionException; + +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.websphere.simplicity.provider.commandline.CommandLineProvider; +import com.ibm.websphere.simplicity.provider.commandline.RemoteCommandFactory; +import com.ibm.websphere.simplicity.provider.commandline.local.LocalCommandLineProvider; +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.LocalMachine; +import componenttest.common.apiservices.cmdline.RXAProvider; + +/** + * This class represents a physical machine. This might be a standalone machine or one that has + * WebSphere installed. If the Machine is not the local machine, a remote connection may need to be + * established to be able to perform Machine operations. If an operation is requested and a + * connection is not established, the connection will be implicitly created and the operation + * complete. Also, the connection can be managed manually using the {@link #connect()} and {@link #disconnect()} methods of this class. + */ +public class Machine { + + @SuppressWarnings("rawtypes") + private static Class c = Machine.class; + private static Map machineCache = new HashMap(); + + private final ConnectionInfo connInfo; + protected OperatingSystem os; + private String bootstrapFileKey; + private String osVersion; + private String rawOSName; + private String tempDir; + private static int[] existingWindowsProcesses; + protected String workDir; + protected boolean isLocal = false; + + /** + * {@link ConnectionInfo} constructor + * + * @param connInfo The {@link ConnectionInfo} contains the information needed to make a + * connection to the machine. This includes the hostname, administrative username and + * password. + * + * @throws Exception + */ + protected Machine(ConnectionInfo connInfo) throws Exception { + this.connInfo = connInfo; + } + + /** + * Factory method to get a Machine using a {@link ConnectionInfo} Object. This method + * should be used by so that there is only one instance of a Machine per physical machine + * existing at any one time. + * + * @param connInfo The {@link ConnectionInfo} contains the information needed to make a + * connection to the machine. This includes the hostname, administrative username and + * password. + * @return A Machine Object corresponding to the {@link ConnectionInfo} + * @throws Exception + */ + public static Machine getMachine(String hostname) throws Exception { + Log.entering(c, "getMachine", hostname); + ConnectionInfo connInfo = Bootstrap.getInstance().getMachineConnectionData(hostname); + Machine ret = getMachine(connInfo); + Log.exiting(c, "getMachine", ret); + return ret; + } + + /** + * Factory method to get a Machine using a {@link ConnectionInfo} Object. This method + * should be used by so that there is only one instance of a Machine per physical machine + * existing at any one time. + * + * @param connInfo The {@link ConnectionInfo} contains the information needed to make a + * connection to the machine. This includes the hostname, administrative username and + * password. + * @return A Machine Object corresponding to the {@link ConnectionInfo} + * @throws Exception + */ + public static Machine getMachine(ConnectionInfo connInfo) throws Exception { + Log.entering(c, "getMachine", connInfo); + Machine machine = machineCache.get(connInfo); + if (machine == null) { + if (connInfo.getHost().contains("localhost")) + machine = getLocalMachine(); + else + machine = new Machine(connInfo); + machineCache.put(connInfo, machine); + } + Log.exiting(c, "getMachine", machine); + return machine; + } + + /** + * Get a Machine instance that represents the local physical machine. This method uses + * java.net.InetAddress to obtain the local hostname and reads security information from the + * bootstrapping properties file. If security information cannot be found in the bootstrapping + * properties file based on the hostname returned by java.net.InetAddress, a second attempt will + * be made using "localhost" as the hostname. If the second attempt fails, a Machine instance + * will be returned using the hostname localhost with no security information. Note that without + * security credentials, remote command line operations may not be possible. + * + * @return A Machine representation for the local physical machine. + * @throws Exception + */ + public static Machine getLocalMachine() throws Exception { + final String method = "getLocalMachine"; + Log.entering(c, method); + Machine ret = LocalMachine.getInstance(); + Log.exiting(c, method, ret); + return ret; + } + + /** + * Get a Machine instance that represents the local physical machine. + * + * @param connInfo The {@link ConnectionInfo} Object which contains connection information for the local machine + * @return A Machine representation for the local physical machine. + * @throws Exception + */ + public static Machine getLocalMachine(ConnectionInfo connInfo) throws Exception { + return getMachine(connInfo); + } + + /** + * Get the {@link ConnectionInfo} Object that contains the information used to make a connection + * to this Machine. + * + * @return The {@link ConnectionInfo} for this Machine + */ + public ConnectionInfo getConnInfo() { + return this.connInfo; + } + + /** + * Get the bootstrapping file key used to cache this Machine. If the caching is not enabled, + * this returns null + * + * @return The key used to cache the machine in the bootstrapping file + */ + public String getBootstrapFileKey() { + return bootstrapFileKey; + } + + /** + * Set the boostrapping file key + * + * @param bootstrapFileKey The boostrapping file key + */ + protected void setBootstrapFileKey(String bootstrapFileKey) { + this.bootstrapFileKey = bootstrapFileKey; + } + + /** + * Get the hostname or ip address of the Machine. The hostname can be used to communicate with + * the Machine. + * + * @return The hostname of the Machine + */ + public String getHostname() { + return this.getConnInfo().getHost(); + } + + /** + * @return True if the current instance references the local machine. + */ + public boolean isLocal() { + return this.isLocal; + } + + /** + * Get the administrative username of the Machine. The username is used to establish a remote + * connection to the machine. + * + * @return The administrative username of the Machine + */ + public String getUsername() { + return this.getConnInfo().getUser(); + } + + /** + * Get the administrative password of the Machine. The password is used to establish a remote + * connection to the machine. + * + * @return The administrative password of the Machine + */ + public String getPassword() { + return this.getConnInfo().getPassword(); + } + + /** + * Constructs a RemoteFile object that represents the path to the remote file indicated by the + * input path. Note that the actual file is not guaranteed to exist. The input path may + * represent either a file or a directory. + * + * @param path The absolute path to a file on the remote device. + * @return A RemoteFile representing the input abstract path name + */ + public RemoteFile getFile(String path) { + return new RemoteFile(this, path); + } + + /** + * Constructs a RemoteFile object that represents the path to the remote file indicated by the + * input path. Note that the actual file is not guaranteed to exist. The input path may + * represent either a file or a directory. + * + * @param parent The parent directory of the target file + * @param name The name of the file + * @return A RemoteFile representing the input abstract path name + */ + public RemoteFile getFile(RemoteFile parent, String name) { + return new RemoteFile(this, parent, name); + } + + /** + * Get the {@link OperatingSystem} that this Machine is running + * + * @return A representation of the operating system of the remote machine + */ + public OperatingSystem getOperatingSystem() throws Exception { + if (this.os == null) { + this.os = OperatingSystem.getOperatingSystem(RXAProvider.getOSName(this)); + } + return this.os; + } + + protected void setOperatingSystem(OperatingSystem os) { + this.os = os; + } + + /** + * Get the version of the OperatingSystem that this Machine is running + * + * @return A String value of the operating system returned by the operating system itself + * @throws Exception + */ + public String getOSVersion() throws Exception { + final String method = "getOSVersion"; + Log.entering(c, method); + if (this.osVersion == null) { + String cmd = null; + String[] params = null; + if (getOperatingSystem() == OperatingSystem.WINDOWS) { + cmd = "cmd.exe"; + params = new String[] { "/C", "ver" }; + } else { + cmd = "/bin/sh"; + params = new String[] { "-c", "\"cat", "/proc/version\"" }; + } + Log.finer(c, method, "Command to get OS version: " + cmd); + this.osVersion = RXAProvider.executeCommand(this, cmd, params, null, null).getStdout().trim(); + } + Log.exiting(c, method, this.osVersion); + return this.osVersion; + } + + /** + * Set the OS version for this Machine + * + * @param version The OS version to set + */ + protected void setOSVersion(String version) { + this.osVersion = version; + } + + /** + * Get a String representation of the raw name of operating system that this Machine is running + * (as opposed to the {@link OperatingSystem} enum). + * + * @return A String representation of the raw name of the operating system + * @throws Exception + */ + public String getRawOSName() throws Exception { + if (this.rawOSName == null) { + this.rawOSName = RXAProvider.getOSName(this); + } + return this.rawOSName; + } + + /** + * Set the raw OS name for this Machine + * + * @param name The raw OS name to set + */ + protected void setRawOSName(String name) { + this.rawOSName = name; + } + + /** + * Execute the specified command line command. + * If you have parameters you should use the version of execute where you + * give the parameters in an Array. + * + * @param cmd The command to execute. + * @return The result of the command + * @throws ExecutionException + */ + public ProgramOutput execute(String cmd) throws Exception { + return this.execute(cmd, null, workDir, null); + } + + /** + * Execute the specified command line command. + * If you have parameters you should use the version of execute where you + * give the parameters in an Array. + * + * @param cmd The command to execute. + * @param timeout Execute the command with timeout + * @param workDir The directory to execute the command from + * @return The result of the command + * @throws ExecutionException + */ + public ProgramOutput execute(String cmd, int timeout) throws Exception { + return this.execute(cmd, null, workDir, null, timeout); + } + + /** + * Execute the specified command line command. + * If you have parameters you should use the version of execute where you + * give the parameters in an Array. + * + * @param cmd The command to execute. + * @param workDir The directory to execute the command from + * @return The result of the command + * @throws ExecutionException + */ + public ProgramOutput execute(String cmd, String workDir) throws Exception { + return this.execute(cmd, null, workDir, null); + } + + /** + * Execute the specified command line command. + * If you have parameters you should use the version of execute where you + * give the parameters in an Array. + * + * @param cmd The command to execute. + * @param workDir The directory to execute the command from + * @param envVars Environment variables to modify the default environment + * @return The result of the command + * @throws ExecutionException + */ + public ProgramOutput execute(String cmd, String workDir, Properties envVars) throws Exception { + return this.execute(cmd, null, workDir, envVars); + } + + /** + * Execute the specified command line command. + * + * @param cmd The command to execute. + * @param parameters The parameters to pass to the command. Spaces are allowed within arguments + * and path names. DO NOT use quotation marks around paths, they will be inserted + * automatically when needed. + * @return The result of the command + * @throws ExecutionException + */ + public ProgramOutput execute(String cmd, String[] parameters) throws Exception { + return this.execute(cmd, parameters, workDir, null); + } + + /** + * Execute the specified command line command. + * + * @param cmd The command to execute. + * @param parameters The parameters to pass to the command. Spaces are allowed within arguments + * and path names. DO NOT use quotation marks around paths, they will be inserted + * automatically when needed. + * @param envVars Environment variables to modify the default environment + * @return The result of the command + * @throws ExecutionException + */ + public ProgramOutput execute(String cmd, String[] parameters, Properties envVars) throws Exception { + return this.execute(cmd, parameters, workDir, envVars); + } + + /** + * Execute the specified command line command. + * + * @param cmd The command to execute. + * @param parameters The parameters to pass to the command. Spaces are allowed within arguments + * and path names. DO NOT use quotation marks around paths, they will be inserted + * automatically when needed. + * @param workDir The directory to execute the command from + * @return The result of the command + * @throws ExecutionException + */ + public ProgramOutput execute(String cmd, String[] parameters, String workDir) throws Exception { + return this.execute(cmd, parameters, workDir, null); + } + + /** + * Execute the specified command line command + * + * @param cmd The command to execute + * @param parameters The parameters to pass to the command. Spaces are allowed within arguments + * and path names. DO NOT use quotation marks around paths, they will be inserted + * automatically when needed. + * @param workDir The directory to execute the command from + * @param envVars A Properties Object which contain name/value pairs for environment variables + * needed to execute the command + * @return The result of the command + * @throws Exception + */ + public ProgramOutput execute(String cmd, String[] parameters, String workDir, Properties envVars) throws Exception { + return this.execute(cmd, parameters, workDir, envVars, 0); + } + + /** + * Execute the specified command line command + * + * @param cmd The command to execute + * @param parameters The parameters to pass to the command. Spaces are allowed within arguments + * and path names. DO NOT use quotation marks around paths, they will be inserted + * automatically when needed. + * @param workDir The directory to execute the command from + * @param envVars A Properties Object which contain name/value pairs for environment variables + * needed to execute the command + * @param timeout Execute the command with timeout + * @return The result of the command + * @throws Exception + */ + public ProgramOutput execute(String cmd, String[] parameters, String workDir, Properties envVars, int timeout) throws Exception { + // On iSeries, we should be adding the qsh -c flag to the start of any command. + // This means commands are executed in a native-like shell, rather than a + // PASE environment. + if (OperatingSystem.ISERIES.compareTo(getOperatingSystem()) == 0) { + cmd = "qsh -c " + cmd; + } + return RXAProvider.executeCommand(this, cmd, parameters, workDir, envVars, timeout); + } + + /** + * Asynchronously execute the specified command line command. + * If you have parameters you should use the version of execute where you + * give the parameters in an Array. + * + * @param cmd The command to execute. + * @return The result of the command + * @throws ExecutionException + */ + public void executeAsync(String cmd) throws Exception { + this.executeAsync(cmd, new String[0]); + } + + /** + * Asynchronously execute the specified command line command. + * + * + * @param cmd The command to execute. + * @param parameters The parameters to pass to the command. Spaces are allowed within arguments + * and path names. DO NOT use quotation marks around paths, they will be inserted + * automatically when needed. + * @return The result of the command + * @throws ExecutionException + */ + public ProgramOutput executeAsync(String cmd, String[] parameters) throws Exception { + return RXAProvider.executeAsync(this, cmd, parameters, workDir, null); + } + + /** + * Execute a command line command asynchronously. This method creates a {@link RemoteCommand} Object and starts the command execution in a separate thread. The + * {@link RemoteCommand} is + * returned for querying. + * + * @param cmd The command to execute + * @param parameters The parameters to pass to the command. Spaces are allowed within arguments + * and path names. DO NOT use quotation marks around paths, they will be inserted + * automatically when needed. + * @param workDir The directory to execute the command from + * @param envVars A Properties Object which contain name/value pairs for environment variables + * needed to execute the command + * @return The {@link RemoteCommand} Object + * @throws Exception + */ + public RemoteCommand executeAsync(String cmd, String[] parameters, String workDir, Properties envVars) throws Exception { + RemoteCommand remoteCommand = RemoteCommandFactory.getInstance(cmd, parameters, workDir, envVars, this); + remoteCommand.setDaemon(true); + remoteCommand.start(); + return remoteCommand; + } + + /** + * Get the temporary directory for the Machine defined by the Machines operating system. + * + * @return A {@link RemoteFile} representation of the temporary directory + * @throws Exception + */ + public RemoteFile getTempDir() throws Exception { + if (this.tempDir == null) { + this.tempDir = RXAProvider.getTempDir(this.getConnInfo()); + } + return new RemoteFile(this, this.tempDir); + } + + protected void setTempDir(String dir) { + this.tempDir = dir; + } + + /** + * Establish a remote connection if needed by the {@link CommandLineProvider} implementation. + * + * @throws Exception + */ + public void connect() throws Exception { + RXAProvider.connect(this.getConnInfo()); + } + + /** + * Close a remote connection to this Machine if there is one established + * + * @throws Exception + */ + public void disconnect() throws Exception { + RXAProvider.disconnect(this.getConnInfo()); + } + + /** + * Return true if a remote connection is currently established to the machine. The return value + * is specific to the {@link CommandLineProvider} implementation. For example, the {@link LocalCommandLineProvider} will always return true since no connection is needed to + * interact with the local machine. + * + * @return true if a connection to the machine is currently established + * @throws Exception + */ + public boolean isConnected() throws Exception { + return RXAProvider.isConnected(this.getConnInfo()); + } + + /** + * Kill the process specified by the process id. The process is not killed "gracefully." + * It is immediately stopped. + * + * @param processId The id of the process to kill + */ + public void killProcess(int processId) throws Exception { + killProcessRemote(processId, 0); + } + + private void killProcessRemote(int processID, int attemptNumber) throws Exception { + ProgramOutput po = RXAProvider.killProcess(this, processID); + Thread.sleep(1000); + if (processStillRunning(processID)) { + if (attemptNumber >= 3) {//so has tried 3 times + String ErrorMessage = "The processID " + processID + " could not be killed. The command ran was " + po.getCommand() + " The Std Output is: \'" + + po.getStdout() + "\' and the Std Error was \'" + po.getStderr() + "\'"; + throw new Exception(ErrorMessage); + } else { + Log.warning(c, "Unable to kill process " + processID + " - Retrying, this is attempt number " + attemptNumber); + killProcessRemote(processID, ++attemptNumber); + } + } + } + + /** + * Get a java.util.Date representation of the current time on the Machine + * + * @return A Date repesentation of the current time on the Machine + * @throws Exception + */ + public Date getDate() throws Exception { + return RXAProvider.getDate(this); + } + + /** + * Two Machines are equal if the hostname and credentials they are initialized with are the + * same. + */ + @Override + public boolean equals(Object o) { + final String method = "equals"; + Log.entering(c, method, o); + if (o == null) { + Log.finer(c, method, "Input was null"); + Log.exiting(c, method, false); + return false; + } + if (o == this) { + Log.finer(c, method, "Same instance as this"); + return true; + } + if (!(o instanceof Machine)) { + Log.finer(c, method, "Input was not a Machine"); + return false; + } + + Machine other = (Machine) o; + boolean equals = this.getHostname().equalsIgnoreCase(other.getHostname()) && + this.getConnInfo().equals(other.getConnInfo()); + + Log.exiting(c, method, equals); + return equals; + } + + public int[] getJavaProcesses(String installPath, String serverName) throws Exception { + String command; + String[] parameters; + if (os == OperatingSystem.WINDOWS) { + command = "tasklist"; + parameters = new String[] { "/NH", "/FI", "\"IMAGENAME eq java.exe\"" }; + if (serverName != null) + Log.warning(c, "Cannot distinguish server only processes running on Windows"); + } else { + command = "ps"; + + if (serverName == null) { + parameters = new String[] { "-ef", "|", "grep", installPath }; + } else { + parameters = new String[] { "-ef", "|", "grep", installPath, "|", "grep", serverName }; + } + + } + ProgramOutput result = this.execute(command, parameters); + + String ps = result.getStdout(); + String[] split = ps.split("\n"); + ArrayList splitted = new ArrayList(); + for (String s : split) + splitted.add(s); + if (os == OperatingSystem.WINDOWS) + splitted.remove(0); //to get rid of the first blank line + + // Assume one of our entries is our command + // Split always returns at least one entry so the subtraction is safe + List processes = new ArrayList(); + for (String s : splitted) { + // Don't count our break statement + + if (!s.contains("grep")) { + String[] columns = s.trim().split("\\s+"); + if (columns.length >= 2) { + // The pid will be the second column + int pid = Integer.parseInt(columns[1]); + if (!!!isExcludedProcess(pid)) + processes.add(pid); + } + } + } + + // Convert the list to an array + int[] pss = new int[processes.size()]; + int i = 0; + for (int p : processes) { + pss[i] = p; + i++; + } + return pss; + } + + private boolean isExcludedProcess(int pid) { + if (existingWindowsProcesses != null) { + for (int i : existingWindowsProcesses) { + if (i == pid) + return true; + } + return false; + } else { + //If the existingWindowsProcesses is null it means it is setting up + //the list so we don't want any exceptions... + return false; + } + + } + + /** + * Returns whether the given processID is running on the system or not + * + * @param processID The process ID to check for + * @return true - it is running + * false - it is not running + * @throws Exception + */ + public boolean processStillRunning(int processID) throws Exception { + String command; + String[] parameters; + if (os == OperatingSystem.WINDOWS) { + command = "tasklist"; + parameters = new String[] { "/NH", "/FI", "\"PID eq " + processID + "\"" }; + ProgramOutput result = this.execute(command, parameters); + String ps = result.getStdout(); + String[] split = ps.split("\n"); + ArrayList splitted = new ArrayList(); + for (String s : split) + splitted.add(s); + splitted.remove(0); //to get rid of the first blank line + INFO (if no process) + if (splitted.isEmpty()) + return false; + else + return true; //as we have done the filtering above if there is a result left after removing blank line the PID is still there + } else { + command = "ps"; + parameters = new String[] { "-e" }; + ProgramOutput result = this.execute(command, parameters); + String ps = result.getStdout(); + String[] split = ps.split("\n"); + for (int i = 1; i < split.length; i++) //We do start at 1 as the first line (0) is headers + { + String s = split[i]; + s = s.trim(); + String[] columns = s.split("\\s+"); + if (columns.length >= 2) { + // The pid will be the first column + int pid = Integer.parseInt(columns[0]); + if (pid == processID) + return true; + } + } + //if we dont find the process its not running so return false + return false; + } + } + + public String getWorkDir() { + return workDir; + } + + public void setWorkDir(String workDir) { + this.workDir = workDir; + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Node.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Node.java new file mode 100755 index 000000000000..f8e8760926de --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Node.java @@ -0,0 +1,353 @@ +package com.ibm.websphere.simplicity; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.ibm.websphere.simplicity.exception.NotImplementedException; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.websphere.simplicity.product.InstallationType; +import com.ibm.websphere.simplicity.product.InstalledWASProduct; +import com.ibm.websphere.simplicity.product.WASInstallation; +import com.ibm.websphere.simplicity.server.AppServerCreationOptions; +import com.ibm.websphere.simplicity.util.CollectionUtility; + +/** + * This class represents a WebSphere node. A Node is a logical grouping of application servers. A + * Node instance of {@link Scope} has visibility to the servers within it. + */ +public class Node extends Scope { + + private static Class c = Node.class; + protected static final String CHANGE_KEY_SERVERS = "servers"; + + private Set servers; + private Machine machine; + private String profilePath; + private String profileName; + private String hostname; + private WebSphereVersion baseProductVersion; + + /** + * Nodes can only be created by instances of {@link Cell} and {@link Topology}. + * + * @param configId The {@link ConfigIdentifier} for this node + * @param cell The instance of {@link Cell} representing the cell to which this node belongs. + */ + protected Node(Cell cell) throws Exception { + super(cell, cell); + } + + @Override + public String getObjectNameFragment() { + return this.cell.getObjectNameFragment() + ",node=" + this.name; + } + + /** + * Get the name of the {@link Cell} to which this Node belongs + * + * @return The name of the Node's {@link Cell} + */ + public String getCellName() { + return this.cell.getName(); + } + + /** + * Get the {@link Server}s that exist in this Node + * + * @return A Set of {@link Server}s in the this Node + * @throws Exception + */ + public Set getServers() throws Exception { + return new HashSet(this.servers); + } + + /** + * Get a sorted List of Servers in the Cell + * + * @param c The Comparator that defines how to sort the Servers + * @return A List containing the sorted Servers + * @throws Exception + */ + public List getServers(Comparator c) throws Exception { + return CollectionUtility.sort(getServers(), c); + } + + public ApplicationServer getManager() throws Exception { + return (ApplicationServer) servers.iterator().next(); + } + + /** + * Get a specific {@link Server} in this Node that has the specified name + * + * @param name The name of the {@link Server} to get + * @return The existing {@link Server} in this cell that has the specified name or null if no {@link Server} in the node exists with the name + * @throws Exception + */ + public Server getServerByName(String name) throws Exception { + final String method = "getServerByName"; + Log.entering(c, method, name); + for (Server server : getServers()) { + Log.finest(c, method, "Current server name: " + server.getName()); + if (server.getName().equalsIgnoreCase(name)) { + Log.finer(c, method, "Server with matching name found."); + Log.exiting(c, method, server); + return server; + } + } + Log.finer(c, method, "No server with matching name found."); + Log.exiting(c, method, null); + return null; + } + + /** + * Retrieves all servers in the cell that match a certain server type. + * + * @param name The name of the server to get + * @return The {@link Server} with the specified name or null if no Server with the name exists + * @throws Exception + */ + public List getServersByType(ServerType type) throws Exception { + final String method = "getServerByType"; + Log.entering(c, method, type); + List ret = new ArrayList(); + Set servers = getServers(); + for (Server server : servers) { + if (server.getServerType().equals(type)) { + ret.add(server); + } + } + Log.exiting(c, method, ret); + return ret; + } + + public OperationResults createApplicationServer(AppServerCreationOptions options) throws Exception { + return new OperationResults(false); + } + + public void deleteServer(String serverName) throws Exception { + + } + + public Set getInstalledWASProducts() throws Exception { + return new HashSet(); + } + + public WASInstallation getWASInstall() throws Exception { + return new WASInstallation(getMachine(), null, InstallationType.WAS_INSTALL); + } + + /** + * Get the profile directory of this Node. If the Node is not installed on the local machine + * this will NOT refer to a path on the local machine. The path exists on the machine that the + * Node is installed to. + * + * @return The profile directory of the node + * @throws Exception + */ + public String getProfileDir() throws Exception { + if (this.profilePath == null) { + this.profilePath = expandVariable(VariableType.USER_INSTALL_ROOT); + if (this.profilePath != null) // unmanaged nodes do not have a profile path + this.profilePath = this.profilePath.replace('\\', '/'); + } + return this.profilePath; + } + + public String getJavaDir() throws Exception { + String ret = getProfileDir(); + return ret.substring(0, ret.lastIndexOf("/")) + "/java/jre"; + } + + /** + * Translates a predefined variable into its corresponding string value. + * + * @param variable The variable to translate. + * @return The value of the variable, or null if it does not exist. + * @throws Exception + */ + public String expandVariable(VariableType variable) throws Exception { + return expandVariable(variable.getValue()); + } + + /** + * Translates a custom variable into its corresponding string value. + * + * @param variable The variable name to translate. + * @return The value of the variable, or null if it does not exist. + * @throws Exception + */ + public String expandVariable(String variable) throws Exception { + // Remove the standard prefix & postfix, if any + variable = variable.replace("${", "").replace("$(", "").replace("}", "").replace(")", ""); + throw new NotImplementedException(); + } + + /** + * Recursively expands all variables in the string to the corresponding value + * from the server, and replaces backslashes with forward slashes. The + * resulting string does not contain any variables. + * + * @param str A string that contains zero or more variables. + * @return The fully-expanded version of the string. + * @throws Exception + */ + public String expandString(String str) throws Exception { + return Scope.expandString(this, str); + } + + /** + * Set the profile directory for this Node + * + * @param path The profile directory path + */ + protected void setProfileDir(String path) { + this.profilePath = path; + } + + /** + * The hostname of the machine that the Node is installed on + * + * @return The hostname of the machine that the node is installed on + * @throws Exception + */ + public String getHostname() throws Exception { + return hostname; + } + + public void setHostname(String hostname) throws Exception { + this.hostname = hostname; + } + + /** + * Get a {@link Machine} Object that represents the machine that this Node is installed on + * + * @return The {@link Machine} of this Node + * @throws Exception + */ + public Machine getMachine() throws Exception { + final String method = "getMachine"; + Log.entering(c, method); + if (this.machine == null) { + ConnectionInfo connInfo = Topology.getBootstrapMgr().getMachineConnectionData(hostname); + Log.finer(c, method, "Constructing the machine."); + this.machine = Machine.getMachine(connInfo); + } + Log.exiting(c, method, this.machine); + return this.machine; + } + + protected void setMachine(Machine machine) { + this.machine = machine; + } + + public WebSphereVersion getBaseProductVersion() throws Exception { + final String method = "getBaseProductVersion"; + Log.entering(c, method); + if (this.baseProductVersion == null) { + // To avoid stack overflow, assign a default "8.0" version + this.baseProductVersion = new WebSphereVersion("8.0"); + // TODO Call Alpine to get the product version + // String versionString = (String)task.run(this).getResult(); + // Log.finer(c, method, "version: " + versionString); + // this.baseProductVersion = new WebSphereVersion(versionString.trim()); + } + Log.exiting(c, method, this.baseProductVersion); + return this.baseProductVersion; + } + + /** + * Get the name of the profile that this Node belongs to.
+ * IMPORTANT!!!!
+ * This method requires the use of a command line provider. If this method is being run against + * a node on a remote machine, the command line provider must have remote execution + * capabilities. ex: RXA provider + * + * @return The profile name for the node + * @throws Exception + */ + public String getProfileName() throws Exception { + final String method = "getProfileName"; + Log.entering(c, method); + if (this.profileName == null) { + Log.finer(c, method, "Obtaining profile name."); + Machine m = getMachine(); + String[] params = new String[3]; + params[0] = "-getName"; + params[1] = "-profilePath"; + params[2] = getProfileDir(); + if (params[1].indexOf(" ") != -1) { + params[1] = "\"" + params[1] + "\""; + } + String cmd = getProfileDir() + "/bin/manageprofiles" + m.getOperatingSystem().getDefaultScriptSuffix(); + Log.finer(c, method, "cmd: " + cmd); + Log.finer(c, method, "params: " + params); + this.profileName = m.execute(cmd, params).getStdout().trim(); + } + Log.exiting(c, method, this.profileName); + return this.profileName; + } + + /** + * Set the profile name of the node + * + * @param profileName The profile name to set + */ + protected void setProfileName(String profileName) { + this.profileName = profileName; + } + + /** + * Add a {@link Server} to this Node's private Set + * + * @param ep The {@link Server} to add + * @throws Exception + */ + protected void addServer(Server ep) throws Exception { + if (this.servers == null) { + this.servers = new HashSet(); + } + this.servers.add(ep); + } + + /** + * Remove a {@link Server} from this Node's private Set + * + * @param server The {@link Server} to remove + * @throws Exception + */ + protected void removeServer(Server server) throws Exception { + final String method = "removeServer"; + Log.entering(c, method, server); + Server s = this.getServerByName(server.getName()); + if (s == null) { + return; + } + this.servers.remove(s); + Log.finer(c, method, "Server is removed: " + !this.servers.contains(s)); + Log.exiting(c, method); + } + + public void commit(HashMap values) throws Exception {} + + @SuppressWarnings("unchecked") + public void rollback(HashMap values) throws Exception { + for (Map.Entry entry : values.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key.equals(CHANGE_KEY_SERVERS)) { + this.servers = (Set) value; + } + } + } + + public void sync() { + // do nothing + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/OperatingSystem.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/OperatingSystem.java new file mode 100755 index 000000000000..fca2b4c153ab --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/OperatingSystem.java @@ -0,0 +1,177 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * Represents the operating system of a local or remote device. + * + * Overrides the simplicity version and is needed to include MAC and other OS' + */ +public enum OperatingSystem { + + AIX, + HP, + LINUX, + ISERIES, + MAC, + SOLARIS, + WINDOWS, + ZOS; + + private static final Class c = OperatingSystem.class; + + private static final String FILE_ENCODING_DEFAULT = "ISO8859-1"; + private static final String FILE_ENCODING_Z = "cp1047"; + private static final String FILE_SUFFIX_DEFAULT = ".sh"; + private static final String FILE_SUFFIX_WINDOWS = ".bat"; + private static final String FILE_SUFFIX_I = ""; + private static final String FILE_SEPARATOR_DEFAULT = "/"; + private static final String FILE_SEPARATOR_WINDOWS = "\\"; + private static final String PATH_SEPARATOR_DEFAULT = ":"; + private static final String PATH_SEPARATOR_WINDOWS = ";"; + private static final String LINE_SEPARATOR_DEFAULT = "\n"; + private static final String LINE_SEPARATOR_WINDOWS = "\r\n"; + private static final String ENV_VAR_SET_DEFAULT = "export"; + private static final String ENV_VAR_SET_WINDOWS = "set"; + + /** + * Get the file separator used by this operating system + * + * @return A file separator + */ + public String getFileSeparator() { + return (this.equals(WINDOWS) ? FILE_SEPARATOR_WINDOWS : FILE_SEPARATOR_DEFAULT); + } + + /** + * Get the path separator used by this operating system + * + * @return A path separator + */ + public String getPathSeparator() { + return (this.equals(WINDOWS) ? PATH_SEPARATOR_WINDOWS : PATH_SEPARATOR_DEFAULT); + } + + /** + * Get the line separator used by this operating system + * + * @return A line separator + */ + public String getLineSeparator() { + return (this.equals(WINDOWS) ? LINE_SEPARATOR_WINDOWS : LINE_SEPARATOR_DEFAULT); + } + + /** + * The default file encoding used by this operating system. + * + * @return a file encoding + */ + public String getDefaultEncoding() { + return (this.equals(ZOS) ? FILE_ENCODING_Z : FILE_ENCODING_DEFAULT); + } + + /** + * @return The shell command to set an environment variable. + */ + public String getEnvVarSet() { + return (this.equals(WINDOWS) ? ENV_VAR_SET_WINDOWS : ENV_VAR_SET_DEFAULT); + } + + /** + * The default executable file extension used by this operating + * system + * + * @return ".bat" for Windows, "" for i-Series, ".sh" for everything else + */ + public String getDefaultScriptSuffix() { + switch (this) { + case WINDOWS: + return FILE_SUFFIX_WINDOWS; + case ISERIES: + return FILE_SUFFIX_I; + default: + return FILE_SUFFIX_DEFAULT; + } + } + + /** + * Convert an operating system name String to an {@link OperatingSystem} enum. + * Value values are those returned by {@link OSName#getOSName()} + * + * @param osName The name of the operating system + * @return The corresponding {@link OperatingSystem} + * @throws Exception + */ + public static OperatingSystem getOperatingSystem(String osName) throws Exception { + final String method = "getOperatingSystem"; + Log.entering(c, method, osName); + OperatingSystem os = null; + + //We search MAC first beacause mac uses a kernel called "Darwin" and if we were to put windows first + //while searching for "win" it would get confused and think a mac was a windows... + if (osName.toLowerCase().indexOf(OSName.OS_NAME_MAC.getOSName().toLowerCase()) != -1 + || osName.toLowerCase().indexOf(OSName.OS_NAME_MAC2.getOSName().toLowerCase()) != -1) { + os = OperatingSystem.MAC; + } else if (osName.toLowerCase().indexOf(OSName.OS_NAME_WINDOWS.getOSName().toLowerCase()) != -1) { + os = OperatingSystem.WINDOWS; + } else if ((osName.toLowerCase().indexOf(OSName.OS_NAME_ISERIES.getOSName().toLowerCase()) != -1)) { + os = OperatingSystem.ISERIES; + } else if ((osName.toLowerCase().indexOf(OSName.OS_NAME_ZOS.getOSName().toLowerCase()) != -1) + || (osName.toLowerCase().indexOf(OSName.OS_NAME_ZOS_2.getOSName().toLowerCase()) != -1) + || (osName.toLowerCase().indexOf(OSName.OS_NAME_ZOS_3.getOSName().toLowerCase()) != -1)) { + os = OperatingSystem.ZOS; + } else if (osName.toLowerCase().indexOf(OSName.OS_NAME_LINUX.getOSName().toLowerCase()) != -1) { + os = OperatingSystem.LINUX; + } else if (osName.toLowerCase().indexOf(OSName.OS_NAME_HP.getOSName().toLowerCase()) != -1) { + os = OperatingSystem.HP; + } else if ((osName.toLowerCase().indexOf(OSName.OS_NAME_SOLARIS.getOSName().toLowerCase()) != -1) + || (osName.toLowerCase().indexOf(OSName.OS_NAME_SOLARIS_2.getOSName().toLowerCase()) != -1)) { + os = OperatingSystem.SOLARIS; + } else if (osName.toLowerCase().indexOf(OSName.OS_NAME_AIX.getOSName().toLowerCase()) != -1) { + os = OperatingSystem.AIX; + } else { + throw new Exception("Unknown OS name: " + osName); + } + Log.exiting(c, method, os); + return os; + } + + /** + * This enum contains known operating system names + */ + public enum OSName { + OS_NAME_WINDOWS("Win"), + OS_NAME_ISERIES("400"), + OS_NAME_ZOS("OS/390"), + OS_NAME_ZOS_2("z/OS"), + OS_NAME_ZOS_3("zOS"), + OS_NAME_LINUX("Linux"), + OS_NAME_HP("HP"), + OS_NAME_MAC("Darwin"), + OS_NAME_MAC2("Mac OS"), + OS_NAME_SOLARIS("Solaris"), + OS_NAME_SOLARIS_2("Sun"), + OS_NAME_AIX("AIX"); + + private String name; + + private OSName(String name) { + this.name = name; + } + + public String getOSName() { + return this.name; + } + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/PortType.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/PortType.java new file mode 100755 index 000000000000..ccd6eec9c76a --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/PortType.java @@ -0,0 +1,78 @@ +package com.ibm.websphere.simplicity; + +/** + * Represents the default WebSphere server port names. A port is not synonymous with + * a connector, however, which is the mechanism by which a client connects to a running + * instance of WebSphere Application Server. For those values, see {@link ConnectorType}. + */ +public enum PortType { + /** + * Telnet access to the OSGi console. + */ + OSGi("OSGi"), + /** + * Used by RMI and JSR160RMI. + */ +// BOOTSTRAP_ADDRESS("BOOTSTRAP_ADDRESS"), + /** + * Used by CORBA clients. + */ +// ORB_LISTENER_ADDRESS("ORB_LISTENER_ADDRESS"), +// ORB_SSL_LISTENER_ADDRESS("ORB_SSL_LISTENER_ADDRESS"), +// SAS_SSL_SERVERAUTH_LISTENER_ADDRESS("SAS_SSL_SERVERAUTH_LISTENER_ADDRESS"), + /** + * Admin console port when security is disabled. + */ +// WC_adminhost("WC_adminhost"), + /** + * Admin console port when security is enabled. + */ +// WC_adminhost_secure("WC_adminhost_secure"), + /** + * The standard HTTP (unsecured) port. + */ + WC_defaulthost("WC_defaulthost"), + /** + * The standard HTTPS (secured) port. + */ + WC_defaulthost_secure("WC_defaulthost_secure"), + /** + * Admin Agent subsystems act as the connection host for + * registered nodes (application servers whose node has been + * registered to an Admin Agent process). Use this port for + * RMI connections to a registered node. + */ +// RMI_CONNECTOR_ADDRESS("RMI_CONNECTOR_ADDRESS"), +// HTTP("HTTP"), +// HTTP_SECURE("HTTP_SECURE"), + IIOP("HTTP_SECURE"), + JMX_REST("HTTP_SECURE"); + + public static PortType fromName(String name) { + for (PortType pt : PortType.values()) + if (pt.getPortName().equalsIgnoreCase(name)) + return pt; + return null; + } + + private final String portName; + + private PortType(String portName) { + this.portName = portName; + } + + /** + * Returns the port name used in the property file for this Port + * + * @return The port name used in the property file for this Port + */ + public String getPortName() { + return this.portName; + } + + @Override + public String toString() { + return this.portName; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/RemoteFile.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/RemoteFile.java new file mode 100755 index 000000000000..4b1917845c48 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/RemoteFile.java @@ -0,0 +1,805 @@ +package com.ibm.websphere.simplicity; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.cmdline.RXAProvider; + +/** + * Represents a file or directory on a {@link Machine}. This file or directory + * may or may not actually exist on the {@link Machine}. When an instance of + * RemoteFile is created the path name is modified to be of the form + * /dir/dir2/file. + */ +public class RemoteFile { + + @SuppressWarnings("rawtypes") + private static final Class c = RemoteFile.class; + + private final Machine host; + private String filePath; + private final String parentPath; + private String name; + private File localFile; // non-null only if Machine.isLocal() returns true + private final Charset encoding; + + /** + * Construct an instance based on the fully qualified path of the remote + * file. + * + * @param host + * The {@link Machine} where this file is physically located + * @param filePath + * The fully qualified (absolute) path of the file + */ + public RemoteFile(Machine host, String filePath) { + this(host, filePath, Charset.defaultCharset()); + } + + /** + * Construct an instance based on the fully qualified path of the remote + * file. + * + * @param host + * The {@link Machine} where this file is physically located + * @param filePath + * The fully qualified (absolute) path of the file + * @param encoding + * The character set the file is encoded in + */ + public RemoteFile(Machine host, String filePath, Charset encoding) { + this.host = host; + this.filePath = convertPath(filePath); + this.parentPath = convertPath(getParentPath(filePath)); + this.encoding = encoding; + init(); + } + + /** + * Construct an instance based on the parent of the remote file. + * + * @param host + * The {@link Machine} where this file is physically located + * @param parent + * The remote file's parent directory + * @param name + * The name of the file + */ + public RemoteFile(Machine host, RemoteFile parent, String name) { + this(host, parent, name, Charset.defaultCharset()); + } + + /** + * Construct an instance based on the parent of the remote file. + * + * @param host + * The {@link Machine} where this file is physically located + * @param parent + * The remote file's parent directory + * @param name + * The name of the file + * @param encoding + * The character set the file is encoded in + */ + public RemoteFile(Machine host, RemoteFile parent, String name, Charset encoding) { + if (parent.getAbsolutePath().endsWith("/") + || parent.getAbsolutePath().endsWith("\\")) { + this.filePath = convertPath(parent.getAbsolutePath() + name); + } else { + this.filePath = convertPath(parent.getAbsolutePath() + "/" + name); + } + this.parentPath = parent.getAbsolutePath(); + this.name = name; + this.host = host; + this.encoding = encoding; + init(); + } + + /** + * Construct an instance based on the parent of the remote file. Assumes that the new instance resides on the same machine as the parent file. + * + * @param parent + * The remote file's parent directory + * @param name + * The name of the file + */ + public RemoteFile(RemoteFile parent, String name) { + this(parent.getMachine(), parent, name, Charset.defaultCharset()); + } + + /** + * Construct an instance based on the parent of the remote file. Assumes that the new instance resides on the same machine as the parent file. + * + * @param parent + * The remote file's parent directory + * @param name + * The name of the file + * @param encoding + * The character set the file is encoded in + */ + public RemoteFile(RemoteFile parent, String name, Charset encoding) { + this(parent.getMachine(), parent, name, encoding); + } + + /** + * Get the {@link Machine} of this RemoteFile + * + * @return The {@link Machine} + */ + public Machine getMachine() { + return this.host; + } + + /** + * Returns a String representation the parent directory of this file, or + * null if this pathname does not name a parent directory. + * + * @return A String representation of this remote file's parent directory + */ + public String getParent() throws Exception { + RemoteFile parent = getParentFile(); + if (parent == null) { + return null; + } else { + return parent.getAbsolutePath(); + } + } + + /** + * Returns a RemoteFile representation of the parent directory of this file + * or null if this pathname does not name a parent directory. + * + * @return A RemoteFile representation of the parent directory. + * @throws Exception + */ + public RemoteFile getParentFile() throws Exception { + String path = parentPath; + if (path == null) { + return null; + } + return new RemoteFile(this.host, path); + } + + /** + * Returns the absolute pathname string of this RemoteFile in the form + * /dir1/dir2/file + * + * @return The absolute pathname of this RemoteFile + */ + public String getAbsolutePath() { + return this.filePath; + } + + /** + *

+ * Searches a directory for file names matching a numeric prefix, and + * returns a new File instance representing a new (unique) file in that + * directory. Successive calls to this method for the same directory and + * prefix will produce an alphabetically sorted list of child files. For example: + * prefix01_nameA, prefix02_nameB, prefix03_nameC, prefix04_nameC, etc. Note + * that the returned File will not yet exist on the file system. + *

+ *

+ * This method is not thread-safe. + *

+ * + * @param prefix + * an optional String that proceeds ordering information. All + * characters must match: [a-zA-Z_0-9\\.] + * @param digits + * the number of digits to use for generated identifiers + * @param suffix + * the optional name of the desired file, without any numeric identifier. + * All characters must match: [a-zA-Z_0-9\\.] + * @return a new RemoteFile representing a unique child of the parent. The file must be created before use. + * @throws IllegalArgumentException + * if this instance does not denote a directory, + * if input arguments are invalid, + * or if the file cannot be created + */ + public RemoteFile getOrderedChild(String prefix, int digits, String suffix) throws Exception { + RemoteFile[] children = this.list(false); + if (children == null) { + throw new IllegalArgumentException("Does not denote a directory: " + this); + } + Pattern wordCharacters = Pattern.compile("[\\w\\.]*"); // zero or more characters matching [a-zA-Z_0-9\\.]. The '-' character is not allowed! + if (suffix != null) { + if (!wordCharacters.matcher(suffix).matches()) { // if the file name contains a non-word character + throw new IllegalArgumentException("Invalid characters detected in proposed file name: " + suffix); + } + } + int prefixLength = 0; + if (prefix != null) { + if (!wordCharacters.matcher(prefix).matches()) { // if the file name contains a non-word character + throw new IllegalArgumentException("Invalid characters detected in file prefix: " + prefix); + } + prefixLength = prefix.length(); + } + long highest = 0; + for (RemoteFile child : children) { + if (child == null) { + continue; // ignore children with a null name + } + String childName = child.getName(); + if (prefixLength > 0 && !childName.startsWith(prefix)) { + continue; // ignore children missing our prefix in their name + } + childName = childName.substring(prefixLength); // remove prefix from the name (if it exists) + int dashIndex = childName.indexOf("-"); + if (dashIndex > -1) { + childName = childName.substring(0, dashIndex); // remove suffix from the name (if it exists) + } + long number; + try { + number = Long.parseLong(childName); + } catch (Exception e) { + continue; // ignore children without a number between the prefix and suffix + } + if (number > highest) { + highest = number; + } + } + StringBuilder newName = new StringBuilder(); + if (prefixLength > 0) { + newName.append(prefix); + } + newName.append(zeroPad(highest + 1, digits)); + if (suffix != null) { + newName.append("-"); + newName.append(suffix); + } + return new RemoteFile(this.getMachine(), this, newName.toString()); + } + + /** + * Prepends zeros to the left of the input number to ensure that the input + * number is a total of width digits. Truncates the input + * number if it has more than width digits. + * + * @param number + * a positive integer (negative integers cause problems with odd + * widths) + * @param width + * the number of characters that you want in a String + * representation of number; must be a positive + * integer smaller than 18 (larger numbers cause an overflow + * issue) + * @return a zero-padded String representation of the input number + */ + private String zeroPad(long number, int width) { + long n = Math.abs(number); + long w = width; + if (w < 0) { + w = 0; + } else if (w > 18) { + w = 18; + } + long wrapAt = (long) Math.pow(10, w); + return String.valueOf(n % wrapAt + wrapAt).substring(1); + } + + /** + * Copies the file or directory represented by this instance to a remote + * machine. + * + * @param destFile + * The location on the remote device where you want to place this + * file + * @param recursive + * If this instance represents a directory, whether or not to + * recursively transfer all files and directories within this + * directory + * @param overwrite + * true if files should be overwritten durin the copy. If this is + * false and a file is encountered in the destination of the + * copy, an Exception is thrown. + * @return true if the copy was successful + */ + public boolean copyToDest(RemoteFile destFile, boolean recursive, + boolean overwrite) throws Exception { + return RemoteFile.copy(this, destFile, recursive, overwrite, true); + } + + /** + * Copies the file or directory represented by this instance to a remote + * machine. + * + * @param destFile + * The location on the remote device where you want to place this + * file + * @param recursive + * If this instance represents a directory, whether or not to + * recursively transfer all files and directories within this + * directory + * @param overwrite + * true if files should be overwritten durin the copy. If this is + * false and a file is encountered in the destination of the + * copy, an Exception is thrown. + * @return true if the copy was successful + */ + public boolean copyToDestText(RemoteFile destFile, boolean recursive, + boolean overwrite) throws Exception { + return RemoteFile.copy(this, destFile, recursive, overwrite, false); + } + + /** + * Copies the file or directory represented by this instance to a remote + * machine. If this is a directory the copy is not done recursively. Files + * are overwritten during the copy. + * + * @param destFile + * The location on the remote device where you want to place this + * file + * @return true if the copy was successful + * @throws Exception + */ + public boolean copyToDest(RemoteFile destFile) throws Exception { + return RemoteFile.copy(this, destFile, false, true, true); + } + + /** + * Copies the file or directory represented by this instance to a remote + * machine. If this is a directory the copy is not done recursively. Files + * are overwritten during the copy. + * + * @param destFile + * The location on the remote device where you want to place this + * file + * @return true if the copy was successful + * @throws Exception + */ + public boolean copyToDestText(RemoteFile destFile) throws Exception { + return RemoteFile.copy(this, destFile, false, true, false); + } + + /** + * Copies the file or directory from a RemoteMachine to the path specified + * by this instance + * + * @param srcFile + * The location on the remote device where you want to get this + * file + * @param recursive + * If this srcFile represents a directory, whether or not to + * recursively transfer all files and directories within the + * source directory + * @param overwrite + * true if files should be overwritten durin the copy. If this is + * false and a file is encountered in the destination of the + * copy, an Exception is thrown. + * @return true if the copy was successful + */ + public boolean copyFromSource(RemoteFile srcFile, boolean recursive, + boolean overwrite) throws Exception { + return RemoteFile.copy(srcFile, this, recursive, overwrite, true); + } + + /** + * Copies the file or directory from a RemoteMachine to the path specified + * by this instance + * + * @param srcFile + * The location on the remote device where you want to get this + * file + * @param recursive + * If this srcFile represents a directory, whether or not to + * recursively transfer all files and directories within the + * source directory + * @param overwrite + * true if files should be overwritten durin the copy. If this is + * false and a file is encountered in the destination of the + * copy, an Exception is thrown. + * @return true if the copy was successful + */ + public boolean copyFromSourceText(RemoteFile srcFile, boolean recursive, + boolean overwrite) throws Exception { + return RemoteFile.copy(srcFile, this, recursive, overwrite, false); + } + + /** + * Copies the file or directory from a RemoteMachine to the path specified + * by this instance. If the source is a directory the copy is not done + * recursively. Files are overwritten during the copy. + * + * @param srcFile + * The location on the remote device where you want to get this + * file + * @return true if the copy was successful + * @throws Exception + */ + public boolean copyFromSource(RemoteFile srcFile) throws Exception { + return RemoteFile.copy(srcFile, this, false, true, true); + } + + /** + * Copies the file or directory from a RemoteMachine to the path specified + * by this instance. If the source is a directory the copy is not done + * recursively. Files are overwritten during the copy. + * + * @param srcFile + * The location on the remote device where you want to get this + * file + * @param binary + * true if you want the file transfered in binary, ascii if false + * @return true if the copy was successful + * @throws Exception + */ + public boolean copyFromSource(RemoteFile srcFile, boolean binary) + throws Exception { + return RemoteFile.copy(srcFile, this, false, true, binary); + } + + /** + * Deletes the file or directory denoted by this abstract pathname. + * + * @return true if and only if the file or directory is successfully + * deleted; false otherwise + */ + public boolean delete() throws Exception { + if (host.isLocal()) { + if (localFile.isDirectory()) { + return this.deleteLocalDirectory(localFile); + } else + return this.localFile.delete(); + } else + return RXAProvider.delete(this); + } + + /** + * Recursively deletes the contents then the directory denoted by this + * pathname. + * + * @return true if and only if the directory is successfully deleted; false + * otherwise + */ + public boolean deleteLocalDirectory(File path) { + if (path.exists()) { + File[] files = path.listFiles(); + for (int i = 0; i < files.length; i++) { + if (files[i].isDirectory()) { + deleteLocalDirectory(files[i]); + } else { + boolean b = files[i].delete(); + if (!b) { + Log.info(c, "deleteLocalDirectory", "couldn't delete localfile = " + files[i]); + } + } + } + } + return (path.delete()); + } + + /** + * Tests whether the file represented by this RemoteFile is a directory. + * + * @return true if and only if the file denoted by this abstract pathname + * exists and is a directory; false otherwise + */ + public boolean isDirectory() throws Exception { + if (!this.exists()) { + return false; + } + if (host.isLocal()) + return this.localFile.isDirectory(); + else + return RXAProvider.isDirectory(this); + } + + /** + * Tests whether the file denoted by this RemoteFile is a normal file. A + * file is normal if it is not a directory and, in addition, satisfies other + * system-dependent criteria. Any non-directory file created by a Java + * application is guaranteed to be a normal file. + * + * @return true if and only if the file denoted by this abstract pathname + * exists and is a normal file; false otherwise + */ + public boolean isFile() throws Exception { + if (!this.exists()) { + return false; + } + if (host.isLocal()) + return this.localFile.isFile(); + else + return RXAProvider.isFile(this); + } + + /** + * Tests whether the file or directory denoted by this Remotefile exists + * + * @return if and only if the file or directory denoted by this abstract + * pathname exists; false otherwise + */ + public boolean exists() throws Exception { + if (host.isLocal()) + return this.localFile.exists(); + else + return RXAProvider.exists(this); + } + + /** + * Returns an array of RemoteFiles denoting the files in the directory + * denoted by this RemoteFile. + * + * @param recursive + * If this instance represents a directory, whether or not to + * recursively list all files and directories + * + * @return An array of RemoteFiles denoting the files and directories in the + * directory denoted by this RemoteFile. The array will be empty if + * the directory is empty. Returns null if this abstract pathname + * does not denote a directory + */ + public RemoteFile[] list(boolean recursive) throws Exception { + final String method = "list"; + Log.entering(c, method, recursive); + if (!this.isDirectory()) { + Log.finer(c, method, "This is not a directory."); + Log.exiting(c, method, null); + return null; + } + + RemoteFile[] remoteFiles = null; + List remoteFilesList = new ArrayList(); + if (host.isLocal()) { + File[] list = this.localFile.listFiles(); + for (int i = 0; i < list.length; ++i) { + RemoteFile remoteFile = new RemoteFile(this.host, list[i] + .getCanonicalPath()); + remoteFilesList.add(remoteFile); + + // If needed recurse + if (recursive && remoteFile.isDirectory()) { + RemoteFile[] grandchildren = remoteFile.list(true); + for (RemoteFile grandchild : grandchildren) { + remoteFilesList.add(grandchild); + } + } + } + remoteFiles = remoteFilesList.toArray(new RemoteFile[0]); + } else { + String[] fileList = RXAProvider.list(this, recursive); + remoteFiles = new RemoteFile[fileList.length]; + for (int i = 0; i < fileList.length; ++i) { + remoteFiles[i] = new RemoteFile(this.host, fileList[i]); + } + } + Log.exiting(c, method, remoteFiles); + return remoteFiles; + } + + /** + * Creates the directory named by this RemoteFile + * + * @return true if and only if the directory was created; false otherwise + */ + public boolean mkdir() throws Exception { + if (host.isLocal()) + return this.localFile.mkdir(); + else + return RXAProvider.mkdir(this); + } + + /** + * Creates the directory named by this RemoteFile, including any necessary + * but nonexistent parent directories. Note that if this operation fails it + * may have succeeded in creating some of the necessary parent directories. + * + * @return true if and only if the directory was created, along with all + * necessary parent directories; false otherwise + */ + public boolean mkdirs() throws Exception { + if (host.isLocal()) + return this.localFile.mkdirs(); + else + return RXAProvider.mkdirs(this); + } + + public boolean rename(RemoteFile newFile) throws Exception { + if (host.isLocal()) + return this.localFile.renameTo(new File(newFile.getAbsolutePath())); + else + return RXAProvider.rename(this, newFile); + } + + /** + * Returns the name of the file or directory denoted by this RemoteFile + * + * @return The name of the file + * @throws Exception + */ + public String getName() throws Exception { + if (this.name == null) { + name = this.getAbsolutePath(); + int startIndex = name.lastIndexOf("/"); + if (startIndex != -1) { + name = name.substring(startIndex + 1); + } + } + return this.name; + } + + public InputStream openForReading() throws Exception { + if (host.isLocal()) + return new FileInputStream(this.localFile); + else + return RXAProvider.openFileForReading(this); + } + + public OutputStream openForWriting(boolean append) throws Exception { + if (host.isLocal()) + return new FileOutputStream(this.localFile, append); + else + return RXAProvider.openFileForWriting(this, append); + } + + /** + * Returns a String representation of the RemoteFile + */ + @Override + public String toString() { + return this.getAbsolutePath(); + } + + /** + * Copy a RemoteFile + * + * @param srcFile + * The source RemoteFile + * @param destFile + * The destination RemoteFile + * @param recursive + * true if this a recursive copy + * @param overwrite + * true if files should be overwritten during the copy + * @return true if the copy was successful + * @throws Exception + */ + private static boolean copy(RemoteFile srcFile, RemoteFile destFile, + boolean recursive, boolean overwrite, boolean binary) + throws Exception { + final String method = "copy"; + Log.entering(c, method, new Object[] { srcFile, destFile, recursive, + overwrite }); + boolean destExists = destFile.exists(); + boolean destIsDir = destFile.isDirectory(); + boolean copied = true; + if (destFile == null) { + throw new Exception("destFile cannot be null."); + } + if (!srcFile.exists()) { + throw new Exception("Cannot copy a file or directory that does not exist: " + + srcFile.getAbsolutePath() + ": " + + srcFile.getMachine().getHostname()); + } + if (!overwrite && destExists && !destIsDir) { + throw new Exception("Destination " + destFile.getAbsolutePath() + + " on machine " + destFile.getMachine().getHostname() + + " already exists."); + } + + RemoteFile[] childEntries = null; + + if (srcFile.isDirectory()) { + Log.finer(c, method, "Source file is a directory."); + if (!destIsDir) { + Log.finer(c, method, "Converting the destination file to a directory."); + if (destExists) { + if (!destFile.delete()) { + throw new Exception("The destination directory exists as a file. Unable to delete the file and overwrite. DestDir: " + + destFile.getAbsolutePath()); + } + } + // create the directory + Log.finer(c, method, "Creating the destination directory."); + if (!destFile.mkdirs()) { + throw new Exception("Unable to create destination directory " + destFile.getAbsolutePath()); + } + } + childEntries = srcFile.list(false); + + // now copy any children + if (childEntries != null && recursive) { + Log.finer(c, method, "Copying children..."); + for (int i = 0; i < childEntries.length; ++i) { + RemoteFile destChild = new RemoteFile(destFile.host, destFile, childEntries[i].getName()); + copied = copied && RemoteFile.copy(childEntries[i], destChild, recursive, overwrite, binary); + Log.finer(c, method, "Child copied successfully: " + copied); + } + } + + Log.exiting(c, method, copied); + return copied; + } else { + Log.finer(c, method, "The source file is a file. Copying the file."); + //Now we ensure the parent directory path exists and create if it doesn't as long as it has a parent + if (!!!destFile.getParentFile().equals(null)) { + RemoteFile parentFolder = new RemoteFile(destFile.getMachine(), destFile.getParent()); + Log.finer(c, method, destFile.getParent()); // info level is inconsistent with other messages in this method, and also very loud for large transfers + parentFolder.mkdirs(); + } + + // copy the file + boolean result = RXAProvider.copy(srcFile, destFile, binary); + Log.exiting(c, method, result); + return result; + } + } + + /** + * Get the parent path of a file + * + * @param path + * The path of the file + * @return The parent path of the file + */ + private String getParentPath(String path) { + if (path.equals("/")) { // root + return null; + } + path = path.replace('\\', '/'); + if (path.endsWith("/")) + path = path.substring(0, path.length() - 1); + int endIndex = path.lastIndexOf("/"); + if (endIndex != -1) { + path = path.substring(0, endIndex); + } + if (path.length() == 0) { + path = "/"; + } + return path; + } + + private String convertPath(String path) { + if (path != null) { + path = path.replace('\\', '/'); + if (!path.equals("/") && path.endsWith("/")) + path = path.substring(0, path.length() - 1); + } + return path; + } + + private void init() { + if (this.host.isLocal()) + this.localFile = new File(this.filePath); + } + + /** + * Get the size of the file + * + * @return the size of the file + */ + public long length() { + if (this.localFile != null) + return this.localFile.length(); + else + return 0; + } + + /** + * Get the last modified timestamp of the file. If directory + * returns 0L + * + * @return the last modified timestamp + */ + public long lastModified() { + return this.localFile.lastModified(); + } + + /** + * Returns the encoding of the file + * + * @return the character set the file is encoded in + */ + public Charset getEncoding() { + return this.encoding; + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Scope.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Scope.java new file mode 100755 index 000000000000..3f4b036cf1e3 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Scope.java @@ -0,0 +1,231 @@ +package com.ibm.websphere.simplicity; + +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.management.ObjectName; + +import com.ibm.websphere.simplicity.config.securitydomain.GlobalSecurityDomain; +import com.ibm.websphere.simplicity.config.securitydomain.SecurityDomain; +import com.ibm.websphere.simplicity.log.Log; + +/** + * The Scope class is the parent for defined areas of visibility in a WebSphere topology. The Cell + * instance of Scope, being the highest, can see and affect all other scopes in the topology. A Node + * instance of Scope has visibility to the servers within it. A Server instance of Scope is the most + * limited view, and can only affect settings and other values directly impacting the Server itself. + */ +public abstract class Scope { + + private static Class c = Scope.class; + + protected String bootstrapFileKey; + protected String name; + protected Scope parent = null; + protected Cell cell; + // can't be static since we need one per Cell; non-Cell scopes have null references + protected ConnectionInfo connInfo = null; + protected ConfigIdentifier configId; + + // Centralized logic for recursive variable substitution + protected static String expandString(Scope scope, String str) throws Exception { + String ret = str; + String regex = "\\$(\\{|\\()[A-Za-z0-9_]+(\\}|\\))"; + Pattern p = Pattern.compile(regex); + Matcher m = null; + while ((m = p.matcher(ret)).lookingAt()) { + Scope current = scope; + String var = m.group(); + String value = null; + // Search up the scope tree until we find a variable or never find it + while (value == null && current != null) { + if (current instanceof Cell) + value = ((Cell) current).expandVariable(var); + else if (current instanceof Node) + value = ((Node) current).expandVariable(var); + else if (current instanceof Server) + value = ((Server) current).expandVariable(var); + current = current.getParent(); + } + if (value == null) + value = ""; + ret = ret.replace(var, value); + } + return ret.replace('\\', '/'); + } + + /** + * Constructor to create a parent-less Scope. Sets the {@link ConnectionInfo} to be used by this + * Scope and all it's children + * + * @param configId The {@link ConfigIdentifier} of this Scope + * @param connInfo The {@link ConnectionInfo} that contains the data needed to make an + * administrative connection for this Scope + */ + protected Scope(ConnectionInfo connInfo, Cell cell) { + this.parent = null; + this.connInfo = connInfo; + this.cell = cell; + } + + /** + * Constructor to create a Scope with a parent + * + * @param configId The {@link ConfigIdentifier} of this Scope + * @param parent The parent Scope of this Scope + */ + protected Scope(Scope parent, Cell cell) { + this.parent = parent; + this.cell = cell; + } + + /** + * The scope portion of an ObjectName pattern corresponding to the scope represented by this + * instance. + * + * @return The scope portion of an ObjectName pattern corresponding to the scope represented by + * this instance. + */ + public abstract String getObjectNameFragment(); + + /** + * @return The name of this scope + */ + public String getName() { + return this.name; + } + + /** + * Sets the name of this scope. + * + * @param name + */ + protected void setName(String name) { + this.name = name; + } + + /** + * @return The topological parent; in other words, a Server returns a Node, a Node returns a Cell, etc. + */ + public Scope getParent() { + return this.parent; + } + + /** + * Get the {@link Cell} level {@link Workspace} Object + * + * @return A representation of the config workspace + * @throws Exception + */ + public Workspace getWorkspace() throws Exception { + if (this.cell.workspace == null) { + this.cell.workspace = new Workspace(this.cell); + } + return this.cell.workspace; + } + + /** + * @return A value describing the type of scope this instance represents. + */ + public ScopeType getScopeType() { + if (this instanceof Cell) + return ScopeType.CELL; + else if (this instanceof Node) + return ScopeType.NODE; + else if (this instanceof Server) + return ScopeType.SERVER; + else + return null; + } + + /** + * @return A ConnectionInfo instance, which contains information used to communicate with the endpoint. May return a reference to a parent connection. + */ + public ConnectionInfo getConnInfo() { + if (this.parent != null) { + return parent.getConnInfo(); + } else { + if (this.connInfo == null) + this.connInfo = new ConnectionInfo(); + return this.connInfo; + } + } + + /** + * @return Returns a public-friendly configuration identifier for the scope's main configuration element. + */ + public ConfigIdentifier getConfigId() { + return this.configId; + } + + /** + * Get the {@link Cell} that this Scope belongs to + * + * @return The {@link Cell} of the Scope + */ + public Cell getCell() { + return this.cell; + } + + public String getBootstrapFileKey() { + return bootstrapFileKey; + } + + protected void setBootstrapFileKey(String bootstrapFileKey) { + this.bootstrapFileKey = bootstrapFileKey; + } + + /** + * Get the {@link SecurityDomain} that this server is mapped to. If it is not mapped to any + * application security domains, the {@link GlobalSecurityDomain} is returned. + * + * @return The {@link SecurityDomain} that this server belongs to + * @throws Exception + */ + public SecurityDomain getSecurityDomain() throws Exception { + final String method = "getSecurityDomain"; + Log.entering(c, method); + Set domains = this.cell.getSecurityConfiguration().getSecurityDomains(); + for (SecurityDomain domain : domains) { + if (domain.getMappedScopes().contains(this)) { + Log.finer(c, method, "Server " + this.name + " is part of domain " + domain.getName() + "."); + Log.exiting(c, method, domain); + return domain; + } + } + Log.finer(c, method, "Server " + this.name + " is not mapped to a domain. Returning global domain."); + Log.exiting(c, method, this.cell.getSecurityConfiguration().getGlobalSecurityDomain()); + return this.cell.getSecurityConfiguration().getGlobalSecurityDomain(); + } + + protected static String getCellName(ObjectName on) { + String ret = on.getKeyProperty("cell"); + if (ret != null) + return ret; + + String[] parts = getConfigIdParts(on); + // skip "cells" + return parts[1]; + } + + protected static String getNodeName(ObjectName on) { + String ret = on.getKeyProperty("cell"); + if (ret != null) + return ret; + String[] parts = getConfigIdParts(on); + // skip "cells", "", "nodes" + return parts[3]; + } + + private static String[] getConfigIdParts(ObjectName on) { + // configID looks something like this: cells/wssecsuse2Cell03/nodes/wssecsuse2Node03|node.xml + String configID = on.getKeyProperty("_Websphere_Config_Data_Id"); + // First strip out everything after the pipe + configID = configID.substring(0, configID.indexOf('|')); + // Now split the string based on "/" delimiter + String[] parts = configID.split("/"); + return parts; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Server.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Server.java new file mode 100755 index 000000000000..568af6f2f974 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Server.java @@ -0,0 +1,293 @@ +package com.ibm.websphere.simplicity; + +import java.util.HashMap; +import java.util.Set; + +import com.ibm.websphere.simplicity.exception.NotImplementedException; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.websphere.simplicity.runtime.ProcessStatus; +import componenttest.topology.impl.LibertyServer; + +/** + * This abstract class is the parent for all Servers in the Topology. This includes application + * servers, web servers, and generic servers. + */ +public abstract class Server extends Scope { + + private static final Class c = Server.class; + + protected LibertyServer instance; + protected Node node = null; + protected ServerType serverType = null; + + /** + * Constructor to create a new Server + * + * @param configId The {@link ConfigIdentifier} for the Server + * @param cell The {@link Cell} that this Server belongs to + * @param node The {@link Node} that the Server belongs to + * @param server The underlying server instance + * @param serverType The type of this server + */ + protected Server(Cell cell, Node node, componenttest.topology.impl.LibertyServer server, ServerType serverType) throws Exception { + super(node, cell); + this.node = node; + this.serverType = serverType; + this.instance = server; + } + + @Override + public String getObjectNameFragment() { + return this.node.getObjectNameFragment() + ",process=" + this.getName(); + } + + /** + * Get the name of the parent {@link Cell} for this Server + * + * @return The name of the parent {@link Cell} of this Server + */ + public String getCellName() { + return this.cell.getName(); + } + + /** + * Get the parent {@link Node} for this Server + * + * @return The parent {@link Node} of this Server + */ + public Node getNode() { + return this.node; + } + + public componenttest.topology.impl.LibertyServer getBackend() { + return this.instance; + } + + /** + * Get the name of the parent {@link Node} for this Server + * + * @return The name of the parent {@link Node} of this Server + */ + public String getNodeName() { + return this.node.getName(); + } + + /** + * Translates a predefined variable into its corresponding string value. + * + * @param variable The variable to translate. + * @return The value of the variable, or null if it does not exist. + * @throws Exception + */ + public String expandVariable(VariableType variable) throws Exception { + return expandVariable(variable.getValue()); + } + + /** + * Translates a custom variable into its corresponding string value. + * + * @param variable The variable name to translate. + * @return The value of the variable, or null if it does not exist. + * @throws Exception + */ + public String expandVariable(String variable) throws Exception { + // Remove the standard prefix & postfix, if any + variable = variable.replace("${", "").replace("$(", "").replace("}", "").replace(")", ""); + throw new NotImplementedException(); + } + + /** + * Recursively expands all variables in the string to the corresponding value + * from the server, and replaces backslashes with forward slashes. The + * resulting string does not contain any variables. + * + * @param str A string that contains zero or more variables. + * @return The fully-expanded version of the string. + * @throws Exception + */ + public String expandString(String str) throws Exception { + return Scope.expandString(this, str); + } + + /** + * This method starts the Server + * + * @throws Exception + */ + public abstract void start() throws Exception; + + /** + * This method starts the Server + * + * @throws Exception + */ + public abstract void start(int mbeanWaitDuration) throws Exception; + + /** + * This method stops the Server + * + * @throws Exception + */ + public abstract void stop() throws Exception; + + /** + * This method stops the Server + * + * @throws Exception + */ + public abstract void stop(long timeout) throws Exception; + + /** + * Get the {@link ServerType} of this Server. The server type determines the capibilities of the + * Server. For example, a {@link Dmgr} server manages the nodes within a {@link Cell}. + * + * @return The type of this Server + */ + public ServerType getServerType() { + return this.serverType; + } + + //// public String getProfile() { + //// return this.instance.getProfileName(); + //// } + + /** + * This method clears all cached data for this Server. Further requests for + * information will be loaded fresh from the WAS instance. + *

+ * WARNING!!! Calling this method invalidates all pointers to any Simplicity + * objects obtained from the Server and its children. Only call this method if + * you absolutely want to reset the object model underneath this Server. + * + * @throws Exception + */ + public void resetServer() throws Exception { + // nothing to do; ports are handled by underlying componenttest.topolgy.impl.LibertyServer instance + } + + /** + * Get the port number value for a {@link ConnectorType} for this Server + * + * @param connectorType The {@link ConnectorType} port value to get + * @return An Integer representation of the port value + * @throws Exception + */ + public Integer getPortNumber(ConnectorType connectorType) throws Exception { + final String method = "getPortNumber"; + Log.entering(c, method, connectorType); + Log.finer(c, method, "server is " + this.getNodeName() + ", " + this.getName()); + //PortType port = PortType.valueOf(connectorType.getEndpointName()); + Integer portNumber = getPortNumber(PortType.OSGi); // there is no RMI, SOAP, IPC, etc port in alpine (yet?), so assume OSGi + Log.exiting(c, method, portNumber); + return portNumber; + } + + /** + * Get a port value for a port for this Server + * + * @param port The port to get + * @return An Integer representation of the port value + * @throws Exception + */ + public Integer getPortNumber(PortType port) throws Exception { + return this.instance.getPort(port); + } + + /** + * Get the host that the {@link ConnectorType} is bound to + * + * @param connectorType The {@link ConnectorType} to get the host for + * @return The host of the port + * @throws Exception + */ + //// public String getPortHost(ConnectorType connectorType) throws Exception { + //// PortType port = PortType.valueOf(connectorType.getEndpointName()); + //// return getPortHost(port); + //// } + + /** + * Get the host that the {@link PortType} is bound to + * + * @param connectorType The {@link PortType} to get the host for + * @return The host of the port + * @throws Exception + */ + //// public String getPortHost(PortType port) throws Exception { + //// return this.instance.getHostname(); // why would some ports have a different host name? + //// } + + /** + * This method returns the {@link ProcessStatus} of the Server. This method can be used to + * determine whether or not a server is running. There are cases where the status of a server + * may not be able to be determined. In these cases a status of {@link ProcessStatus#STOPPED} is + * returned. + * + * @return The status of the server + * @throws Exception + */ + public abstract ProcessStatus getServerStatus() throws Exception; + + /** + * Determine whether or not the target port is currently listening. + * This method is useful for determining if the server is really ready + * to accept requests on its ports. Occasionally, a port is not ready + * immediately after the server is started. If a request to a server port + * is made before it is ready, unexpected failures can occur. + * + * @param port The port whose status you want to check + * @return true if the port is listening, otherwise false + * @throws Exception if port status cannot be established + */ + public boolean isPortListening(PortType port) throws Exception { + ////return this.instance.isPortListening(PortType.convert(port)); + return true; + } + + /** + * Determine whether or not the target ports are currently listening. + * + * @param ports The ports whose status you want to check + * @return true if the ports are listening, otherwise false + * @throws Exception if port status cannot be established + */ + public boolean isPortListening(Set ports) throws Exception { + //// final String method = "isPortListening"; + //// Log.entering(c, method, ports); + //// if(ports==null) { + //// throw new IllegalArgumentException("Unable to determine if ports are listening since the input Set of PortType objects was null"); + //// } + //// for(PortType portType : ports) { + //// if(!this.isPortListening(portType)) { + //// Log.exiting(c, method, false); + //// return false; + //// } + //// } + //// Log.exiting(c, method, true); + return true; + } + + /** + * Modify a port for this Server + * + * @param port The port to modify + * @param host The hostname to set for the port + * @param value The value to set for the port + * @param modifyShared + * @throws Exception + */ + //// public void modifyServerPort(PortType port, String host, Integer value, Boolean modifyShared) throws Exception { + //// final String method = "modifyServerPort"; + //// Log.entering(c, method, new Object[]{host, value, modifyShared}); + //// if(value==null) { + //// throw new IllegalArgumentException("Unable to modify the port named "+port+" on the server named "+this.getName()+" because the specified port value is null"); + //// } + //// this.instance.setPort(PortType.convert(port), value.intValue()); + //// Log.exiting(c, method); + //// } + + public void commit(HashMap values) throws Exception {} + + @SuppressWarnings("unchecked") + public void rollback(HashMap values) throws Exception {} + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/ShrinkHelper.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/ShrinkHelper.java new file mode 100755 index 000000000000..caa2bad62e6e --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/ShrinkHelper.java @@ -0,0 +1,112 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity; + +import java.io.File; + +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ArchivePath; +import org.jboss.shrinkwrap.api.Filter; +import org.jboss.shrinkwrap.api.Filters; +import org.jboss.shrinkwrap.api.GenericArchive; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.exporter.ZipExporter; +import org.jboss.shrinkwrap.api.importer.ExplodedImporter; + +import componenttest.topology.impl.LibertyServer; + +/** + * Helper utilities for working with the ShrinkWrap APIs. + */ +public class ShrinkHelper { + + /** + * Export an artifact to autoFVT/publish/servers/$server.getName()/$path/$a.getName() + * and also copy it into the currently used wlp image at the same location + */ + public static void exportToServer(LibertyServer server, String path, Archive a) throws Exception { + String serverDir = "publish/servers/" + server.getServerName(); + exportArtifact(a, serverDir + '/' + path); + server.copyFileToLibertyServerRoot(serverDir + "/" + path, path, a.getName()); + } + + /** + * Writes an Archive to a a file in the 'publish/servers/' directory + * with the file name returned by a.getName(), which should include the + * file type extension (ear, war, jar, rar, etc) + * + * @param server The server to publish the application to + * @param a The archive to export as a file + * @throws Exception + */ + public static void exportAppToServer(LibertyServer server, Archive a) throws Exception { + exportToServer(server, "apps", a); + } + + /** + * Writes an Archive to a a file in the target destination + * with the file name returned by a.getName(), which should include the + * file type extension (ear, war, jar, rar, etc) + * + * @param a The archive to export as a file + * @param dest The target folder to export the archive to (i.e. publish/files/apps) + */ + public static Archive exportArtifact(Archive a, String dest) { + return exportArtifact(a, dest, true); + } + + /** + * Writes an Archive to a a file in the target destination + * with the file name returned by a.getName(), which should include the + * file type extension (ear, war, jar, rar, etc). + * + * @param a The archive to export as a file + * @param dest The target folder to export the archive to (i.e. publish/files/apps) + * @param printArchiveContents Whether or not to log the contents of the archive being exported + */ + public static Archive exportArtifact(Archive a, String dest, boolean printArchiveContents) { + File outputFile = new File(dest, a.getName()); + outputFile.getParentFile().mkdirs(); + a.as(ZipExporter.class).exportTo(outputFile, true); + System.out.println(a.toString(printArchiveContents)); + return a; + } + + /** + * Recursively adds a folder and all of its contents to an archive. + * + * @param a The archive to add the files to + * @param dir The directory which will be recursively added to the archive. + */ + public static Archive addDirectory(Archive a, String dir) throws Exception { + return addDirectory(a, dir, Filters.includeAll()); + } + + /** + * Recursively adds a folder and all of its contents matching a filter to an archive. + * + * @param a The archive to add the files to + * @param dir The directory which will be recursively added to the archive. + * @param filter A filter indicating which files should be included in the archive + */ + public static Archive addDirectory(Archive a, String dir, Filter filter) throws Exception { + return a.merge(ShrinkWrap.create(GenericArchive.class).as(ExplodedImporter.class).importDirectory(dir).as(GenericArchive.class), + "/", filter); + } + + /** + * Shortcut for: System.getProperty("user.dir") + */ + public static String getCWD() { + return System.getProperty("user.dir"); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Topology.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Topology.java new file mode 100755 index 000000000000..e65b454500a1 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Topology.java @@ -0,0 +1,309 @@ +package com.ibm.websphere.simplicity; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.websphere.simplicity.provider.OperationsProviderFactory; +import com.ibm.websphere.simplicity.provider.websphere.WebSphereOperationsProvider; +import componenttest.common.apiservices.Bootstrap; +import componenttest.exception.TopologyException; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * The Topology class is the entry point into the Simplicity WebSphere topology Object model. A + * WebSphere topology is the collection of all servers underneath a top-level server, such as a + * deployment manager, admin agent, or job manager. This class provides access to that information, + * as well as client-side operations such as tracing. Additionally, this class provides methods to + * programmatically set Simplicity settings and prefernces. + */ +public class Topology { + + /** + * This is the default configuration file in which settings such which {@link WebSphereOperationsProvider} should be used. The configuration file to use can be + * specified using the jvm arg configProps.
ex: -DconfigProps=myConfig.props + */ + public static final String DEFAULT_CONFIG_FILE = "simplicityConfig.props"; + + /** + * Simplicity version number + */ + public static final String SIMPLICITY_VERSION = "1.0.1.5"; + + private static Class c = Topology.class; + private static List cells = new ArrayList(); + private static boolean inited = false; + private static boolean topologyCachingEnabled = false; + private static WebSphereOperationsProvider operationsProvider; + private static LibertyServer libServer; + + /** + * @return the libServer + */ + public static LibertyServer getLibertyServer() { + return libServer; + } + + /** + * Default path to published servers + */ + private static final String PATH_TO_AUTOFVT_SERVERS = "publish/servers/"; + + private Topology() {} + + /** + * This method returns true if the topology has already been initialized using one of the init + * methods of this class + * + * @return true if the Simplicity Object model has already been initialized. + */ + public static boolean isInited() { + return inited; + } + + /** + * Returns a List of initialized {@link Cell}s. The {@link Cell} Object provides access to all + * other objects in the topology object model. This method returns the Cells in the order they + * are defined in the bootstrapping file if one is being used, or in the order that they are + * initialized. + * + * @return A List of initialized {@link Cell}s + */ + public static List getCells() { + return cells; + } + + /** + * Get a sorted List of {@link Cell}s. + * + * @param c The Comparator that defines how to sort the {@link Cell}s + * @return A List containing the Cells in sorted order + */ + public static List getCells(Comparator c) { + List cells = getCells(); + Collections.sort(cells, c); + return cells; + } + + /** + * Get a {@link Cell} with a specific name. Note that if multiple cells have been initialized + * with the same name, this method will return the first {@link Cell} found. + * + * @param name The name of the {@link Cell} to retrieve + * @return The {@link Cell} with the specified name, or null if no {@link Cell} exists with the + * name + */ + public static Cell getCellByName(String name) { + for (Cell c : cells) + if (c.getName().equalsIgnoreCase(name)) + return c; + return null; + } + + /** + * Get all the cells that have the specific {@link WebSphereTopologyType} + * + * @param type The type to get + * @return All the cells with the specified {@link WebSphereTopologyType} + * @throws Exception + */ + public static Set getCellsByType(WebSphereTopologyType type) throws Exception { + Set ret = new HashSet(); + for (Cell c : cells) + if (c.getTopologyType().equals(type)) + ret.add(c); + return ret; + } + + /** + * @param cellKey + * @return + */ + public static Cell getCellByBootstrapKey(String bootstrapKey) { + for (Cell cell : cells) { + if (cell.getBootstrapFileKey().equals(bootstrapKey)) { + return cell; + } + } + return null; + } + + /** + * Loads all the {@link Cell}s defined in bootstrapping properties file. If no bootstrapping + * properties file exists, an Exception is thrown. The {@link Cell}s are then accessible via + * the getCell* methods of this class. + * + * @throws Exception + */ + public static void init() throws Exception { + Log.entering(c, "init"); + if (inited) { + Log.exiting(c, "init (already initialized)"); + return; + } + + //As Liberty doesn't have a concept of cells and nodes we will just mock up a cell and node. + //This is required so that we can run both tWAS FAT suites and our own Liberty FAT suites + cells = new ArrayList(); + + //Determine serverName to use from the publish directory... + String serverName = ""; + + //Get the location of the local.properties file - default to current directory + String localPropsPath = System.getProperty("local.properties", "./local.properties"); + java.util.Properties localProps = new java.util.Properties(); + localProps.load(new java.io.FileInputStream(localPropsPath)); + + //Get the autoFVT root - dir.component.root used in FAT launch.xml so this must be set + String absolutePathToPublishDirectory = localProps.getProperty("dir.component.root", ".") + "/" + PATH_TO_AUTOFVT_SERVERS; + + Log.info(c, "init", "Path to publish directory from Local Properties: " + absolutePathToPublishDirectory); + //Get the name for the server from the publish directory + File pubDir = new File(absolutePathToPublishDirectory); + File[] files = pubDir.listFiles(); + // We only support one server at the moment so choose the first one. + if (files != null && files.length > 0) { + serverName = files[0].getName(); + } else { + Log.info(c, "init", "No servers found in publish directory: " + absolutePathToPublishDirectory); + throw new TopologyException("No servers found in publish directory: " + absolutePathToPublishDirectory); + } + Log.info(c, "init", "Using serverName: " + serverName); + + //Use the factory to get our Liberty server + libServer = LibertyServerFactory.getLibertyServer(serverName, null, false); + + Cell cell = new Cell(null);// add all Nodes to the same "cell" + cell.initApplicationManager(libServer); + cell.setBootstrapFileKey(libServer.getBootstrapKey()); + + Machine machine = libServer.getMachine(); + String hostname = machine.getHostname(); + + cell.setName("Cell " + hostname); + Node node = new Node(cell); + node.setBootstrapFileKey(libServer.getBootstrapKey()); + node.setName("Node " + hostname); + node.setHostname(hostname); + node.setProfileDir(libServer.getServerRoot()); + + ApplicationServer appServer = new ApplicationServer(libServer, node); + appServer.setBootstrapFileKey(libServer.getBootstrapKey()); + appServer.setName(libServer.getServerName()); // cached in Scope, not in Server, so we have to cache the name redundantly + node.addServer(appServer); + cell.addNode(node); + cells.add(cell); + + inited = true; + Log.exiting(c, "init"); + } + + /** + * This method clears the internal cell cache and reloads the cells defined in the bootstrapping + * properties file.
+ * WARNING!! Calling this method invalidates all pointers to any + * Simplicity Objects. Only call this method if you absolutely want to reset the topology Object + * model. + * + * @throws Exception + */ + public static void reset() throws Exception { + cells = new ArrayList(); + inited = false; + init(); + } + + /** + * Set the bootstrapping file to read from when initializing the WebSphere topology Object model. + * + * @param bootStrappingFile The file that contains the {@link Cell} definitions + */ + public static void setBootStrappingFile(File bootStrappingFile) { + if (bootStrappingFile != null) { + //FIXME: the import statement might trigger the static block of com.ibm.alpine.Topology too early for this to work + System.setProperty("bootstrapping.properties", bootStrappingFile.getPath()); + } + } + + /** + * Get the bootstrapping file used to initialize the WebSphere topology Object model + * + * @return The bootstrapping file + * @throws Exception + */ + public static Bootstrap getBootstrapMgr() throws Exception { + return Bootstrap.getInstance(); + } + + public static BootStrappingFileOperations getBootstrapFileOps() throws Exception { + File bootStrappingFile = getBootStrappingFile(); + if (null != bootStrappingFile && bootStrappingFile.canRead()) { + return new BootStrappingFileOperations(bootStrappingFile); + } + return null; + } + + public static File getBootStrappingFile() { + try { + return getBootstrapMgr().getFile(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * Set if topology caching should be used when initializing the topology Object model. If true, {@link Cell}, {@link Node}, {@link Server}, {@link Cluster}, and {@link Machine} + * data are + * cached to the bootstrapping properties file. These properties can then be used externally or + * used to reinitalized the topology Object model without incurring the cost of a wsadmin or JMX + * connection. + * + * @param enabled true if topology caching should be used + */ + public static void setTopologyCaching(boolean enabled) { + topologyCachingEnabled = enabled; + } + + /** + * @return true if topology caching is enabled + */ + public static boolean isTopologyCachingEnabled() { + return topologyCachingEnabled; + } + + /** + * Set the default {@link OperationsProviderType} to use to perform + * WebSphere operations. This type of operations provider will be used by + * the {@link WebSphereOperationsProvider}. + * + * @param type The {@link OperationsProviderType} to use when performing + * WebSphere operations. + * @throws Exception + */ + public static void setDefaultOperationsProvider(OperationsProviderType type) throws Exception { + OperationsProviderFactory.setDefaultCommandProvider(type); + operationsProvider = null; + } + + /** + * Get the {@link WebSphereOperationsProvider} used to perform WebSphere + * operations. + * + * @return The {@link WebSphereOperationsProvider} + * @throws Exception + */ + public static WebSphereOperationsProvider getOperationsProvider() throws Exception { + if (operationsProvider == null) { + operationsProvider = OperationsProviderFactory.getProvider(); + } + return operationsProvider; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Workspace.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Workspace.java new file mode 100755 index 000000000000..48cafcd1e7f6 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/Workspace.java @@ -0,0 +1,49 @@ +package com.ibm.websphere.simplicity; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * + * @author SterlingBates + * + */ +public class Workspace { + + private static Class c = Workspace.class; + + private final Cell cell; + private final String[] workspaceChanges; + + protected Workspace(Cell cell) throws Exception { + Log.entering(c, "constructor"); + this.cell = cell; + this.workspaceChanges = new String[0]; + Log.exiting(c, "constructor"); + } + + public void save() throws Exception { + Log.entering(c, "save", this); + Log.exiting(c, "save", this.workspaceChanges); + } + + /** + * This method saves the configuration and syncs the nodes in an ND topology. If the topology is + * not {@link WebSphereTopologyType#ND}, this method will ONLY save and will not attempt to + * sync any nodes. + * + * @throws Exception + */ + public void saveAndSync() throws Exception { + save(); + } + + public void discard() throws Exception { + Log.entering(c, "discard"); + Log.exiting(c, "discard"); + } + + public Cell getCell() { + return this.cell; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/Application.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/Application.java new file mode 100755 index 000000000000..705a33b5596a --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/Application.java @@ -0,0 +1,332 @@ +package com.ibm.websphere.simplicity.application; + +import java.util.HashSet; +import java.util.Set; + +import com.ibm.websphere.simplicity.Cluster; +import com.ibm.websphere.simplicity.Node; +import com.ibm.websphere.simplicity.OperationResults; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.Scope; +import com.ibm.websphere.simplicity.Server; +import com.ibm.websphere.simplicity.application.types.UpdateContentType; +import com.ibm.websphere.simplicity.application.types.UpdateType; +import com.ibm.websphere.simplicity.exception.NotImplementedException; +import com.ibm.websphere.simplicity.log.Log; + +public abstract class Application { + + protected static Application create(ApplicationManager mgr, ApplicationType type, String name, Scope scope) throws Exception { + Application ret = null; + // Other application types? + switch (type) { + case EAR: + ret = new EnterpriseApplication(mgr, name, scope); + } + return ret; + } + + protected static Class c = Application.class; + + protected Scope scope; + protected String name; + protected ArchiveType archiveType = null; + protected String installRoot; + protected Boolean isInstalled = null; + protected ApplicationType type; + protected ApplicationManager applications; + + protected Application(ApplicationManager mgr, ApplicationType type, String name, Scope scope) throws Exception { + Log.entering(c, "WebSphereApplication"); + this.scope = scope; + this.type = type; + this.name = name; + this.archiveType = ArchiveType.EAR; + + this.applications = mgr; + this.isInstalled = isInstalled(); + } + + public abstract OperationResults stop() throws Exception; + + public abstract OperationResults start() throws Exception; + + public abstract OperationResults update(UpdateWrapper options) throws Exception; + + public abstract OperationResults edit(EditWrapper options) throws Exception; + + public abstract UpdateWrapper getUpdateWrapper() throws Exception; + + public abstract UpdateWrapper getUpdateWrapper(UpdateType updateType, RemoteFile contents, UpdateContentType contentType) throws Exception; + + @Deprecated + public abstract UpdateWrapper getUpdateWrapper(RemoteFile file) throws Exception; + + public abstract EditWrapper getEditWrapper() throws Exception; + + /** + * @return The path to the binary files, with variables left intact. + */ + public abstract String getDestinationPath(); + + /** + * @return The fully qualified path to the binary files, with variables expanded. + */ + public abstract String getDestinationPath(Node node); + + /** + * @return The name of the application defined during installation. + */ + public String getName() { + return this.name; + } + + /** + * @return an enum that describes the type of archive that contains this application. + */ + public ArchiveType getArchiveType() { + return this.archiveType; + } + + /** + * @return An enum that describes the type of application represented by this instance. + */ + public ApplicationType getApplicationType() { + return this.type; + } + + public Set getModules() throws Exception { + return new HashSet(); + } + + /** + * Returns the root folder for the application installation. This is either + * the default folder, or the one specified in AppDeploymentOptions during + * installation. + */ + public String getInstallLocation() { + return getInstallLocation(null); + } + + public String getInstallLocation(Node scope) { + try { + throw new NotImplementedException(); + // if (installLocation == null) + // installLocation = this.getApplicationOptions().getAppDeploymentOptions().getInstallDirectory(); + // + // if (scope != null) + // return scope.expandString(installLocation); + } catch (Exception e) { + Log.error(c, "getInstallLocation", e); + } + return null; + } + + /** + * @return A reference to the scope used to create this application. + */ + public Scope getScope() { + return this.scope; + } + + /** + * @return The full path of the archive on the cell's server. + */ + public String getArchivePath() { + return getInstallLocation() + "/" + getName() + ".ear"; + } + + /** + * @return True if the application is installed. + * @throws Exception + */ + public boolean isInstalled() throws Exception { + Log.entering(c, "isInstalled"); + isInstalled = true; + Log.exiting(c, "isInstalled", isInstalled); + return isInstalled; + } + + /** + * Attempts to launch the application, and -- if successful -- waits up to + * five minutes for the app to finish starting on all targets. If the launch + * operation is not successful, the call will return immediately. + * + * @param wait True to wait synchronously for a successful launch. + * @return An instance of OperationResults containing all startup information. + * @throws Exception + */ + public OperationResults start(boolean wait) throws Exception { + // Default to three minutes + return start(wait, 30000); + } + + /** + * Attempts to launch the application, and -- if successful -- waits up to + * the specified timeout (ms) for the app to finish starting on all targets. + * If the launch operation is not successful, the call will return immediately. + * + * @param wait True to wait synchronously for a successful launch. + * @param timeout The duration to wait for a successful launch in milliseconds. + * @return An instance of OperationResults containing all startup information. + * @throws Exception + */ + public OperationResults start(boolean wait, long timeout) throws Exception { + Log.entering(c, "start", new Object[] { wait, timeout }); + OperationResults result = start(); + if (!result.isSuccess()) + return result; + + if (wait) { + ApplicationStatus state = waitForState(ApplicationStatus.STARTED, timeout); + OperationResults tmp = new OperationResults(state == ApplicationStatus.STARTED); + // Copy over notifications etc. + OperationResults.setOperationResults(tmp, result); + result = tmp; + } + Log.exiting(c, "start", result); + return result; + } + + /** + * Attempts to stop the application, and -- if successful -- waits up to + * five minutes for the app to finish stopping on all targets. If the stop + * operation is not successful, the call will return immediately. + * + * @param wait True to wait synchronously for a complete stop. + * @return An instance of OperationResults containing all shutdown information. + * @throws Exception + */ + public OperationResults stop(boolean wait) throws Exception { + // Default to three minutes + return stop(wait, 30000); + } + + /** + * Attempts to stop the application, and -- if successful -- waits up to + * the specified timeout (ms) for the app to finish stopping on all targets. + * If the stop operation is not successful, the call will return immediately. + * + * @param wait True to wait synchronously for a complete stop. + * @param timeout The duration to wait for a complete stop in milliseconds. + * @return An instance of OperationResults containing all shutdown information. + * @throws Exception + */ + public OperationResults stop(boolean wait, long timeout) throws Exception { + Log.entering(c, "stop", new Object[] { wait, timeout }); + OperationResults result = stop(); + if (!result.isSuccess()) + return result; + + if (wait) { + ApplicationStatus state = waitForState(ApplicationStatus.STOPPED, timeout); + OperationResults tmp = new OperationResults(state == ApplicationStatus.STOPPED); + // Copy over notifications etc. + OperationResults.setOperationResults(tmp, result); + result = tmp; + } + Log.exiting(c, "stop", result); + return result; + } + + /** + * This method returns true if the application is running on any of its deployed targets. Use + * the {@link #getApplicationStatus()} to get the aggregate status of the application across all + * deployed targets and the {@link #getApplicationStatus(Scope)} method to get the + * status of the application on a particular target. + * TODO This should call getApplicationStatus instead. + * + * @return True if the application is running on any of its deployed targets + * @throws Exception + */ + public boolean isStarted() throws Exception { + Log.entering(c, "isStarted"); + ApplicationStatus result = this.getApplicationStatus(); + Log.exiting(c, "isStarted", (result == ApplicationStatus.STARTED)); + return (result == ApplicationStatus.STARTED); + } + + /** + * Check the status of an application on a particular server. This method returns {@link ApplicationStatus#STARTED} if the application is running on the server. + * {@link ApplicationStatus#STOPPED} is + * returned if the application is not running on the target and the server or the node manager + * is running. {@link ApplicationStatus#UNKNOWN} is returned if the application is not running on the + * server and the node manager is not available. + * + * @param server The {@link Server} to get the status of the application on + * @return The status of the application on the particular server + * @throws Exception + */ + protected ApplicationStatus getApplicationStatus(Server server) throws Exception { + final String method = "getServerSpecificApplicationStatus"; + Log.entering(c, method, server); + ApplicationStatus ret = ApplicationStatus.STARTED; + Log.exiting(c, method, ret); + return ret; + } + + /** + * Get the status of the application on the specified {@link Scope}. This method returns {@link ApplicationStatus#STARTED} if the application is running on all the servers in + * the scope. If the + * Scope is a {@link Cluster} all the members of the cluster are checked. This method returns {@link ApplicationStatus#STOPPED} if the application is not running on any of the + * servers in the Scope + * and at least one of the node manager servers is running. This method returns {@link ApplicationStatus#UNKNOWN} if the application is not running on any of the servers in the + * Scope + * and the node manager is not available. This method returns {@link ApplicationStatus#PARTIALLY_STARTED} if the application is running on at least one of the servers in the + * scope but not all. + * + * @param scope The {@link Scope} to query + * @return The aggregate status of the application on the specified Scope + * @throws Exception + */ + public ApplicationStatus getApplicationStatus(Scope scope) throws Exception { + final String method = "getApplicationStatus"; + Log.entering(c, method, scope); + ApplicationStatus status = ApplicationStatus.STARTED; + Log.exiting(c, method, status); + return status; + } + + /** + * Get the aggregate status of an application across all deployed targets. This method returns {@link ApplicationStatus#STARTED} if the application is running on all deployed + * targets. This method + * returns {@link ApplicationStatus#STOPPED} if the application is not running on any of the deployed + * targets and the application status is not {@link ApplicationStatus#UNKNOWN} on at least one of the + * targets. {@link ApplicationStatus#UNKNOWN} is returned if the manager server is not running on all the + * nodes of all the deployed targets. {@link ApplicationStatus#PARTIALLY_STARTED} is returned if the + * application is running on at least one target but not all targets. + * + * @return The status aggregate status of the application + * @throws Exception + */ + public ApplicationStatus getApplicationStatus() throws Exception { + final String method = "getApplicationStatus"; + Log.entering(c, method); + ApplicationStatus status = ApplicationStatus.STARTED; + Log.exiting(c, method, status); + return status; + } + + /** + * @return The ApplicationManager instance that manages this application. + */ + public ApplicationManager getApplicationManager() { + return this.applications; + } + + private ApplicationStatus waitForState(ApplicationStatus expected, long timeout) throws Exception { + ApplicationStatus result = ApplicationStatus.UNKNOWN; + + long end = System.currentTimeMillis() + timeout; + while (System.currentTimeMillis() < end && result != expected) { + try { + Thread.sleep(500); + } catch (Exception e) { + } + result = getApplicationStatus(); + } + + return result; + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/ApplicationManager.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/ApplicationManager.java new file mode 100755 index 000000000000..30542f7a3f4c --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/ApplicationManager.java @@ -0,0 +1,671 @@ +package com.ibm.websphere.simplicity.application; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.Node; +import com.ibm.websphere.simplicity.OperationResults; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.Scope; +import com.ibm.websphere.simplicity.application.loose.VirtualArchive; +import com.ibm.websphere.simplicity.application.loose.VirtualArchiveFactory; +import com.ibm.websphere.simplicity.application.tasks.ApplicationTask; +import com.ibm.websphere.simplicity.exception.ApplicationNotInstalledException; +import com.ibm.websphere.simplicity.exception.NotImplementedException; +import com.ibm.websphere.simplicity.exception.NullArgumentException; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.topology.impl.LibertyServer; + +/** + * Maintains state information for applications running on the cell, + * and provides APIs to install and uninstall applications. + */ +public class ApplicationManager { + + private static Class c = ApplicationManager.class; + private static final String CHANGE_KEY_APPS = "applications"; + + protected Scope scope; + protected Set applications; + private LibertyServer target; + + enum InstallType { + NORMAL_FILE, NORMAL_EXTRACTION, LOOSE_EXTRACTION + }; + + public ApplicationManager(Scope scope) throws Exception { + this.scope = scope; + } + + /** + * @param type The type of application install root you want to retrieve. + * @return The root path to which applications of the specified type are installed. + * @throws Exception + */ + public String getInstallLocation(ApplicationType type) throws Exception { + String path = ((Node) scope).getProfileDir(); + String imageName = System.getProperty("image.name", "wlp"); + path += "/" + imageName + "/usr/shared/apps/"; + return path; + } + + /** + * Installing an application has a few steps, the most important of which is + * setting the options prior to installation. The install wrapper provides + * access to those options. When you are ready to install, call + * ApplicationManager.install(InstallWrapper). + *

+ * The app file parameter can point to any file on any machine, as long as + * it's accessible from the local machine. Simplicity will perform the + * necessary copy operations to install the application. + * + * @param appFile A pointer to the application file to install. + * @return An InstallWrapper instance in which application options can be set. + * @throws Exception + */ + public InstallWrapper getInstallWrapper(RemoteFile appFile) throws Exception { + if (!appFile.getName().endsWith(".ear")) + throw new Exception("This API is valid only for EAR-type archives. Please use the alternative getInstallWrapper API for other archive types."); + return getInstallWrapper(appFile, ArchiveType.EAR); + } + + public InstallWrapper getInstallWrapper(RemoteFile appFile, ArchiveType archiveType) throws Exception { + if (!archiveType.equals(ArchiveType.EAR)) + throw new NotImplementedException(); + List tasks = new ArrayList(); + InstallWrapper ret = new InstallWrapper(appFile, tasks, scope, archiveType); + return ret; + } + + /** + * @param name The name of the application. + * @return True if the specified application is installed on the cell from which this ApplicationManager instance was obtained. + * @throws Exception + */ + public boolean isInstalled(String name) throws Exception { + List list = getApplicationNames(); + for (String s : list) + if (s.equalsIgnoreCase(name)) + return true; + return false; + } + + /** + * @return A list of names of applications installed on the cell from which this ApplicationManager was obtained. + * @throws Exception + */ + public List getApplicationNames() throws Exception { + Log.entering(c, "getList"); + List result = listApplications(); + + Log.exiting(c, "getList", result.toArray()); + return result; + } + + /** + * Get the currently installed {@link Application}s + * + * @return A Set of {@link Application}s representing the currently + * installed apps + * @throws Exception + */ + public Set getApplications() throws Exception { + final String method = "getApplications"; + Log.entering(c, method); + if (this.applications == null) { + List appNames = this.getApplicationNames(); + this.applications = new HashSet(); + for (String appName : appNames) { + // TODO Will need to update this for other application types... + this.addApplication(Application.create(this, ApplicationType.EAR, appName, this.scope)); + } + } + Log.exiting(c, method, this.applications); + return new HashSet(this.applications); + } + + /** + * Performs all of the steps necessary to prepare, copy and install the application + * defined by the options parameter. + * + * @param appName The name of the application to be installed. + * @param options The settings for the application to be installed + * @return An OperationResults instance for an application installation. That instance will contain a reference to the newly installed app. + * @throws Exception + */ + public OperationResults install(String appName, InstallWrapper options) throws Exception { + options.getAppDeploymentOptions().setApplicationName(appName); + return install(options); + } + + /** + * Get an {@link Application} that has the specified name + * + * @param name + * The name of the application to get + * @return The {@link Application} with the specified name or null if no + * application with that name exists + * @throws Exception + */ + public Application getApplicationByName(String name) throws Exception { + final String method = "getApplicationByName"; + Log.entering(c, method, name); + Set apps = this.getApplications(); + for (Application app : apps) { + if (app.getName().equalsIgnoreCase(name)) { + Log.exiting(c, method, app); + return app; + } + } + return null; + } + + /** + * Performs all of the steps necessary to prepare, copy and install the application + * defined by the options parameter. + * + * @param options The settings for the application to be installed + * @return An OperationResults instance for an application installation. That instance will contain a reference to the newly installed app. + * @throws Exception + */ + public OperationResults install(InstallWrapper options) throws Exception { + Log.entering(c, "install", options); + if (options == null) + throw new NullArgumentException("options"); + + RemoteFile file = options.getEarFile(); + String name = options.getAppDeploymentOptions().getApplicationName(); + if (name == null) + name = file.getName(); + installApplication(name, file, ApplicationType.EAR); + + this.addApplication(Application.create(this, ApplicationType.EAR, name, this.scope)); + + /* + * final String appName = options.getAppDeploymentOptions().getApplicationName(); + * + * if (isInstalled(appName)) + * throw new ApplicationAlreadyInstalledException(appName); + * + * ensureMinimumInstallOptions(appName, options); + * + * scope.getWorkspace().registerConfigChange(this, CHANGE_KEY_APPS, getApplications()); + * + * final Cell fcell = this.scope; + * final RemoteFile fearFile = options.getEarFile(); + * final InstallWrapper fwrapper = options; + * Log.finer(c, "install", "Performing installation", options.toTaskString()); + * OperationResults results = OperationsProviderFactory.getProvider().getApplicationOperationsProvider().installApplication(fcell, appName, fearFile, fwrapper, + * fcell.getActiveSession()); + * + * Application app = null; + * if (results.isSuccess()) { + * app = Application.create(this, ApplicationType.Enterprise, appName, this.scope); + * results.setResult(app); + * this.addApplication(app); + * } + */ + OperationResults results = new OperationResults(false); + Log.exiting(c, "install", results.isSuccess()); + return results; + } + + /** + * Add an Application to the internal Set + * + * @param app + * The Application to add + */ + protected void addApplication(Application app) { + if (this.applications == null) { + this.applications = new HashSet(); + } + this.applications.add(app); + } + + /** + * Performs the steps necessary to uninstall an application from the cell. + * + * @param appName The name of the application to uninstall. + * @return An OperationResults instance containing information about the uninstall, including whether it was successful. + * @throws Exception + */ + public OperationResults uninstall(String appName) throws Exception { + final String method = "uninstall"; + Log.entering(c, method, appName); + + if (!isInstalled(appName)) { + throw new ApplicationNotInstalledException(appName); + } + + //scope.getWorkspace().registerConfigChange(this, CHANGE_KEY_APPS, getApplications()); + + uninstallApplication(appName, ApplicationType.EAR, false); + + this.removeApplication(this.getApplicationByName(appName)); + + OperationResults results = new OperationResults(true); + Log.exiting(c, method, results.isSuccess()); + return results; + } + + /** + * Remove an Application from the internal Set + * + * @param app + * The Application to remove + * @throws Exception + */ + protected void removeApplication(Application app) throws Exception { + if (this.applications != null && app != null) { + this.applications.remove(app); + } + } + + /** + * For internal use only. + */ + public void commit(HashMap values) throws Exception {} + + /** + * For internal use only. + */ + @SuppressWarnings("unchecked") + public void rollback(HashMap values) throws Exception { + for (Map.Entry entry : values.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key.equals(CHANGE_KEY_APPS)) { + this.applications = (Set) value; + } + } + } + + public ApplicationManager(LibertyServer target) throws Exception { + this.target = target; + } + + public String getApplicationPath() { + return target.getInstallRoot() + "/usr/shared/apps"; + } + + /** + * Installs the provides app file into the appropriate Alpine destination. + * + * @param name The name of the application (currently unused) + * @param app The application archive + * @param type The application type (currently unused) + * @throws Exception + */ + public void installApplication(String name, RemoteFile app, ApplicationType type) throws Exception { + installApplication(name, app, type, false); + } + + /** + * Installs the provides app file into the appropriate Alpine destination. + * + * @param name The name of the application (currently unused) + * @param app The application archive + * @param type The application type (currently unused) + * @param restart Set to "true" to restart the server after installation + * @throws Exception + */ + public void installApplication(String name, RemoteFile app, ApplicationType type, boolean restart) throws Exception { + //have moved the getDeployPath into the depolyApplication method so as to support .ZIP's + deployApplication(name, app, type, restart); + } + + public void uninstallApplication(String name, ApplicationType type, boolean restart) throws Exception { + final String method = "uninstallApplication"; + + String path = ""; + String appNameAsStoredByLibertyServer = name; + + if (type.equals(ApplicationType.ZIP)) { + path = getDeployPath(type) + "/" + name; + } else { + path = getDeployPath(type) + "/" + name + "." + type.toString().toLowerCase(); + + } + + Machine m = target.getMachine(); + RemoteFile app_target = m.getFile(path); + + Log.info(c, method, "Uninstalling Application " + + app_target.getAbsolutePath()); + + if (restart) { + target.stopServer(); + } + VirtualArchiveFactory factory = new VirtualArchiveFactory(); // does not maintain state; no need to cache the factory + VirtualArchive archive = factory.unmarshal(app_target); + if (archive != null) { + Log.info(c, method, "Virtual archive detected; need to delete physical entries before deleting the archive itself"); + factory.delete(m, archive); + // FIXME: Danger! What if an unsuspecting tester writes a virtual archive with an entry where sourceOnDisk="C:/"? When we uninstall the app, we'll try to recursively delete the whole file system! Hopefully that won't happen. + } + if (!app_target.delete()) + throw new Exception("Unable to delete the target application"); + + target.removeInstalledAppForValidation(appNameAsStoredByLibertyServer); + + if (restart) { + target.startServer(); + } + } + + public List listApplications() throws Exception { + List ret = new ArrayList(); + Machine m = target.getMachine(); + for (ApplicationType type : ApplicationType.values()) { + RemoteFile dir = m.getFile(getDeployPath(type)); + RemoteFile[] list = dir.list(false); + if (list != null) { + for (RemoteFile file : list) { + String name = file.getName(); + if (file.isDirectory()) { //&& + //!file.getName().contains("aries") && + //!file.getName().contains("webcontainer")) { + name = this.removeExtension(name); // remove extension of application type (.ear/.war/etc) + } else { // a file + if (name.endsWith(".xml")) { + name = this.removeExtension(name); // remove extension of loose archive (.xml) + } + name = this.removeExtension(name); // remove extension of application type (.ear/.war/etc) + } + ret.add(name); + } + } + } + return ret; + } + + protected String removeExtension(String fileName) { + if (fileName.contains(".")) { + return fileName.substring(0, fileName.lastIndexOf(".")); + } + return fileName; + } + + private String getDeployPath(ApplicationType type) { + String path = null; + switch (type) { + case EBA: + path = getApplicationPath() + "/aries"; + break; + case WAR: + case ZIP: + case JS: + //case Enterprise: + case Asset: + case EAR: + path = getApplicationPath() + "/webcontainer"; + break; + } + return path; + } + + private String getDeployPath(String name, ApplicationType type) { + String path = getDeployPath(type); + return path + "/" + name + "." + type.name().toLowerCase(); + } + + /** + * Reads the bootstrapping.properties value for "fat.installType" to determine how applications should be installed. An "extract" install will unzip application archives during + * deployment. A "file" install will deploy the application as an archive to liberty. A "loose" install will extract application arvhives using a loose configuration and + * generate a virtual archive XML. The default (traditional) implementation is "extract". + * + * @return the installation type selected by the user. This field can be configured at the personal build level. + */ + protected InstallType getInstallType() throws Exception { + String userInstallType = Bootstrap.getInstance().getValue("fat.installType"); + if (userInstallType != null) { + userInstallType = userInstallType.trim(); + } + InstallType result = InstallType.NORMAL_EXTRACTION; // default to original implementation + if ("loose".equalsIgnoreCase(userInstallType)) { + result = InstallType.LOOSE_EXTRACTION; + } + if ("file".equalsIgnoreCase(userInstallType)) { + result = InstallType.NORMAL_FILE; + } + if ("extract".equalsIgnoreCase(userInstallType)) { + result = InstallType.NORMAL_EXTRACTION; + } + Log.info(c, "getInstallType", "Requested Install Type='" + userInstallType + "'; Using Install Type='" + result + "'"); + return result; + } + + private void deployApplication(String name, RemoteFile app, ApplicationType type, boolean restart) throws Exception { + final String method = "deployApplication"; + + InstallType installType = this.getInstallType(); + + /* + * When using NORMAL_FILE copy, the message that is supposed to appear after install did not happen in time, + * [junit] [10/11/2011 18:16:26:270 EDT] 000 LibertyServer validateAppsLoaded I Waiting for app loaded confirmations: + * "CWWKZ0001I: The application webcontainer.watchdog has started successfully." to be found in + * C:/WAS_Sandbox/RTCworkspace/build.image/wlp/usr/servers/webcontainer-8.0_tWAS_fat_server/logs/console.log + * [junit] [10/11/2011 18:16:58:590 EDT] 000 LibertyServer validateAppsLoaded S Exception thrown confirming apps are loaded when validating that + * C:/WAS_Sandbox/RTCworkspace/build.image/wlp/usr/servers/webcontainer-8.0_tWAS_fat_server/logs/console.log contains application install messages. + * [junit] componenttest.exception.TopologyException: According to the logs, application webcontainer.watchdog was never installed. + * + * This causes the first few (8-20) requests to fail. + */ + //installType = InstallType.NORMAL_FILE; + + Machine m = target.getMachine(); + //boolean copied = true; + + String targetPath = getDeployPath(name, type); + RemoteFile app_target = null; + + //RemoteFile app_temp_target = null; + + String installedAppName = name; + //If it's a zip file unpack into a folder name excluding the .zip postfix + if (type.equals(ApplicationType.ZIP)) { + app_target = m.getFile(targetPath.substring(0, targetPath.length() - 4)); + boolean b = app_target.mkdirs(); + if (!b) { + Log.info(c, method, "problem making dirs for ZIP : " + app_target); + } + if (installType == InstallType.NORMAL_FILE) { + //change how to install a zip ... use extraction + Log.info(c, method, "installing a zip via extraction"); + installType = InstallType.NORMAL_EXTRACTION; + } + } else { + if ((type.equals(ApplicationType.EAR) || type.equals(ApplicationType.WAR)) + && (installType == InstallType.NORMAL_FILE || installType == InstallType.LOOSE_EXTRACTION)) { + String targetPathParentDir = getDeployPath(type); + app_target = m.getFile(targetPathParentDir); + boolean b = app_target.mkdirs(); + if (!b) { + Log.info(c, method, "problem making dirs : " + app_target); + } + //app_target = m.getFile(targetPath.substring(0, targetPath.length() - 4)); + app_target = m.getFile(targetPath); + } else { + app_target = m.getFile(targetPath); + boolean b = app_target.mkdirs(); + if (!b) { + Log.info(c, method, "problem making dirs : " + app_target); + } + } + } + + switch (installType) { + case NORMAL_FILE: + installNormalFile(m, app_target, app, targetPath, type); + break; + case LOOSE_EXTRACTION: + installLooseExtraction(app, app_target); + break; + case NORMAL_EXTRACTION: + default: + installNormalExtraction(m, app_target, app, targetPath); + break; + + } + + //Need to log this app is installed on the server + target.addInstalledAppForValidation(installedAppName); + + // Restart the server + if (restart) { + Log.info(c, method, "Restarting server as requested as have just installed " + app.getName()); + target.restartServer(); + } + } + + private void installNormalFile(Machine m, RemoteFile app_target, RemoteFile app, String targetPath, ApplicationType type) throws Exception { + final String method = "installNormalFile"; + + Log.info(c, method, "installing an application via file : " + app.getAbsolutePath() + " to " + app_target.getAbsolutePath()); + if (!app.getAbsolutePath().equals(targetPath)) { + app.copyToDest(app_target); + } else { + //I don't think we will ever get in here + Log.info(c, method, "using app without copying : " + app.getAbsolutePath()); + //copied = false; + } + } + + /** + * Originally, I wanted to use the server root directory to store physical entries from virtual archives, in order to auto-backup these entries during server stop. However, + * this process is very time consuming, so I'm storing physical entries in the unmonitored app root instead. + * + * @return the parent directory of all physical entries of virtual archives + */ + protected RemoteFile getLooseConfigRoot() { + Machine libertyMachine = this.target.getMachine(); + String looseConfigParentDir = this.getApplicationPath();//this.target.getServerRoot(); + return new RemoteFile(libertyMachine, looseConfigParentDir + "/looseConfig"); + } + + private void installLooseExtraction(RemoteFile sourceArchive, RemoteFile destinationFile) throws Exception { + RemoteFile physicalArchive = sourceArchive; + RemoteFile virtualLocation = this.getLooseConfigRoot(); + RemoteFile virtualArchive = destinationFile; + VirtualArchiveFactory factory = new VirtualArchiveFactory(); // does not maintain state; no need to cache the factory + factory.extract(physicalArchive, virtualLocation, virtualArchive); + } + + private void installNormalExtraction(Machine m, RemoteFile app_target, RemoteFile app, String targetPath) throws Exception { + final String method = "installNormalExtraction"; + + boolean copied = true; + + RemoteFile app_temp_target = m.getFile(target.getInstallRoot() + "/simplicityTemp"); + app_temp_target.mkdirs(); + + if (!app.getParentFile().getAbsolutePath().equals(targetPath)) { + //use this temporary directory so there is no lock held on the file when it's dropped in the apps directory + app.copyToDest(app_temp_target); + } else { + //I don't think we will ever get in here + Log.info(c, method, "using app without copying : " + app.getAbsolutePath()); + copied = false; + app_temp_target = app.getParentFile(); + } + + RemoteFile app_remote = m.getFile(app_temp_target, app.getName()); + + // Unzip and delete the file + // Use a single string instead of parameters for the command or it doesn't work so well on local linux because + // of how LocalProvider works + String command = m.getFile(target.getMachineJavaJarCommandPath()).getAbsolutePath(); + String[] parameters = { "xf", "\"" + app_remote.getAbsolutePath() + "\"" }; + ProgramOutput unzipEARoutput = m.execute(command, parameters, app_temp_target.getAbsolutePath()); + if (unzipEARoutput.getReturnCode() != 0) { + throw new IOException(unzipEARoutput.getCommand() + " reported " + unzipEARoutput.getStderr()); + } + + if (copied) { + if (!app_remote.delete()) { + Log.info(c, method, "failure to delete temporary file: " + app_remote.getAbsolutePath()); + } + //if (!(app_temp_target.delete())) { + // Log.info(c, method, "failure to delete temporary file: " + app_temp_target.getAbsolutePath()); + //} + } + + // Iterate over all WAR files, unzipping them + // Using jar to unzip means we can run this on different platforms but + // makes it harder to unzip as we can't create a .war dir in the same dir as the actual war file. + // Therefore we need to create a temp WAR file dir to use while we create the .war dirs and then + // unzip the wars into their respective dirs + //final String TEMP_WAR_DIR = "/tempWARS/"; + //RemoteFile tempWARFileDir = null; + RemoteFile[] wars = app_temp_target.list(false); + boolean recursive = true; + boolean overwrite = true; + for (RemoteFile war : wars) { + if (war.isDirectory() || !war.getName().toLowerCase().endsWith(".war")) { + //recursively move everything except war files. We are going to extract war files. + Log.info(c, method, "copying " + war.getAbsolutePath() + "to dest " + app_target.getAbsolutePath()); + RemoteFile newDir = null; + if (war.isDirectory()) { + newDir = new RemoteFile(m, app_target, war.getName()); + newDir.mkdirs(); + } else { + //must be a jar or something + //don't extract - just copy into this dir + newDir = app_target; + } + + Log.info(c, method, "copying " + war.getAbsolutePath() + "to dest " + newDir.getAbsolutePath()); + war.copyToDest(newDir, recursive, overwrite); + war.delete(); + continue; + } + + //tempWARFileDir = m.getFile(targetPath + TEMP_WAR_DIR); + //tempWARFileDir.mkdirs(); + + String warname = war.getName(); + //String warAbsPath = app_target.getAbsolutePath(), warname; + //war.getAbsolutePath(); + + //Copy the WAR to the temp Dir + //war.copyToDest(tempWARFileDir); + //Now delete it from it's current location + //war.delete(); + + //Create the dir that will hold the contents of the unzipped WAR + RemoteFile newWARDir = new RemoteFile(m, app_target, warname); + newWARDir.mkdirs(); + + //RemoteFile newWARFile = m.getFile(targetPath + TEMP_WAR_DIR + warname); + + //Unzip the WAR + parameters = new String[] { "xf", war.getAbsolutePath() }; + ProgramOutput warUnzipOutput = m.execute(command, parameters, newWARDir.getAbsolutePath()); + if (warUnzipOutput.getReturnCode() != 0) { + throw new IOException(warUnzipOutput.getCommand() + " reported " + warUnzipOutput.getStderr()); + } + war.delete(); + } + + //Now we can delete the tempWAR folder and all it's contents + //if (tempWARFileDir != null) { + // tempWARFileDir.delete(); + //} + + if (copied) { + if (!(app_temp_target.delete())) { + Log.info(c, method, "failure to delete temporary directory: " + app_temp_target.getAbsolutePath()); + } + } + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/ApplicationOptions.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/ApplicationOptions.java new file mode 100755 index 000000000000..b37cd1760633 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/ApplicationOptions.java @@ -0,0 +1,537 @@ +package com.ibm.websphere.simplicity.application; + +import java.lang.reflect.Field; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.List; +import java.util.Set; +import java.util.Vector; + +import com.ibm.websphere.simplicity.Scope; +import com.ibm.websphere.simplicity.application.tasks.ActSpecJNDITask; +import com.ibm.websphere.simplicity.application.tasks.AppDeploymentOptionsTask; +import com.ibm.websphere.simplicity.application.tasks.ApplicationTask; +import com.ibm.websphere.simplicity.application.tasks.BackendIdSelectionTask; +import com.ibm.websphere.simplicity.application.tasks.BindJndiForEJBBusinessTask; +import com.ibm.websphere.simplicity.application.tasks.BindJndiForEJBMessageBindingTask; +import com.ibm.websphere.simplicity.application.tasks.BindJndiForEJBNonMessageBindingTask; +import com.ibm.websphere.simplicity.application.tasks.CorrectOracleIsolationLevelTask; +import com.ibm.websphere.simplicity.application.tasks.CorrectUseSystemIdentityTask; +import com.ibm.websphere.simplicity.application.tasks.CtxRootForWebModTask; +import com.ibm.websphere.simplicity.application.tasks.CustomTask; +import com.ibm.websphere.simplicity.application.tasks.DataSourceFor10CMPBeansTask; +import com.ibm.websphere.simplicity.application.tasks.DataSourceFor10EJBModulesTask; +import com.ibm.websphere.simplicity.application.tasks.DataSourceFor20CMPBeansTask; +import com.ibm.websphere.simplicity.application.tasks.DataSourceFor20EJBModulesTask; +import com.ibm.websphere.simplicity.application.tasks.DefaultBindingTask; +import com.ibm.websphere.simplicity.application.tasks.EJBDeployOptionsTask; +import com.ibm.websphere.simplicity.application.tasks.EmbeddedRarTask; +import com.ibm.websphere.simplicity.application.tasks.EnsureMethodProtectionFor10EJBTask; +import com.ibm.websphere.simplicity.application.tasks.EnsureMethodProtectionFor20EJBTask; +import com.ibm.websphere.simplicity.application.tasks.JSPCompileOptionsTask; +import com.ibm.websphere.simplicity.application.tasks.JSPReloadForWebModTask; +import com.ibm.websphere.simplicity.application.tasks.ListModulesTask; +import com.ibm.websphere.simplicity.application.tasks.MapEJBRefToEJBTask; +import com.ibm.websphere.simplicity.application.tasks.MapMessageDestinationRefToEJBTask; +import com.ibm.websphere.simplicity.application.tasks.MapModulesToServersEntry; +import com.ibm.websphere.simplicity.application.tasks.MapModulesToServersTask; +import com.ibm.websphere.simplicity.application.tasks.MapResEnvRefToResTask; +import com.ibm.websphere.simplicity.application.tasks.MapResRefToEJBTask; +import com.ibm.websphere.simplicity.application.tasks.MapRolesToUsersTask; +import com.ibm.websphere.simplicity.application.tasks.MapRunAsRolesToUsersTask; +import com.ibm.websphere.simplicity.application.tasks.MapWebModToVHTask; +import com.ibm.websphere.simplicity.application.tasks.MetadataCompleteForModulesTask; +import com.ibm.websphere.simplicity.application.tasks.MultiEntryApplicationTask; +import com.ibm.websphere.simplicity.application.tasks.WSDeployOptionsTask; +import com.ibm.websphere.simplicity.log.Log; + +public class ApplicationOptions { + + private static Hashtable standardTasks = new Hashtable(); + private static Class c = ApplicationOptions.class; + private static Field[] fields = c.getDeclaredFields(); + + static { + mapTasksToClasses(); + } + + public static Class getTaskClass(String taskName) { + if (standardTasks.containsKey(taskName)) + return standardTasks.get(taskName); + else + return CustomTask.class; + } + + public ApplicationOptions(List tasks, Scope scope) throws Exception { + this.tasks = tasks; + this.scope = scope; + if (tasks != null) + loadTasks(tasks); + } + + protected Scope scope = null; + protected List tasks = null; + protected Vector customTasks = new Vector(); + protected Set modules = null; + + protected ActSpecJNDITask actSpecJndi = new ActSpecJNDITask(); + protected AppDeploymentOptionsTask appDeploymentOptions = new AppDeploymentOptionsTask(); + protected BackendIdSelectionTask backendIdSelection = new BackendIdSelectionTask(); + protected BindJndiForEJBBusinessTask bindJndiForEJBBusiness = new BindJndiForEJBBusinessTask(); + protected BindJndiForEJBMessageBindingTask bindJndiForEjbMessageBinding = new BindJndiForEJBMessageBindingTask(); + protected BindJndiForEJBNonMessageBindingTask bindJndiForEjbNonMessageBinding = new BindJndiForEJBNonMessageBindingTask(); + protected CorrectOracleIsolationLevelTask correctOracleIsolationLevel = new CorrectOracleIsolationLevelTask(); + protected CorrectUseSystemIdentityTask correctUseSystemIdentity = new CorrectUseSystemIdentityTask(); + protected CtxRootForWebModTask ctxRootForWebMod = new CtxRootForWebModTask(); + protected DataSourceFor10CMPBeansTask dataSourceFor10CmpBeans = new DataSourceFor10CMPBeansTask(); + protected DataSourceFor10EJBModulesTask dataSourceFor10EjbModules = new DataSourceFor10EJBModulesTask(); + protected DataSourceFor20CMPBeansTask dataSourceFor20CmpBeans = new DataSourceFor20CMPBeansTask(); + protected DataSourceFor20EJBModulesTask dataSourceFor20EjbModules = new DataSourceFor20EJBModulesTask(); + protected DefaultBindingTask defaultBinding = new DefaultBindingTask(); + protected EJBDeployOptionsTask ejbDeployOptions = new EJBDeployOptionsTask(); + protected EmbeddedRarTask embeddedRar = new EmbeddedRarTask(); + protected EnsureMethodProtectionFor10EJBTask ensureMethodProtectionFor10Ejb = new EnsureMethodProtectionFor10EJBTask(); + protected EnsureMethodProtectionFor20EJBTask ensureMethodProtectionFor20Ejb = new EnsureMethodProtectionFor20EJBTask(); + protected JSPCompileOptionsTask jspCompileOptions = new JSPCompileOptionsTask(); + protected JSPReloadForWebModTask jspReloadForWebMod = new JSPReloadForWebModTask(); + protected ListModulesTask listModules = new ListModulesTask(); + protected MapEJBRefToEJBTask mapEjbRefToEjb = new MapEJBRefToEJBTask(); + protected MapMessageDestinationRefToEJBTask mapMessageDestinationRefToEJB = new MapMessageDestinationRefToEJBTask(); + protected MapModulesToServersTask mapModulesToServers = new MapModulesToServersTask(); + protected MapResEnvRefToResTask mapResEnvRefToRes = new MapResEnvRefToResTask(); + protected MapResRefToEJBTask mapResRefToEjb = new MapResRefToEJBTask(); + protected MapRolesToUsersTask mapRolesToUsers = new MapRolesToUsersTask(); + protected MapRunAsRolesToUsersTask mapRunAsRolesToUsers = new MapRunAsRolesToUsersTask(); + protected MapWebModToVHTask mapWebModToVh = new MapWebModToVHTask(); + protected MetadataCompleteForModulesTask metadataCompleteForModules = new MetadataCompleteForModulesTask(); + protected WSDeployOptionsTask wsDeployOptions = new WSDeployOptionsTask(); + + public List getTasks() { + return this.tasks; + } + + public Set getModules() throws Exception { + if (modules == null) { + modules = new HashSet(); + if (mapModulesToServers != null) + for (int i = 0; i < mapModulesToServers.size(); i++) { + MapModulesToServersEntry entry = mapModulesToServers.get(i); + AssetModule module = AssetModule.getModuleInstance(null, entry.getModule(), entry.getUri()); + modules.add(module); + } + } + return modules; + } + + /** + * The ActSpecJNDI option binds Java 2 Connector (J2C) activation specifications + * to destination Java Naming and Directory Interface (JNDI) names. You can + * optionally bind J2C activation specifications in your application or module + * to a destination JNDI name. + */ + public ActSpecJNDITask getActSpecJndi() { + return actSpecJndi; + } + + /** + * Contains general deployment options. These include file permission + * specifications, auto-linking of JNDI names for EE5 apps, enabling + * and disabling distribution of the app, and so on. + */ + public AppDeploymentOptionsTask getAppDeploymentOptions() { + return appDeploymentOptions; + } + + /** + * The BackendIdSelection option specifies the backend ID for the enterprise + * bean Java archive (JAR) modules that have container-managed persistence + * (CMP) beans. An enterprise bean JAR module can support multiple backend + * configurations as specified using an application assembly tool. + */ + public BackendIdSelectionTask getBackendIdSelection() { + return backendIdSelection; + } + + /** + * Specify Java Naming and Directory (JNDI) name bindings for each enterprise bean + * with a business interface in an EJB module. Each enterprise bean with a business + * interface in an EJB module must be bound to a JNDI name. For any business interface + * that does not provide a JNDI name, or if its bean does not provide a JNDI name, a + * default binding name is provided. If its bean provides a JNDI name, the default + * JNDI name for the business interface is provided on top of its bean JNDI name by + * appending the package-qualifed class name of the interface. + *

+ * If you specify the JNDI name for a bean in the Provide JNDI names for beans panel, + * Do not specify both the JNDI name and business interface JNDI name for the same bean. + * If you do not specify the JNDI name for a bean, you can optionally specify a business + * interface JNDI name. If you do not specify a business interface JNDI name, the + * runtime provides a container default. + */ + public BindJndiForEJBBusinessTask getBindJndiForEJBBusiness() { + return bindJndiForEJBBusiness; + } + + /** + * The BindJndiForEJBMessageBinding option Binds enterprise beans to listener + * port names or Java Naming and Directory Interface (JNDI) names. Ensure each + * message-driven enterprise bean in your application or module is bound to a + * listener port name. + */ + public BindJndiForEJBMessageBindingTask getBindJndiForEjbMessageBinding() { + return bindJndiForEjbMessageBinding; + } + + /** + * The BindJndiForEJBNonMessageBinding option binds enterprise beans to Java + * Naming and Directory Interface (JNDI) names. Ensure each non message-driven + * enterprise bean in your application or module is bound to a JNDI name. + */ + public BindJndiForEJBNonMessageBindingTask getBindJndiForEjbNonMessageBinding() { + return bindJndiForEjbNonMessageBinding; + } + + /** + * The CorrectOracleIsolationLevel option specifies the isolation level for the + * Oracle type provider. The last field of each entry specifies the isolation + * level. Valid isolation level values are 2 or 4. + */ + public CorrectOracleIsolationLevelTask getCorrectOracleIsolationLevel() { + return correctOracleIsolationLevel; + } + + /** + * The CorrectUseSystemIdentity option replaces RunAs System to RunAs Roles. The + * enterprise beans that you install contain a RunAs system identity. You can + * optionally change this identity to a RunAs role. + */ + public CorrectUseSystemIdentityTask getCorrectUseSystemIdentity() { + return correctUseSystemIdentity; + } + + /** + * The CtxRootForWebMod option edits the context root of the Web module. You can + * edit a context root that is defined in the application.xml file using this option. + */ + public CtxRootForWebModTask getCtxRootForWebMod() { + return ctxRootForWebMod; + } + + /** + * The DataSourceFor10CMPBeans option specifies optional data sources for + * individual 1.x container-managed persistence (CMP) beans. Mapping a + * specific data source to a CMP bean overrides the default data source + * for the module that contains the enterprise bean. + */ + public DataSourceFor10CMPBeansTask getDataSourceFor10CmpBeans() { + return dataSourceFor10CmpBeans; + } + + /** + * The DataSourceFor10EJBModules option specifies the default data source for + * the enterprise bean module that contains 1.x container-managed persistence + * (CMP) beans. + */ + public DataSourceFor10EJBModulesTask getDataSourceFor10EjbModules() { + return dataSourceFor10EjbModules; + } + + /** + * The DataSourceFor20CMPBeans option specifies optional data sources for + * individual 2.x container-managed persistence (CMP) beans. Mapping a + * specific data source to a CMP bean overrides the default data source + * for the module that contains the enterprise bean. + */ + public DataSourceFor20CMPBeansTask getDataSourceFor20CmpBeans() { + return dataSourceFor20CmpBeans; + } + + /** + * The DataSourceFor20EJBModules option specifies the default data source for + * the enterprise bean 2.x module that contains 2.x container managed + * persistence (CMP) beans. + */ + public DataSourceFor20EJBModulesTask getDataSourceFor20EjbModules() { + return dataSourceFor20EjbModules; + } + + /** + * A collection of default setting options. + */ + public DefaultBindingTask getDefaultBinding() { + return defaultBinding; + } + + /** + * Allows you to specify various options that can be passed when you want to + * deploy EJB modules during application installation. This task has only 2 + * rows. The first row specifies the option name and the second row has the + * corresponding option value. + */ + public EJBDeployOptionsTask getEjbDeployOptions() { + return ejbDeployOptions; + } + + /** + * The EmbeddedRar option binds Java 2 Connector objects to JNDI names. You must + * bind each Java 2 Connector object in your application or module, such as, J2C + * connection factories, J2C activation specifications and J2C administrative + * objects, to a JNDI name. + */ + public EmbeddedRarTask getEmbeddedRar() { + return embeddedRar; + } + + /** + * The EnsureMethodProtectionFor10EJB option selects method protections for + * unprotected methods of 1.x enterprise beans. Specify to leave the method as + * unprotected, or assign protection which denies all access. + */ + public EnsureMethodProtectionFor10EJBTask getEnsureMethodProtectionFor10Ejb() { + return ensureMethodProtectionFor10Ejb; + } + + /** + * The EnsureMethodProtectionFor20EJB option selects method protections for + * unprotected methods of 2.x enterprise beans. Specify to assign a security + * role to the unprotected method, add the method to the exclude list, or mark + * the method as cleared. You can assign multiple roles for a method by + * separating role names with commas. + */ + public EnsureMethodProtectionFor20EJBTask getEnsureMethodProtectionFor20Ejb() { + return ensureMethodProtectionFor20Ejb; + } + + /** + * The JSPCompileOptions option assigns shared libraries to applications or + * every module. You can associate multiple shared libraries to applications + * and modules. + */ + public JSPCompileOptionsTask getJspCompileOptions() { + return jspCompileOptions; + } + + /** + * The JSPReloadForWebMod option edits the JSP reload attributes for the Web + * module. You can specify the reload attributes of the servlet and JSP for + * each module. + */ + public JSPReloadForWebModTask getJspReloadForWebMod() { + return jspReloadForWebMod; + } + + /** + * TODO + */ + public ListModulesTask getListModules() { + return listModules; + } + + /** + * The MapEJBRefToEJB option maps enterprise Java references to enterprise + * beans. You must map each enterprise bean reference defined in your application + * to an enterprise bean. + */ + public MapEJBRefToEJBTask getMapEjbRefToEjb() { + return mapEjbRefToEjb; + } + + /** + * The MapMessageDestinationRefToEJB option maps message destination references + * to Java Naming and Directory Interface (JNDI) names of administrative objects + * from the installed resource adapters. You must map each message destination + * reference that is defined in your application to an administrative object. + */ + public MapMessageDestinationRefToEJBTask getMapMessageDestinationRefToEjb() { + return mapMessageDestinationRefToEJB; + } + + /** + * The MapModulesToServers option specifies the application server where you want + * to install modules that are contained in your application. You can install + * modules on the same server, or disperse them among several servers. + */ + public MapModulesToServersTask getMapModulesToServers() { + return mapModulesToServers; + } + + /** + * The MapResEnvRefToRes option maps resource environment references to resources. + * You must map each resource environment reference that is defined in your + * application to a resource. + */ + public MapResEnvRefToResTask getMapResEnvRefToRes() { + return mapResEnvRefToRes; + } + + /** + * The MapResRefToEJB option maps resource references to resources. You must map + * each resource reference that is defined in your application to a resource. + */ + public MapResRefToEJBTask getMapResRefToEjb() { + return mapResRefToEjb; + } + + /** + * The MapRolesToUsers option maps users to roles. You must map each role that is + * defined in the application or module to a user or group from the domain user + * registry. You can specify multiple users or groups for a single role by + * separating them with a pipe (|). + */ + public MapRolesToUsersTask getMapRolesToUsers() { + return mapRolesToUsers; + } + + /** + * The MapRunAsRolesToUsers option maps RunAs roles to users. The enterprise beans + * you that install contain predefined RunAs roles. Enterprise beans that need to + * run as a particular role for recognition while interacting with another + * enterprise bean use RunAs roles. + */ + public MapRunAsRolesToUsersTask getMapRunAsRolesToUsers() { + return mapRunAsRolesToUsers; + } + + /** + * The MapWebModToVH option selects virtual hosts for Web modules. Specify the + * virtual host where you want to install the Web modules that are contained in + * your application. You can install Web modules on the same virtual host, or + * disperse them among several hosts. + */ + public MapWebModToVHTask getMapWebModToVh() { + return mapWebModToVh; + } + + /** + * If your application contains EJB 3.0 or Web 2.5 modules, you can optionally lock the + * deployment descriptor of one or more of the EJB 3.0 or Web 2.5 modules. If you set + * the metadata-complete attribute to true and lock deployment descriptors, the product + * writes the complete module deployment descriptor, including deployment information + * from annotations, to XML format. + *

+ * Annotations are a standard mechanism of adding metadata to Java classes. You can use + * metadata to simplify development and deployment of Java EE 5 artifacts. Prior to the + * introduction of Java language annotations, deployment descriptors were the standard + * mechanism used by Java EE components. These deployment descriptors were mapped to XML + * format, which facilitated their persistence. If you select to lock deployment + * descriptors, the product merges Java EE 5 annotation-based metadata with the XML-based + * existing deployment descriptor metadata and persists the result. + * + * @return + */ + public MetadataCompleteForModulesTask getMetadataCompleteForModules() { + return metadataCompleteForModules; + } + + /** + * To deploy Java-based Web services, you need an enterprise application, also known + * as an EAR file that is configured and enabled for Web services. + *

+ * A Java? API for XML-Based Web Services (JAX-WS) application does not require + * additional bindings and deployment descriptors for deployment whereas a Java API + * for XML-based RPC (JAX-RPC) Web services application requires you to add + * additional bindings and deployment descriptors for application deployment. JAX-WS + * is much more dynamic, and does not require any of the static data generated by + * the deployment step required for deploying JAX-RPC applications. + *

+ * For JAX-WS Web services, the use of the webservices.xml deployment descriptor is + * optional because you can use annotations to specify all of the information that + * is contained within the deployment descriptor file. You can use the deployment + * descriptor file to augment or override existing JAX-WS annotations. Any information + * that you define in the webservices.xml deployment descriptor overrides any + * corresponding information that is specified by annotations. + */ + public WSDeployOptionsTask getWSDeployOptions() { + return wsDeployOptions; + } + + public ApplicationTask getTaskByName(String taskName) throws Exception { + ApplicationTask ret = null; + if (isCustomTask(taskName)) { + for (CustomTask task : customTasks) + if (task.getTaskName().equalsIgnoreCase(taskName)) { + ret = task; + break; + } + } else { + Class clazz = standardTasks.get(taskName); + for (Field field : fields) { + if (field.getType().equals(clazz)) { + ret = (ApplicationTask) field.get(this); + break; + } + } + } + return ret; + } + + protected boolean isCustomTask(String taskName) { + return !standardTasks.containsKey(taskName); + } + + public String toTaskString() throws Exception { + StringBuilder ret = new StringBuilder(); + for (Field field : fields) { + Class superclass = field.getClass().getSuperclass(); + if (superclass.equals(ApplicationTask.class) || + superclass.equals(MultiEntryApplicationTask.class)) { + ApplicationTask task = (ApplicationTask) field.get(this); + ret.append(task.toString()); + } + } + return ret.toString(); + } + + protected void loadTasks(List tasks) throws Exception { + for (ApplicationTask task : tasks) { + if (task instanceof CustomTask) { + customTasks.add((CustomTask) task); + } else { + // Avoid endless lists of if..then by using reflection + boolean found = false; + for (Field field : fields) { + if (field.getType().equals(task.getClass())) { + field.set(this, task); + found = true; + break; + } + } + if (!found) + Log.warning(c, "Task not found: " + task.getTaskName() + "; make sure it's in the standardTasks map"); + } + } + } + + private static void mapTasksToClasses() { + standardTasks.put(AppConstants.ActSpecJNDITask, ActSpecJNDITask.class); + standardTasks.put(AppConstants.AppDeploymentOptionsTask, AppDeploymentOptionsTask.class); + standardTasks.put(AppConstants.BackendIdSelectionTask, BackendIdSelectionTask.class); + standardTasks.put(AppConstants.BindJndiForEJBBusinessTask, BindJndiForEJBBusinessTask.class); + standardTasks.put(AppConstants.BindJndiForEJBMessageBindingTask, BindJndiForEJBMessageBindingTask.class); + standardTasks.put(AppConstants.BindJndiForEJBNonMessageBindingTask, BindJndiForEJBNonMessageBindingTask.class); + standardTasks.put(AppConstants.CorrectOracleIsolationLevelTask, CorrectOracleIsolationLevelTask.class); + standardTasks.put(AppConstants.CorrectUseSystemIdentityTask, CorrectUseSystemIdentityTask.class); + standardTasks.put(AppConstants.CtxRootForWebMethodTask, CtxRootForWebModTask.class); + standardTasks.put(AppConstants.DataSourceFor10CMPBeansTask, DataSourceFor10CMPBeansTask.class); + standardTasks.put(AppConstants.DataSourceFor10EJBModulesTask, DataSourceFor10EJBModulesTask.class); + standardTasks.put(AppConstants.DataSourceFor20CMPBeansTask, DataSourceFor20CMPBeansTask.class); + standardTasks.put(AppConstants.DataSourceFor20EJBModulesTask, DataSourceFor20EJBModulesTask.class); + standardTasks.put(AppConstants.DefaultBindingTask, DefaultBindingTask.class); + standardTasks.put(AppConstants.EJBDeployOptionsTask, EJBDeployOptionsTask.class); + standardTasks.put(AppConstants.EmbeddedRarTask, EmbeddedRarTask.class); + standardTasks.put(AppConstants.EnsureMethodProtectionFor10EJBTask, EnsureMethodProtectionFor10EJBTask.class); + standardTasks.put(AppConstants.EnsureMethodProtectionFor20EJBTask, EnsureMethodProtectionFor20EJBTask.class); + standardTasks.put(AppConstants.JSPCompileOptionsTask, JSPCompileOptionsTask.class); + standardTasks.put(AppConstants.JSPReloadForWebModTask, JSPReloadForWebModTask.class); + standardTasks.put(AppConstants.ListModulesTaskName, ListModulesTask.class); + standardTasks.put(AppConstants.MapEJBRefToEJBTask, MapEJBRefToEJBTask.class); + standardTasks.put(AppConstants.MapModulesToServersTask, MapModulesToServersTask.class); + standardTasks.put(AppConstants.MapResEnvRefToResTask, MapResEnvRefToResTask.class); + standardTasks.put(AppConstants.MapResRefToEJBTask, MapResRefToEJBTask.class); + standardTasks.put(AppConstants.MapRolesToUsersTask, MapRolesToUsersTask.class); + standardTasks.put(AppConstants.MapRunAsRolesToUsersTask, MapRunAsRolesToUsersTask.class); + standardTasks.put(AppConstants.MapWebModToVHTask, MapWebModToVHTask.class); + standardTasks.put(AppConstants.MetadataCompleteForModulesTask, MetadataCompleteForModulesTask.class); + standardTasks.put(AppConstants.WSDeployOptionsTask, WSDeployOptionsTask.class); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/ApplicationType.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/ApplicationType.java new file mode 100755 index 000000000000..62b3d7c07b67 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/ApplicationType.java @@ -0,0 +1,14 @@ +package com.ibm.websphere.simplicity.application; + +public enum ApplicationType { + + // TODO is this the same as Enterprise? + EBA, + WAR, + EAR, + ZIP, + JS, + //Enterprise, + // BLA, + Asset; +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/EditWrapper.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/EditWrapper.java new file mode 100755 index 000000000000..9ff9fe77937a --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/EditWrapper.java @@ -0,0 +1,26 @@ +package com.ibm.websphere.simplicity.application; + +import java.util.List; + +import com.ibm.websphere.simplicity.Scope; +import com.ibm.websphere.simplicity.application.tasks.ApplicationTask; + +public class EditWrapper extends ApplicationOptions { + + private Application application; + private boolean appEdit; + + public EditWrapper(Application app, List tasks, Scope cell) throws Exception { + super(tasks, cell); + this.application = app; + } + + public Application getApplication() { + return this.application; + } + + public boolean isFullApplicationEdit() { + return appEdit; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/EnterpriseApplication.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/EnterpriseApplication.java new file mode 100755 index 000000000000..d0bb0ed31256 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/EnterpriseApplication.java @@ -0,0 +1,165 @@ +package com.ibm.websphere.simplicity.application; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.websphere.simplicity.Node; +import com.ibm.websphere.simplicity.OperationResults; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.Scope; +import com.ibm.websphere.simplicity.application.tasks.ApplicationTask; +import com.ibm.websphere.simplicity.application.types.UpdateContentType; +import com.ibm.websphere.simplicity.application.types.UpdateType; +import com.ibm.websphere.simplicity.exception.ApplicationNotInstalledException; +import com.ibm.websphere.simplicity.exception.NotImplementedException; +import com.ibm.websphere.simplicity.log.Log; + +/** + * Need to add code to request all installed modules and validation routines. + * Port relevant code from following: + * - GetLocs.java + * ValidateUpdate.java + * AppUpdateTest.java + * ... + * + * @author SterlingBates + * + */ +public class EnterpriseApplication extends Application { + + public EnterpriseApplication(ApplicationManager mgr, String name, Scope scope) throws Exception { + super(mgr, ApplicationType.EAR, name, scope); + } + + @Override + public String getDestinationPath() { + return getInstallLocation() + "/" + this.name + ".ear"; + } + + @Override + public String getDestinationPath(Node node) { + return getInstallLocation(node) + "/" + this.name + ".ear"; + } + + @Override + public UpdateWrapper getUpdateWrapper(RemoteFile originalAppFile) throws Exception { + return getUpdateWrapper(); + } + + @Override + public UpdateWrapper getUpdateWrapper(UpdateType updateType, RemoteFile contents, UpdateContentType contentType) throws Exception { + throw new NotImplementedException(); + } + + @Override + public UpdateWrapper getUpdateWrapper() throws Exception { + throw new NotImplementedException(); + } + + @Override + public OperationResults update(UpdateWrapper options) throws Exception { + throw new NotImplementedException(); + } + + @Override + public OperationResults start() throws Exception { + Log.entering(c, "start"); + OperationResults results = new OperationResults(true); + results.setResult(results.isSuccess()); + Log.exiting(c, "start", results.isSuccess()); + return results; + } + + /** + * Start an application on a specific {@link Scope}. The application will be started on that + * Scope only. + * + * @param target The target to start the application on + * @return The {@link OperationResults} of the command + */ + public OperationResults start(Scope target) throws Exception { + final String method = "start"; + Log.entering(c, method, target); + if (!isInstalled()) { + Exception e = new ApplicationNotInstalledException(this.getName()); + Log.error(c, method, e); + throw e; + } + + OperationResults results = new OperationResults(true); + results.setResult(results.isSuccess()); + + Log.exiting(c, method, results.isSuccess()); + return results; + } + + @Override + public OperationResults stop() throws Exception { + Log.entering(c, "stop"); + if (!isInstalled()) { + Exception e = new ApplicationNotInstalledException(this.getName()); + Log.error(c, "stop", e); + throw e; + } + OperationResults results = new OperationResults(false); + results.setResult(results.isSuccess()); + Log.exiting(c, "stop", results.isSuccess()); + return results; + } + + /** + * Stop an application on a specific {@link Scope}. The application will be stopped on that + * Scope only. + * + * @param target The target to stop the application on + * @return The {@link OperationResults} of the command + */ + public OperationResults stop(Scope target) throws Exception { + final String method = "stop"; + Log.entering(c, method, target); + if (!isInstalled()) { + Exception e = new ApplicationNotInstalledException(this.getName()); + Log.error(c, method, e); + throw e; + } + + OperationResults results = new OperationResults(false); + results.setResult(results.isSuccess()); + + Log.exiting(c, method, results.isSuccess()); + return results; + } + + /** + * Tests to see if the application has been distributed and is ready to be run. + * TODO Rename this to isAppDistributed to reduce confusion with app state APIs + * that identify started state. + * + * @param ignoreUnknownState If true, any node or server with unknown state is not included in the final ready return + * @return true if the application is ready; false otherwise. + */ + public boolean isAppReady(boolean ignoreUnknownState) throws Exception { + final String method = "isAppReady"; + Log.entering(c, method); + + boolean isReady = true; + + Log.exiting(c, method, isReady); + return isReady; + } + + @Override + public OperationResults edit(EditWrapper options) throws Exception { + Log.entering(c, "update", options); + throw new NotImplementedException(); + // Log.exiting(c, "update", results.getResult()); + // return results; + } + + @Override + public EditWrapper getEditWrapper() throws Exception { + List tasks = new ArrayList(); + return new EditWrapper(this, tasks, this.scope); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/InstallWrapper.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/InstallWrapper.java new file mode 100755 index 000000000000..95822be720cc --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/InstallWrapper.java @@ -0,0 +1,36 @@ +package com.ibm.websphere.simplicity.application; + +import java.util.List; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.Scope; +import com.ibm.websphere.simplicity.application.tasks.ApplicationTask; + +public class InstallWrapper extends ApplicationOptions { + + private RemoteFile earFile; + private ArchiveType originalArchiveType; + + protected InstallWrapper(RemoteFile earFile, List tasks, Scope scope, ArchiveType archiveType) throws Exception { + super(tasks, scope); + this.earFile = earFile; + this.originalArchiveType = archiveType; + } + + public RemoteFile getEarFile() { + return earFile; + } + + public void setEarFile(RemoteFile earFile) { + this.earFile = earFile; + } + + public ArchiveType getOriginalArchiveType() { + return this.originalArchiveType; + } + + public boolean validate() throws Exception { + return true; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/DirectoryEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/DirectoryEntry.java new file mode 100755 index 000000000000..b008b9a1d48f --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/DirectoryEntry.java @@ -0,0 +1,68 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.application.loose; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * Represents a single directory entry in a virtual archive XML document. + */ +public class DirectoryEntry extends FileEntry { + protected String excludes; + + /** + * No-argument constructor (required by JAXB) + */ + public DirectoryEntry() { + super(); // required by JAXB + } + + /** + * Primary constructor for directory entries + * + * @param sourceOnDisk the physical location of this entry in the file system + * @param targetInArchive the virtual location of this entry in the parent archive + */ + public DirectoryEntry(String sourceOnDisk, String targetInArchive) { + super(sourceOnDisk, targetInArchive); + } + + /** + * Supplementary constructor for directory entries + * + * @param sourceOnDisk the physical location of this entry in the file system + * @param excludes entries to exclude from sourceOnDisk in the virtual archive + * @param targetInArchive the virtual location of this entry in the parent archive + */ + public DirectoryEntry(String sourceOnDisk, String excludes, String targetInArchive) { + super(sourceOnDisk, targetInArchive); + this.excludes = excludes; + } + + /** + * @return entries to exclude from sourceOnDisk in the virtual archive + */ + public String getExcludes() { + return excludes; + } + + /** + * Defines an exclusion filter for sourceOnDisk + * + * @param excludes entries to exclude from sourceOnDisk in the virtual archive + */ + @XmlAttribute + public void setExcludes(String excludes) { + this.excludes = excludes; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/FileEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/FileEntry.java new file mode 100755 index 000000000000..ea5c0e7f39c0 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/FileEntry.java @@ -0,0 +1,61 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.application.loose; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * Represents a single file entry in a virtual archive XML document. + */ +public class FileEntry extends VirtualEntry { + + private String sourceOnDisk; + + /** + * No-argument constructor (required by JAXB) + */ + public FileEntry() { + super(); // required by JAXB + } + + /** + * Primary constructor for file entries + * + * @param sourceOnDisk the physical location of this entry in the file system + * @param targetInArchive the virtual location of this entry in the parent archive + */ + public FileEntry(String sourceOnDisk, String targetInArchive) { + super(targetInArchive); + this.setSourceOnDisk(sourceOnDisk); + } + + /** + * @return the physical location of this entry in the file system + */ + public String getSourceOnDisk() { + return sourceOnDisk; + } + + /** + *

Defines the physical location of this entry in the file system

+ *

Note that the virtual entry represented by this class may be + * located on a remote machine, so paths must be expressed by + * String instances instead of File instances.

+ * + * @param targetInArchive the physical location of this entry in the file system + */ + @XmlAttribute + public void setSourceOnDisk(String sourceOnDisk) { + this.sourceOnDisk = sourceOnDisk; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/VirtualArchive.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/VirtualArchive.java new file mode 100755 index 000000000000..7ddb0cd01d9a --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/VirtualArchive.java @@ -0,0 +1,78 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.application.loose; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Represents a virtual archive XML document, or an embedded archive within a parent XML document. + */ +@XmlRootElement(name = "archive") +public class VirtualArchive extends VirtualEntry { + + @XmlElement(name = "file") + private final ArrayList fileEntries = new ArrayList(); + @XmlElement(name = "dir") + private final ArrayList dirEntries = new ArrayList(); + @XmlElement(name = "archive") + private final ArrayList archiveEntries = new ArrayList(); + + /** + * Constructs a virtual archive XML document. + * This constructor should not be used to construct an embedded archive within a parent XML document. + */ + public VirtualArchive() { + super(); // required by JAXB + } + + /** + * Constructs an embedded archive within a parent XML document. + * This constructor should not be used to construct virtual archive XML document. + * + * @param targetInArchive the virtual location of this entry in the parent archive + */ + public VirtualArchive(String targetInArchive) { + super(targetInArchive); + } + + /** + * Gets the internal list of file entries in this archive. The list can be modified to change the state of this instance. + * + * @return the file entries in this archive + */ + public List getFileEntries() { + return this.fileEntries; + } + + /** + * Gets the internal list of directory entries in this archive. The list can be modified to change the state of this instance. + * + * @return the directory entries in this archive + */ + public List getDirectoryEntries() { + return this.dirEntries; + } + + /** + * Gets the internal list of child archives. The list can be modified to change the state of this instance. + * + * @return child virtual archives + */ + public List getVirtualArchiveEntries() { + return this.archiveEntries; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/VirtualArchiveFactory.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/VirtualArchiveFactory.java new file mode 100755 index 000000000000..dadb7f891378 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/VirtualArchiveFactory.java @@ -0,0 +1,681 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.application.loose; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Enumeration; +import java.util.Set; +import java.util.TreeSet; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; + +import com.ibm.websphere.simplicity.LocalFile; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.RemoteFile; + +/** + * Generates virtual archive XML files (aka "loose config" files) that describe physical ear/war applications. + * This implementation is based on the virtual archive files generated by Eclipse tooling for v8.5 Alpha. + */ +public class VirtualArchiveFactory { + + private static final String CLASS_NAME = VirtualArchiveFactory.class.getName(); + private static final Logger LOG = Logger.getLogger(CLASS_NAME); + + private boolean usingVirtualWebModuleLibraries = false; // not sure if current Eclipse tooling supports this option + + /** + * You can use this method to test the implementation without fully initializing Simplicity. + * Before this will work, you have to create some property files and server.xml, + * because Simplicity is a little weird like that. + * + * @param args nothing + * @throws Exception + */ + public static void main(String[] args) throws Exception { + System.setProperty("local.properties", "C:\\blah2\\liberty\\local.properties"); + System.setProperty("bootstrapping.properties", "C:\\blah2\\liberty\\bootstrapping.properties"); + Machine localMachine = Machine.getLocalMachine(); + Machine remoteMachine = localMachine; + + // initialize inputs + RemoteFile physicalArchive = new RemoteFile(localMachine, "C:\\blah2\\liberty\\apps\\resources.ear"); + RemoteFile virtualLocation = new RemoteFile(remoteMachine, "C:\\blah2\\liberty\\looseConfig"); + RemoteFile virtualArchive = new RemoteFile(remoteMachine, "C:\\blah2\\liberty\\vapps\\resources.ear"); + // RemoteFile physicalArchive = new RemoteFile(localMachine, "C:/Storage/Workspaces/liberty/com.ibm.ws.webcontainer-8.0_fat/autoFVT/apps/webcontainer.watchdog.ear"); + // RemoteFile virtualLocation = new RemoteFile(remoteMachine, "C:\\blah2\\liberty\\looseConfig"); + // RemoteFile virtualArchive = new RemoteFile(remoteMachine, "C:\\blah2\\liberty\\vapps\\webcontainer.watchdog.ear"); + + // extract archives and construct virtual archive + VirtualArchiveFactory factory = new VirtualArchiveFactory(); + factory.extract(physicalArchive, virtualLocation, virtualArchive); + + // parse archive and display the result + PrintWriter writer = new PrintWriter(System.out); + factory.print(writer, factory.unmarshal(virtualArchive), 0); + writer.flush(); + } + + /** + * Deletes the physical files represented by a virtual archive. Does not delete the virtual archive XML file itself. Assumes that the virtual archive was created by this + * factory; more specifically: assumes that all "sourceOnDisk" attributes are child files/directories of a parent directory in the current archive. The parent directory + * of all "sourceOnDisk" attributes will be recursively deleted by this method! + * + * @param machine the machine where the virtual archive resides + * @param archive the virtual archive whose physical entries you want to delete + * @throws Exception if deletion fails + */ + public void delete(Machine machine, VirtualArchive archive) throws Exception { + if (archive == null) { + return; + } + for (FileEntry child : archive.getFileEntries()) { + this.deleteParent(machine, child.getSourceOnDisk()); + } + for (DirectoryEntry child : archive.getDirectoryEntries()) { + this.deleteParent(machine, child.getSourceOnDisk()); + } + for (VirtualArchive child : archive.getVirtualArchiveEntries()) { + this.delete(machine, child); + } + } + + /** + * Recursively deletes the parent directory of a specific file. + * + * @param machine the machine you want to update + * @param path the path to a file/directory whose parent directory you want to delete + * @throws Exception if something odd happens + */ + protected void deleteParent(Machine machine, String path) throws Exception { + if (machine == null || path == null) { + return; + } + RemoteFile file = machine.getFile(path); + RemoteFile projectDir = file.getParentFile(); + if (projectDir.exists()) { // don't try to delete the file (or complain) if the file has already been deleted + if (!projectDir.delete()) { // complain if deletion fails, but don't fail (want to try deleting all the other files/directories) + LOG.warning("Failed to delete: " + this.describeFile(file)); + } + } + } + + /** + * Prints an indented message + * + * @param out the writer to print to + * @param spaces indentation + * @param msg the message to print + */ + protected void print(PrintWriter out, int spaces, String msg) { + for (int i = 0; i < spaces; i++) { + out.print(" "); + } + out.println(msg); + } + + /** + * prints the contents of an archive to a writer + * + * @param out the writer to print to + * @param archive the archive to print + * @param indent used to express nested archives; the immediate caller should use 0. + */ + protected void print(PrintWriter out, VirtualArchive archive, int indent) { + if (out == null) { + return; + } + if (out == null || archive == null) { + this.print(out, indent, "(archive is null)"); + return; + } + this.print(out, indent, archive.getClass().getSimpleName() + ":"); + int nextIndent = indent + 2; + this.print(out, nextIndent, "TargetInArchive : " + archive.getTargetInArchive()); + for (FileEntry child : archive.getFileEntries()) { + this.print(out, nextIndent, child.getClass().getSimpleName() + ":"); + this.print(out, nextIndent + 2, "SourceOnDisk : " + child.getSourceOnDisk()); + this.print(out, nextIndent + 2, "TargetInArchive : " + child.getTargetInArchive()); + } + for (DirectoryEntry child : archive.getDirectoryEntries()) { + this.print(out, nextIndent, child.getClass().getSimpleName() + ":"); + this.print(out, nextIndent + 2, "SourceOnDisk : " + child.getSourceOnDisk()); + this.print(out, nextIndent + 2, "Excludes : " + child.getExcludes()); + this.print(out, nextIndent + 2, "TargetInArchive : " + child.getTargetInArchive()); + } + for (VirtualArchive child : archive.getVirtualArchiveEntries()) { + this.print(out, child, nextIndent); + } + } + + /** + * Expresses the current state of a virtual archive in an XML document. + * + * @param sourceArchive the Java object you want to marshal + * @return the file generated by this method (stored on the local machine) + * @throws Exception if generation fails + */ + public LocalFile marshal(VirtualArchive sourceArchive) throws Exception { + JAXBContext context = JAXBContext.newInstance(VirtualArchive.class); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + String targetInArchive = sourceArchive.getTargetInArchive(); // cache current value (in case it's set) + sourceArchive.setTargetInArchive(null); // top-level virtual archive should never set this attribute + File result = File.createTempFile("virtualArchive", ".xml"); + result.getParentFile().mkdirs(); + marshaller.marshal(sourceArchive, result); + // marshaller.marshal(this, System.out); + sourceArchive.setTargetInArchive(targetInArchive); // restore original value (in case it's set) + return this.createLocalFile(result); + } + + /** + * Converts a virtual archive XML file into a series of Java objects. + * + * @param sourceFile a virtual archive XML file. If the input file does not end with ".xml", the ".xml" extension will automatically be added. + * @return a Java object representation of the virtual archive, or null if the input file is null or does not exist + * @throws Exception if the XML file can't be parsed + */ + public VirtualArchive unmarshal(RemoteFile sourceFile) throws Exception { + // Step 1: ensure the file has an XML extension + if (sourceFile == null) { + return null; + } + RemoteFile remoteArchive = this.ensureExtension(sourceFile, ".xml"); + if (!remoteArchive.exists()) { + return null; + } + + // Step 2: ensure the file is local + boolean fileIsLocal = remoteArchive.getMachine().isLocal(); + File file = null; + if (fileIsLocal) { + file = new File(remoteArchive.getAbsolutePath()); + } else { + file = File.createTempFile("virtualArchive", ".xml"); + remoteArchive.copyToDest(this.createLocalFile(file)); + } + + // Step 3: Unmarshall XML + JAXBContext context = JAXBContext.newInstance(VirtualArchive.class); + Unmarshaller unmarshaller = context.createUnmarshaller(); + VirtualArchive result = (VirtualArchive) unmarshaller.unmarshal(file); + + // Step 4: Delete tmp file (if necessary) and return result + if (!fileIsLocal) { + file.delete(); + } + return result; + } + + /** + *

+ * Extracts an application to a series of directories, and generates a virtual archive that represents the original physical archive. + *

+ * Implementation:
    + *
  1. Copy original archive file to the local machine (if it is not already on the local machine)
  2. + *
  3. Extract archive file to local temporary directory
  4. + *
  5. Recursively extract child archives
  6. + *
  7. Move remaining files to remote machine
  8. + *
  9. Return in-memory representation of virtual archive
  10. + *
+ * Performance:
    + *
  • + * Since we need to extract archives and additionally rearrange the extracted files to simulate a series of Eclipse projects, we need to consider the + * way that Simplicity copies files remotely. When Simplicity copies file A to file B on machine M, and M is not the local machine, Simplicity actuall copies A to the local + * machine and then copies A to the remote machine as B. Consequently, it's faster to extract/rearrange all files locally before transferring any files to the remote + * device. + *
  • + *
  • + * See javadoc on the moveDirectory for more performance information. + *
  • + *
+ * + * @see #moveDirectory(RemoteFile, RemoteFile, VirtualArchive, String) + * @param physicalArchive the application to extract + * @param extractLocation the directory where you want to extract the application. Machine must match virtualArchive. + * @param virtualArchive the XML file where you want to describe the virtual archive. Machine must match virtualLocation. If the input file does not end with + * ".xml", the ".xml" extension will automatically be added. + * @throws Exception if any problem occurs + */ + public void extract(RemoteFile physicalArchive, RemoteFile extractLocation, RemoteFile virtualArchive) throws Exception { + RemoteFile remoteArchive = this.ensureExtension(virtualArchive, ".xml"); + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Extracting an archive using a loose configuration"); + LOG.info(" Physical Archive : " + this.describeFile(physicalArchive)); + LOG.info(" Extract Location : " + this.describeFile(extractLocation)); + LOG.info(" Virtual Archive : " + this.describeFile(remoteArchive)); + LOG.info(" Use Virtual Web Module Libraries: " + this.isUsingVirtualWebModuleLibraries()); + } + if (!physicalArchive.exists()) { + throw new IllegalArgumentException("Physical archive does not exist: " + this.describeFile(physicalArchive)); + } + if (!extractLocation.getMachine().getHostname().equals(virtualArchive.getMachine().getHostname())) { + throw new IOException("The extract location and virtual archive must reside on the same machine. Location=" + this.describeFile(extractLocation) + ", Archive=" + + this.describeFile(virtualArchive)); + } + long start = System.currentTimeMillis(); + VirtualArchive archive = this.extract(physicalArchive, extractLocation); + LocalFile localArchive = this.marshal(archive); + if (!localArchive.copyToDest(remoteArchive)) { + throw new IOException("Failed to copy " + this.describeFile(localArchive) + " to " + this.describeFile(remoteArchive)); + } + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Contents of virtual archive ..."); + this.logFileContents(localArchive, true); + LOG.info("Extraction complete. Time elapsed: " + (System.currentTimeMillis() - start) + " ms"); + } + localArchive.delete(); // tmp file no longer needed + } + + /** + * Extracts an application to a directory, returns a virtual representation of that archive + * + * @param physicalArchive the application to extract + * @param extractLocation the directory where you want to extract the application + * @return a virtual representation of that archive, or null if this instance doesn't know how to extract the archive + * @throws Exception if any problem occurs + */ + protected VirtualArchive extract(RemoteFile physicalArchive, RemoteFile extractLocation) throws Exception { + // Step 0: validate input + String ext = this.getExtension(physicalArchive.getName()); + if (!this.isSupported(ext)) { + return null; // don't do anything if the input archive is not supported (fail fast for recursive calls) + } + + // Step 1: Copy original archive file to the local machine (if it is not already on the local machine) + extractLocation.mkdirs(); // will throw NPE if targetDir is null (expected) + if (!extractLocation.isDirectory()) { + throw new IllegalArgumentException("Failed to create directory: " + this.describeFile(extractLocation)); + } + boolean appIsLocal = physicalArchive.getMachine().isLocal(); + File localArchive = null; + if (appIsLocal) { + localArchive = new File(physicalArchive.getAbsolutePath()); + } else { + localArchive = File.createTempFile("archive", null); + physicalArchive.copyToDest(this.createLocalFile(localArchive)); + } + + // Step 2: Extract the archive file to a local temporary directory + File tmpDir = File.createTempFile("archiveDir", null); + tmpDir.delete(); // we don't want the file, we just want the abstract path name (for a directory) + this.unzip(localArchive, tmpDir); + if (!appIsLocal) { + localArchive.delete(); // we don't need the local copy now that we've extracted it + } + + // Step 3: Recursively extract child archives + VirtualArchive archive = new VirtualArchive(); + // always search child archives of ears, but only search child archives of wars if this.usingVirtualWebModuleLibraries + if ("ear".equals(ext) || ("war".equals(ext) && this.isUsingVirtualWebModuleLibraries())) { + Set children = this.getAllChildren(tmpDir, new TreeSet()); // TreeSet sorts File paths alphabetically (ensures consistent ordering in virtual archive) + for (File child : children) { + RemoteFile childFile = this.createLocalFile(child); + VirtualArchive childArchive = this.extract(childFile, extractLocation); + if (childArchive != null) { // in other words, if the child really was an archive + String targetInArchive = this.forwardSlashes(child.getAbsolutePath().substring(tmpDir.getAbsolutePath().length() + 1)); + childArchive.setTargetInArchive(targetInArchive); + archive.getVirtualArchiveEntries().add(childArchive); + child.delete(); // don't copy this child twice + } + } + } + + // Step 4: Move remaining files to remote machine + /*- + * The following line avoids directory name conflicts by + * generating a unique file name based on the archive type. + * This implementation is safe as long as we don't install + * more than 9999 archives of any single type. + */ + RemoteFile remoteProjectDir = extractLocation.getOrderedChild(ext, 4, null); // see note above + remoteProjectDir.mkdirs(); + RemoteFile localTmpDir = this.createLocalFile(tmpDir); + if ("ear".equals(ext)) { + RemoteFile remoteEarContent = new RemoteFile(remoteProjectDir, "EarContent"); + this.moveDirectory(localTmpDir, remoteEarContent, archive, "/"); + } else if ("war".equals(ext)) { + RemoteFile localWebInfDir = new RemoteFile(localTmpDir, "WEB-INF"); + RemoteFile localClassesDir = new RemoteFile(localWebInfDir, "classes"); + if (localClassesDir.exists()) { + RemoteFile remoteBuildDir = new RemoteFile(remoteProjectDir, "build"); + RemoteFile remoteClassesDir = new RemoteFile(remoteBuildDir, "classes"); + this.moveDirectory(localClassesDir, remoteClassesDir, archive, "/WEB-INF/classes"); + } + RemoteFile localSrcDir = new RemoteFile(localWebInfDir, "source"); + if (localSrcDir.exists()) { + RemoteFile remoteSrcDir = new RemoteFile(remoteProjectDir, "src"); + this.moveDirectory(localSrcDir, remoteSrcDir, archive, "/WEB-INF/source"); + } + RemoteFile remoteWebContent = new RemoteFile(remoteProjectDir, "WebContent"); + this.moveDirectory(localTmpDir, remoteWebContent, archive, "/"); + } else if ("jar".equals(ext)) { + RemoteFile remoteBuildDir = new RemoteFile(remoteProjectDir, "build"); + RemoteFile remoteClassesDir = new RemoteFile(remoteBuildDir, "classes"); + this.moveDirectory(localTmpDir, remoteClassesDir, archive, "/"); + } + + // Step 5: Return in-memory representation of virtual archive + return archive; + } + + /** + *

+ * Copies a directory from the local machine to the remote machine, and updates a virtual archive with the result of the transfer. + *

+ *

+ * POTENTIAL PERFORMANCE PROBLEM: + * The current implementation uses Simplicity to transfer files one at a time from the source directory to the target directory. + * This implementation is efficient when the source and target machines are both local, but inefficient when either machine is remote. + * For applications with very large numbers of files, this transfer may be very slow. + *

+ *

+ * HOW TO FIX IT: + * The concept is simple: zip the source directory, transfer the zip, and extract the zip on the remote machine. + * The implementation is tricky because you'll need a JRE on both remote machines to handle the zip/unzip operations. + * Technically, this protected method is ONLY called with sourceDir is local, so you can use the java.util.zip package for zipping (see unzip method in this + * class). + * You'll have to use the Liberty server's JRE for unzipping on the target machine. Since instances of this class currently don't have a reference to a liberty server, the JVM + * that you intend to use should be passed in through the constructor or a member method. + * Recommendation: use a Map<Machine, String> variable to map machines to JRE paths, and then reference the map to determine the path to the JRE for a + * particular remote machine. + *

+ * + * @param sourceDir the source directory (currently always local) + * @param targetDir the target directory (currently sometimes remote, and currently is the Machine with Liberty installed) + * @param archive the virtual archive to update after the transfer is complete + * @param targetInArchive the target for the transferred directory in the virtual archive + * @throws Exception if the transfer fails + */ + protected void moveDirectory(RemoteFile sourceDir, RemoteFile targetDir, VirtualArchive archive, String targetInArchive) throws Exception { + boolean recursive = true; // we want to recursively copy all files + boolean overwrite = true; // this value shouldn't matter + sourceDir.copyToDest(targetDir, recursive, overwrite); + sourceDir.delete(); // transfer complete, recursively delete local trash (and avoid redundant transfer later on) + // we specifically WANT to use the fully qualified path because that's what the Eclipse tooling does + String sourceOnDisk = targetDir.getAbsolutePath(); + archive.getDirectoryEntries().add(new DirectoryEntry(sourceOnDisk, targetInArchive)); + } + + /** + * Logs the contents of a File. If singleLine=true, then the whole File will be logged as one single message. Otherwise, each invidivual line in the file will be + * logged separately. Some logging formatters look prettier with single line log messages; others look better with multiple-line log messages. + * + * @param file the file whose contents you want to log. + * @param singleLine true to log the whole file in one message, false to log each individual line + */ + protected void logFileContents(LocalFile file, boolean singleLine) { + BufferedReader reader = null; + try { + StringWriter stringWriter = null; // Closing a StringWriter has no effect. + PrintWriter printWriter = null; + reader = new BufferedReader(new InputStreamReader(new FileInputStream(file.getAbsolutePath()))); + if (singleLine) { + stringWriter = new StringWriter(); + printWriter = new PrintWriter(stringWriter); + } + String line; + while ((line = reader.readLine()) != null) { + if (singleLine) { + printWriter.println(line); + } else { + LOG.info(line); + } + } + if (singleLine) { + LOG.info(stringWriter.toString()); + } + } catch (IOException e) { + LOG.info("Failed to log contents of file: " + file + ". Exception: " + e.getMessage()); + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + LOG.info("Failed to close reader for file: " + file + ". Exception: " + e.getMessage()); + } + } + } + } + + /** + * Produces a file with the specified extension. + * + * @param remoteFile the original file to examine + * @param extension the desired file extension + * @return Returns null if the input file is null. If the name of the input file already ends in the correct extension, then the input file is returned. If it does not, then + * the correct extension is + * appended to the name of the file, and the resulting RemoteFile is returned. + * @throws Exception if the path cannot be built + */ + protected RemoteFile ensureExtension(RemoteFile remoteFile, String extension) throws Exception { + if (remoteFile == null) { + return null; + } + String name = remoteFile.getName(); + if (!name.endsWith(extension)) { + return new RemoteFile(remoteFile.getParentFile(), name + extension); + } + return remoteFile; + } + + /** + * Describes the host and path name of a file instance + * + * @param remoteFile a file to examine + * @return a description of the file + */ + protected String describeFile(RemoteFile remoteFile) { + String host = "(null)"; + String path = "(null)"; + if (remoteFile != null) { + path = remoteFile.getAbsolutePath(); + Machine machine = remoteFile.getMachine(); + if (machine != null) { + host = machine.getHostname(); + } + } + return host + ":" + path; + } + + /** + * Constructs a LocalFile instance using a java.io.File instance. + * It seems like this method should be a direct LocalFile constructor. + * + * @param file the file you want to represent + * @return a new LocalFile instance for the input java.io.File instance. + * @throws Exception if bootstrapping.properties is wrong (really? why should that matter?) + */ + protected LocalFile createLocalFile(File file) throws Exception { + return new LocalFile(file.getAbsolutePath()); + } + + /** + * Extracts a local file to a local target directory. + * + * @param source the file to extract + * @param targetDir the directory to extract the file to + * @throws IOException if extraction fails + */ + protected void unzip(File source, File targetDir) throws IOException { + targetDir.mkdirs(); + ZipFile zipFile = null; + try { + zipFile = new ZipFile(source); + Enumeration entries = zipFile.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = entries.nextElement(); + File newFile = new File(targetDir, entry.getName()); + if (entry.isDirectory()) { + newFile.mkdirs(); + } else { + // make sure the parent directory exists (entries may be extractd out of order) + newFile.getParentFile().mkdirs(); + InputStream in = new BufferedInputStream(zipFile.getInputStream(entry)); + OutputStream out = new BufferedOutputStream(new FileOutputStream(newFile)); + this.redirect(in, out); + } + } + } finally { + if (zipFile != null) { + zipFile.close(); + } + } + } + + /** + * Reads the input stream and writes every byte to the output stream. Closes both streams when the end of the input stream is reached. + * + * @param in the stream to read + * @param out the stream to write + * @throws IOException if redirection fails for any reason + */ + protected void redirect(InputStream in, OutputStream out) throws IOException { + byte[] buffer = new byte[2048]; + int len; + try { + while ((len = in.read(buffer)) >= 0) { + out.write(buffer, 0, len); + } + } finally { + if (in != null) { + try { + in.close(); + } catch (Exception e) { + LOG.logp(Level.FINE, CLASS_NAME, "redirect", "Failed to close input stream", e); + } + } + if (out != null) { + try { + out.flush(); + } catch (Exception e) { + LOG.logp(Level.FINE, CLASS_NAME, "redirect", "Failed to flush output stream", e); + } + try { + out.close(); + } catch (Exception e) { + LOG.logp(Level.FINE, CLASS_NAME, "redirect", "Failed to close output stream", e); + } + } + } + } + + /** + * Recursively searches a file/directory for all child files/directories. Stores all results in the input set. + * + * @param file the file/directory to search. Cannot be null. + * @param children the cache to store all child files/directories. Cannot be null. + * @return the input set after children are recursively added + */ + protected Set getAllChildren(File file, Set children) { + File[] immediateChildren = file.listFiles(); + if (immediateChildren != null) { + for (File child : immediateChildren) { + if (child == null) { + continue; + } + children.add(child); + this.getAllChildren(child, children); + } + } + return children; + } + + /** + * Replaces all back slashes in the input string with forward slashes. + * + * @param string A String to mangle + * @return the input string with all forward slashes + */ + protected String forwardSlashes(String string) { + return string.replace("\\", "/"); + } + + // public boolean isSupported(RemoteFile file) throws Exception { + // return this.isSupported(this.getExtension(file.getName())); + // } + + /** + * This implementation only knows how to generate a loose archive for Java, Web, and Enterprise archives. + * Supported extensions include "jar", "war", and "ear". + * + * @param file the file to examine + * @return true if this instance can abstract the input file as a virtual archive + * @throws Exception never; file.getName() shouldn't declare this throws clause + */ + public boolean isSupported(RemoteFile file) throws Exception { + return this.isSupported(this.getExtension(file.getName())); + } + + protected boolean isSupported(String extension) { + if ("ear".equals(extension)) { + return true; + } else if ("war".equals(extension)) { + return true; + } else if ("jar".equals(extension)) { + return true; + } + return false; + } + + /** + * @return true if virtual archives should be used for child libraries of web modules, false if physical archives should be used + */ + public boolean isUsingVirtualWebModuleLibraries() { + return usingVirtualWebModuleLibraries; + } + + /** + * Configure this factory to create virtual/physical archives for child libraries of web modules + * + * @param useVirtualWebModuleLibraries true to create virtual archives for web module library files (under WEB-INF/lib); false to create physical archives + */ + public void setUsingVirtualWebModuleLibraries(boolean useVirtualWebModuleLibraries) { + this.usingVirtualWebModuleLibraries = useVirtualWebModuleLibraries; + } + + /** + * Derives the extension of the input file name + * + * @param fileName the name of the file whose extension you want to examine + * @return the extension of the file + */ + protected String getExtension(String fileName) { + if (fileName == null) { + return null; + } + int lastDotIndex = fileName.lastIndexOf("."); + if (-1 < lastDotIndex && lastDotIndex < fileName.length()) { + return fileName.substring(lastDotIndex + 1).toLowerCase(); + } + return null; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/VirtualEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/VirtualEntry.java new file mode 100755 index 000000000000..bc4af9aa92c2 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/loose/VirtualEntry.java @@ -0,0 +1,56 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.application.loose; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * Represents a single entry in a virtual archive XML document. + */ +public class VirtualEntry { + + private String targetInArchive; + + /** + * No-argument constructor (required by JAXB) + */ + public VirtualEntry() { + super(); // required by JAXB + } + + /** + * Primary constructor for virtual entries + * + * @param targetInArchive the virtual location of this entry in the parent archive + */ + public VirtualEntry(String targetInArchive) { + this.setTargetInArchive(targetInArchive); + } + + /** + * @return the virtual location of this entry in the parent archive + */ + public String getTargetInArchive() { + return targetInArchive; + } + + /** + * Defines the virtual location of this entry in the parent archive + * + * @param targetInArchive the virtual location of this entry in the parent archive + */ + @XmlAttribute + public void setTargetInArchive(String targetInArchive) { + this.targetInArchive = targetInArchive; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ActSpecJNDIEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ActSpecJNDIEntry.java new file mode 100755 index 000000000000..fe67317328fc --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ActSpecJNDIEntry.java @@ -0,0 +1,44 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class ActSpecJNDIEntry extends TaskEntry { + + public ActSpecJNDIEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getRarModule() { + return getString(AppConstants.APPDEPL_RAR_MODULE); + } + + protected void setRarModule(String value) { + setItem(AppConstants.APPDEPL_RAR_MODULE, value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getJ2cId() { + return getString(AppConstants.APPDEPL_J2C_ID); + } + + protected void setJ2cId(String value) { + setItem(AppConstants.APPDEPL_J2C_ID, value); + } + + public String getJndi() { + return getString(AppConstants.APPDEPL_J2C_JNDINAME); + } + + public void setJndi(String value) { + task.setModified(); + setItem(AppConstants.APPDEPL_J2C_JNDINAME, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ActSpecJNDITask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ActSpecJNDITask.java new file mode 100755 index 000000000000..215efa74ed15 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ActSpecJNDITask.java @@ -0,0 +1,27 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class ActSpecJNDITask extends MultiEntryApplicationTask { + + public ActSpecJNDITask() {} + + public ActSpecJNDITask(String[][] taskData) { + super(AppConstants.ActSpecJNDITask, taskData); + for (String[] data : taskData) { + this.entries.add(new ActSpecJNDIEntry(data, this)); + } + } + + public ActSpecJNDITask(String[] columns) { + super(AppConstants.ActSpecJNDITask, columns); + } + + @Override + public ActSpecJNDIEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (ActSpecJNDIEntry) entries.get(i); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/AppDeploymentOptionsTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/AppDeploymentOptionsTask.java new file mode 100755 index 000000000000..813836d9e24a --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/AppDeploymentOptionsTask.java @@ -0,0 +1,262 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.types.AsyncRequestDispatchType; + +/** + * + * + * @author SterlingBates + * + */ +public class AppDeploymentOptionsTask extends ApplicationTask { + + private String defaultAppName; + private boolean useDefaultBindings = false; + private boolean appNameModified = false; + private boolean asyncDispatchModified = false; + private boolean ejbDeployModified = false; + private boolean filePermissionModified = false; + private boolean precompileJspsModified = false; + private boolean processEmbeddedConfigModified = false; + private boolean reloadIntervalModified = false; + private boolean useAutoLinkModified = false; + private boolean useBinaryConfigModified = false; + private boolean useDefaultBindingsModified = false; + private boolean wsDeployModified = false; + private boolean allowDispatchRemoteIncludeModified = false; + private boolean allowServiceRemoteIncludeModified = false; + private boolean blaNameModified = false; + private boolean installDirectoryModified = false; + + public AppDeploymentOptionsTask() { + + } + + public AppDeploymentOptionsTask(String[][] taskData) { + super(AppConstants.AppDeploymentOptionsTask, taskData); + defaultAppName = getString(AppConstants.APPDEPL_APPNAME, 1); + if (defaultAppName != null && defaultAppName.length() == 0) + defaultAppName = null; + } + + public AppDeploymentOptionsTask(String[] columns) { + super(AppConstants.AppDeploymentOptionsTask, columns); + } + + public String getDefaultApplicationName() { + return this.defaultAppName; + } + + public boolean getUseDefaultBindings() { + return this.useDefaultBindings; + } + + public void setUseDefaultBindings(boolean value) { + useDefaultBindingsModified = true; + this.useDefaultBindings = value; + } + + public boolean getUseAutoLink() { + return getBoolean(AppConstants.APPDEPL_AUTOLINK, 1, AppConstants.APPDEPL_AUTOLINK_DEFAULT); + } + + public void setUseAutoLink(boolean value) { + useAutoLinkModified = true; + setBoolean(AppConstants.APPDEPL_AUTOLINK, 1, value); + } + + public boolean getEjbDeploy() { + return getBoolean(AppConstants.APPDEPL_DEPLOYEJB_CMDARG, 1, AppConstants.APPDEPL_DEPLOYEJB_CMDARG_DEFAULT); + } + + public void setEjbDeploy(boolean value) { + ejbDeployModified = true; + setBoolean(AppConstants.APPDEPL_DEPLOYEJB_CMDARG, 1, value); + } + + public boolean getWsDeploy() { + return getBoolean(AppConstants.APPDEPL_DEPLOYWS_CMDARG, 1, AppConstants.APPDEPL_DEPLOYWS_CMDARG_DEFAULT); + } + + public void setWsDeploy(boolean value) { + wsDeployModified = true; + setBoolean(AppConstants.APPDEPL_DEPLOYWS_CMDARG, 1, value); + } + + public boolean getPrecompileJsps() { + return getBoolean(AppConstants.APPDEPL_PRECOMPILE_JSP, 1, AppConstants.APPDEPL_PRECOMPILE_JSP_DEFAULT); + } + + public void setPrecompileJsps(boolean value) { + precompileJspsModified = true; + setBoolean(AppConstants.APPDEPL_PRECOMPILE_JSP, 1, value); + } + + public boolean getUseBinaryConfig() { + return getBoolean(AppConstants.APPDEPL_USE_BINARY_CONFIG, 1, AppConstants.APPDEPL_USE_BINARY_CONFIG_DEFAULT); + } + + public void setUseBinaryConfig(boolean value) { + useBinaryConfigModified = true; + setBoolean(AppConstants.APPDEPL_USE_BINARY_CONFIG, 1, value); + } + + public boolean getProcessEmbeddedConfig() { + return getBoolean(AppConstants.APPDEPL_PROCESS_EMBEDDEDCFG_INSTALL, 1, AppConstants.APPDEPL_PROCESS_EMBEDDEDCFG_INSTALL_DEFAULT); + } + + public void setProcessEmbeddedConfig(boolean value) { + processEmbeddedConfigModified = true; + setBoolean(AppConstants.APPDEPL_PROCESS_EMBEDDEDCFG_INSTALL, 1, value); + } + + public String getFilePermission() { + return getString(AppConstants.APPDEPL_FILEPERMISSION, 1, AppConstants.APPDEPL_FILEPERMISSION_DEFAULT); + } + + public void setFilePermission(String value) { + setItem(AppConstants.APPDEPL_FILEPERMISSION, 1, value); + } + + public void addFilePermission(String filespec) { + filePermissionModified = true; + String s = getFilePermission() + "#" + filespec; + setFilePermission(s); + } + + public AsyncRequestDispatchType getAsyncRequestDispatch() { + AsyncRequestDispatchType type = null; + String s = getString(AppConstants.APPDEPL_ASYNC_REQUEST_DISPATCH, 1); + if (s != null) + type = AsyncRequestDispatchType.valueOf(s); + return type; + } + + public void setAsyncRequestDispatch(AsyncRequestDispatchType value) { + asyncDispatchModified = true; + setItem(AppConstants.APPDEPL_ASYNC_REQUEST_DISPATCH, 1, value.getValue()); + } + + public Integer getReloadInterval() { + return getInteger(AppConstants.APPDEPL_RELOADINTERVAL, AppConstants.APPDEPL_RELOADINTERVAL_DEFAULT); + } + + public void setReloadInterval(int value) { + reloadIntervalModified = true; + setInteger(AppConstants.APPDEPL_RELOADINTERVAL, 1, value); + } + + public String getApplicationName() { + return getString(AppConstants.APPDEPL_APPNAME, 1); + } + + public void setApplicationName(String value) { + appNameModified = true; + setItem(AppConstants.APPDEPL_APPNAME, 1, value); + } + + public boolean isAppNameModified() { + return appNameModified; + } + + public boolean isAsyncDispatchModified() { + return asyncDispatchModified; + } + + public boolean isEjbDeployModified() { + return ejbDeployModified; + } + + public boolean isFilePermissionModified() { + return filePermissionModified; + } + + public boolean isPrecompileJspsModified() { + return precompileJspsModified; + } + + public boolean isProcessEmbeddedConfigModified() { + return processEmbeddedConfigModified; + } + + public boolean isReloadIntervalModified() { + return reloadIntervalModified; + } + + public boolean isUseAutoLinkModified() { + return useAutoLinkModified; + } + + public boolean isUseBinaryConfigModified() { + return useBinaryConfigModified; + } + + public boolean isUseDefaultBindingsModified() { + return useDefaultBindingsModified; + } + + public boolean isWsDeployModified() { + return wsDeployModified; + } + + public boolean isAllowDispatchRemoteIncludeModified() { + return this.allowDispatchRemoteIncludeModified; + } + + public boolean isAllowServiceRemoteIncludeModified() { + return this.allowServiceRemoteIncludeModified; + } + + public boolean getAllowDispatchRemoteInclude() { + return getBoolean(AppConstants.APPDEPL_DISPATCH_REMOTEINCLUDE, 1, AppConstants.APPDEPL_DISPATCH_REMOTEINCLUDE_DEFAULT); + } + + public void setAllowDispatchRemoteInclude(boolean allowDispatchRemoteInclude) { + allowDispatchRemoteIncludeModified = true; + setBoolean(AppConstants.APPDEPL_DISPATCH_REMOTEINCLUDE, 1, allowDispatchRemoteInclude); + } + + public boolean getAllowServiceRemoteInclude() { + return getBoolean(AppConstants.APPDEPL_SERVICE_REMOTEINCLUDE, 1, AppConstants.APPDEPL_SERVICE_REMOTEINCLUDE_DEFAULT); + } + + public void setAllowServiceRemoteInclude(boolean allowServiceRemoteInclude) { + this.allowServiceRemoteIncludeModified = true; + setBoolean(AppConstants.APPDEPL_SERVICE_REMOTEINCLUDE, 1, allowServiceRemoteInclude); + } + + public String getBlaName() { + return getString(AppConstants.APPDEPL_BLANAME, 1); + } + + public void setBlaName(String value) { + blaNameModified = true; + setItem(AppConstants.APPDEPL_BLANAME, 1, value); + } + + public boolean isBlaNameModified() { + return blaNameModified; + } + + public String getInstallDirectory() { + return getString(AppConstants.APPDEPL_INSTALL_DIR, 1); + } + + public void setInstallDirectory(String value) { + installDirectoryModified = true; + setItem(AppConstants.APPDEPL_INSTALL_DIR, 1, value); + } + + public boolean isInstallDirectoryModified() { + return installDirectoryModified; + } + + @Override + protected void init() { + super.init(); + if (getReloadInterval() == null) + setReloadInterval(0); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ApplicationTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ApplicationTask.java new file mode 100755 index 000000000000..0d22f0c9e2bb --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ApplicationTask.java @@ -0,0 +1,199 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import java.util.Hashtable; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.exception.IncompatibleVersionException; + +public abstract class ApplicationTask { + + protected boolean modified = false; + + public static class ColumnMetadata { + + public boolean isMutable = false; + public boolean isRequired = false; + public boolean isHidden = false; + + protected ColumnMetadata(boolean isMutable, boolean isRequired, boolean isHidden) { + this.isMutable = isMutable; + this.isRequired = isRequired; + this.isHidden = isHidden; + } + + } + + protected String taskName; + protected String[][] taskData; + protected Hashtable coltbl = new Hashtable(); + protected Hashtable colmeta = new Hashtable(); + + public ApplicationTask() { + taskData = new String[1][0]; + } + + public ApplicationTask(String taskName, String[][] taskData) { + this.taskName = taskName; + this.taskData = taskData; + init(); + } + + public ApplicationTask(String taskName, String[] columns) { + this.taskName = taskName; + this.taskData = new String[1][columns.length]; + for (int i = 0; i < columns.length; i++) + this.taskData[0][i] = columns[i]; + init(); + } + + public void setColumnMetadata(String name, boolean isMutable, boolean isRequired, boolean isHidden) { + colmeta.put(name, new ColumnMetadata(isMutable, isRequired, isHidden)); + } + + public ColumnMetadata getColumnMetadata(String name) { + return colmeta.get(name); + } + + public String getTaskName() { + return taskName; + } + + public String[][] getTaskData() { + return taskData; + } + + public String toString() { + StringBuilder s = new StringBuilder(getTaskName()); + String[][] data = this.getTaskData(); + if (data != null) { + s.append("\n\t\t" + data.length + " entry(s)"); + for (int i = 0; i < data.length; i++) { + s.append("\n\t\t"); + for (int o = 0; o < data[i].length; o++) + s.append(data[i][o] + " | "); + } + s.append("\n"); + } else + s.append(": null\n"); + return s.toString(); + } + + // Earlier versions do not have certain columns + protected void hasAtLeast(int columns) throws IncompatibleVersionException { + if (taskData.length > 0 && taskData[0].length < columns) + throw new IncompatibleVersionException(""); + } + + protected void setBoolean(String columnName, int row, boolean value) { + setItem(columnName, row, value ? AppConstants.YES_KEY : AppConstants.NO_KEY); + } + + protected void setInteger(String columnName, int row, int value) { + setItem(columnName, row, Integer.toString(value)); + } + + protected void setItem(String columnName, int row, String value) { + if (!coltbl.containsKey(columnName)) { + addColumn(columnName); + } + Integer col = coltbl.get(columnName); + if (col != null) { + if (row >= taskData.length) { + resizeTo(row + 1); + } + taskData[row][col] = value; + } + } + + protected boolean getBoolean(String columnName, int row) { + return getBoolean(columnName, row, false); + } + + protected boolean getBoolean(String columnName, int row, Boolean deflt) { + String s = getItem(columnName, row); + boolean b = false; + if (s != null) { + b = (s.equalsIgnoreCase(AppConstants.YES_KEY) || s.equalsIgnoreCase("true") || s.equalsIgnoreCase("yes")); + } + return b || deflt; + } + + protected String getString(String columnName, int row) { + return getString(columnName, row, null); + } + + protected String getString(String columnName, int row, String deflt) { + String s = getItem(columnName, row); + if (s == null) + s = deflt; + return s; + } + + protected Integer getInteger(String columnName, int row) { + return getInteger(columnName, row, null); + } + + protected Integer getInteger(String columnName, int row, Integer deflt) { + String s = getItem(columnName, row); + Integer ret = toInteger(s); + if (ret == null) + ret = deflt; + return ret; + } + + protected Integer toInteger(String s) { + try { + return Integer.valueOf(s); + } catch (NumberFormatException nfe) { + return null; + } + } + + protected String getItem(String columnName, int row) { + String ret = null; + Integer col = coltbl.get(columnName); + if (col != null && taskData.length > row) + ret = taskData[row][col]; + return ret; + } + + protected void init() { + for (int i = 0; i < taskData[0].length; i++) + coltbl.put(taskData[0][i], i); + } + + /** + * Resizes the first dimension of the taskData array. + * The |rows| parameter *includes* the column headings, + * so the entire dimension will be size |rows|. + * + * @param rows + */ + private void resizeTo(int rows) { + String[][] newData = new String[rows][coltbl.size()]; + for (int r = 0; r < taskData.length; r++) { + for (int c = 0; c < coltbl.size(); c++) + newData[r][c] = taskData[r][c]; + } + taskData = newData; + } + + private void addColumn(String name) { + String[][] newData = new String[taskData.length][coltbl.size() + 1]; + for (int r = 0; r < taskData.length; r++) { + for (int c = 0; c < coltbl.size(); c++) + newData[r][c] = taskData[r][c]; + } + taskData = newData; + int num = coltbl.size(); + coltbl.put(name, num); + } + + public boolean isModified() { + return modified; + } + + protected void setModified() { + this.modified = true; + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BackendIdSelectionEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BackendIdSelectionEntry.java new file mode 100755 index 000000000000..8197d6bf2a54 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BackendIdSelectionEntry.java @@ -0,0 +1,60 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class BackendIdSelectionEntry extends TaskEntry { + + public BackendIdSelectionEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getAppVersion() throws Exception { + return super.getAppVersion(); + } + + protected void setAppVersion(String value) throws Exception { + super.setAppVersion(value); + } + + public String getModuleVersion() throws Exception { + return super.getModuleVersion(); + } + + protected void setModuleVersion(String value) throws Exception { + super.setModuleVersion(value); + } + + public String getEjbModule() { + return super.getEjbModule(); + } + + protected void setEjbModule(String value) { + super.setEjbModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getBackendIds() { + return getString(AppConstants.APPDEPL_BACKENDIDS); + } + + protected void setBackendIds(String value) { + setItem(AppConstants.APPDEPL_BACKENDIDS, value); + } + + public String getCurrentBackendId() { + return getString(AppConstants.APPDEPL_CURRENT_BACKEND_ID); + } + + public void setCurrentBackendId(String value) { + task.setModified(); + setItem(AppConstants.APPDEPL_CURRENT_BACKEND_ID, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BackendIdSelectionTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BackendIdSelectionTask.java new file mode 100755 index 000000000000..68a7c0686b19 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BackendIdSelectionTask.java @@ -0,0 +1,50 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class BackendIdSelectionTask extends MultiEntryApplicationTask { + + public BackendIdSelectionTask() { + + } + + public BackendIdSelectionTask(String[][] taskData) { + super(AppConstants.BackendIdSelectionTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new BackendIdSelectionEntry(data, this)); + } + } + + public BackendIdSelectionTask(String[] columns) { + super(AppConstants.BackendIdSelectionTask, columns); + } + + @Override + public BackendIdSelectionEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (BackendIdSelectionEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public String getBackendIdForModule(AssetModule module) { + + BackendIdSelectionEntry entry = (BackendIdSelectionEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + return (entry != null ? entry.getCurrentBackendId() : null); + } + + public void setBackendIdForModule(AssetModule module, String backendId) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + BackendIdSelectionEntry entry = (BackendIdSelectionEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + entry.setCurrentBackendId(backendId); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBBusinessEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBBusinessEntry.java new file mode 100755 index 000000000000..d13851eb25cd --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBBusinessEntry.java @@ -0,0 +1,71 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class BindJndiForEJBBusinessEntry extends TaskEntry { + + public BindJndiForEJBBusinessEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + /** + * The EJB module that contains the enterprise beans that bind to the JNDI name. + */ + public String getEjbModule() { + return super.getEjbModule(); + } + + /** + * The enterprise bean that binds to the JNDI name. + */ + public String getEjb() { + return super.getEjb(); + } + + /** + * The Uniform Resource Identifier (URI) specifies the location of the module + * archive relative to the root of the application EAR. + */ + public String getUri() { + return super.getUri(); + } + + /** + * The enterprise bean business interface in an EJB module. + */ + public String getEjbBusinessInterface() { + return super.getItem(AppConstants.APPDEPL_EJB_BUSINESS_INTERFACE); + } + + /** + * Specifies the JNDI name associated with the enterprise bean business interface in an EJB module. + */ + public String getJndi() { + return super.getItem(AppConstants.APPDEPL_EJB_BUSINESS_INTERFACE_JNDI); + } + + protected void setEjbModule(String value) { + super.setEjbModule(value); + } + + protected void setEjb(String value) { + super.setEjb(value); + } + + protected void setUri(String value) { + super.setUri(value); + } + + protected void setEjbBusinessInterface(String value) { + super.setItem(AppConstants.APPDEPL_EJB_BUSINESS_INTERFACE, value); + } + + /** + * Specifies the JNDI name associated with the enterprise bean business interface in an EJB module. + */ + public void setJndi(String value) { + task.setModified(); + super.setItem(AppConstants.APPDEPL_EJB_BUSINESS_INTERFACE_JNDI, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBBusinessTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBBusinessTask.java new file mode 100755 index 000000000000..ba8560f34a64 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBBusinessTask.java @@ -0,0 +1,30 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class BindJndiForEJBBusinessTask extends MultiEntryApplicationTask { + + public BindJndiForEJBBusinessTask() { + + } + + public BindJndiForEJBBusinessTask(String[][] taskData) { + super(AppConstants.BindJndiForEJBBusinessTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new BindJndiForEJBBusinessEntry(data, this)); + } + } + + public BindJndiForEJBBusinessTask(String[] columns) { + super(AppConstants.BindJndiForEJBBusinessTask, columns); + } + + @Override + public BindJndiForEJBBusinessEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (BindJndiForEJBBusinessEntry) entries.get(i); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBMessageBindingEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBMessageBindingEntry.java new file mode 100755 index 000000000000..18df05ba2d0e --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBMessageBindingEntry.java @@ -0,0 +1,107 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class BindJndiForEJBMessageBindingEntry extends TaskEntry { + + public BindJndiForEJBMessageBindingEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getEjb() { + return super.getEjb(); + } + + protected void setEjb(String value) { + super.setEjb(value); + } + + public String getEjbModule() { + return super.getEjbModule(); + } + + protected void setEjbModule(String value) { + super.setEjbModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public Integer getListenerPort() { + return getInteger(AppConstants.APPDEPL_LISTENER_PORT); + } + + public void setListenerPort(int value) { + task.setModified(); + setInteger(AppConstants.APPDEPL_LISTENER_PORT, value); + } + + public String getJndi() throws Exception { + hasAtLeast(5); + return super.getJndi(); + } + + public void setJndiName(String value) throws Exception { + hasAtLeast(5); + task.setModified(); + super.setJndi(value); + } + + public String getAppVersion() throws Exception { + hasAtLeast(5); + return super.getAppVersion(); + } + + protected void setAppVersion(String value) throws Exception { + hasAtLeast(5); + super.setAppVersion(value); + } + + public String getModuleVersion() throws Exception { + hasAtLeast(5); + return super.getModuleVersion(); + } + + protected void setModuleVersion(String value) throws Exception { + hasAtLeast(5); + super.setModuleVersion(value); + } + + public String getJndiDestination() throws Exception { + hasAtLeast(5); + return getString(AppConstants.APPDEPL_JNDI_DEST); + } + + public void setJndiDestination(String value) throws Exception { + hasAtLeast(5); + task.setModified(); + setItem(AppConstants.APPDEPL_JNDI_DEST, value); + } + + public String getActSpecAuth() throws Exception { + hasAtLeast(5); + return getString(AppConstants.APPDEPL_ACT_AUTH); + } + + public void setActSpecAuth(String value) throws Exception { + hasAtLeast(5); + task.setModified(); + setItem(AppConstants.APPDEPL_ACT_AUTH, value); + } + + public String getMessagingType() throws Exception { + hasAtLeast(5); + return getString(AppConstants.APPDEPL_MESSAGING_TYPE); + } + + protected void setMessagingType(String value) throws Exception { + hasAtLeast(5); + setItem(AppConstants.APPDEPL_MESSAGING_TYPE, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBMessageBindingTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBMessageBindingTask.java new file mode 100755 index 000000000000..8691dddea4a2 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBMessageBindingTask.java @@ -0,0 +1,50 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class BindJndiForEJBMessageBindingTask extends MultiEntryApplicationTask { + + public BindJndiForEJBMessageBindingTask() { + + } + + public BindJndiForEJBMessageBindingTask(String[][] taskData) { + super(AppConstants.BindJndiForEJBMessageBindingTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new BindJndiForEJBMessageBindingEntry(data, this)); + } + } + + public BindJndiForEJBMessageBindingTask(String[] columns) { + super(AppConstants.BindJndiForEJBMessageBindingTask, columns); + } + + @Override + public BindJndiForEJBMessageBindingEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (BindJndiForEJBMessageBindingEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public BindJndiForEJBMessageBindingEntry getBindingsForModule(AssetModule module) { + BindJndiForEJBMessageBindingEntry entry = (BindJndiForEJBMessageBindingEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + return entry; + } + + public void setBindingsForModule(AssetModule module, String jndiName, String jndiDestination, int port) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + BindJndiForEJBMessageBindingEntry entry = getBindingsForModule(module); + entry.setJndiName(jndiName); + entry.setJndiDestination(jndiDestination); + entry.setListenerPort(port); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBNonMessageBindingEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBNonMessageBindingEntry.java new file mode 100755 index 000000000000..4d2dffc51bb4 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBNonMessageBindingEntry.java @@ -0,0 +1,76 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class BindJndiForEJBNonMessageBindingEntry extends TaskEntry { + + public BindJndiForEJBNonMessageBindingEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getEjbModule() { + return super.getEjbModule(); + } + + protected void setEjbModule(String value) { + super.setEjbModule(value); + } + + public String getEjb() { + return super.getEjb(); + } + + protected void setEjb(String value) { + super.setEjb(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getJndi() throws Exception { + return super.getJndi(); + } + + public void setJndi(String value) throws Exception { + task.setModified(); + super.setJndi(value); + } + + public String getModuleVersion() throws Exception { + hasAtLeast(5); + return super.getModuleVersion(); + } + + protected void setModuleVersion(String value) throws Exception { + hasAtLeast(5); + super.setModuleVersion(value); + } + + public String getLocalHomeJndi() throws Exception { + hasAtLeast(5); + return getString(AppConstants.APPDEPL_EJB_LOCAL_HOME_JNDI); + } + + public void setLocalHomeJndi(String value) throws Exception { + hasAtLeast(5); + task.setModified(); + setItem(AppConstants.APPDEPL_EJB_LOCAL_HOME_JNDI, value); + } + + public String getRemoteHomeJndi() throws Exception { + hasAtLeast(5); + return getString(AppConstants.APPDEPL_EJB_REMOTE_HOME_JNDI); + } + + public void setRemoteHomeJndi(String value) throws Exception { + hasAtLeast(5); + task.setModified(); + setItem(AppConstants.APPDEPL_EJB_REMOTE_HOME_JNDI, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBNonMessageBindingTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBNonMessageBindingTask.java new file mode 100755 index 000000000000..9212bed44288 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/BindJndiForEJBNonMessageBindingTask.java @@ -0,0 +1,50 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class BindJndiForEJBNonMessageBindingTask extends MultiEntryApplicationTask { + + public BindJndiForEJBNonMessageBindingTask() { + + } + + public BindJndiForEJBNonMessageBindingTask(String[][] taskData) { + super(AppConstants.BindJndiForEJBNonMessageBindingTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new BindJndiForEJBNonMessageBindingEntry(data, this)); + } + } + + public BindJndiForEJBNonMessageBindingTask(String[] columns) { + super(AppConstants.BindJndiForEJBNonMessageBindingTask, columns); + } + + @Override + public BindJndiForEJBNonMessageBindingEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (BindJndiForEJBNonMessageBindingEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public BindJndiForEJBNonMessageBindingEntry getBindingsForModule(AssetModule module) { + return (BindJndiForEJBNonMessageBindingEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + } + + public void setBindingsForModule(AssetModule module, String globalJndi, String localHomeJndi, String remoteHomeJndi) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + this.modified = true; + BindJndiForEJBNonMessageBindingEntry entry = getBindingsForModule(module); + entry.setJndi(globalJndi); + entry.setLocalHomeJndi(localHomeJndi); + entry.setRemoteHomeJndi(remoteHomeJndi); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectOracleIsolationLevelEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectOracleIsolationLevelEntry.java new file mode 100755 index 000000000000..0cf929a9cf27 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectOracleIsolationLevelEntry.java @@ -0,0 +1,45 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.types.OracleIsolationLevelType; + +public class CorrectOracleIsolationLevelEntry extends TaskEntry { + + public CorrectOracleIsolationLevelEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getModule() { + return super.getModule(); + } + + protected void setModule(String value) { + super.setModule(value); + } + + public String getReferenceBinding() { + return super.getReferenceBinding(); + } + + protected void setReferenceBinding(String value) { + super.setReferenceBinding(value); + } + + public String getJndi() throws Exception { + return super.getJndi(); + } + + protected void setJndi(String value) throws Exception { + super.setJndi(value); + } + + public OracleIsolationLevelType getIsolationLevel() { + return OracleIsolationLevelType.getByValue(getInteger(AppConstants.APPDEPL_ISOLATION_LEVEL, -1)); + } + + public void setIsolationLevel(OracleIsolationLevelType value) { + task.setModified(); + setInteger(AppConstants.APPDEPL_ISOLATION_LEVEL, value.getValue()); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectOracleIsolationLevelTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectOracleIsolationLevelTask.java new file mode 100755 index 000000000000..e8a0688a9847 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectOracleIsolationLevelTask.java @@ -0,0 +1,35 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class CorrectOracleIsolationLevelTask extends MultiEntryApplicationTask { + + public CorrectOracleIsolationLevelTask() { + + } + + public CorrectOracleIsolationLevelTask(String[][] taskData) { + super(AppConstants.CorrectOracleIsolationLevelTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new CorrectOracleIsolationLevelEntry(data, this)); + } + } + + public CorrectOracleIsolationLevelTask(String[] columns) { + super(AppConstants.CorrectOracleIsolationLevelTask, columns); + } + + @Override + public CorrectOracleIsolationLevelEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (CorrectOracleIsolationLevelEntry) entries.get(i); + } + + /* + * Need more info about this task. What's the likely uniqueness scenario + * for the columns? That'll help define generalized setters & getters. + */ + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectUseSystemIdentityEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectUseSystemIdentityEntry.java new file mode 100755 index 000000000000..f733083465e9 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectUseSystemIdentityEntry.java @@ -0,0 +1,70 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class CorrectUseSystemIdentityEntry extends TaskEntry { + + public CorrectUseSystemIdentityEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getEjb() { + return super.getEjb(); + } + + protected void setEjb(String value) { + super.setEjb(value); + } + + public String getEjbModule() { + return super.getEjbModule(); + } + + protected void setEjbModule(String value) { + super.setEjbModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getMethodSignature() { + return getString(AppConstants.APPDEPL_METHOD_SIGNATURE, null); + } + + protected void setMethodSignature(String value) { + setItem(AppConstants.APPDEPL_METHOD_SIGNATURE, value); + } + + public String getRole() { + return super.getRole(); + } + + public void setRole(String value) { + task.setModified(); + super.setRole(value); + } + + public String getUser() { + return super.getUser(); + } + + public void setUser(String value) { + task.setModified(); + super.setUser(value); + } + + public String getPassword() { + return super.getPassword(); + } + + public void setPassword(String value) { + task.setModified(); + super.setPassword(value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectUseSystemIdentityTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectUseSystemIdentityTask.java new file mode 100755 index 000000000000..c965e7858e88 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CorrectUseSystemIdentityTask.java @@ -0,0 +1,106 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import java.util.List; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class CorrectUseSystemIdentityTask extends MultiEntryApplicationTask { + + public CorrectUseSystemIdentityTask() { + + } + + public CorrectUseSystemIdentityTask(String[][] taskData) { + super(AppConstants.CorrectUseSystemIdentityTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new CorrectUseSystemIdentityEntry(data, this)); + } + } + + public CorrectUseSystemIdentityTask(String[] columns) { + super(AppConstants.CorrectUseSystemIdentityTask, columns); + } + + @Override + public Object get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (CorrectUseSystemIdentityEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public boolean hasIdentity(AssetModule module, String ejb, String methodSignature) { + return getEntry( + new String[] { + AppConstants.APPDEPL_URI, + AppConstants.APPDEPL_EJB, + AppConstants.APPDEPL_METHOD_SIGNATURE + }, + new String[] { + module.getURI(), + ejb, + methodSignature + }) != null; + } + + public List getIdentities(AssetModule module) { + return (List) getEntries(AppConstants.APPDEPL_URI, module.getURI()); + } + + public List getIdentities(AssetModule module, String ejb) { + return (List) getEntries( + new String[] { + AppConstants.APPDEPL_URI, + AppConstants.APPDEPL_EJB + }, + new String[] { + module.getURI(), + ejb + }); + } + + public CorrectUseSystemIdentityEntry getIdentity(AssetModule module, String ejb, String methodSignature) throws Exception { + List entries = getIdentities(module, ejb); + for (CorrectUseSystemIdentityEntry entry : entries) + if (entry.getMethodSignature().equals(methodSignature)) + return entry; + return null; + } + + /** + * Sets the role, user, and password for the specified method in the specified + * EJB + * + * @param module + * @param methodSignature + * @param role + * @param user + * @param password + * @throws Exception + */ + public void setIdentity(AssetModule module, String ejb, String methodSignature, String role, String user, String password) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + this.modified = true; + CorrectUseSystemIdentityEntry entry = getIdentity(module, ejb, methodSignature); + if (entry == null) { + // We know we have the module, so get a template entry + CorrectUseSystemIdentityEntry other = getIdentities(module).get(0); + entry = new CorrectUseSystemIdentityEntry(new String[coltbl.size()], this); + entry.setEjbModule(other.getEjbModule()); + entry.setUri(other.getUri()); + entry.setEjb(ejb); + entry.setMethodSignature(methodSignature); + } + entry.setRole(role); + entry.setUser(user); + entry.setPassword(password); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CtxRootForWebModEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CtxRootForWebModEntry.java new file mode 100755 index 000000000000..8e26abc6ead3 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CtxRootForWebModEntry.java @@ -0,0 +1,36 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class CtxRootForWebModEntry extends TaskEntry { + + public CtxRootForWebModEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getWebModule() { + return super.getWebModule(); + } + + protected void setWebModule(String value) { + super.setWebModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getContextRoot() { + return getString(AppConstants.APPDEPL_WEB_CONTEXTROOT); + } + + public void setContextRoot(String value) { + task.setModified(); + setItem(AppConstants.APPDEPL_WEB_CONTEXTROOT, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CtxRootForWebModTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CtxRootForWebModTask.java new file mode 100755 index 000000000000..54f30e8ea34a --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CtxRootForWebModTask.java @@ -0,0 +1,49 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class CtxRootForWebModTask extends MultiEntryApplicationTask { + + public CtxRootForWebModTask() { + + } + + public CtxRootForWebModTask(String[][] taskData) { + super(AppConstants.CtxRootForWebMethodTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new CtxRootForWebModEntry(data, this)); + } + } + + public CtxRootForWebModTask(String[] columns) { + super(AppConstants.CtxRootForWebMethodTask, columns); + } + + @Override + public CtxRootForWebModEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (CtxRootForWebModEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public String getContextRoot(AssetModule module) { + CtxRootForWebModEntry entry = (CtxRootForWebModEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + return entry.getContextRoot(); + } + + public void setContextRoot(AssetModule module, String contextRoot) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + CtxRootForWebModEntry entry = (CtxRootForWebModEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + entry.setContextRoot(contextRoot); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CustomTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CustomTask.java new file mode 100755 index 000000000000..a189bcfc04a1 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/CustomTask.java @@ -0,0 +1,22 @@ +package com.ibm.websphere.simplicity.application.tasks; + +public class CustomTask extends ApplicationTask { + + public CustomTask(String taskName, String[] columns) { + super(taskName, columns); + } + + public CustomTask(String taskName, String[][] taskData) { + super(taskName, taskData); + } + + public void setItem(String columnName, int row, String value) { + super.setItem(columnName, row, value); + } + + public String getItem(String columnName, int row) { + modified = true; + return super.getItem(columnName, row); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10CMPBeansEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10CMPBeansEntry.java new file mode 100755 index 000000000000..efadfa62c7d1 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10CMPBeansEntry.java @@ -0,0 +1,82 @@ +package com.ibm.websphere.simplicity.application.tasks; + +public class DataSourceFor10CMPBeansEntry extends TaskEntry { + + public DataSourceFor10CMPBeansEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getEjbModule() { + return super.getEjbModule(); + } + + protected void setEjbModule(String value) { + super.setEjbModule(value); + } + + public String getEjb() { + return super.getEjb(); + } + + protected void setEjb(String value) { + super.setEjb(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getJndi() throws Exception { + return super.getJndi(); + } + + public void setJndi(String value) throws Exception { + task.setModified(); + super.setJndi(value); + } + + public String getUser() { + return super.getUser(); + } + + public void setUser(String value) { + task.setModified(); + super.setUser(value); + } + + public String getPassword() { + return super.getPassword(); + } + + public void setPassword(String value) { + task.setModified(); + super.setPassword(value); + } + + public String getLoginConfig() throws Exception { + hasAtLeast(9); + return super.getLoginConfig(); + } + + public void setLoginConfig(String value) throws Exception { + hasAtLeast(9); + task.setModified(); + super.setLoginConfig(value); + } + + public String getAuthorizationProps() throws Exception { + hasAtLeast(9); + return super.getAuthorizationProps(); + } + + public void setAuthorizationProps(String value) throws Exception { + hasAtLeast(9); + task.setModified(); + super.setAuthorizationProps(value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10CMPBeansTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10CMPBeansTask.java new file mode 100755 index 000000000000..c6a28a9eb63d --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10CMPBeansTask.java @@ -0,0 +1,85 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import java.util.List; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class DataSourceFor10CMPBeansTask extends MultiEntryApplicationTask { + + public DataSourceFor10CMPBeansTask() { + + } + + public DataSourceFor10CMPBeansTask(String[][] taskData) { + super(AppConstants.DataSourceFor10CMPBeansTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new DataSourceFor10CMPBeansEntry(data, this)); + } + } + + public DataSourceFor10CMPBeansTask(String[] columns) { + super(AppConstants.DataSourceFor10CMPBeansTask, columns); + } + + @Override + public DataSourceFor10CMPBeansEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (DataSourceFor10CMPBeansEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public boolean hasDataSource(AssetModule module, String ejb) { + return getEntry( + new String[] { + AppConstants.APPDEPL_URI, + AppConstants.APPDEPL_EJB, + }, + new String[] { + module.getURI(), + ejb, + }) != null; + } + + public DataSourceFor10CMPBeansEntry getDataSource(AssetModule module, String ejb) { + return (DataSourceFor10CMPBeansEntry) getEntry( + new String[] { + AppConstants.APPDEPL_URI, + AppConstants.APPDEPL_EJB, + }, + new String[] { + module.getURI(), + ejb, + }); + } + + public List getDataSources(AssetModule module) { + return (List) getEntries(AppConstants.APPDEPL_URI, module.getURI()); + } + + public void setDataSource(AssetModule module, String ejb, String jndi, String user, String password, String loginConfig, String authorizationProps) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + DataSourceFor10CMPBeansEntry entry = getDataSource(module, ejb); + if (entry == null) { + DataSourceFor10CMPBeansEntry other = getDataSources(module).get(0); + entry = new DataSourceFor10CMPBeansEntry(new String[coltbl.size()], this); + entry.setEjbModule(other.getEjbModule()); + entry.setUri(other.getUri()); + entry.setEjb(ejb); + } + entry.setJndi(jndi); + entry.setUser(user); + entry.setPassword(password); + entry.setLoginConfig(loginConfig); + entry.setAuthorizationProps(authorizationProps); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10EJBModulesEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10EJBModulesEntry.java new file mode 100755 index 000000000000..106e6df3e3fe --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10EJBModulesEntry.java @@ -0,0 +1,82 @@ +package com.ibm.websphere.simplicity.application.tasks; + +public class DataSourceFor10EJBModulesEntry extends TaskEntry { + + public DataSourceFor10EJBModulesEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getAppVersion() throws Exception { + return super.getAppVersion(); + } + + protected void setAppVersion(String value) throws Exception { + super.setAppVersion(value); + } + + public String getEjbModule() { + return super.getEjbModule(); + } + + protected void setEjbModule(String value) { + super.setEjbModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getJndi() throws Exception { + return super.getJndi(); + } + + public void setJndi(String value) throws Exception { + task.setModified(); + super.setJndi(value); + } + + public String getUser() { + return super.getUser(); + } + + public void setUser(String value) { + task.setModified(); + super.setUser(value); + } + + public String getPassword() { + return super.getPassword(); + } + + public void setPassword(String value) { + task.setModified(); + super.setPassword(value); + } + + public String getLoginConfig() throws Exception { + hasAtLeast(6); + return super.getLoginConfig(); + } + + public void setLoginConfig(String value) throws Exception { + hasAtLeast(6); + task.setModified(); + super.setLoginConfig(value); + } + + public String getAuthorizationProps() throws Exception { + hasAtLeast(6); + return super.getAuthorizationProps(); + } + + public void setAuthorizationProps(String value) throws Exception { + hasAtLeast(6); + task.setModified(); + super.setAuthorizationProps(value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10EJBModulesTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10EJBModulesTask.java new file mode 100755 index 000000000000..541390a5643e --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor10EJBModulesTask.java @@ -0,0 +1,85 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import java.util.List; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class DataSourceFor10EJBModulesTask extends MultiEntryApplicationTask { + + public DataSourceFor10EJBModulesTask() { + + } + + public DataSourceFor10EJBModulesTask(String[][] taskData) { + super(AppConstants.DataSourceFor10EJBModulesTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new DataSourceFor10EJBModulesEntry(data, this)); + } + } + + public DataSourceFor10EJBModulesTask(String[] columns) { + super(AppConstants.DataSourceFor10EJBModulesTask, columns); + } + + @Override + public DataSourceFor10EJBModulesEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (DataSourceFor10EJBModulesEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public boolean hasDataSource(AssetModule module, String ejb) { + return getEntry( + new String[] { + AppConstants.APPDEPL_URI, + AppConstants.APPDEPL_EJB, + }, + new String[] { + module.getURI(), + ejb, + }) != null; + } + + public DataSourceFor10EJBModulesEntry getDataSource(AssetModule module, String ejb) { + return (DataSourceFor10EJBModulesEntry) getEntry( + new String[] { + AppConstants.APPDEPL_URI, + AppConstants.APPDEPL_EJB, + }, + new String[] { + module.getURI(), + ejb, + }); + } + + public List getDataSources(AssetModule module) { + return (List) getEntries(AppConstants.APPDEPL_URI, module.getURI()); + } + + public void setDataSource(AssetModule module, String ejb, String jndi, String user, String password, String loginConfig, String authorizationProps) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + DataSourceFor10EJBModulesEntry entry = getDataSource(module, ejb); + if (entry == null) { + DataSourceFor10EJBModulesEntry other = getDataSources(module).get(0); + entry = new DataSourceFor10EJBModulesEntry(new String[coltbl.size()], this); + entry.setAppVersion(other.getAppVersion()); + entry.setEjbModule(other.getEjbModule()); + entry.setUri(other.getUri()); + } + entry.setJndi(jndi); + entry.setUser(user); + entry.setPassword(password); + entry.setLoginConfig(loginConfig); + entry.setAuthorizationProps(authorizationProps); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20CMPBeansEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20CMPBeansEntry.java new file mode 100755 index 000000000000..192e3e6115fc --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20CMPBeansEntry.java @@ -0,0 +1,89 @@ +package com.ibm.websphere.simplicity.application.tasks; + +public class DataSourceFor20CMPBeansEntry extends TaskEntry { + + public DataSourceFor20CMPBeansEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getAppVersion() throws Exception { + return super.getAppVersion(); + } + + protected void setAppVersion(String value) throws Exception { + super.setAppVersion(value); + } + + public String getEjbVersion() throws Exception { + return super.getEjbVersion(); + } + + protected void setEjbVersion(String value) throws Exception { + super.setEjbVersion(value); + } + + public String getEjbModule() { + return super.getEjbModule(); + } + + protected void setEjbModule(String value) { + super.setEjbModule(value); + } + + public String getEjb() { + return super.getEjb(); + } + + protected void setEjb(String value) { + super.setEjb(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getJndi() throws Exception { + return super.getJndi(); + } + + public void setJndi(String value) throws Exception { + task.setModified(); + super.setJndi(value); + } + + public String getResourceAuth() throws Exception { + return super.getResourceAuth(); + } + + public void setResourceAuth(String value) throws Exception { + task.setModified(); + super.setResourceAuth(value); + } + + public String getLoginConfig() throws Exception { + hasAtLeast(8); + return super.getLoginConfig(); + } + + public void setLoginConfig(String value) throws Exception { + hasAtLeast(8); + task.setModified(); + super.setLoginConfig(value); + } + + public String getAuthorizationProps() throws Exception { + hasAtLeast(8); + return super.getAuthorizationProps(); + } + + public void setAuthorizationProps(String value) throws Exception { + hasAtLeast(8); + task.setModified(); + super.setAuthorizationProps(value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20CMPBeansTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20CMPBeansTask.java new file mode 100755 index 000000000000..c4b745e10d62 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20CMPBeansTask.java @@ -0,0 +1,87 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import java.util.List; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class DataSourceFor20CMPBeansTask extends MultiEntryApplicationTask { + + public DataSourceFor20CMPBeansTask() { + + } + + public DataSourceFor20CMPBeansTask(String[][] taskData) { + super(AppConstants.DataSourceFor20CMPBeansTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new DataSourceFor20CMPBeansEntry(data, this)); + } + } + + public DataSourceFor20CMPBeansTask(String[] columns) { + super(AppConstants.DataSourceFor20CMPBeansTask, columns); + } + + @Override + public DataSourceFor20CMPBeansEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (DataSourceFor20CMPBeansEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public boolean hasDataSource(AssetModule module, String ejb) { + return getEntry( + new String[] { + AppConstants.APPDEPL_URI, + AppConstants.APPDEPL_EJB, + }, + new String[] { + module.getURI(), + ejb, + }) != null; + } + + public DataSourceFor20CMPBeansEntry getDataSource(AssetModule module, String ejb) { + return (DataSourceFor20CMPBeansEntry) getEntry( + new String[] { + AppConstants.APPDEPL_URI, + AppConstants.APPDEPL_EJB, + }, + new String[] { + module.getURI(), + ejb, + }); + } + + public List getDataSources(AssetModule module) { + return (List) getEntries(AppConstants.APPDEPL_URI, module.getURI()); + } + + public void setDataSource(AssetModule module, String ejb, String jndi, String resourceAuth, String loginConfig, String authorizationProps) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + DataSourceFor20CMPBeansEntry entry = getDataSource(module, ejb); + if (entry == null) { + // We know we have one for the module, so get a template + DataSourceFor20CMPBeansEntry other = getDataSources(module).get(0); + entry = new DataSourceFor20CMPBeansEntry(new String[coltbl.size()], this); + entry.setAppVersion(other.getAppVersion()); + entry.setEjbModule(other.getEjbModule()); + entry.setUri(other.getUri()); + entry.setEjbVersion(other.getEjbVersion()); + entry.setEjb(ejb); + } + entry.setJndi(jndi); + entry.setResourceAuth(resourceAuth); + entry.setLoginConfig(loginConfig); + entry.setAuthorizationProps(authorizationProps); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20EJBModulesEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20EJBModulesEntry.java new file mode 100755 index 000000000000..5c50f6f58bee --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20EJBModulesEntry.java @@ -0,0 +1,86 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class DataSourceFor20EJBModulesEntry extends TaskEntry { + + public DataSourceFor20EJBModulesEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getAppVersion() throws Exception { + return super.getAppVersion(); + } + + protected void setAppVersion(String value) throws Exception { + super.setAppVersion(value); + } + + public String getEjbModule() { + return super.getEjbModule(); + } + + protected void setEjbModule(String value) { + super.setEjbModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getJndi() throws Exception { + return super.getJndi(); + } + + public void setJndi(String value) throws Exception { + task.setModified(); + super.setJndi(value); + } + + public String getResourceAuth() throws Exception { + return super.getResourceAuth(); + } + + public void setResourceAuth(String value) throws Exception { + task.setModified(); + super.setResourceAuth(value); + } + + public String getLoginConfig() throws Exception { + hasAtLeast(6); + return super.getLoginConfig(); + } + + public void setLoginConfig(String value) throws Exception { + hasAtLeast(6); + task.setModified(); + super.setLoginConfig(value); + } + + public String getAuthorizationProps() throws Exception { + hasAtLeast(6); + return super.getAuthorizationProps(); + } + + public void setAuthorizationProps(String value) throws Exception { + hasAtLeast(6); + task.setModified(); + super.setAuthorizationProps(value); + } + + public String getDataSourceProps() throws Exception { + hasAtLeast(8); + return getString(AppConstants.APPDEPL_DATASOURCE_PROPS); + } + + public void setDataSourceProps(String value) throws Exception { + hasAtLeast(8); + task.setModified(); + setItem(AppConstants.APPDEPL_DATASOURCE_PROPS, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20EJBModulesTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20EJBModulesTask.java new file mode 100755 index 000000000000..dc51ec573379 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DataSourceFor20EJBModulesTask.java @@ -0,0 +1,92 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import java.util.List; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class DataSourceFor20EJBModulesTask extends MultiEntryApplicationTask { + + public DataSourceFor20EJBModulesTask() { + + } + + public DataSourceFor20EJBModulesTask(String[][] taskData) { + super(AppConstants.DataSourceFor20EJBModulesTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new DataSourceFor20EJBModulesEntry(data, this)); + } + } + + public DataSourceFor20EJBModulesTask(String[] columns) { + super(AppConstants.DataSourceFor20EJBModulesTask, columns); + } + + @Override + public DataSourceFor20EJBModulesEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (DataSourceFor20EJBModulesEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public boolean hasDataSource(AssetModule module, String ejb) { + return getEntry( + new String[] { + AppConstants.APPDEPL_URI, + AppConstants.APPDEPL_EJB, + }, + new String[] { + module.getURI(), + ejb, + }) != null; + } + + public void deleteDataSource(AssetModule module, String ejb) { + DataSourceFor20EJBModulesEntry entry = getDataSource(module, ejb); + if (entry != null) + entry.deleteEntry(); + } + + public List getDataSources(AssetModule module) { + return (List) getEntries(AppConstants.APPDEPL_URI, module.getURI()); + } + + public DataSourceFor20EJBModulesEntry getDataSource(AssetModule module, String ejb) { + return (DataSourceFor20EJBModulesEntry) getEntry( + new String[] { + AppConstants.APPDEPL_URI, + AppConstants.APPDEPL_EJB, + }, + new String[] { + module.getURI(), + ejb, + }); + } + + public void setDataSource(AssetModule module, String ejb, String jndi, String resourceAuth, String loginConfig, String authorizationProps, String dataSourceProps) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + DataSourceFor20EJBModulesEntry entry = getDataSource(module, ejb); + if (entry == null) { + // We know we have one for the module, so get a template + DataSourceFor20EJBModulesEntry other = getDataSources(module).get(0); + entry = new DataSourceFor20EJBModulesEntry(new String[coltbl.size()], this); + entry.setAppVersion(other.getAppVersion()); + entry.setEjbModule(other.getEjbModule()); + entry.setUri(other.getUri()); + } + entry.setJndi(jndi); + entry.setResourceAuth(resourceAuth); + entry.setLoginConfig(loginConfig); + entry.setAuthorizationProps(authorizationProps); + entry.setDataSourceProps(dataSourceProps); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DefaultBindingTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DefaultBindingTask.java new file mode 100755 index 000000000000..28dabac203cc --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/DefaultBindingTask.java @@ -0,0 +1,100 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class DefaultBindingTask extends ApplicationTask { + + public DefaultBindingTask() { + + } + + public DefaultBindingTask(String[][] taskData) { + super(AppConstants.DefaultBindingTask, taskData); + } + + public DefaultBindingTask(String[] columns) { + super(AppConstants.DefaultBindingTask, columns); + } + + public String getDefaultDataSourceJndi() { + return getString(AppConstants.APPDEPL_DFLTBNDG_DDSJNDI, 1); + } + + public void setDefaultDataSourceJndi(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DFLTBNDG_DDSJNDI, 1, value); + } + + public String getDefaultDataSourceUser() { + return getString(AppConstants.APPDEPL_DFLTBNDG_DDSUSER, 1); + } + + public void setDefaultDataSourceUser(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DFLTBNDG_DDSUSER, 1, value); + } + + public String getDefaultDataSourcePassword() { + return getString(AppConstants.APPDEPL_DFLTBNDG_DDSPASS, 1); + } + + public void setDefaultDataSourcePassword(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DFLTBNDG_DDSPASS, 1, value); + } + + public String getConnectionFactoryJndi() { + return getString(AppConstants.APPDEPL_DFLTBNDG_CFJNDI, 1); + } + + public void setConnectionFactoryJndi(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DFLTBNDG_CFJNDI, 1, value); + } + + public String getConnectionFactoryResourceAuth() { + return getString(AppConstants.APPDEPL_DFLTBNDG_CFRESAUTH, 1); + } + + public void setConnectionFactoryResourceAuth(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DFLTBNDG_CFRESAUTH, 1, value); + } + + public String getEjbJndiPrefix() { + return getString(AppConstants.APPDEPL_DFLTBNDG_EJBJNDIPREFIX, 1); + } + + public void setEjbJndiPrefix(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DFLTBNDG_EJBJNDIPREFIX, 1, value); + } + + public String getVirtualHost() { + return getString(AppConstants.APPDEPL_DFLTBNDG_VHOST, 1); + } + + public void setVirtualHost(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DFLTBNDG_VHOST, 1, value); + } + + public boolean getForceBindings() { + return getBoolean(AppConstants.APPDEPL_DFLTBNDG_FORCE, 1); + } + + public void setForceBindings(Boolean value) { + modified = true; + setBoolean(AppConstants.APPDEPL_DFLTBNDG_FORCE, 1, value); + } + + public String getStrategyFile() { + return getString(AppConstants.APPDEPL_DFLTBNDG_STRATEGY, 1); + } + + public void setStrategyFile(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DFLTBNDG_STRATEGY, 1, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EJBDeployOptionsTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EJBDeployOptionsTask.java new file mode 100755 index 000000000000..919e20f9c33b --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EJBDeployOptionsTask.java @@ -0,0 +1,88 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class EJBDeployOptionsTask extends ApplicationTask { + + public EJBDeployOptionsTask() { + + } + + public EJBDeployOptionsTask(String[][] taskData) { + super(AppConstants.EJBDeployOptionsTask, taskData); + } + + public EJBDeployOptionsTask(String[] columns) { + super(AppConstants.EJBDeployOptionsTask, columns); + } + + public String getClasspath() { + return getString(AppConstants.APPDEPL_DEPLOYEJB_CLASSPATH_OPTION, 1); + } + + public void setClasspath(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DEPLOYEJB_CLASSPATH_OPTION, 1, value); + } + + public String getRmic() { + return getString(AppConstants.APPDEPL_DEPLOYEJB_RMIC_OPTION, 1); + } + + public void setRmic(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DEPLOYEJB_RMIC_OPTION, 1, value); + } + + public String getDbType() { + return getString(AppConstants.APPDEPL_DEPLOYEJB_DBTYPE_OPTION, 1); + } + + public void setDbType(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DEPLOYEJB_DBTYPE_OPTION, 1, value); + } + + public String getDbSchema() { + return getString(AppConstants.APPDEPL_DEPLOYEJB_DBSCHEMA_OPTION, 1); + } + + public void setDbSchema(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DEPLOYEJB_DBSCHEMA_OPTION, 1, value); + } + + public String getComplianceLevel() throws Exception { + hasAtLeast(5); + return getString(AppConstants.APPDEPL_DEPLOYEJB_COMPLIANCE_LEVEL_OPTION, 1); + } + + public void setComplianceLevel(String value) throws Exception { + hasAtLeast(5); + modified = true; + setItem(AppConstants.APPDEPL_DEPLOYEJB_COMPLIANCE_LEVEL_OPTION, 1, value); + } + + public String getDbAccessType() throws Exception { + hasAtLeast(5); + return getString(AppConstants.APPDEPL_DEPLOYEJB_DBACCESSTYPE_OPTION, 1); + } + + public void setDbAccessType(String value) throws Exception { + hasAtLeast(5); + modified = true; + setItem(AppConstants.APPDEPL_DEPLOYEJB_DBACCESSTYPE_OPTION, 1, value); + } + + public String getSqlJClasspath() throws Exception { + hasAtLeast(5); + return getString(AppConstants.APPDEPL_DEPLOYEJB_SQLJCLASSPATH_OPTION, 1); + } + + public void setSqlJClasspath(String value) throws Exception { + hasAtLeast(5); + modified = true; + setItem(AppConstants.APPDEPL_DEPLOYEJB_SQLJ_ACCESS_OPTION, 1, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EmbeddedRarEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EmbeddedRarEntry.java new file mode 100755 index 000000000000..f6307f42ba06 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EmbeddedRarEntry.java @@ -0,0 +1,61 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class EmbeddedRarEntry extends TaskEntry { + + public EmbeddedRarEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getRarModule() { + return getString(AppConstants.APPDEPL_RAR_MODULE); + } + + protected void setRarModule(String value) { + setItem(AppConstants.APPDEPL_RAR_MODULE, value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getJ2cType() { + return getString(AppConstants.APPDEPL_J2C_TYPE); + } + + protected void setJ2cType(String value) { + setItem(AppConstants.APPDEPL_J2C_TYPE, value); + } + + public String getJ2cId() { + return getString(AppConstants.APPDEPL_J2C_ID); + } + + protected void setJ2cId(String value) { + setItem(AppConstants.APPDEPL_J2C_ID, value); + } + + public String getJ2cName() { + return getString(AppConstants.APPDEPL_J2C_NAME); + } + + public void setJ2cName(String value) { + task.setModified(); + setItem(AppConstants.APPDEPL_J2C_NAME, value); + } + + public String getJ2cJndi() { + return getString(AppConstants.APPDEPL_J2C_JNDINAME); + } + + public void setJ2cJndi(String value) { + task.setModified(); + setItem(AppConstants.APPDEPL_J2C_JNDINAME, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EmbeddedRarTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EmbeddedRarTask.java new file mode 100755 index 000000000000..ec8c55fe6477 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EmbeddedRarTask.java @@ -0,0 +1,30 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class EmbeddedRarTask extends MultiEntryApplicationTask { + + public EmbeddedRarTask() { + + } + + public EmbeddedRarTask(String[][] taskData) { + super(AppConstants.EmbeddedRarTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new EmbeddedRarEntry(data, this)); + } + } + + public EmbeddedRarTask(String[] columns) { + super(AppConstants.EmbeddedRarTask, columns); + } + + @Override + public EmbeddedRarEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (EmbeddedRarEntry) entries.get(i); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor10EJBEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor10EJBEntry.java new file mode 100755 index 000000000000..f6ee6a5f6f98 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor10EJBEntry.java @@ -0,0 +1,36 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class EnsureMethodProtectionFor10EJBEntry extends TaskEntry { + + public EnsureMethodProtectionFor10EJBEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getEjbModule() { + return super.getEjbModule(); + } + + protected void setEjbModule(String value) { + super.setEjbModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public boolean getDenyAll() { + return getBoolean(AppConstants.APPDEPL_METHOD_DENYALL_ACCESS_PERMISSION); + } + + public void setDenyAll(boolean value) { + task.setModified(); + setBoolean(AppConstants.APPDEPL_METHOD_DENYALL_ACCESS_PERMISSION, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor10EJBTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor10EJBTask.java new file mode 100755 index 000000000000..4fa97bd005c0 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor10EJBTask.java @@ -0,0 +1,49 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class EnsureMethodProtectionFor10EJBTask extends MultiEntryApplicationTask { + + public EnsureMethodProtectionFor10EJBTask() { + + } + + public EnsureMethodProtectionFor10EJBTask(String[][] taskData) { + super(AppConstants.EnsureMethodProtectionFor10EJBTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new EnsureMethodProtectionFor10EJBEntry(data, this)); + } + } + + public EnsureMethodProtectionFor10EJBTask(String[] columns) { + super(AppConstants.EnsureMethodProtectionFor10EJBTask, columns); + } + + @Override + public EnsureMethodProtectionFor10EJBEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (EnsureMethodProtectionFor10EJBEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public boolean getDenyAllAccess(AssetModule module) { + EnsureMethodProtectionFor10EJBEntry entry = (EnsureMethodProtectionFor10EJBEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + return entry.getDenyAll(); + } + + public void setDenyAllAccess(AssetModule module, boolean denyAll) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + EnsureMethodProtectionFor10EJBEntry entry = (EnsureMethodProtectionFor10EJBEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + entry.setDenyAll(denyAll); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor20EJBEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor20EJBEntry.java new file mode 100755 index 000000000000..31b72e68b7e8 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor20EJBEntry.java @@ -0,0 +1,36 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class EnsureMethodProtectionFor20EJBEntry extends TaskEntry { + + public EnsureMethodProtectionFor20EJBEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getEjbModule() { + return super.getEjbModule(); + } + + protected void setEjbModule(String value) { + super.setEjbModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getProtectionType() { + return getString(AppConstants.APPDEPL_METHOD_PROTECTION_TYPE); + } + + public void setProtectionType(String value) { + task.setModified(); + setItem(AppConstants.APPDEPL_METHOD_PROTECTION_TYPE, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor20EJBTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor20EJBTask.java new file mode 100755 index 000000000000..787f383f6536 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/EnsureMethodProtectionFor20EJBTask.java @@ -0,0 +1,50 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.application.types.MethodProtectionType; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class EnsureMethodProtectionFor20EJBTask extends MultiEntryApplicationTask { + + public EnsureMethodProtectionFor20EJBTask() { + + } + + public EnsureMethodProtectionFor20EJBTask(String[][] taskData) { + super(AppConstants.EnsureMethodProtectionFor20EJBTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new EnsureMethodProtectionFor20EJBEntry(data, this)); + } + } + + public EnsureMethodProtectionFor20EJBTask(String[] columns) { + super(AppConstants.EnsureMethodProtectionFor20EJBTask, columns); + } + + @Override + public EnsureMethodProtectionFor20EJBEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (EnsureMethodProtectionFor20EJBEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public MethodProtectionType getMethodProtectionType(AssetModule module) { + EnsureMethodProtectionFor20EJBEntry entry = (EnsureMethodProtectionFor20EJBEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + return MethodProtectionType.fromValue(entry.getProtectionType()); + } + + public void setMethodProtectionType(AssetModule module, MethodProtectionType type) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + EnsureMethodProtectionFor20EJBEntry entry = (EnsureMethodProtectionFor20EJBEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + entry.setProtectionType(type.getValue()); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPCompileOptionsEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPCompileOptionsEntry.java new file mode 100755 index 000000000000..b95c3d5a0846 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPCompileOptionsEntry.java @@ -0,0 +1,69 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class JSPCompileOptionsEntry extends TaskEntry { + + public JSPCompileOptionsEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getWebModule() { + return super.getWebModule(); + } + + protected void setWebModule(String value) { + super.setWebModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getJspClasspath() { + return getString(AppConstants.APPDEPL_PRECMPJSP_CLASSPATH_OPTION); + } + + public void setJspClasspath(String value) { + task.setModified(); + setItem(AppConstants.APPDEPL_PRECMPJSP_CLASSPATH_OPTION, value); + } + + public boolean getUseFullPackageNames() { + return getBoolean(AppConstants.APPDEPL_PRECMPJSP_USEFULLPACKAGENAMES, AppConstants.APPDEPL_PRECMPJSP_USEFULLPACKAGENAMES_DEFAULT); + } + + public void setUseFullPackageNames(boolean value) { + task.setModified(); + setBoolean(AppConstants.APPDEPL_PRECMPJSP_USEFULLPACKAGENAMES, value); + } + + public String getSourceLevel() { + return getString(AppConstants.APPDEPL_PRECMPJSP_SOURCELEVEL, AppConstants.APPDEPL_PRECMPJSP_SOURCELEVEL_DEFAULT); + } + + /** + * Corresponds to the Java version used to compile the JSP. The + * string is the version number without dots. So Java 1.4 is "14". + * + * @param value + */ + public void setSourceLevel(String value) { + task.setModified(); + setItem(AppConstants.APPDEPL_PRECMPJSP_SOURCELEVEL, value); + } + + public boolean getDisableRuntimeCompilation() { + return getBoolean(AppConstants.APPDEPL_PRECMPJSP_DISABLERTCOMPILE, AppConstants.APPDEPL_PRECMPJSP_DISABLERTCOMPILE_DEFAULT); + } + + public void setDisableRuntimeCompilation(boolean value) { + task.setModified(); + setBoolean(AppConstants.APPDEPL_PRECMPJSP_DISABLERTCOMPILE, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPCompileOptionsTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPCompileOptionsTask.java new file mode 100755 index 000000000000..b399c363e4e4 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPCompileOptionsTask.java @@ -0,0 +1,51 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class JSPCompileOptionsTask extends MultiEntryApplicationTask { + + public JSPCompileOptionsTask() { + + } + + public JSPCompileOptionsTask(String[][] taskData) { + super(AppConstants.JSPCompileOptionsTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new JSPCompileOptionsEntry(data, this)); + } + } + + public JSPCompileOptionsTask(String[] columns) { + super(AppConstants.JSPCompileOptionsTask, columns); + } + + @Override + public JSPCompileOptionsEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (JSPCompileOptionsEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public JSPCompileOptionsEntry getCompileOptions(AssetModule module) { + return (JSPCompileOptionsEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + } + + public void setCompileOptions(AssetModule module, String classPath, boolean useFullPackageNames, String sourceLevel, boolean disableRuntimeCompilation) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + JSPCompileOptionsEntry entry = (JSPCompileOptionsEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + entry.setJspClasspath(classPath); + entry.setUseFullPackageNames(useFullPackageNames); + entry.setSourceLevel(sourceLevel); + entry.setDisableRuntimeCompilation(disableRuntimeCompilation); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPReloadForWebModEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPReloadForWebModEntry.java new file mode 100755 index 000000000000..7e1311c08447 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPReloadForWebModEntry.java @@ -0,0 +1,45 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class JSPReloadForWebModEntry extends TaskEntry { + + public JSPReloadForWebModEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getWebModule() { + return super.getWebModule(); + } + + protected void setWebModule(String value) { + super.setWebModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public boolean getJspReload() { + return getBoolean(AppConstants.APPDEPL_JSP_RELOADENABLED, AppConstants.APPDEPL_JSP_RELOADENABLED_DEFAULT); + } + + public void setJspReload(boolean value) { + task.setModified(); + setBoolean(AppConstants.APPDEPL_JSP_RELOADENABLED, value); + } + + public int getJspReloadInterval() { + return getInteger(AppConstants.APPDEPL_JSP_RELOADINTERVAL, AppConstants.APPDEPL_JSP_RELOADINTERVAL_DEFAULT); + } + + public void setJspReloadInterval(int value) { + task.setModified(); + setInteger(AppConstants.APPDEPL_JSP_RELOADINTERVAL, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPReloadForWebModTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPReloadForWebModTask.java new file mode 100755 index 000000000000..8ce363d389e5 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/JSPReloadForWebModTask.java @@ -0,0 +1,49 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class JSPReloadForWebModTask extends MultiEntryApplicationTask { + + public JSPReloadForWebModTask() { + + } + + public JSPReloadForWebModTask(String[][] taskData) { + super(AppConstants.JSPReloadForWebModTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new JSPReloadForWebModEntry(data, this)); + } + } + + public JSPReloadForWebModTask(String[] columns) { + super(AppConstants.JSPReloadForWebModTask, columns); + } + + @Override + public JSPReloadForWebModEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (JSPReloadForWebModEntry) entries.get(i); + } + + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + public JSPReloadForWebModEntry getReloadOptions(AssetModule module) { + return (JSPReloadForWebModEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + } + + public void setReloadOptions(AssetModule module, boolean reload, int interval) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + JSPReloadForWebModEntry entry = (JSPReloadForWebModEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + entry.setJspReload(reload); + entry.setJspReloadInterval(interval); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ListModulesEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ListModulesEntry.java new file mode 100755 index 000000000000..51667455cf0c --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ListModulesEntry.java @@ -0,0 +1,49 @@ +package com.ibm.websphere.simplicity.application.tasks; + +public class ListModulesEntry extends TaskEntry { + + public ListModulesEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getModule() { + return super.getModule(); + } + + protected void setModule(String value) { + super.setModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getServer() { + return super.getServer(); + } + + protected void setServer(String value) { + super.setServer(value); + } + + public String getAppVersion() throws Exception { + return super.getAppVersion(); + } + + protected void setAppVersion(String value) throws Exception { + super.setAppVersion(value); + } + + public String getModuleVersion() throws Exception { + return super.getModuleVersion(); + } + + protected void setModuleVersion(String value) throws Exception { + super.setModuleVersion(value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ListModulesTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ListModulesTask.java new file mode 100755 index 000000000000..d467ac4016f8 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/ListModulesTask.java @@ -0,0 +1,30 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class ListModulesTask extends MultiEntryApplicationTask { + + public ListModulesTask() { + + } + + public ListModulesTask(String[][] taskData) { + super(AppConstants.ListModulesTaskName, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new ListModulesEntry(data, this)); + } + } + + public ListModulesTask(String[] columns) { + super(AppConstants.ListModulesTaskName, columns); + } + + @Override + public ListModulesEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (ListModulesEntry) entries.get(i); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapEJBRefToEJBEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapEJBRefToEJBEntry.java new file mode 100755 index 000000000000..e8a7e37e0637 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapEJBRefToEJBEntry.java @@ -0,0 +1,68 @@ +package com.ibm.websphere.simplicity.application.tasks; + +public class MapEJBRefToEJBEntry extends TaskEntry { + + public MapEJBRefToEJBEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getModule() { + return super.getModule(); + } + + protected void setModule(String value) { + super.setModule(value); + } + + public String getEjb() { + return super.getEjb(); + } + + protected void setEjb(String value) { + super.setEjb(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getReferenceBinding() { + return super.getReferenceBinding(); + } + + protected void setReferenceBinding(String value) { + super.setReferenceBinding(value); + } + + public String getClassName() { + return super.getClassName(); + } + + protected void setClassName(String value) { + super.setClassName(value); + } + + public String getJndi() throws Exception { + return super.getJndi(); + } + + public void setJndi(String value) throws Exception { + task.setModified(); + super.setJndi(value); + } + + public String getModuleVersion() throws Exception { + hasAtLeast(7); + return super.getModuleVersion(); + } + + protected void setModuleVersion(String value) throws Exception { + hasAtLeast(7); + super.setModuleVersion(value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapEJBRefToEJBTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapEJBRefToEJBTask.java new file mode 100755 index 000000000000..3fc28c503018 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapEJBRefToEJBTask.java @@ -0,0 +1,30 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class MapEJBRefToEJBTask extends MultiEntryApplicationTask { + + public MapEJBRefToEJBTask() { + + } + + public MapEJBRefToEJBTask(String[][] taskData) { + super(AppConstants.MapEJBRefToEJBTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new MapEJBRefToEJBEntry(data, this)); + } + } + + public MapEJBRefToEJBTask(String[] columns) { + super(AppConstants.MapEJBRefToEJBTask, columns); + } + + @Override + public MapEJBRefToEJBEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (MapEJBRefToEJBEntry) entries.get(i); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapMessageDestinationRefToEJBEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapMessageDestinationRefToEJBEntry.java new file mode 100755 index 000000000000..63942d182a04 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapMessageDestinationRefToEJBEntry.java @@ -0,0 +1,96 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class MapMessageDestinationRefToEJBEntry extends TaskEntry { + + public MapMessageDestinationRefToEJBEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getModule() { + return super.getModule(); + } + + public String getModuleVersion() throws Exception { + return super.getModuleVersion(); + } + + public String getAppVersion() throws Exception { + return super.getAppVersion(); + } + + public String getEjb() { + return super.getEjb(); + } + + public String getUri() { + return super.getUri(); + } + + public String getMessageDestinationObject() { + return super.getItem(AppConstants.APPDEPL_MESSAGE_DESTINATION_OBJECT); + } + + public Boolean getIsMd() { + return super.getBoolean(AppConstants.APPDEPL_IS_MD); + } + + public String getMessageDestinationRefName() { + return super.getItem(AppConstants.APPDEPL_MESSAGE_DESTINATION_REF_NAME); + } + + public String getJndi() throws Exception { + return super.getJndi(); + } + + public String getDestJndi() { + return super.getItem(AppConstants.APPDEPL_JNDI_DEST); + } + + public void setModule(String value) { + task.setModified(); + super.setModule(value); + } + + protected void setModuleVersion(String value) throws Exception { + super.setModuleVersion(value); + } + + protected void setAppVersion(String value) throws Exception { + super.setAppVersion(value); + } + + public void setEjb(String value) { + task.setModified(); + super.setEjb(value); + } + + public void setUri(String value) { + task.setModified(); + super.setUri(value); + } + + public void setMessageDestinationObject(String value) { + task.setModified(); + super.setItem(AppConstants.APPDEPL_MESSAGE_DESTINATION_OBJECT, value); + } + + protected void setIsMd(Boolean value) { + super.setBoolean(AppConstants.APPDEPL_IS_MD, value); + } + + protected void setMessageDestinationRefName(String value) { + super.setItem(AppConstants.APPDEPL_MESSAGE_DESTINATION_REF_NAME, value); + } + + public void setJndi(String value) throws Exception { + task.setModified(); + super.setJndi(value); + } + + protected void setDestJndi(String value) { + super.setItem(AppConstants.APPDEPL_JNDI_DEST, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapMessageDestinationRefToEJBTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapMessageDestinationRefToEJBTask.java new file mode 100755 index 000000000000..6a4dd330b200 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapMessageDestinationRefToEJBTask.java @@ -0,0 +1,30 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class MapMessageDestinationRefToEJBTask extends MultiEntryApplicationTask { + + public MapMessageDestinationRefToEJBTask() { + + } + + public MapMessageDestinationRefToEJBTask(String[][] taskData) { + super(AppConstants.MapMessageDestinationRefToEJBTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new MapMessageDestinationRefToEJBEntry(data, this)); + } + } + + public MapMessageDestinationRefToEJBTask(String[] columns) { + super(AppConstants.MapMessageDestinationRefToEJBTask, columns); + } + + @Override + public MapMessageDestinationRefToEJBEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (MapMessageDestinationRefToEJBEntry) entries.get(i); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapModulesToServersEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapModulesToServersEntry.java new file mode 100755 index 000000000000..337f82ec5ceb --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapModulesToServersEntry.java @@ -0,0 +1,74 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import java.util.List; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Cluster; +import com.ibm.websphere.simplicity.Scope; +import com.ibm.websphere.simplicity.exception.InvalidTargetException; + +public class MapModulesToServersEntry extends TaskEntry { + + public MapModulesToServersEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getModule() { + return super.getModule(); + } + + protected void setModule(String value) { + super.setModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getTarget() { + return super.getServer(); + } + + public void setTarget(Scope value) throws Exception { + validateTarget(value); + task.setModified(); + if (value instanceof ApplicationServer) + super.setServer(((ApplicationServer) value).getMappingName()); + else + super.setServer(((Cluster) value).getMappingName()); + } + + public void setTarget(ApplicationServer value) { + task.setModified(); + super.setServer(value.getMappingName()); + } + + public void setTargets(List values) throws Exception { + task.setModified(); + String target = ""; + for (int i = 0; i < values.size(); ++i) { + validateTarget(values.get(i)); + if (values.get(i) instanceof ApplicationServer) { + target += (((ApplicationServer) values.get(i)).getMappingName() + "+"); + } else { + target += (((Cluster) values.get(i)).getMappingName() + "+"); + } + } + super.setServer(target.substring(0, target.length() - 1)); + } + + public void setTarget(String value) { + task.setModified(); + super.setServer(value); + } + + private void validateTarget(Scope target) throws Exception { + if (!(target instanceof ApplicationServer || target instanceof Cluster)) + throw new InvalidTargetException(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapModulesToServersTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapModulesToServersTask.java new file mode 100755 index 000000000000..483a504e8227 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapModulesToServersTask.java @@ -0,0 +1,122 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import java.util.List; + +import com.ibm.websphere.simplicity.Scope; +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class MapModulesToServersTask extends MultiEntryApplicationTask { + + public MapModulesToServersTask() { + + } + + public MapModulesToServersTask(String[][] taskData) { + super(AppConstants.MapModulesToServersTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new MapModulesToServersEntry(data, this)); + } + } + + public MapModulesToServersTask(String[] columns) { + super(AppConstants.MapModulesToServersTask, columns); + } + + @Override + public MapModulesToServersEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (MapModulesToServersEntry) entries.get(i); + } + + /** + * Determines whether the specified module exists in this application task. + * + * @param module The module to find. + * @return True if the module is found in this application task. + */ + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + /** + * @param module The module whose target will be retrieved. + * @return The raw target string. + */ + public String getTarget(AssetModule module) { + String find = module.getURI(); + MapModulesToServersEntry entry = (MapModulesToServersEntry) getEntry(AppConstants.APPDEPL_URI, find); + if (entry == null) { + // Sometimes WAS gives us slightly differing formats + if (find.indexOf("+") != -1) + find = find.replace("+", ","); + else + find = find.replace(",", "+"); + entry = (MapModulesToServersEntry) getEntry(AppConstants.APPDEPL_URI, find); + } + if (entry == null) + return null; + else + return entry.getTarget(); + } + + /** + * Sets the server or cluster to which the module will be deployed. + * + * @param module The module to be deployed. + * @param target The server or cluster to which the module will be deployed. + * @throws Exception + */ + public void setTarget(AssetModule module, Scope target) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + MapModulesToServersEntry entry = (MapModulesToServersEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + entry.setTarget(target); + } + + /** + * Sets the servers and/or clusters to which the module will be deployed. + * + * @param module The module to be deployed. + * @param targets The servers and/or clusters to which the module will be deployed. + * @throws Exception + */ + public void setTarget(AssetModule module, List targets) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + MapModulesToServersEntry entry = (MapModulesToServersEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + entry.setTargets(targets); + } + + /** + * Sets all modules to deploy on the specified server or cluster. + * + * @param target The server or cluster to which all modules will be deployed. + * @throws Exception + */ + public void setTarget(Scope target) throws Exception { + modified = true; + for (int i = 0; i < size(); i++) { + get(i).setTarget(target); + } + } + + /** + * Sets all modules to deploy on the specified servers and/or clusters. + * + * @param target The servers and/or clusters to which all modules will be deployed. + * @throws Exception + */ + public void setTarget(List targets) throws Exception { + modified = true; + for (int i = 0; i < size(); i++) { + get(i).setTargets(targets); + } + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResEnvRefToResEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResEnvRefToResEntry.java new file mode 100755 index 000000000000..bcdff3ef10b3 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResEnvRefToResEntry.java @@ -0,0 +1,58 @@ +package com.ibm.websphere.simplicity.application.tasks; + +public class MapResEnvRefToResEntry extends TaskEntry { + + public MapResEnvRefToResEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getModule() { + return super.getModule(); + } + + protected void setModule(String value) { + super.setModule(value); + } + + public String getEjb() { + return super.getEjb(); + } + + protected void setEjb(String value) { + super.setEjb(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getResEnvRefBinding() { + return super.getResEnvRefBinding(); + } + + protected void setResEnvRefBinding(String value) { + super.setResEnvRefBinding(value); + } + + public String getResEnvRefType() { + return super.getResEnvRefType(); + } + + protected void setResEnvRefType(String value) { + super.setResEnvRefType(value); + } + + public String getJndi() throws Exception { + return super.getJndi(); + } + + public void setJndi(String value) throws Exception { + task.setModified(); + super.setJndi(value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResEnvRefToResTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResEnvRefToResTask.java new file mode 100755 index 000000000000..42e30412a3ed --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResEnvRefToResTask.java @@ -0,0 +1,30 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class MapResEnvRefToResTask extends MultiEntryApplicationTask { + + public MapResEnvRefToResTask() { + + } + + public MapResEnvRefToResTask(String[][] taskData) { + super(AppConstants.MapResEnvRefToResTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new MapResEnvRefToResEntry(data, this)); + } + } + + public MapResEnvRefToResTask(String[] columns) { + super(AppConstants.MapResEnvRefToResTask, columns); + } + + @Override + public MapResEnvRefToResEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (MapResEnvRefToResEntry) entries.get(i); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResRefToEJBEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResRefToEJBEntry.java new file mode 100755 index 000000000000..6e32853384f0 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResRefToEJBEntry.java @@ -0,0 +1,128 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class MapResRefToEJBEntry extends TaskEntry { + + public MapResRefToEJBEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getAppVersion() throws Exception { + return super.getAppVersion(); + } + + protected void setAppVersion(String value) throws Exception { + super.setAppVersion(value); + } + + public String getModuleVersion() throws Exception { + return super.getModuleVersion(); + } + + protected void setModuleVersion(String value) throws Exception { + super.setModuleVersion(value); + } + + public String getModule() { + return super.getModule(); + } + + protected void setModule(String value) { + super.setModule(value); + } + + public String getEjb() { + return super.getEjb(); + } + + protected void setEjb(String value) { + super.setEjb(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getReferenceBinding() { + return super.getReferenceBinding(); + } + + protected void setReferenceBinding(String value) { + super.setReferenceBinding(value); + } + + public String getType() { + return getString(AppConstants.APPDEPL_RESREF_TYPE); + } + + protected void setType(String value) { + setItem(AppConstants.APPDEPL_RESENVREF_TYPE, value); + } + + public String getOracleRef() { + return getString(AppConstants.APPDEPL_ORACLE_REF); + } + + public void setOracleRef(String value) { + task.setModified(); + setItem(AppConstants.APPDEPL_ORACLE_REF, value); + } + + public String getJndi() throws Exception { + return super.getJndi(); + } + + public void setJndi(String value) throws Exception { + task.setModified(); + super.setJndi(value); + } + + public String getLoginConfig() throws Exception { + hasAtLeast(10); + return super.getLoginConfig(); + } + + public void setLoginConfig(String value) throws Exception { + hasAtLeast(10); + task.setModified(); + super.setLoginConfig(value); + } + + public String getAuthorizationProps() throws Exception { + hasAtLeast(10); + return super.getAuthorizationProps(); + } + + public void setAuthorizationProps(String value) throws Exception { + hasAtLeast(10); + task.setModified(); + super.setAuthorizationProps(value); + } + + public String getResourceAuth() throws Exception { + hasAtLeast(10); + return super.getResourceAuth(); + } + + protected void setResourceAuth(String value) throws Exception { + hasAtLeast(10); + super.setResourceAuth(value); + } + + public String getResDataSourceProps() throws Exception { + hasAtLeast(13); + return getString(AppConstants.APPDEPL_DATASOURCE_PROPS); + } + + public void setResDataSourceProps(String value) throws Exception { + hasAtLeast(13); + task.setModified(); + setItem(AppConstants.APPDEPL_DATASOURCE_PROPS, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResRefToEJBTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResRefToEJBTask.java new file mode 100755 index 000000000000..9b4050c86d1a --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapResRefToEJBTask.java @@ -0,0 +1,37 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import java.util.List; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; + +public class MapResRefToEJBTask extends MultiEntryApplicationTask { + + public MapResRefToEJBTask() { + + } + + public MapResRefToEJBTask(String[][] taskData) { + super(AppConstants.MapResRefToEJBTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new MapResRefToEJBEntry(data, this)); + } + } + + public MapResRefToEJBTask(String[] columns) { + super(AppConstants.MapResRefToEJBTask, columns); + } + + @Override + public MapResRefToEJBEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (MapResRefToEJBEntry) entries.get(i); + } + + @SuppressWarnings("unchecked") + public List getResourceReferenceToResourceMappings(AssetModule module) { + return (List) getEntries(AppConstants.APPDEPL_URI, module.getURI()); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRolesToUsersEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRolesToUsersEntry.java new file mode 100755 index 000000000000..3f2bcc09578a --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRolesToUsersEntry.java @@ -0,0 +1,298 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.websphere.simplicity.application.AppConstants; + +/** + * Represents a single mapping of a role (specific in application.xml) + * to an arbitrary target. + */ +public class MapRolesToUsersEntry extends TaskEntry { + + public MapRolesToUsersEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + /** + * @return The role represented by this instance. + */ + public String getRole() { + return super.getRole(); + } + + protected void setRole(String value) { + super.setRole(value); + } + + /** + * Clear the "everyone" field. + */ + public void clearEveryone() { + task.setModified(); + setItem(AppConstants.APPDEPL_ROLE_EVERYONE, ""); + } + + /** + * @return True if the role applies to both authenticated and unauthenticated users. + */ + public boolean getEveryone() { + return getBoolean(AppConstants.APPDEPL_ROLE_EVERYONE); + } + + /** + * @param value True if the role should apply to both authenticated and unauthenticated users. + */ + public void setEveryone(boolean value) { + task.setModified(); + setBoolean(AppConstants.APPDEPL_ROLE_EVERYONE, value); + } + + /** + * Clear the "all-authenticated-users" field. + */ + public void clearAllAuthenticatedUsers() { + task.setModified(); + setItem(AppConstants.APPDEPL_ROLE_ALL_AUTH_USER, ""); + } + + /** + * @return True if the role applies to all authenticated users. + */ + public boolean getAllAuthenticatedUsers() { + return getBoolean(AppConstants.APPDEPL_ROLE_ALL_AUTH_USER); + } + + /** + * @param value True if the role should apply to all authenticated users. + */ + public void setAllAuthenticatedUsers(boolean value) { + task.setModified(); + setBoolean(AppConstants.APPDEPL_ROLE_ALL_AUTH_USER, value); + } + + /** + * Clear the "user" field. + */ + public void clearUser() { + task.setModified(); + setItem(AppConstants.APPDEPL_ROLE_USER, ""); + } + + /** + * @param value Adds the specified user to the list without replacing the existing users. + */ + public void addUser(String value) { + task.setModified(); + String users = getUser(); + if (users == null) + users = ""; + + if (users != "") + users += "|"; + users += value; + setUser(users); + } + + /** + * @return The user to which the role has been mapped. If multiple users are mapped, this string will be pipe-delimited. + */ + public String getUser() { + return super.getRoleUser(); + } + + /** + * @return The users to which the role has been mapped. + */ + public List getUsers() { + String[] users = super.getRoleUser().split("\\|"); + List ret = new ArrayList(users.length); + for (String user : users) + ret.add(user); + return ret; + } + + /** + * @param value The user to remove from the list of configured users. + */ + public void removeUser(String value) { + task.setModified(); + List users = getUsers(); + List res = new ArrayList(); + for (String s : users) + if (!s.equalsIgnoreCase(value)) + res.add(s); + setUsers(res); + } + + /** + * @param value The user to which the role should apply. Replaces any existing configured user. + */ + public void setUser(String value) { + task.setModified(); + super.setRoleUser(value); + } + + /** + * @param users The users to which the role should apply. Replaces any existing configured users. + */ + public void setUsers(List users) { + clearUser(); + for (String user : users) + addUser(user); + } + + /** + * Clear the "group" field. + */ + public void clearGroup() { + task.setModified(); + setItem(AppConstants.APPDEPL_ROLE_GROUP, ""); + } + + /** + * @param value Adds the specified group to the list without replacing the existing groups. + */ + public void addGroup(String value) { + task.setModified(); + String groups = getGroup(); + if (groups == null) + groups = ""; + + if (groups != "") + groups += "|"; + groups += value; + setGroup(groups); + } + + /** + * @return The group to which the role has been mapped. + */ + public String getGroup() { + return getString(AppConstants.APPDEPL_ROLE_GROUP); + } + + /** + * @return The groups to which the role has been mapped. + */ + public List getGroups() { + String[] groups = getGroup().split("\\|"); + List ret = new ArrayList(groups.length); + for (String group : groups) + ret.add(group); + return ret; + } + + /** + * @param value The group to remove from the list of configured groups. + */ + public void removeGroup(String value) { + task.setModified(); + List groups = getGroups(); + List res = new ArrayList(); + for (String s : groups) + if (!s.equalsIgnoreCase(value)) + res.add(s); + setGroups(res); + } + + /** + * @param value The group to which the role should apply. + */ + public void setGroup(String value) { + task.setModified(); + setItem(AppConstants.APPDEPL_ROLE_GROUP, value); + } + + /** + * @param groups The groups to which the role should apply. Replaces any existing configured groups. + */ + public void setGroups(List groups) { + clearGroup(); + for (String user : groups) + addGroup(user); + } + + /** + * Clear the "all-authenticated-realms" field. + */ + public void clearAllAuthenticatedRealms() { + task.setModified(); + setItem(AppConstants.APPDEPL_ROLE_ALL_AUTH_REALMS, ""); + } + + /** + * @return True if the role applies to all authenticated realms. + * @throws Exception + */ + public boolean getAllAuthenticatedRealms() throws Exception { + hasAtLeast(6); + return getBoolean(AppConstants.APPDEPL_ROLE_ALL_AUTH_REALMS); + } + + /** + * @param value True if the role should apply to all authenticated realms. + * @throws Exception + */ + public void setAllAuthenticatedRealms(boolean value) throws Exception { + hasAtLeast(6); + task.setModified(); + setBoolean(AppConstants.APPDEPL_ROLE_ALL_AUTH_REALMS, value); + } + + /** + * Clear the user access ID list. + */ + public void clearUserAccessIds() { + task.setModified(); + setItem(AppConstants.APPDEPL_ROLE_EVERYONE, ""); + } + + /** + * @return A pipe (|) delimited list of group access IDs. + * @throws Exception + */ + public String getUserAccessIds() throws Exception { + hasAtLeast(6); + return getString(AppConstants.APPDEPL_ROLE_USER_ACCESS_IDS); + } + + /** + * @param value A pipe (|) delimited list of user access IDs. + * @throws Exception + */ + public void setUserAccessIds(String value) throws Exception { + hasAtLeast(6); + task.setModified(); + setItem(AppConstants.APPDEPL_ROLE_USER_ACCESS_IDS, value); + } + + /** + * Clear the group access ID list. + */ + public void clearGroupAccessIds() { + task.setModified(); + setItem(AppConstants.APPDEPL_ROLE_GROUP_ACCESS_IDS, ""); + } + + /** + * @return A pipe (|) delimited list of group access IDs. + * @throws Exception + */ + public String getGroupAccessIds() throws Exception { + hasAtLeast(6); + return getString(AppConstants.APPDEPL_ROLE_GROUP_ACCESS_IDS); + } + + /** + * @param value A pipe (|) delimited list of group access IDs. + * @throws Exception + */ + public void setGroupAccessIds(String value) throws Exception { + hasAtLeast(6); + task.setModified(); + setItem(AppConstants.APPDEPL_ROLE_GROUP_ACCESS_IDS, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRolesToUsersTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRolesToUsersTask.java new file mode 100755 index 000000000000..fdff86da4200 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRolesToUsersTask.java @@ -0,0 +1,133 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class MapRolesToUsersTask extends MultiEntryApplicationTask { + + public MapRolesToUsersTask() { + + } + + public MapRolesToUsersTask(String[][] taskData) { + super(AppConstants.MapRolesToUsersTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new MapRolesToUsersEntry(data, this)); + } + } + + public MapRolesToUsersTask(String[] columns) { + super(AppConstants.MapRolesToUsersTask, columns); + } + + @Override + public MapRolesToUsersEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (MapRolesToUsersEntry) entries.get(i); + } + + public void deleteRoleMap(String role) { + MapRolesToUsersEntry entry = getRoleMap(role); + if (entry != null) + entry.deleteEntry(); + } + + public MapRolesToUsersEntry getRoleMap(String role) { + return (MapRolesToUsersEntry) getEntry(AppConstants.APPDEPL_ROLE, role); + } + + public void clearRole(String role) throws Exception { + MapRolesToUsersEntry entry = getRoleMap(role); + if (entry != null) + this.delete(entry); + } + + public void addGroupToRole(String role, String group) throws Exception { + MapRolesToUsersEntry entry = getRoleMapInternal(role); + entry.addGroup(group); + } + + public void addUserToRole(String role, String user) throws Exception { + MapRolesToUsersEntry entry = getRoleMapInternal(role); + entry.addUser(user); + } + + public void removeGroupFromRole(String role, String group) throws Exception { + MapRolesToUsersEntry entry = getRoleMapInternal(role); + entry.removeGroup(group); + } + + public void removeUserFromRole(String role, String user) throws Exception { + MapRolesToUsersEntry entry = getRoleMapInternal(role); + entry.removeUser(user); + } + + public void setRoleToEveryone(String role) throws Exception { + setRoleMap(role, true, false, false, null, null, null, null); + } + + public void setRoleToAllAuthenticatedRealms(String role) throws Exception { + setRoleMap(role, false, true, false, null, null, null, null); + } + + public void setRoleToAllAuthenticatedUsers(String role) throws Exception { + setRoleMap(role, false, false, true, null, null, null, null); + } + + public void setRoleToGroup(String role, String group) throws Exception { + setRoleMap(role, false, false, false, group, null, null, null); + } + + public void setRoleToGroupAccessIds(String role, String groupAccessIds) throws Exception { + setRoleMap(role, false, false, false, null, groupAccessIds, null, null); + } + + public void setRoleToUser(String role, String user) throws Exception { + setRoleMap(role, false, false, false, null, null, user, null); + } + + public void setRoleToUserAccessIds(String role, String userAccessIds) throws Exception { + setRoleMap(role, false, false, false, null, null, null, userAccessIds); + } + + private void setRoleMap(String role, boolean everyone, boolean allAuthenticatedRealms, boolean allAuthenticatedUsers, String group, String groupAccessIds, String user, + String userAccessIds) throws Exception { + modified = true; + MapRolesToUsersEntry entry = getRoleMapInternal(role); + + entry.clearEveryone(); + entry.clearAllAuthenticatedRealms(); + entry.clearAllAuthenticatedUsers(); + entry.clearGroup(); + entry.clearGroupAccessIds(); + entry.clearUser(); + entry.clearUserAccessIds(); + + if (everyone) + entry.setEveryone(everyone); + else if (allAuthenticatedRealms) + entry.setAllAuthenticatedRealms(allAuthenticatedRealms); + else if (allAuthenticatedUsers) + entry.setAllAuthenticatedUsers(allAuthenticatedUsers); + else if (group != null) + entry.setGroup(group); + else if (groupAccessIds != null) + entry.setGroupAccessIds(groupAccessIds); + else if (user != null) + entry.setUser(user); + else if (userAccessIds != null) + entry.setUserAccessIds(userAccessIds); + } + + private MapRolesToUsersEntry getRoleMapInternal(String role) { + MapRolesToUsersEntry entry = getRoleMap(role); + if (entry == null) { + entry = new MapRolesToUsersEntry(new String[coltbl.size()], this); + entry.setRole(role); + entries.add(entry); + } + return entry; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRunAsRolesToUsersEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRunAsRolesToUsersEntry.java new file mode 100755 index 000000000000..97bc80ce9b8c --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRunAsRolesToUsersEntry.java @@ -0,0 +1,35 @@ +package com.ibm.websphere.simplicity.application.tasks; + +public class MapRunAsRolesToUsersEntry extends TaskEntry { + + public MapRunAsRolesToUsersEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getRole() { + return super.getRole(); + } + + protected void setRole(String value) { + super.setRole(value); + } + + public String getUser() { + return super.getUser(); + } + + public void setUser(String value) { + task.setModified(); + super.setUser(value); + } + + public String getPassword() { + return super.getPassword(); + } + + public void setPassword(String value) { + task.setModified(); + super.setPassword(value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRunAsRolesToUsersTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRunAsRolesToUsersTask.java new file mode 100755 index 000000000000..8fbe291bb2ac --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapRunAsRolesToUsersTask.java @@ -0,0 +1,53 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class MapRunAsRolesToUsersTask extends MultiEntryApplicationTask { + + public MapRunAsRolesToUsersTask() { + + } + + public MapRunAsRolesToUsersTask(String[][] taskData) { + super(AppConstants.MapRunAsRolesToUsersTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new MapRunAsRolesToUsersEntry(data, this)); + } + } + + public MapRunAsRolesToUsersTask(String[] columns) { + super(AppConstants.MapRunAsRolesToUsersTask, columns); + } + + @Override + public MapRunAsRolesToUsersEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (MapRunAsRolesToUsersEntry) entries.get(i); + } + + public void deleteRoleMap(String role) { + modified = true; + MapRunAsRolesToUsersEntry entry = getRoleMap(role); + if (entry != null) + entry.deleteEntry(); + } + + public MapRunAsRolesToUsersEntry getRoleMap(String role) { + return (MapRunAsRolesToUsersEntry) getEntry(AppConstants.APPDEPL_ROLE, role); + } + + public void setRoleMap(String role, String user, String password) throws Exception { + modified = true; + MapRunAsRolesToUsersEntry entry = getRoleMap(role); + if (entry == null) { + entry = new MapRunAsRolesToUsersEntry(new String[coltbl.size()], this); + entry.setRole(role); + entries.add(entry); + } + entry.setUser(user); + entry.setPassword(password); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapWebModToVHEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapWebModToVHEntry.java new file mode 100755 index 000000000000..ef2c37d96683 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapWebModToVHEntry.java @@ -0,0 +1,36 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class MapWebModToVHEntry extends TaskEntry { + + public MapWebModToVHEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + public String getWebModule() { + return super.getWebModule(); + } + + protected void setWebModule(String value) { + super.setWebModule(value); + } + + public String getUri() { + return super.getUri(); + } + + protected void setUri(String value) { + super.setUri(value); + } + + public String getVirtualHost() { + return getString(AppConstants.APPDEPL_VIRTUAL_HOST); + } + + public void setVirtualHost(String value) { + task.setModified(); + setItem(AppConstants.APPDEPL_VIRTUAL_HOST, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapWebModToVHTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapWebModToVHTask.java new file mode 100755 index 000000000000..1a9863f0a2db --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MapWebModToVHTask.java @@ -0,0 +1,82 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class MapWebModToVHTask extends MultiEntryApplicationTask { + + public MapWebModToVHTask() { + + } + + public MapWebModToVHTask(String[][] taskData) { + super(AppConstants.MapWebModToVHTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new MapWebModToVHEntry(data, this)); + } + } + + public MapWebModToVHTask(String[] columns) { + super(AppConstants.MapWebModToVHTask, columns); + } + + @Override + public MapWebModToVHEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (MapWebModToVHEntry) entries.get(i); + } + + /** + * Determines whether the specified module exists in this application task. + * + * @param module The module to find. + * @return True if the module is found in this application task. + */ + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + /** + * Retrieves the currently configured virtual host for the specified module. + * + * @param module The module whose virtual host will be retrieved. + * @return The configured virtual host for the module, or null if either the module doesn't exist or the virtual host has not been configured. + */ + public String getVirtualHost(AssetModule module) { + MapWebModToVHEntry entry = (MapWebModToVHEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + return (entry != null ? entry.getVirtualHost() : null); + } + + /** + * Sets the virtual host for the specified module only. + * + * @param module The module whose virtual host configuration will be changed. + * @param virtualHost The target virtual host. + * @throws Exception + */ + public void setVirtualHost(AssetModule module, String virtualHost) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + MapWebModToVHEntry entry = (MapWebModToVHEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + entry.setVirtualHost(virtualHost); + } + + /** + * Sets the virtual host for all modules. Note that this method does not distinguish + * between existing null and non-null virtual host values. + * + * @param virtualHost The virtual host to which all modules will be mapped. + * @throws Exception + */ + public void setVirtualHost(String virtualHost) throws Exception { + modified = true; + for (int i = 0; i < size(); i++) { + get(i).setVirtualHost(virtualHost); + } + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MetadataCompleteForModulesEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MetadataCompleteForModulesEntry.java new file mode 100755 index 000000000000..2a59c046687b --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MetadataCompleteForModulesEntry.java @@ -0,0 +1,86 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class MetadataCompleteForModulesEntry extends TaskEntry { + + public MetadataCompleteForModulesEntry(String[] data, MultiEntryApplicationTask task) { + super(data, task); + } + + /** + * The name of a module in the installed (or deployed) application. + */ + public String getModule() { + return super.getModule(); + } + + /** + * The location of the module relative to the root of the application (EAR file). + */ + public String getUri() { + return super.getUri(); + } + + /** + * Specifies whether to write the complete module deployment descriptor, including + * deployment information from annotations, to extensible markup language (XML) format. + *

+ * The default is not to write out a module deployment descriptor. + *

+ * If your EJB 3.0 or Web 2.5 module does not have a metadata-complete attribute or the + * metadata-complete attribute is set to false, you can set this value to true and instruct + * the product to write out a module deployment descriptor. + *

+ * Avoid trouble: If your Java EE 5 application uses annotations and a shared library, + * do not enable the metadata-complete attribute. When your application uses annotations and + * a shared library, setting the metadata-complete attribute to true causes the product + * to incorrectly represent an @EJB annotation in the deployment descriptor as <ejb-ref> + * rather than <ejb-local-ref>. For Web modules, setting the metadata-complete attribute + * to true might cause InjectionException errors. If you must set the metadata-complete + * attribute to true, avoid errors by not using a shared library, by placing the shared + * library in either the classes or lib directory of the application server, or by fully + * specifying the metadata in the deployment descriptors. + * + * @return True if the metadata is locked. + */ + public boolean getMetadataComplete() { + return super.getBoolean(AppConstants.APPDEPL_LOCK_MODULE_DD); + } + + protected void setModule(String value) { + super.setModule(value); + } + + protected void setUri(String value) { + super.setUri(value); + } + + /** + * Specifies whether to write the complete module deployment descriptor, including + * deployment information from annotations, to extensible markup language (XML) format. + *

+ * The default is not to write out a module deployment descriptor. + *

+ * If your EJB 3.0 or Web 2.5 module does not have a metadata-complete attribute or the + * metadata-complete attribute is set to false, you can set this value to true and instruct + * the product to write out a module deployment descriptor. + *

+ * Avoid trouble: If your Java EE 5 application uses annotations and a shared library, + * do not enable the metadata-complete attribute. When your application uses annotations and + * a shared library, setting the metadata-complete attribute to true causes the product + * to incorrectly represent an @EJB annotation in the deployment descriptor as <ejb-ref> + * rather than <ejb-local-ref>. For Web modules, setting the metadata-complete attribute + * to true might cause InjectionException errors. If you must set the metadata-complete + * attribute to true, avoid errors by not using a shared library, by placing the shared + * library in either the classes or lib directory of the application server, or by fully + * specifying the metadata in the deployment descriptors. + * + * @param value True to lock the module deployment descriptor. + */ + public void setMetadataComplete(boolean value) { + task.setModified(); + super.setBooleanTrueFalse(AppConstants.APPDEPL_LOCK_MODULE_DD, value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MetadataCompleteForModulesTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MetadataCompleteForModulesTask.java new file mode 100755 index 000000000000..5d8af5027d56 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MetadataCompleteForModulesTask.java @@ -0,0 +1,100 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.application.AssetModule; +import com.ibm.websphere.simplicity.exception.TaskEntryNotFoundException; + +public class MetadataCompleteForModulesTask extends MultiEntryApplicationTask { + + public MetadataCompleteForModulesTask() { + + } + + public MetadataCompleteForModulesTask(String[][] taskData) { + super(AppConstants.MetadataCompleteForModulesTask, taskData); + for (int i = 1; i < taskData.length; i++) { + String[] data = taskData[i]; + this.entries.add(new MetadataCompleteForModulesEntry(data, this)); + } + } + + public MetadataCompleteForModulesTask(String[] columns) { + super(AppConstants.MetadataCompleteForModulesTask, columns); + } + + @Override + public MetadataCompleteForModulesEntry get(int i) { + if (i >= size()) + throw new ArrayIndexOutOfBoundsException(i); + return (MetadataCompleteForModulesEntry) entries.get(i); + } + + /** + * Determines whether the specified module exists in this application task. + * + * @param module The module to find. + * @return True if the module is found in this application task. + */ + public boolean hasModule(AssetModule module) { + return getEntry(AppConstants.APPDEPL_URI, module.getURI()) != null; + } + + /** + * Specifies whether to write the complete module deployment descriptor, including + * deployment information from annotations, to extensible markup language (XML) format. + *

+ * The default is not to write out a module deployment descriptor. + *

+ * If your EJB 3.0 or Web 2.5 module does not have a metadata-complete attribute or the + * metadata-complete attribute is set to false, you can set this value to true and instruct + * the product to write out a module deployment descriptor. + *

+ * Avoid trouble: If your Java EE 5 application uses annotations and a shared library, + * do not enable the metadata-complete attribute. When your application uses annotations and + * a shared library, setting the metadata-complete attribute to true causes the product + * to incorrectly represent an @EJB annotation in the deployment descriptor as <ejb-ref> + * rather than <ejb-local-ref>. For Web modules, setting the metadata-complete attribute + * to true might cause InjectionException errors. If you must set the metadata-complete + * attribute to true, avoid errors by not using a shared library, by placing the shared + * library in either the classes or lib directory of the application server, or by fully + * specifying the metadata in the deployment descriptors. + * + * @param value True to lock the module deployment descriptor. + */ + public void setMetadataComplete(AssetModule module, boolean value) throws Exception { + if (!hasModule(module)) + throw new TaskEntryNotFoundException(); + modified = true; + MetadataCompleteForModulesEntry entry = (MetadataCompleteForModulesEntry) getEntry(AppConstants.APPDEPL_URI, module.getURI()); + entry.setMetadataComplete(value); + } + + /** + * Specifies whether to write the complete module deployment descriptor, including + * deployment information from annotations, to extensible markup language (XML) format. + *

+ * The default is not to write out a module deployment descriptor. + *

+ * If your EJB 3.0 or Web 2.5 module does not have a metadata-complete attribute or the + * metadata-complete attribute is set to false, you can set this value to true and instruct + * the product to write out a module deployment descriptor. + *

+ * Avoid trouble: If your Java EE 5 application uses annotations and a shared library, + * do not enable the metadata-complete attribute. When your application uses annotations and + * a shared library, setting the metadata-complete attribute to true causes the product + * to incorrectly represent an @EJB annotation in the deployment descriptor as <ejb-ref> + * rather than <ejb-local-ref>. For Web modules, setting the metadata-complete attribute + * to true might cause InjectionException errors. If you must set the metadata-complete + * attribute to true, avoid errors by not using a shared library, by placing the shared + * library in either the classes or lib directory of the application server, or by fully + * specifying the metadata in the deployment descriptors. + * + * @param value True to lock the module deployment descriptor. + */ + public void setMetadataComplete(boolean value) throws Exception { + modified = true; + for (int i = 0; i < this.size(); i++) + get(i).setMetadataComplete(value); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MultiEntryApplicationTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MultiEntryApplicationTask.java new file mode 100755 index 000000000000..d714612915ad --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/MultiEntryApplicationTask.java @@ -0,0 +1,137 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import java.lang.reflect.Constructor; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * MEATs work differently than ATs. The superclass's taskData property + * isn't used. Instead the list of entries makes up the task data, and + * when the data is requested we build it from scratch each time. + */ +public abstract class MultiEntryApplicationTask extends ApplicationTask { + + private static final Class c = MultiEntryApplicationTask.class; + + protected ArrayList entries = new ArrayList(); + + public MultiEntryApplicationTask() { + super(); + } + + public MultiEntryApplicationTask(String taskName, String[][] taskData) { + super(taskName, taskData); + } + + public MultiEntryApplicationTask(String taskName, String[] columns) { + super(taskName, columns); + generateEntries(); + } + + public abstract Object get(int i); + + public void deleteAll() { + modified = true; + entries.clear(); + } + + public String[][] getTaskData() { + if (entries.size() == 0) + return null; + + String[][] ret = new String[entries.size() + 1][coltbl.size()]; + // Populate columns + for (Map.Entry entry : coltbl.entrySet()) { + ret[0][entry.getValue()] = entry.getKey(); + } + // Populate data + for (int i = 0; i < entries.size(); i++) { + String[] data = entries.get(i).getTaskData(); + for (int p = 0; p < coltbl.size(); p++) + ret[i + 1][p] = data[p]; + } + return ret; + } + + public void delete(TaskEntry entry) { + modified = true; + entries.remove(entry); + } + + public int size() { + return (entries != null ? entries.size() : 0); + } + + protected TaskEntry getEntry(String column, String value) { + for (TaskEntry entry : entries) { + if (entry.getString(column).equalsIgnoreCase(value)) + return entry; + } + return null; + } + + protected List getEntries(String column, String value) { + List ret = new ArrayList(); + for (TaskEntry entry : entries) { + if (entry.getString(column).equalsIgnoreCase(value)) + ret.add(entry); + } + return ret; + } + + protected TaskEntry getEntry(String[] columns, String[] values) { + for (TaskEntry entry : entries) { + boolean match = true; + for (int i = 0; i < columns.length && match; i++) { + if (!entry.getString(columns[i]).equalsIgnoreCase(values[i])) + match = false; + } + if (match) + return entry; + } + return null; + } + + protected List getEntries(String[] columns, String[] values) { + List ret = new ArrayList(); + for (TaskEntry entry : entries) { + boolean match = true; + for (int i = 0; i < columns.length && match; i++) { + if (!entry.getString(columns[i]).equalsIgnoreCase(values[i])) + match = false; + } + if (match) + ret.add(entry); + } + return ret; + } + + // This is probably unnecessary -- I think it's called at the wrong time to do anything + private void generateEntries() { + Log.entering(c, "generateEntries"); + this.entries = new ArrayList(); + try { + for (int i = 1; i < taskData.length; i++) { + String[] data = new String[taskData[i].length]; + for (int o = 0; o < taskData[i].length; o++) + data[o] = taskData[i][o]; + String className = this.getClass().getCanonicalName().replace("Task", "Entry"); + Log.debug(c, "class: " + className); + Class clazz = Class.forName(className); + + Constructor constructor = clazz.getConstructor(String[].class, MultiEntryApplicationTask.class); + TaskEntry entry = (TaskEntry) constructor.newInstance(data, this); + + this.entries.add(entry); + } + this.taskData = null; + } catch (Exception e) { + Log.error(c, "generateEntries", e); + } + Log.exiting(c, "generateEntries"); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/TaskEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/TaskEntry.java new file mode 100755 index 000000000000..0aa64dd10946 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/TaskEntry.java @@ -0,0 +1,290 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; +import com.ibm.websphere.simplicity.exception.IncompatibleVersionException; + +public abstract class TaskEntry { + + private String[] data; + protected MultiEntryApplicationTask task; + + public TaskEntry(String[] data, MultiEntryApplicationTask task) { + this.data = data; + this.task = task; + } + + public String[] getTaskData() { + return data; + } + + public void deleteEntry() { + task.delete(this); + } + + protected void setBoolean(String columnName, boolean value) { + setItem(columnName, value ? AppConstants.YES_KEY : AppConstants.NO_KEY); + } + + protected void setBooleanTrueFalse(String columnName, boolean value) { + setItem(columnName, value ? "true" : "false"); + } + + protected void setYesNo(String columnName, boolean value) { + setItem(columnName, value ? "Yes" : "No"); + } + + protected void setInteger(String columnName, int value) { + setItem(columnName, Integer.toString(value)); + } + + protected void setItem(String columnName, String value) { + Integer col = task.coltbl.get(columnName); + if (col != null) + data[col] = value; + } + + protected boolean getBoolean(String columnName) { + return getBoolean(columnName, false); + } + + protected boolean getBoolean(String columnName, Boolean deflt) { + String s = getItem(columnName); + boolean b = false; + if (s != null) { + b = (s.equalsIgnoreCase(AppConstants.YES_KEY) || s.equalsIgnoreCase("true") || s.equalsIgnoreCase("yes")); + } + return b || deflt; + } + + protected String getString(String columnName) { + return getString(columnName, null); + } + + protected String getString(String columnName, String deflt) { + String s = getItem(columnName); + if (s == null) + s = deflt; + return s; + } + + protected Integer getInteger(String columnName) { + return getInteger(columnName, null); + } + + protected Integer getInteger(String columnName, Integer deflt) { + String s = getItem(columnName); + Integer ret = toInteger(s); + if (ret == null) + ret = deflt; + return ret; + } + + protected Integer toInteger(String s) { + try { + return Integer.valueOf(s); + } catch (NumberFormatException nfe) { + return null; + } + } + + protected String getItem(String columnName) { + String ret = null; + Integer col = task.coltbl.get(columnName); + if (col != null) + ret = data[col]; + return ret; + } + + // Earlier versions do not have certain columns + protected void hasAtLeast(int columns) throws IncompatibleVersionException { + if (data.length < columns) + throw new IncompatibleVersionException(""); + } + + /* + * ===================================================================================== + * The methods below this point are stock methods to avoid a lot of + * repetition in individual tasks. + */ + + protected String getAppVersion() throws Exception { + return getString(AppConstants.APPDEPL_APP_VERSION); + } + + protected String getEjbVersion() throws Exception { + return getString(AppConstants.APPDEPL_EJB_VERSION); + } + + protected String getServer() { + return getString(AppConstants.APPDEPL_SERVER_NAME); + } + + protected String getModuleVersion() throws Exception { + return getString(AppConstants.APPDEPL_MODULE_VERSION); + } + + protected String getEjbModule() { + return getString(AppConstants.APPDEPL_EJB_MODULE); + } + + protected String getWebModule() { + return getString(AppConstants.APPDEPL_WEB_MODULE, null); + } + + protected String getModule() { + return getString(AppConstants.APPDEPL_MODULE, null); + } + + protected String getEjb() { + return getString(AppConstants.APPDEPL_EJB); + } + + protected String getUri() { + return getString(AppConstants.APPDEPL_URI); + } + + protected String getJndi() throws Exception { + return getString(AppConstants.APPDEPL_JNDI); + } + + protected String getUser() { + return getString(AppConstants.APPDEPL_USERNAME, null); + } + + protected String getPassword() { + return getString(AppConstants.APPDEPL_PASSWORD, null); + } + + protected String getLoginConfig() throws Exception { + return getString(AppConstants.APPDEPL_LOGIN_CONFIG); + } + + protected String getAuthorizationProps() throws Exception { + return getString(AppConstants.APPDEPL_AUTH_PROPS); + } + + protected String getResEnvRefBinding() { + return getString(AppConstants.APPDEPL_REFERENCE_BINDING); + } + + protected String getResEnvRefType() { + return getString(AppConstants.APPDEPL_RESENVREF_TYPE); + } + + protected String getReferenceBinding() { + return getString(AppConstants.APPDEPL_REFERENCE_BINDING); + } + + protected String getClassName() { + return getString(AppConstants.APPDEPL_CLASS); + } + + protected String getRole() { + return getString(AppConstants.APPDEPL_ROLE, null); + } + + protected String getWebContextRoot() { + return getString(AppConstants.APPDEPL_WEB_CONTEXTROOT, null); + } + + protected String getResourceAuth() throws Exception { + return getString(AppConstants.APPDEPL_RES_AUTH); + } + + protected String getRoleUser() { + return getString(AppConstants.APPDEPL_ROLE_USER); + } + + protected void setAppVersion(String value) throws Exception { + setItem(AppConstants.APPDEPL_APP_VERSION, value); + } + + protected void setEjbVersion(String value) throws Exception { + setItem(AppConstants.APPDEPL_EJB_VERSION, value); + } + + protected void setServer(String value) { + setItem(AppConstants.APPDEPL_SERVER_NAME, value); + } + + protected void setModuleVersion(String value) throws Exception { + setItem(AppConstants.APPDEPL_MODULE_VERSION, value); + } + + protected void setEjbModule(String value) { + setItem(AppConstants.APPDEPL_EJB_MODULE, value); + } + + protected void setWebModule(String value) { + setItem(AppConstants.APPDEPL_WEB_MODULE, value); + } + + protected void setModule(String value) { + setItem(AppConstants.APPDEPL_MODULE, value); + } + + protected void setEjb(String value) { + setItem(AppConstants.APPDEPL_EJB, value); + } + + protected void setUri(String value) { + setItem(AppConstants.APPDEPL_URI, value); + } + + protected void setJndi(String value) throws Exception { + setItem(AppConstants.APPDEPL_JNDI, value); + } + + protected void setUser(String value) { + setItem(AppConstants.APPDEPL_USERNAME, value); + } + + protected void setRoleUser(String value) { + setItem(AppConstants.APPDEPL_ROLE_USER, value); + } + + protected void setPassword(String value) { + setItem(AppConstants.APPDEPL_PASSWORD, value); + } + + protected void setLoginConfig(String value) throws Exception { + setItem(AppConstants.APPDEPL_LOGIN_CONFIG, value); + } + + protected void setAuthorizationProps(String value) throws Exception { + setItem(AppConstants.APPDEPL_AUTH_PROPS, value); + } + + protected void setResEnvRefBinding(String value) { + setItem(AppConstants.APPDEPL_REFERENCE_BINDING, value); + } + + protected void setResEnvRefType(String value) { + setItem(AppConstants.APPDEPL_RESENVREF_TYPE, value); + } + + protected void setReferenceBinding(String value) { + setItem(AppConstants.APPDEPL_REFERENCE_BINDING, value); + } + + protected void setClassName(String value) { + setItem(AppConstants.APPDEPL_CLASS, value); + } + + protected void setRole(String value) { + setItem(AppConstants.APPDEPL_ROLE, value); + } + + protected void setWebContextRoot(String value) { + setItem(AppConstants.APPDEPL_WEB_CONTEXTROOT, value); + } + + protected void setResourceAuth(String value) throws Exception { + setItem(AppConstants.APPDEPL_RES_AUTH, value); + } + + protected MultiEntryApplicationTask getTask() { + return this.task; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/WSDeployOptionsTask.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/WSDeployOptionsTask.java new file mode 100755 index 000000000000..8b1710704fd8 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/application/tasks/WSDeployOptionsTask.java @@ -0,0 +1,36 @@ +package com.ibm.websphere.simplicity.application.tasks; + +import com.ibm.websphere.simplicity.application.AppConstants; + +public class WSDeployOptionsTask extends ApplicationTask { + + public WSDeployOptionsTask() { + + } + + public WSDeployOptionsTask(String[] columns) { + super(AppConstants.WSDeployOptionsTask, columns); + } + + public WSDeployOptionsTask(String[][] data) { + super(AppConstants.WSDeployOptionsTask, data); + } + + public String getDeploywsClasspath() { + return getString(AppConstants.APPDEPL_DEPLOYWS_CLASSPATH, 1); + } + + public void setDeployWsClasspath(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DEPLOYWS_CLASSPATH, 1, value); + } + + public String getDeploywsJarDirs() { + return getString(AppConstants.APPDEPL_DEPLOYWS_JARDIRS, 1); + } + + public void setDeployWsJarDirs(String value) { + modified = true; + setItem(AppConstants.APPDEPL_DEPLOYWS_JARDIRS, 1, value); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/Application.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/Application.java new file mode 100755 index 000000000000..4b9df35d8c46 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/Application.java @@ -0,0 +1,40 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.cloudfoundry; + +import java.io.File; + +public final class Application { + + private final String name; + private final String directory; + + public Application(String appName, String appDir) { + this.name = appName; + this.directory = appDir; + } + + public String getName() { + return this.name; + } + + public String getDirectory() { + return this.directory; + } + + public File getApplicationPath() { + String absolutePath = System.getProperty("user.dir") + "/build/push"; + File appLocation = new File(absolutePath, this.directory); + return appLocation; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/CloudController.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/CloudController.java new file mode 100755 index 000000000000..ab68ea9933a8 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/CloudController.java @@ -0,0 +1,110 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.cloudfoundry; + +import com.ibm.websphere.simplicity.cloudfoundry.util.CloudProperties; + +public final class CloudController { + + private final CloudProperties cloudProperties; + private final String FAILED_STRING = "FAILED"; + + public CloudController() { + cloudProperties = new CloudProperties(); + setCFTarget(); + setCFLogin(); + } + + private void setCFTarget() { + //String[] command = { cloudProperties.getCfCommand(), "api", "http://api." + cloudProperties.getHost() }; + String[] command = { "cf", "api", "http://api.stage1.ng.bluemix.net" }; + //System.out.println("Targeting CloudFoundry: " + cloudProperties.getHost()); + System.out.println("Targeting CloudFoundry: stage1.ng.bluemix.net"); + ExecuteCommandUtil.executeCommand(command); + } + + private void setCFLogin() { + //String[] command = { cloudProperties.getCfCommand(), "login", "-u", cloudProperties.getUserName(), "-p", cloudProperties.getPassword() }; + String[] command = { "cf", "login", "-u", "charcoch@uk.ibm.com", "-p", "charlie1" }; + //System.out.println("Login using username: " + cloudProperties.getUserName() + " and password: " + cloudProperties.getPassword()); + System.out.println("Login using username:charcoch@uk.ibm.com"); + ExecuteCommandUtil.executeCommand(command); + } + + //public String pushApplication(Application app) { + public void pushApplication() { + //String failureOutput = ""; + //String[] command = { cloudProperties.getCfCommand(), "push", app.getName(), "-b", cloudProperties.getBuildpack() }; + String[] command = { "cf", "push", "cccctest", "-b", "https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack" };//, "-p", "ServletSample.jar" };//jaxws_fat_server.zip + //System.out.println("Pushing application: " + app.getName() + " from working directory: " + app.getApplicationPath().getAbsolutePath()); + ExecuteCommandUtil.executeCommand(command, "/home/charlie/testapp/env-javaweb"); + //if (ExecuteCommandUtil.executeCommand(command, app.getApplicationPath().getAbsolutePath()).contains(FAILED_STRING)) { + // failureOutput = getLogs(app.getName()); + //} + //return failureOutput; + } + + public String deleteAndPushApplication(Application app) { + String failureOutput = ""; + deleteApplication(app.getName()); + String[] command = { cloudProperties.getCfCommand(), "push", app.getName(), "-b", cloudProperties.getBuildpack() }; + System.out.println("Pushing application: " + app.getName() + " from working directory: " + app.getApplicationPath().getAbsolutePath()); + if (ExecuteCommandUtil.executeCommand(command, app.getApplicationPath().getAbsolutePath()).contains(FAILED_STRING)) { + failureOutput = getLogs(app.getName()); + } + return failureOutput; + } + + public void deleteApplication(String appName) { + String[] command = { cloudProperties.getCfCommand(), "delete", "-f", appName }; + System.out.println("Deleting application: " + appName); + ExecuteCommandUtil.executeCommand(command); + } + + private String getLogs(String appName) { + String[] command = { cloudProperties.getCfCommand(), "logs", appName, "--recent" }; + System.out.println("Getting logs for application: " + appName); + return ExecuteCommandUtil.executeCommand(command); + } + + public void CreateService(String serviceType, String servicePlan, String serviceName) { + String[] command = { cloudProperties.getCfCommand(), "create-service", serviceType, servicePlan, serviceName }; + System.out.println("Creating service: " + serviceName); + ExecuteCommandUtil.executeCommand(command); + } + + public void deleteAndCreateService(String serviceType, String servicePlan, String serviceName) { + deleteService(serviceName); + String[] command = { cloudProperties.getCfCommand(), "create-service", serviceType, servicePlan, serviceName }; + System.out.println("Creating service: " + serviceName); + ExecuteCommandUtil.executeCommand(command); + } + + public void deleteService(String serviceName) { + String[] command = { cloudProperties.getCfCommand(), "delete-service", "-f", serviceName }; + System.out.println("Deleting service: " + serviceName); + ExecuteCommandUtil.executeCommand(command); + } + + public void bindService(String appName, String serviceName) { + String[] command = { cloudProperties.getCfCommand(), "bind-service", appName, serviceName }; + System.out.println("Binding service: " + serviceName + " to application: " + appName); + ExecuteCommandUtil.executeCommand(command); + } + + public void restageApplication(String appName) { + String[] command = { cloudProperties.getCfCommand(), "restage", appName }; + System.out.println("Restaging application: " + appName); + ExecuteCommandUtil.executeCommand(command); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/Endpoint.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/Endpoint.java new file mode 100755 index 000000000000..840d31888662 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/Endpoint.java @@ -0,0 +1,57 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.cloudfoundry; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; + +/** + * + */ +public final class Endpoint { + + private final String name; + private final String contextRoot; + + public Endpoint(String appName) { + this.name = appName; + this.contextRoot = ""; + } + + public Endpoint(String appName, String contextRoot) { + this.name = appName; + this.contextRoot = contextRoot; + } + + private String getURL() { + return "http://" + this.name + ".stage1.mybluemix.net/" + this.contextRoot; + } + + public String getHttpResponse() throws IOException { + URL testURL = new URL(getURL()); + URLConnection connection = testURL.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String inputLine; + StringBuffer buffer = new StringBuffer(); + + while ((inputLine = in.readLine()) != null) { + buffer.append(inputLine + " "); + } + in.close(); + + return buffer.toString().trim(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/ExecuteCommandUtil.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/ExecuteCommandUtil.java new file mode 100755 index 000000000000..59107a23147b --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/ExecuteCommandUtil.java @@ -0,0 +1,53 @@ +package com.ibm.websphere.simplicity.cloudfoundry; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; + +import com.ibm.websphere.simplicity.cloudfoundry.util.StreamGobbler; + +public final class ExecuteCommandUtil { + + public static String executeCommand(String[] command) { + File workDir = new File(""); + return executeCommand(command, workDir.getAbsolutePath()); + } + + public static String executeCommand(String[] command, String workDirPath) { + ProcessBuilder procBuild = new ProcessBuilder(command); + procBuild.directory(new File(workDirPath)); + String outputString = ""; + + // Redirect stderr to stdout so that we don't lose stderr + procBuild.redirectErrorStream(true); + Process proc; + + try { + proc = procBuild.start(); + + // Capture the merged output and error streams in a separate thread, to avoid blocking + boolean async = false; + ByteArrayOutputStream output = new ByteArrayOutputStream(); + StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), output, async); + + outputGobbler.start(); + + // Don't return until we know if the command was successful or not + proc.waitFor(); + + // let the streams catch up (they'll only last for a second past the original process) + outputGobbler.doJoin(); + + outputString = output.toString(); + } catch (IOException e) { + // Don't make calling code handle this exceptions, but throw something so the test fails + throw new RuntimeException("Running the commands " + Arrays.toString(command) + " in directory " + + workDirPath + " gave an exception: " + e, e); + } catch (InterruptedException e) { + // This is unlikely, and probably non-fatal, so a printStackTrace will suffice + e.printStackTrace(); + } + return outputString; + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/util/CloudProperties.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/util/CloudProperties.java new file mode 100755 index 000000000000..f569a7cbbed4 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/util/CloudProperties.java @@ -0,0 +1,149 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.cloudfoundry.util; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public final class CloudProperties { + + private ResourceBundle properties; + + /* + * cf.buildpack https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack poss add .git on the end + * cf.command /usr/bin/cf /usr/bin/X11/cf + * cf.host stage1.ng.bluemix.net + * cf.password password here + * cf.username charcoch@uk.ibm.com + */ + + public CloudProperties() { + try { + properties = ResourceBundle.getBundle("com.ibm.cf.generated.cloud"); + } catch (MissingResourceException e) { + System.err.println("Could not find the resource bundle. This is probably because the test-util project hasn't been built with ant yet. Either build test-util with ant, or set environment variables with the required properties."); + + // Make an empty resource bundle so we don't NPE trying to read + // stuff out of it + properties = new ResourceBundle() { + private final Enumeration keys = new Hashtable() + .elements(); + + @Override + public Enumeration getKeys() { + return keys; + } + + @Override + protected Object handleGetObject(String key) { + return null; + } + }; + } + } + + /** + * Returns a string which represents the fully qualified path to a cf + * executable. + */ + public String getCfCommand() { + String cmd = properties.getString("cf.command"); + + if (cmd == null) { + String rubyLoc = getEnvironmentVariable("RUBY_HOME"); + rubyLoc = rubyLoc.replace("C:", ""); + + final String cf; + if (System.getProperty("os.name").contains("Win")) { + cf = "cf.exe"; + } else { + cf = "cf"; + } + cmd = rubyLoc + System.getProperty("file.separator") + cf; + } + + if (cmd.contains(" ")) { + cmd = "\"" + cmd + "\""; + } + + return cmd; + + } + + /** + * Will always return non-null; if the environment variable is not set, will + * return the name instead. + */ + private String getEnvironmentVariable(String name) { + String env = System.getenv(name); + if (env == null) { + // Set a value for the null variable that indicates what we were + // looking for + env = name; + } + return env; + } + +// public File getLocalWLPHome() { +// String home = properties.getString("liberty.dir"); +// if (home == null) { +// home = getEnvironmentVariable("LIBERTY_HOME"); +// } +// return new File(home); +// } + + /** + * @return + */ + public String getHost() { + String host = properties.getString("cf.host"); + if (host == null) { + host = getEnvironmentVariable("CF_HOST"); + } + return host; + } + + public String getUserName() { + String user = properties.getString("cf.username"); + if (user == null) { + user = getEnvironmentVariable("CF_USERNAME"); + } + return user; + } + + public String getPassword() { + String password = properties.getString("cf.password"); + if (password == null) { + password = getEnvironmentVariable("CF_PASSWORD"); + } + return password; + } + + public String getBuildpack() { + String buildpack = properties.getString("cf.buildpack"); + if (buildpack == null) { + buildpack = getEnvironmentVariable("CF_BUILDPACK"); + } + return buildpack; + } + + /** + * @return + */ + public int getPort() { + // TODO Return a sensible value, once we figure out where to get it from + return 8080; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/util/StreamGobbler.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/util/StreamGobbler.java new file mode 100755 index 000000000000..7c2763007e69 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/util/StreamGobbler.java @@ -0,0 +1,131 @@ +package com.ibm.websphere.simplicity.cloudfoundry.util; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.util.concurrent.TimeUnit; + +/** + * When instances of this Thread object are run, all the character data that is + * written to the input stream is written (and flushed) line by line to the + * output stream.
+ * + * @author Tim Burns + * + */ +public class StreamGobbler extends Thread { + + protected static final String METHOD_RUN = "run"; + + protected final InputStream input; + protected final OutputStream redirect; + protected final boolean async; + + private boolean joined; + private boolean terminated; + + public static void main(String[] args) throws Exception { + ProcessBuilder pb = new ProcessBuilder(); + pb.command(args); + pb.redirectErrorStream(true); + Process p = pb.start(); + StreamGobbler sg = new StreamGobbler(p.getInputStream(), System.out, false); + sg.start(); + p.waitFor(); + sg.doJoin(); + System.exit(p.exitValue()); + } + + /** + * Constructs a new StreamGobbler. + * + * @param input + * The stream of data you want to listen to + * @param redirect + * The stream of data you want to notify about events on the + * input stream. If this argument is null, the underlying + * OutputStream is initialized to a new ByteArrayOutputStream, + * and events occurring on the input stream will be printed to + * trace but otherwise ignored. + */ + public StreamGobbler(final InputStream input, final OutputStream redirect, boolean async) { + this.input = input; + if (redirect == null) { + this.redirect = new ByteArrayOutputStream(); + } else { + this.redirect = redirect; + } + this.async = async; + if (!async) { + setDaemon(true); + } + } + + /* + * (non-Javadoc) + * + * @see java.lang.Thread#run() + */ + @Override + public void run() { + PrintWriter writer = new PrintWriter(this.redirect, true); + BufferedReader reader = new BufferedReader(new InputStreamReader( + this.input)); + try { + for (String line; (line = reader.readLine()) != null;) { + // For the moment, be noisy and dump all output so we can see what's happening + System.out.println(">>" + line); + synchronized (this) { + if (joined) { + // The main thread was notified that the process + // ended and has already given up waiting for + // output from the foreground process. + break; + } + + writer.println(line); + } + } + } catch (IOException ex) { + throw new Error(ex); + } finally { + synchronized (this) { + terminated = true; + notifyAll(); + } + if (async) { + writer.close(); + } + } + } + + public void doJoin() throws InterruptedException { + // Windows and Solaris don't disconnect background processes (start /b + // or cmd & if output is not redirected) from the console of foreground + // processes, so waiting until the end of output from the server script + // means waiting until the server process itself ends. We can't wait + // that long, so we wait one second after .waitFor() ends. Hopefully + // this will be long enough to copy all the output from the script. + + synchronized (this) { + long begin = System.nanoTime(); + long end = begin + TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS); + long duration = end - begin; + while (!terminated && duration > 0) { + TimeUnit.NANOSECONDS.timedWait(this, duration); + duration = end - System.nanoTime(); + } + + // If the thread didn't end after waiting for a second, + // then assume it's stuck in a blocking read. Oh well, + // it's a daemon thread, so it'll go away eventually. Let + // it know that we gave up to avoid spurious output in case + // it eventually wakes up. + joined = true; + } + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/util/UtilityMethods.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/util/UtilityMethods.java new file mode 100755 index 000000000000..4c8ecd6c8d1c --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/cloudfoundry/util/UtilityMethods.java @@ -0,0 +1,40 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.cloudfoundry.util; + +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * + */ +public final class UtilityMethods { + + public static void main(String[] args) { + String[] result = findMatchingSubstrings("^([^\\s\"]+|\"([^\"]*)\")", "\"C:\\Program Files (x86)\\CloudFoundry\\gcf.exe\" push"); + for (String string : result) { + System.out.println(string); + } + } + + public static String[] findMatchingSubstrings(String regex, String text) { + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(text); + ArrayList matches = new ArrayList(); + while (matcher.find()) { + matches.add(matcher.group()); + } + return matches.toArray(new String[matches.size()]); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/APIDiscoveryElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/APIDiscoveryElement.java new file mode 100644 index 000000000000..71b47043c48b --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/APIDiscoveryElement.java @@ -0,0 +1,135 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +public class APIDiscoveryElement extends ConfigElement { + private String apiName; + private Integer maxSubscriptions; + private String publicURL; + private String swaggerDefinition; + + @XmlElement(name = "webModuleDoc") + private ConfigElementList webModuleDocs; + + public String getApiName() { + return apiName; + } + + @XmlAttribute(name = "apiName") + public void setApiName(String apiName) { + this.apiName = apiName; + } + + public Integer getMaxSubscriptions() { + return maxSubscriptions; + } + + @XmlAttribute(name = "maxSubscriptions") + public void setMaxSubscriptions(Integer maxSubscriptions) { + this.maxSubscriptions = maxSubscriptions; + } + + public String getPublicURL() { + return publicURL; + } + + @XmlAttribute(name = "publicURL") + public void setPublicURL(String publicURL) { + this.publicURL = publicURL; + } + + public String getSwaggerDefinition() { + return swaggerDefinition; + } + + @XmlAttribute(name = "swaggerDefinition") + public void setSwaggerDefinition(String swaggerDefinition) { + this.swaggerDefinition = swaggerDefinition; + } + + public ConfigElementList getWebModuleDocs() { + if (this.webModuleDocs == null) { + this.webModuleDocs = new ConfigElementList(); + } + return this.webModuleDocs; + } + + @Override + public String toString() { + StringBuffer sb = new StringBuffer("APIDiscoveryElement ["); + sb.append("apiName=").append(apiName); + sb.append(", maxSubscriptions=").append(maxSubscriptions); + sb.append(", publicURL=").append(publicURL); + sb.append(", swaggerDefinition=").append(swaggerDefinition); + sb.append(", webModuleDocs=["); + if (webModuleDocs != null) { + for (WebModuleDocElement webModuleDoc : webModuleDocs) { + sb.append(webModuleDoc.toString()).append(", "); + } + } + sb.append("]]"); + return sb.toString(); + } + + @XmlType(name = "WebModuleDoc") + public static class WebModuleDocElement extends ConfigElement { + private String contextRoot; + private String docURL; + private Boolean enabled; + private Boolean isPublic; + + public String getContextRoot() { + return contextRoot; + } + + @XmlAttribute(name = "contextRoot") + public void setContextRoot(String contextRoot) { + this.contextRoot = contextRoot; + } + + public String getDocURL() { + return docURL; + } + + @XmlAttribute(name = "docURL") + public void setDocURL(String docURL) { + this.docURL = docURL; + } + + public Boolean getEnabled() { + return enabled; + } + + @XmlAttribute(name = "enabled") + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public Boolean getIsPublic() { + return isPublic; + } + + @XmlAttribute(name = "public") + public void setIsPublic(Boolean isPublic) { + this.isPublic = isPublic; + } + + @Override + public String toString() { + return "WebModuleDoc [contextRoot=" + contextRoot + ", docURL=" + docURL + ", enabled=" + enabled + ", public=" + isPublic + "]"; + } + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ActivationSpec.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ActivationSpec.java new file mode 100755 index 000000000000..014bb0b3d473 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ActivationSpec.java @@ -0,0 +1,62 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.Arrays; +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +public class ActivationSpec extends ConfigElement { + // attributes + private String authDataRef; + + // nested elements + @XmlElement(name = "authData") + private ConfigElementList authDatas; + @XmlElement(name = "properties.dcra") + private ConfigElementList properties_dcra; + @XmlElement(name = "properties.FAT1") + private ConfigElementList properties_FAT1; + + public ConfigElementList getAuthData() { + return authDatas == null ? (authDatas = new ConfigElementList()) : authDatas; + } + + public String getAuthDataRef() { + return authDataRef; + } + + public ConfigElementList getProperties_dcra() { + return properties_dcra == null ? (properties_dcra = new ConfigElementList()) : properties_dcra; + } + + public ConfigElementList getProperties_FAT1() { + return properties_FAT1 == null ? (properties_FAT1 = new ConfigElementList()) : properties_FAT1; + } + + @XmlAttribute + public void setAuthDataRef(String authDataRef) { + this.authDataRef = authDataRef; + } + + @SuppressWarnings("unchecked") + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + if (authDataRef != null) + buf.append("authDataRef=\"" + authDataRef + "\" "); + + List nestedElementsList = Arrays.asList( + authDatas, + properties_dcra, + properties_FAT1 + ); + for (ConfigElementList nestedElements : (List>) nestedElementsList) + if (nestedElements != null && nestedElements.size() > 0) + for (Object o : nestedElements) + buf.append(", " + o); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/AdminObject.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/AdminObject.java new file mode 100755 index 000000000000..038c70087840 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/AdminObject.java @@ -0,0 +1,104 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.Arrays; +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +public class AdminObject extends ConfigElement { + // attributes + private String jndiName; + + // nested elements + @XmlElement(name = "properties.CalendarApp.CalendarRA") + private ConfigElementList properties_CalendarApp_CalendarRA; + + @XmlElement(name = "properties.CalendarRA") + private ConfigElementList properties_CalendarRA; + + @XmlElement(name = "properties.dcra") + private ConfigElementList properties_dcra; + + @XmlElement(name = "properties.dcra.Date") + private ConfigElementList properties_dcra_Date; + + @XmlElement(name = "properties.dcra.LinkedList") + private ConfigElementList properties_dcra_LinkedList; + + @XmlElement(name = "properties.dcra.List") + private ConfigElementList properties_dcra_List; + + @XmlElement(name = "properties.DynamicConfigRA.List") + private ConfigElementList properties_DynamicConfigRA_List; + + @XmlElement(name = "properties.FAT1") + private ConfigElementList properties_FAT1; + + public String getJndiName() { + return this.jndiName; + } + + public ConfigElementList getProperties_CalendarApp_CalendarRA() { + return properties_CalendarApp_CalendarRA == null ? (properties_CalendarApp_CalendarRA = new ConfigElementList()) : properties_CalendarApp_CalendarRA; + } + + public ConfigElementList getProperties_CalendarRA() { + return properties_CalendarRA == null ? (properties_CalendarRA = new ConfigElementList()) : properties_CalendarRA; + } + + public ConfigElementList getProperties_dcra() { + return properties_dcra == null ? (properties_dcra = new ConfigElementList()) : properties_dcra; + } + + public ConfigElementList getProperties_dcra_Date() { + return properties_dcra_Date == null ? (properties_dcra_Date = new ConfigElementList()) : properties_dcra_Date; + } + + public ConfigElementList getProperties_dcra_LinkedList() { + return properties_dcra_LinkedList == null ? (properties_dcra_LinkedList = new ConfigElementList()) : properties_dcra_LinkedList; + } + + public ConfigElementList getProperties_dcra_List() { + return properties_dcra_List == null ? (properties_dcra_List = new ConfigElementList()) : properties_dcra_List; + } + + public ConfigElementList getProperties_DynamicConfigRA_List() { + return properties_DynamicConfigRA_List == null ? (properties_DynamicConfigRA_List = new ConfigElementList()) : properties_DynamicConfigRA_List; + } + + public ConfigElementList getProperties_FAT1() { + return properties_FAT1 == null ? (properties_FAT1 = new ConfigElementList()) : properties_FAT1; + } + + @XmlAttribute + public void setJndiName(String jndiName) { + this.jndiName = ConfigElement.getValue(jndiName); + } + + @SuppressWarnings("unchecked") + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + if (jndiName != null) + buf.append("jndiName=\"" + jndiName + "\" "); + + List nestedElementsList = Arrays.asList( + properties_CalendarApp_CalendarRA, + properties_CalendarRA, + properties_dcra, + properties_dcra_Date, + properties_dcra_LinkedList, + properties_dcra_List, + properties_DynamicConfigRA_List, + properties_FAT1 + ); + for (ConfigElementList nestedElements : (List>) nestedElementsList) + if (nestedElements != null && nestedElements.size() > 0) + for (Object o : nestedElements) + buf.append(", " + o); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Application.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Application.java new file mode 100755 index 000000000000..fac1bb81b241 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Application.java @@ -0,0 +1,147 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * Represents an explicitly installed application + * + * @author Tim Burns + * + */ +public class Application extends ConfigElement { + + private String name; + private String type; + private String location; + @XmlElement(name = "classloader") + private ConfigElementList classloaders; + @XmlElement(name = "application-bnd") + private ApplicationBnd applicationBnd; + @XmlElement(name = "resourceAdapter") + private ConfigElementList resourceAdapters; + + //@XmlElement(name = "library") + //private List libraries; + + /** + * @return the name of the application (defines context root for wars) + */ + public String getName() { + return this.name; + } + + /** + * @param name the name of the application (defines context root for wars) + */ + @XmlAttribute + public void setName(String name) { + this.name = ConfigElement.getValue(name); + } + + /** + * @return the type of the archive (ear/war/etc) + */ + public String getType() { + return this.type; + } + + /** + * @param type the type of the archive (ear/war/etc) + */ + @XmlAttribute + public void setType(String type) { + this.type = ConfigElement.getValue(type); + } + + /** + * @return the location where the archive is located (may be remote from the local JVM) + */ + public String getLocation() { + return this.location; + } + + /** + * @param location the location where the archive is located (may be remote from the local JVM) + */ + @XmlAttribute + public void setLocation(String location) { + this.location = ConfigElement.getValue(location); + } + + /** + * @deprecated do not use for new code. Use getClassloaders instead. This method exists only for legacy purposes. It does not follow proper conventions for simplicity config. + * @return gets the first configured class loader if one exists, otherwise creates a new ClassloaderElement as the first configured classloader. + */ + @Deprecated + public ClassloaderElement getClassloader() { + if (this.classloaders == null) + this.classloaders = new ConfigElementList(); + if (this.classloaders.isEmpty()) + this.classloaders.add(new ClassloaderElement()); + return this.classloaders.get(0); + } + + /** + * @return gets all configured class loaders + */ + public ConfigElementList getClassloaders() { + if (classloaders == null) { + classloaders = new ConfigElementList(); + } + return classloaders; + } + + /** + * @return get application binding information + */ + public ApplicationBnd getApplicationBnd() { + if (this.applicationBnd == null) { + this.applicationBnd = new ApplicationBnd(); + } + return this.applicationBnd; + } + + /** + * @return configuration for resource adapters that are embedded in the application + */ + public ConfigElementList getResourceAdapters() { + if (resourceAdapters == null) + resourceAdapters = new ConfigElementList(); + return resourceAdapters; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("Application{"); + if (name != null) + buf.append("name=\"" + name + "\" "); + if (type != null) + buf.append("type=\"" + type + "\" "); + if (location != null) + buf.append("location=\"" + location + "\" "); + if (classloaders != null) + buf.append(classloaders); + if (applicationBnd != null) + buf.append(applicationBnd.toString()); + if (resourceAdapters != null) + buf.append(resourceAdapters); + buf.append("}"); + + return buf.toString(); + } + + @Override + public Application clone() throws CloneNotSupportedException { + Application clone = (Application) super.clone(); + if (this.classloaders != null) + clone.classloaders = this.classloaders.clone(); + if (this.applicationBnd != null) + clone.applicationBnd = this.applicationBnd.clone(); + if (this.resourceAdapters != null) + clone.resourceAdapters = this.resourceAdapters.clone(); + + return clone; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ApplicationBnd.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ApplicationBnd.java new file mode 100755 index 000000000000..65e79f4b71b8 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ApplicationBnd.java @@ -0,0 +1,80 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * Binds general deployment information included in the application to specific resources. See /com.ibm.ws.javaee.dd/resources/OSGI-INF/metatype/metatype.xml + * + * @author Tim Burns + * + */ +public class ApplicationBnd extends ConfigElement { + + private String version; + @XmlElement(name = "security-role") + private ConfigElementList securityRoles; + + /** + * @return the version of the application bindings specification. + */ + public String getVersion() { + return this.version; + } + + /** + * @param version the version of the application bindings specification. + */ + @XmlAttribute + public void setVersion(String version) { + this.version = version; + } + + /** + * Retrieves the users for this role + * + * @return the users for this role + */ + public ConfigElementList getSecurityRoles() { + if (this.securityRoles == null) { + this.securityRoles = new ConfigElementList(); + } + return this.securityRoles; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("ApplicationBnd{"); + if (version != null) + buf.append("version=\"" + version + "\" "); + if (this.securityRoles != null) + for (SecurityRole securityRole : this.securityRoles) + buf.append(securityRole.toString() + ","); + buf.append("}"); + + return buf.toString(); + } + + @Override + public ApplicationBnd clone() throws CloneNotSupportedException { + ApplicationBnd clone = (ApplicationBnd) super.clone(); + if (this.securityRoles != null) { + clone.securityRoles = new ConfigElementList(); + for (SecurityRole securityRole : this.securityRoles) + clone.securityRoles.add((SecurityRole) securityRole.clone()); + } + return clone; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ApplicationMonitorElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ApplicationMonitorElement.java new file mode 100755 index 000000000000..9d98d9f0556c --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ApplicationMonitorElement.java @@ -0,0 +1,51 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * + */ +public class ApplicationMonitorElement extends ConfigElement { + private Boolean enabled; + private String dropins; + + public Boolean getEnabled() { + return enabled; + } + + public String getDropins() { + return dropins; + } + + @XmlAttribute(name = "enabled") + public void setEnabled(Boolean b) { + this.enabled = b; + } + + @XmlAttribute(name = "dropins") + public void setDropins(String s) { + this.dropins = s; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("ApplicationMonitorElement{"); + if (enabled != null) + buf.append("enabled=\"" + enabled + "\" "); + if (dropins != null) + buf.append("dropins=\"" + dropins + "\""); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/AuthData.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/AuthData.java new file mode 100755 index 000000000000..06118686b8dd --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/AuthData.java @@ -0,0 +1,119 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; + +/** + * An authData element for holding usernames and passwords + */ +public class AuthData extends ConfigElement implements ModifiableConfigElement { + + private static final Class c = AuthData.class; + + private String user; + private String password; + private String fatModify; + + public String getUser() { + return user; + } + + @XmlAttribute + public void setUser(String user) { + this.user = user; + } + + public String getPassword() { + return password; + } + + @XmlAttribute + public void setPassword(String password) { + this.password = password; + } + + @XmlAttribute(name = "fat.modify") + public void setFatModify(String fatModify) { + this.fatModify = fatModify; + } + + public String getFatModify() { + return fatModify; + } + + /** + * Modifies the element if the fat.modify="true" attribute was configured for this element. + * + * @param config The ServerConfiguration instance. + */ + @Override + public void modify(ServerConfiguration config) throws Exception { + if (fatModify != null && fatModify.toLowerCase().equals("true")) { + updateAuthDataFromBootStrapDBUser1(); + } + } + + /** + * Update an AuthData using database.user1 from Bootstrap + */ + public void updateAuthDataFromBootStrapDBUser1() throws Exception { + Log.entering(c, "updateAuthDataFromBootStrapDBUser1"); + Bootstrap bs = Bootstrap.getInstance(); + + if (bs.getValue(BootstrapProperty.DB_USER1.getPropertyName()) == null) { + Log.info(c, "updateAuthDataFromBootStrapDBUser1", "Database user1 property was not found, skip setting user id and password"); + return; + } + + this.user = bs.getValue(BootstrapProperty.DB_USER1.getPropertyName()); + this.password = bs.getValue(BootstrapProperty.DB_PASSWORD1.getPropertyName()); + Log.exiting(c, "updateAuthDataFromBootStrapDBUser1"); + } + + /** + * Update an AuthData using database.user2 from Bootstrap + */ + public void updateAuthDataFromBootStrapDBUser2() throws Exception { + Log.entering(c, "updateAuthDataFromBootStrapDBUser2"); + Bootstrap bs = Bootstrap.getInstance(); + + if (bs.getValue(BootstrapProperty.DB_USER2.getPropertyName()) == null) { + Log.info(c, "updateAuthDataFromBootStrapDBUser2", "Database user2 property was not found, skip setting user id and password"); + return; + } + + this.user = bs.getValue(BootstrapProperty.DB_USER2.getPropertyName()); + this.password = bs.getValue(BootstrapProperty.DB_PASSWORD2.getPropertyName()); + Log.exiting(c, "updateAuthDataFromBootStrapDBUser2"); + } + + /** + * Returns a string containing a list of the properties and their values stored + * for this AuthData object. + * + * @return String representing the data + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("AuthData{"); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + buf.append("user=\"" + (user == null ? "" : user) + "\" "); + buf.append("password=\"" + (password == null ? "" : "*****") + "\""); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/BasicRegistry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/BasicRegistry.java new file mode 100755 index 000000000000..8b2372495a76 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/BasicRegistry.java @@ -0,0 +1,248 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +/** + * A basic security registry. See /com.ibm.ws.security.registry.basic/resources/OSGI-INF/metatype/metatype.xml + * + */ +public class BasicRegistry extends ConfigElement { + + /** + * Represents group configuration for a basic registry. Nested inside parent to distinguish from group elements of other types. See + * /com.ibm.ws.security.registry.basic/resources/OSGI-INF/metatype/metatype.xml + * + */ + @XmlType(name = "BasicRegistryGroup") + public static class Group extends ConfigElement { + + /** + * Represents member configuration for a basic registry. Nested inside parent to distinguish from member elements of other types. See + * /com.ibm.ws.security.registry.basic/resources/OSGI-INF/metatype/metatype.xml + * + */ + @XmlType(name = "BasicRegistryGroupMember") + public static class Member extends ConfigElement { + + private String name; + + public String getName() { + return this.name; + } + + @XmlAttribute + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer(this.getClass().getSimpleName()); + buf.append("{"); + if (name != null) + buf.append("name=\"" + name + "\" "); + buf.append("}"); + return buf.toString(); + } + + @Override + public Member clone() throws CloneNotSupportedException { + return (Member) super.clone(); + } + + } + + private String name; + @XmlElement(name = "member") + private ConfigElementList members; + + public String getName() { + return this.name; + } + + @XmlAttribute + public void setName(String name) { + this.name = name; + } + + /** + * Retrieves the members in this group + * + * @return the members in this group + */ + public ConfigElementList getMembers() { + if (this.members == null) { + this.members = new ConfigElementList(); + } + return this.members; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer(this.getClass().getSimpleName()); + buf.append("{"); + if (name != null) + buf.append("name=\"" + name + "\" "); + if (this.members != null) { + for (Member member : this.members) { + buf.append(member.toString() + ","); + } + } + buf.append("}"); + return buf.toString(); + } + + @Override + public Group clone() throws CloneNotSupportedException { + Group clone = (Group) super.clone(); + if (this.members != null) { + clone.members = new ConfigElementList(); + for (Member member : this.members) { + clone.members.add(member.clone()); + } + } + return clone; + } + + } + + /** + * Represents user configuration for a basic registry. Nested inside parent to distinguish from user elements of other types. See + * /com.ibm.ws.security.registry.basic/resources/OSGI-INF/metatype/metatype.xml + * + */ + @XmlType(name = "BasicRegistryUser") + public static class User extends ConfigElement { + + private String name; + private String password; + + public String getName() { + return this.name; + } + + @XmlAttribute + public void setName(String name) { + this.name = name; + } + + public String getPassword() { + return this.password; + } + + @XmlAttribute + public void setPassword(String password) { + this.password = password; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer(this.getClass().getSimpleName()); + buf.append("{"); + if (name != null) + buf.append("name=\"" + name + "\" "); + if (password != null) + buf.append("password=\"" + password + "\" "); + buf.append("}"); + return buf.toString(); + } + + @Override + public User clone() throws CloneNotSupportedException { + return (User) super.clone(); + } + + } + + @XmlElement(name = "user") + private ConfigElementList users; + @XmlElement(name = "group") + private ConfigElementList groups; + private String realm; + + public String getRealm() { + return this.realm; + } + + @XmlAttribute + public void setRealm(String realm) { + this.realm = realm; + } + + /** + * Retrieves the users for this role + * + * @return the users for this role + */ + public ConfigElementList getUsers() { + if (this.users == null) { + this.users = new ConfigElementList(); + } + return this.users; + } + + /** + * Retrieves the groups for this role + * + * @return the groups for this role + */ + public ConfigElementList getGroups() { + if (this.groups == null) { + this.groups = new ConfigElementList(); + } + return this.groups; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer(this.getClass().getSimpleName()); + buf.append("{"); + if (this.realm != null) { + buf.append("realm=\"" + this.realm + "\" "); + } + if (this.users != null) { + for (User user : this.users) { + buf.append(user.toString() + ","); + } + } + if (this.groups != null) { + for (Group group : this.groups) { + buf.append(group.toString() + ","); + } + } + buf.append("}"); + return buf.toString(); + } + + @Override + public BasicRegistry clone() throws CloneNotSupportedException { + BasicRegistry clone = (BasicRegistry) super.clone(); + if (this.users != null) { + clone.users = new ConfigElementList(); + for (User user : this.users) { + clone.users.add(user.clone()); + } + } + if (this.groups != null) { + clone.groups = new ConfigElementList(); + for (Group group : this.groups) { + clone.groups.add(group.clone()); + } + } + return clone; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Bell.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Bell.java new file mode 100644 index 000000000000..b0ece696048e --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Bell.java @@ -0,0 +1,58 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import java.util.Set; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * Represents the element in server.xml + */ +public class Bell extends ConfigElement { + + private final Class c = Bell.class; + + private String libraryRef; + + private Set service; + + @XmlAttribute(required = true) + public String getLibraryRef() { + return libraryRef; + } + + public void setLibraryRef(String libraryRef) { + this.libraryRef = libraryRef; + } + + @XmlAttribute + public Set getService() { + return service; + } + + public void setService(Set service) { + this.service = service; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + // attributes + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + if (getLibraryRef() != null) + buf.append("libraryRef=").append(getLibraryRef()).append(' '); + buf.append('}'); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClassloaderElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClassloaderElement.java new file mode 100755 index 000000000000..945aa85ab428 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClassloaderElement.java @@ -0,0 +1,80 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.Set; +import java.util.TreeSet; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * Represents an explicitly installed application + * + * @author Tim Burns + * + */ +public class ClassloaderElement extends ConfigElement { + + @XmlAttribute(name = "commonLibraryRef") + private Set commonLibraryRefs; + + @XmlAttribute(name = "privateLibraryRef") + private Set privateLibraryRefs; + + private String apiTypeVisibility; + + public Set getCommonLibraryRefs() { + if (this.commonLibraryRefs == null) { + this.commonLibraryRefs = new TreeSet(); + } + return this.commonLibraryRefs; + } + + public Set getPrivateLibraryRefs() { + if (this.privateLibraryRefs == null) { + this.privateLibraryRefs = new TreeSet(); + } + return this.privateLibraryRefs; + } + + @Override + public ClassloaderElement clone() throws CloneNotSupportedException { + ClassloaderElement clone = (ClassloaderElement) super.clone(); + + if (this.commonLibraryRefs != null) { + clone.commonLibraryRefs = new TreeSet(); + for (String ref : this.commonLibraryRefs) + clone.commonLibraryRefs.add(ref); + } + + if (this.privateLibraryRefs != null) { + clone.privateLibraryRefs = new TreeSet(); + for (String ref : this.privateLibraryRefs) + clone.privateLibraryRefs.add(ref); + } + + return clone; + } + + @XmlAttribute(name = "apiTypeVisibility") + public void setApiTypeVisibility(String apiTypes) { + this.apiTypeVisibility = apiTypes; + } + + public String getApiTypeVisibility() { + return this.apiTypeVisibility; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("ClassLoaderElement{"); + if (commonLibraryRefs != null) + for (String ref : this.commonLibraryRefs) + buf.append("commonLibraryRefs=\"" + ref + "\" "); + if (privateLibraryRefs != null) + for (String ref : this.privateLibraryRefs) + buf.append("libraryRefs=\"" + ref + "\" "); + buf.append("apiTypeVisibility=\"" + (apiTypeVisibility == null ? "" : apiTypeVisibility) + "\" "); + buf.append("}"); + + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClassloadingElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClassloadingElement.java new file mode 100755 index 000000000000..b68a12103f44 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClassloadingElement.java @@ -0,0 +1,39 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * A top level global "classloading" element, rather than an app's classloader. + */ +public class ClassloadingElement extends ConfigElement { + private Boolean useJarUrls = false; + + public Boolean getUseJarUrls() { + return useJarUrls; + } + + @XmlAttribute(name = "useJarUrls") + public void setUseJarUrls(Boolean b) { + this.useJarUrls = b; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("ClassloadingElement{"); + if (useJarUrls != null) + buf.append("useJarUrls=\"" + useJarUrls + "\" "); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClientConfiguration.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClientConfiguration.java new file mode 100755 index 000000000000..f6da5d3d813f --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClientConfiguration.java @@ -0,0 +1,396 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.namespace.QName; + +import org.w3c.dom.Element; + +/** + * Represents a client configuration document for the WAS 8.5 Liberty Profile. + */ +@XmlRootElement(name = "client") +public class ClientConfiguration implements Cloneable { + + private String description; + @XmlElement(name = "featureManager") + private FeatureManager featureManager; + + @XmlElement(name = "activationSpec") + private ConfigElementList activationSpecs; + + @XmlElement(name = "adminObject") + private ConfigElementList adminObjects; + + @XmlElement(name = "basicRegistry") + private ConfigElementList basicRegistries; + + @XmlElement(name = "application") + private ConfigElementList applications; + + @XmlElement(name = "library") + private ConfigElementList libraries; + + @XmlElement(name = "fileset") + private ConfigElementList filesets; + + @XmlElement(name = "logging") + private Logging logging; + + @XmlElement(name = "include") + private ConfigElementList includeElements; + + @XmlElement(name = "executor") + private ExecutorElement executor; + + @XmlElement(name = "config") + private ConfigMonitorElement config; + + @XmlElement(name = "keyStore") + private KeyStore keyStore; + + @XmlElement(name = "variable") + private ConfigElementList variables; + + @XmlElement(name = "classloading") + private ClassloadingElement classLoading; + + @XmlAnyAttribute + private Map unknownAttributes; + + @XmlAnyElement + private List unknownElements; + + public ClientConfiguration() { + this.description = "Generation date: " + new Date(); + } + + public ConfigElementList getActivationSpecs() { + if (this.activationSpecs == null) + this.activationSpecs = new ConfigElementList(); + return this.activationSpecs; + } + + public ConfigElementList getAdminObjects() { + if (this.adminObjects == null) + this.adminObjects = new ConfigElementList(); + return this.adminObjects; + } + + /** + * Retrieves a description of this configuration. + * + * @return a description of this configuration + */ + public String getDescription() { + return this.description; + } + + /** + * Sets the description of this configuration + * + * @param description the description of this configuration + */ + @XmlAttribute + public void setDescription(String description) { + this.description = ConfigElement.getValue(description); + } + + /** + * @return the featureManager for this configuration + */ + public FeatureManager getFeatureManager() { + if (this.featureManager == null) { + this.featureManager = new FeatureManager(); + } + return this.featureManager; + } + + public ConfigElementList getBasicRegistries() { + if (this.basicRegistries == null) { + this.basicRegistries = new ConfigElementList(); + } + return this.basicRegistries; + } + + /** + * @return the KeyStore configuration for this client + */ + public KeyStore getKeyStore() { + if (this.keyStore == null) { + this.keyStore = new KeyStore(); + } + return this.keyStore; + } + + /** + * @return the includeElement + */ + public ConfigElementList getIncludes() { + if (this.includeElements == null) + this.includeElements = new ConfigElementList(); + return this.includeElements; + } + + /** + * @return the ExecutorElement + */ + public ExecutorElement getExecutor() { + if (this.executor == null) + this.executor = new ExecutorElement(); + return this.executor; + } + + public void setExecutorElement(ExecutorElement exec) { + this.executor = exec; + } + + /** + * @return the applicationMonitor + */ + public ClassloadingElement getClassLoadingElement() { + + if (this.classLoading == null) + this.classLoading = new ClassloadingElement(); + + return this.classLoading; + } + + /** + * @return explicitly installed applications + */ + public ConfigElementList getApplications() { + if (this.applications == null) { + this.applications = new ConfigElementList(); + } + return this.applications; + } + + /** + * Removes all applications with a specific name + * + * @param name + * the name of the applications to remove + * @return the removed applications (no longer bound to the client + * configuration) + */ + public ConfigElementList removeApplicationsByName(String name) { + ConfigElementList installedApps = this.getApplications(); + ConfigElementList uninstalledApps = new ConfigElementList(); + for (Application app : installedApps) { + if (name != null && name.equals(app.getName())) { + uninstalledApps.add(app); + } + } + installedApps.removeAll(uninstalledApps); + return uninstalledApps; + } + + /** + * Adds an application to the current config, or updates an application with + * a specific name if it already exists + * + * @param name + * the name of the application + * @param path + * the fully qualified path to the application archive on the + * liberty machine + * @param type + * the type of the application (ear/war/etc) + * @return the deployed application + */ + public Application addApplication(String name, String path, String type) { + ConfigElementList apps = this.getApplications(); + Application application = null; + for (Application app : apps) { + if (name != null && name.equals(app.getName())) { + application = app; + } + } + if (application == null) { + application = new Application(); + apps.add(application); + } + application.setName(name); + application.setId(name); // application names must be unique, just like element ID names (other config objects probably aren't sharing the app name) + application.setType(type); + application.setLocation(path); // assumes that archive has already been transferred; see FileSetup.java + return application; + } + + /** + * @return gets all configured shared libraries + */ + public ConfigElementList getLibraries() { + if (this.libraries == null) { + this.libraries = new ConfigElementList(); + } + return this.libraries; + } + + /** + * @return gets all configured file sets + */ + public ConfigElementList getFilesets() { + if (this.filesets == null) { + this.filesets = new ConfigElementList(); + } + return this.filesets; + } + + /** + * @return get fileset by id + */ + public Fileset getFilesetById(String id) { + if (this.filesets != null) + for (Fileset fileset : this.filesets) + if (fileset.getId().equals(id)) + return fileset; + + return null; + } + + /** + * @return gets logging configuration + */ + public Logging getLogging() { + if (this.logging == null) { + this.logging = new Logging(); + } + return this.logging; + } + + /** + * @return the config + */ + public ConfigMonitorElement getConfig() { + if (this.config == null) { + this.config = new ConfigMonitorElement(); + } + return config; + } + + /** + * @return all configured elements + */ + public ConfigElementList getVariables() { + if (this.variables == null) { + this.variables = new ConfigElementList(); + } + return this.variables; + } + + @Override + public ClientConfiguration clone() throws CloneNotSupportedException { + ClientConfiguration clone = (ClientConfiguration) super.clone(); + + // clone activationSpec + if (this.activationSpecs != null) { + clone.activationSpecs = new ConfigElementList(); + for (ActivationSpec activationSpec : this.activationSpecs) + clone.activationSpecs.add((ActivationSpec) activationSpec.clone()); + } + + // clone adminObjects + if (this.adminObjects != null) { + clone.adminObjects = new ConfigElementList(); + for (AdminObject adminObject : this.adminObjects) + clone.adminObjects.add((AdminObject) adminObject.clone()); + } + + // clone includeElements + if (this.includeElements != null) { + clone.includeElements = new ConfigElementList(); + for (IncludeElement include : this.includeElements) + clone.includeElements.add((IncludeElement) include.clone()); + } + + // clone featureManager - must explicitly clone due to TreeSet in FeatureManager + if (this.featureManager != null) + clone.featureManager = this.featureManager.clone(); + + // clone httpEndpoints + if (this.basicRegistries != null) { + clone.basicRegistries = new ConfigElementList(); + for (BasicRegistry basicRegistry : basicRegistries) + clone.basicRegistries.add(basicRegistry.clone()); + } + + // clone applications + if (this.applications != null) { + clone.applications = new ConfigElementList(); + for (Application app : this.applications) + clone.applications.add(app.clone()); + } + + // clone libraries + if (this.libraries != null) { + clone.libraries = new ConfigElementList(); + for (Library lib : this.libraries) + clone.libraries.add((Library) lib.clone()); + } + + // clone filesets + if (this.filesets != null) { + clone.filesets = new ConfigElementList(); + for (Fileset fileset : this.filesets) + clone.filesets.add((Fileset) fileset.clone()); + } + + // clone variables + if (this.variables != null) { + clone.variables = new ConfigElementList(); + for (Variable variable : this.variables) + clone.variables.add((Variable) variable.clone()); + } + + return clone; + } + + @Override + public String toString() { + String nl = System.getProperty("line.separator"); + StringBuffer buf = new StringBuffer("ClientConfiguration{" + this.description + "}" + nl); + + if (featureManager != null) + buf.append(featureManager.toString() + nl); + if (activationSpecs != null) + for (ActivationSpec activationSpec : activationSpecs) + buf.append(activationSpec.toString()).append(nl); + if (adminObjects != null) + for (AdminObject adminObject : adminObjects) + buf.append(adminObject.toString()).append(nl); + if (applications != null) + for (Application app : applications) + buf.append(app.toString() + nl); + if (libraries != null) + for (Library lib : libraries) + buf.append(lib.toString() + nl); + if (filesets != null) + for (Fileset fileset : filesets) + buf.append(fileset.toString() + nl); + if (logging != null) + buf.append(logging.toString() + nl); + if (includeElements != null) + for (IncludeElement include : includeElements) + buf.append(include.toString() + nl); + if (executor != null) + buf.append(executor.toString() + nl); + if (config != null) + buf.append(config.toString() + nl); + if (variables != null) + for (Variable variable : variables) + buf.append(variable.toString() + nl); + if (keyStore != null) + buf.append(keyStore.toString() + nl); + + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClientConfigurationFactory.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClientConfigurationFactory.java new file mode 100755 index 000000000000..9c7974ea2c4b --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ClientConfigurationFactory.java @@ -0,0 +1,148 @@ +package com.ibm.websphere.simplicity.config; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; + +/** + * Reads client.xml into memory, writes changes back to client.xml + * + * @author Tim Burns + * + */ +public class ClientConfigurationFactory { + + private static ClientConfigurationFactory INSTANCE; + + public static ClientConfigurationFactory getInstance() throws Exception { + if (INSTANCE == null) { + INSTANCE = new ClientConfigurationFactory(); + } + return INSTANCE; + } + + private final Marshaller marshaller; + private final Unmarshaller unmarshaller; + + private ClientConfigurationFactory() throws Exception { + JAXBContext context = JAXBContext.newInstance(ClientConfiguration.class); + this.marshaller = context.createMarshaller(); + this.marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + this.unmarshaller = context.createUnmarshaller(); + } + + /** + * Expresses a client configuration in an XML document. + * + * @param sourceConfig + * the configuration you want to marshal + * @param targetFile + * the location where you want to marshal state information. + * parent directories will be created automatically + * @throws Exception + * if generation fails + */ + public void marshal(ClientConfiguration sourceConfig, File targetFile) throws Exception { + if (targetFile == null) { + return; // if the target location is null, there's nothing to do + } + targetFile.getParentFile().mkdirs(); + this.marshal(sourceConfig, new FileOutputStream(targetFile)); + } + + /** + * Expresses a client configuration in an XML document. + * + * @param sourceConfig + * the configuration you want to marshal + * @param outputStream + * the stream where you want to marshal state information. the + * stream will be closed before this method returns. + * @throws Exception + * if generation fails + */ + public void marshal(ClientConfiguration sourceConfig, OutputStream outputStream) throws Exception { + if (outputStream == null) { + return; // if the outputStream is null, there's nothing to do + } + try { + this.marshaller.marshal(sourceConfig, outputStream); + } finally { + outputStream.close(); + } + } + + /** + * Converts a client configuration XML file into a series of Java objects. + * + * @param inputStream + * a client configuration XML file as a stream + * @return a Java object representation of the client configuration, or null + * if the input stream is null + * @throws Exception + * if the XML can't be parsed + */ + public ClientConfiguration unmarshal(InputStream inputStream) throws Exception { + if (inputStream == null) { + return null; // nothing to unmarshall + } + try { + return (ClientConfiguration) this.unmarshaller.unmarshal(inputStream); + } finally { + inputStream.close(); + } + } + + /** + * Tests client configuration factory; prints client.xml for easy debug + * + * @param args + * nothing + * @throws Exception + * if any test fails + */ + public static void main(String[] args) throws Exception { + File clientConfig = File.createTempFile("client", ".xml"); + System.out.println("Created temporary file: " + clientConfig); + if (!clientConfig.exists()) { + throw new Exception("Failed to create tmp file"); + } + + ClientConfiguration client = new ClientConfiguration(); + client.getLogging().setTraceSpecification("*=info=enabled:com.ibm.ws.session*=all=enabled"); + BasicRegistry registry = client.getBasicRegistries().getOrCreateById("BasicRealm", BasicRegistry.class); + registry.setRealm(registry.getId()); + BasicRegistry.User user1 = registry.getUsers().getOrCreateById("user1", BasicRegistry.User.class); + user1.setName(user1.getId()); + user1.setPassword("security"); + Application application = new Application(); + application.setId("appName"); + application.setName(application.getId()); + application.setType("ear"); + application.setLocation("C:/some/path/on/my/machine/app.ear"); + SecurityRole role = application.getApplicationBnd().getSecurityRoles().getOrCreateById("securityRole", SecurityRole.class); + role.setName(role.getId()); + SpecialSubject specialSubject = role.getSpecialSubjects().getOrCreateById("specialSubject", SpecialSubject.class); + specialSubject.set(SpecialSubject.Type.ALL_AUTHENTICATED_USERS); + client.getApplications().add(application); + + ClientConfigurationFactory scf = ClientConfigurationFactory.getInstance(); + scf.marshal(client, clientConfig); + scf.marshaller.marshal(client, System.out); // call private variable to avoid calling System.out! + + ClientConfiguration unmarshalled = scf.unmarshal(new FileInputStream(clientConfig)); + scf.marshaller.marshal(unmarshalled, System.out); // call private variable to avoid calling System.out! + if (!clientConfig.delete()) { + throw new Exception("Failed to delete tmp file"); + } + System.out.println("Deleted " + clientConfig); + System.out.println("All tests passed"); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Cloudant.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Cloudant.java new file mode 100755 index 000000000000..a746228adbed --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Cloudant.java @@ -0,0 +1,274 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; + +/** + * Represents the element in server.xml + */ +public class Cloudant extends ConfigElement implements ModifiableConfigElement { + + private final Class c = Cloudant.class; + + // attributes + private String account; + private String connectTimeout; + private String containerAuthDataRef; + private String jndiName; + private String libraryRef; + private String maxConnections; + private String password; + private String proxyPassword; + private String proxyUrl; + private String proxyUser; + private String readTimeout; + private String sslRef; + private String url; + private String username; + private String fatModify; + + // nested elements + @XmlElement(name = "containerAuthData") + private ConfigElementList containerAuthDatas; + + @XmlElement(name = "library") + private ConfigElementList libraries; + + @XmlElement(name = "ssl") + private ConfigElementList ssls; // TODO find or create simplicity object for ssl + + public String getAccount() { + return account; + } + + // getters for attributes + public String getContainerAuthDataRef() { + return containerAuthDataRef; + } + + public String getConnectTimeout() { + return connectTimeout; + } + + public String getJndiName() { + return jndiName; + } + + public String getLibraryRef() { + return libraryRef; + } + + public String getMaxConnections() { + return maxConnections; + } + + public String getProxyPassword() { + return proxyPassword; + } + + public String getProxyUrl() { + return proxyUrl; + } + + public String getProxyUser() { + return proxyUser; + } + + public String getPassword() { + return password; + } + + public String getReadTimeout() { + return readTimeout; + } + + public String getSslRef() { + return sslRef; + } + + public String getUrl() { + return url; + } + + public String getUsername() { + return username; + } + + public String getFatModify() { + return fatModify; + } + + // getters for nested elements + public ConfigElementList getContainerAuthDatas() { + return containerAuthDatas == null ? (containerAuthDatas = new ConfigElementList()) : containerAuthDatas; + } + + public ConfigElementList getLibraries() { + return libraries == null ? (libraries = new ConfigElementList()) : libraries; + } + + // TODO find or create simplicity object for ssl + public ConfigElementList getSsls() { + return ssls == null ? (ssls = new ConfigElementList()) : ssls; + } + + // setters for attributes + @XmlAttribute + public void setAccount(String value) { + account = value; + } + + @XmlAttribute + public void setConnectTimeout(String value) { + connectTimeout = value; + } + + @XmlAttribute + public void setContainerAuthDataRef(String value) { + containerAuthDataRef = value; + } + + @XmlAttribute + public void setJndiName(String value) { + jndiName = value; + } + + @XmlAttribute + public void setLibraryRef(String value) { + libraryRef = value; + } + + @XmlAttribute + public void setMaxConnections(String value) { + maxConnections = value; + } + + @XmlAttribute + public void setPassword(String value) { + password = value; + } + + @XmlAttribute + public void setProxyPassword(String value) { + proxyPassword = value; + } + + @XmlAttribute + public void setProxyUrl(String value) { + proxyUrl = value; + } + + @XmlAttribute + public void setProxyUser(String value) { + proxyUser = value; + } + + @XmlAttribute + public void setReadTimeout(String value) { + readTimeout = value; + } + + @XmlAttribute + public void setSslRef(String value) { + sslRef = value; + } + + @XmlAttribute + public void setUrl(String value) { + url = value; + } + + @XmlAttribute + public void setUsername(String value) { + username = value; + } + + @XmlAttribute(name = "fat.modify") + public void setFatModify(String fatModify) { + this.fatModify = fatModify; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + // attributes + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + if (account != null) + buf.append("account=").append(account).append(' '); + if (connectTimeout != null) + buf.append("connectTimeout=").append(connectTimeout).append(' '); + if (containerAuthDataRef != null) + buf.append("containerAuthDataRef=").append(containerAuthDataRef).append(' '); + if (jndiName != null) + buf.append("jndiName=").append(jndiName).append(' '); + if (libraryRef != null) + buf.append("libraryRef=").append(libraryRef).append(' '); + if (maxConnections != null) + buf.append("maxConnections=").append(maxConnections).append(' '); + if (password != null) + buf.append("password=").append(password).append(' '); + if (proxyPassword != null) + buf.append("proxyPassword=").append(proxyPassword).append(' '); + if (proxyUrl != null) + buf.append("proxyUrl=").append(proxyUrl).append(' '); + if (proxyUser != null) + buf.append("proxyUser=").append(proxyUser).append(' '); + if (readTimeout != null) + buf.append("readTimeout=").append(readTimeout).append(' '); + if (sslRef != null) + buf.append("sslRef=").append(sslRef).append(' '); + if (url != null) + buf.append("url=").append(url).append(' '); + if (username != null) + buf.append("username=").append(username).append(' '); + // nested elements + if (containerAuthDatas != null) + buf.append(containerAuthDatas).append(' '); + if (libraries != null) + buf.append(libraries).append(' '); + if (ssls != null) + buf.append(ssls).append(' '); + buf.append('}'); + return buf.toString(); + } + + @Override + public void modify(ServerConfiguration config) throws Exception { + if (fatModify == null || !fatModify.toLowerCase().equals("true")) + return; + + Bootstrap b = Bootstrap.getInstance(); + + if (getAccount() != null) { + setAccount(b.getValue(BootstrapProperty.DB_ACCOUNT.getPropertyName())); + } else { + boolean secure = expand(config, getUrl()).startsWith("https"); + String protocol = secure ? "https://" : "http://"; + String hostname = b.getValue(BootstrapProperty.DB_HOSTNAME.getPropertyName()); + String port = secure ? b.getValue(BootstrapProperty.DB_PORT_SECURE.getPropertyName()) : + b.getValue(BootstrapProperty.DB_PORT.getPropertyName()); + setUrl(protocol + hostname + ':' + port); + } + + if (getUsername() != null) + setUsername(b.getValue(BootstrapProperty.DB_USER1.getPropertyName())); + + if (getPassword() != null) + setPassword(b.getValue(BootstrapProperty.DB_PASSWORD1.getPropertyName())); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/CloudantDatabase.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/CloudantDatabase.java new file mode 100755 index 000000000000..4d63a1bb5e58 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/CloudantDatabase.java @@ -0,0 +1,116 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; + +/** + * Represents the element in server.xml + */ +public class CloudantDatabase extends ConfigElement implements ModifiableConfigElement { + // attributes + private String cloudantRef; + private String create; + private String databaseName; + private String jndiName; + private String fatModify; + + // nested elements + @XmlElement(name = "cloudant") + private ConfigElementList cloudants; + + // getters for attributes + public String getCloudantRef() { + return cloudantRef; + } + + public String getCreate() { + return create; + } + + public String getDatabaseName() { + return databaseName; + } + + public String getJndiName() { + return jndiName; + } + + public String getFatModify() { + return fatModify; + } + + // getters for nested elements + public ConfigElementList getCloudants() { + return cloudants == null ? (cloudants = new ConfigElementList()) : cloudants; + } + + // setters for attributes + @XmlAttribute + public void setCloudantRef(String value) { + cloudantRef = value; + } + + @XmlAttribute + public void setCreate(String value) { + create = value; + } + + @XmlAttribute + public void setDatabaseName(String value) { + databaseName = value; + } + + @XmlAttribute + public void setJndiName(String value) { + jndiName = value; + } + + @XmlAttribute(name = "fat.modify") + public void setFatModify(String fatModify) { + this.fatModify = fatModify; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + // attributes + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + if (cloudantRef != null) + buf.append("cloudantRef=").append(cloudantRef).append(' '); + if (create != null) + buf.append("create=").append(create).append(' '); + if (databaseName != null) + buf.append("databaseName=").append(databaseName).append(' '); + if (jndiName != null) + buf.append("jndiName=").append(jndiName).append(' '); + // nested elements + if (cloudants != null) + buf.append(cloudants).append(' '); + buf.append('}'); + return buf.toString(); + } + + @Override + public void modify(ServerConfiguration config) throws Exception { + if (fatModify == null || !fatModify.toLowerCase().equals("true")) + return; + + Bootstrap b = Bootstrap.getInstance(); + setDatabaseName(b.getValue(BootstrapProperty.DB_NAME.getPropertyName())); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConfigElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConfigElement.java new file mode 100755 index 000000000000..c6e2cd6852d4 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConfigElement.java @@ -0,0 +1,140 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.namespace.QName; + +import org.w3c.dom.Element; + +/** + * A generic server configuration element. Most entries in server.xml can safely + * extend this class. + * + * @author Tim Burns + * + */ +public class ConfigElement implements Cloneable { + + @XmlAnyAttribute + private Map extraAttributes; + + @XmlAnyElement + private List extraElements; + + private String id; + + /** + * @return the unique identifier of this configuration element + */ + public String getId() { + return this.id; + } + + /** + * @param id the unique identifier of this configuration element + */ + @XmlAttribute + public void setId(String id) { + this.id = getValue(id); + } + + /** + * Sets an attribute on this element that does not have an explicit setter. + */ + public void setExtraAttribute(String name, String value) { + if (extraAttributes == null) { + extraAttributes = new HashMap(); + } + if (value == null) { + extraAttributes.remove(new QName(null, name)); + } else { + extraAttributes.put(new QName(null, name), value); + } + } + + /** + * Sometimes, the JACL representation of a null or empty value includes + * quotation marks. Calling this method will parse away the extra JACL + * syntax and return a real or null value + * + * @param value + * an unchecked input value + * @return the real value described by the input value + */ + public static String getValue(String value) { + if (value == null) { + return null; + } + String v = removeQuotes(value.trim()).trim(); + if (v.isEmpty()) { + return null; + } + return v; + } + + /** + * Removes leading and trailing quotes from the input argument, if they + * exist. + * + * @param arg + * The argument you want to parse + * @return The argument, without leading and trailing quotes + */ + public static String removeQuotes(String arg) { + if (arg == null) { + return null; + } + int length = arg.length(); + if (length > 1 && arg.startsWith("\"") && arg.endsWith("\"")) { + return arg.substring(1, length - 1); + } + return arg; + } + + /** + * Uses the server configuration to resolve a variable into a string. + * For example, with this in server config: + * + * Calling expandVariable(config, "${key}"); would return "val" + * + * @param value The raw value of a variable with brackets + * @return The value of the expanded string. + */ + public static String expand(ServerConfiguration config, String value) { + if (value == null) + return null; + + if (!value.startsWith("${") || !value.endsWith("}")) + return value; + + String variableName = value.substring(2, value.length() - 1); + Variable var = config.getVariables().getBy("name", variableName); + return var.getValue(); + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + @Override + public String toString() { + Class clazz = this.getClass(); + StringBuilder buf = new StringBuilder(clazz.getSimpleName()).append('{'); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + buf.append("}"); + return buf.toString(); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof ConfigElement)) + return false; + return this.toString().equals(o.toString()); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConfigElementList.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConfigElementList.java new file mode 100755 index 000000000000..359a63dadcd3 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConfigElementList.java @@ -0,0 +1,157 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * Provides helper methods for lists of ConfigElements + * + * @param the ConfigElement type + */ +public class ConfigElementList extends ArrayList implements List { + + private static final long serialVersionUID = 1L; + + /** + * Constructs an empty list with the specified initial capacity, as per the recommendation in the Collection interface specification. + */ + public ConfigElementList() { + super(); + } + + /** + * Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator, as per the recommendation in the + * Collection interface specification. + * + * @param c the collection whose elements are to be placed into this list + */ + public ConfigElementList(Collection c) { + super(c); + } + + /** + * Deep copy of the config element list. + * Each element in the list is cloned. + * + * @return deep copy of the config element list. + */ + @Override + @SuppressWarnings("unchecked") + public ConfigElementList clone() { + ConfigElementList clone = new ConfigElementList(); + for (E element : this) + try { + clone.add((E) element.clone()); + } catch (CloneNotSupportedException x) { + throw new UnsupportedOperationException(x); + } + return clone; + } + + /** + * Returns the first element in this list with a matching attribute value. + * + * @param attributeName the attribute for which to search (Example: jndiName) + * @param attributeValue the value to match + * @return the first element in this list with a matching attribute name/value, or null of no such element is found + */ + public E getBy(String attributeName, String attributeValue) { + String methodName = "get" + Character.toUpperCase(attributeName.charAt(0)) + attributeName.substring(1); + for (E element : this) + if (element != null) + try { + Object value = element.getClass().getMethod(methodName).invoke(element); + if (value == attributeValue || value != null && value.equals(attributeValue)) + return element; + } catch (Exception x) { + } + return null; + } + + /** + * Returns the first element in this list with a matching identifier + * + * @param id the identifier to search for + * @return the first element in this list with a matching identifier, or null of no such element is found + */ + public E getById(String id) { + if (id == null) { + for (E element : this) { + if (element != null && element.getId() == null) { + return element; + } + } + } else { + for (E element : this) { + if (element != null && id.equals(element.getId())) { + return element; + } + } + } + return null; + } + + /** + * Removes the first element in this list with a matching attribute name/value + * + * @param attributeName the attribute for which to search (Example: jndiName) + * @param attributeValue the value to match + * @return the removed element, or null of no element was removed + */ + public E removeBy(String attributeName, String attributeValue) { + // traverses the list twice, but reuse code + E element = this.getBy(attributeName, attributeValue); + if (element != null) { + this.remove(element); // this should always return true since we already found the element + } + return element; + } + + /** + * Removes the first element in this list with a matching identifier + * + * @param id the identifier to search for + * @return the removed element, or null of no element was removed + */ + public E removeById(String id) { + // traverses the list twice, but reuse code + E element = this.getById(id); + if (element != null) { + this.remove(element); // this should always return true since we already found the element + } + return element; + } + + /** + * Returns the first element in this list with a matching identifier, or adds a new element to the end of this list and sets the identifier + * + * @param id the identifier to search for + * @param type the type of the element to add when no existing element is found. The type MUST have a public no-argument constructor (but it probably does since JAXB requires + * it anyway) + * @return the first element in this list with a matching identifier. Never returns null. + * @throws InstantiationException if the public no-argument constructor of the element type is not visible + * @throws IllegalAccessException if the instance could not be created + */ + public E getOrCreateById(String id, Class type) throws IllegalAccessException, InstantiationException { + E element = this.getById(id); + if (element == null) { + element = type.newInstance(); + element.setId(id); + this.add(element); + } + return element; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConfigMonitorElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConfigMonitorElement.java new file mode 100755 index 000000000000..e040150e1b7f --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConfigMonitorElement.java @@ -0,0 +1,69 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + *

+ * This represents an XML element for the server configuration monitor such as: + *

+ * <config monitorInterval="500ms" updateTrigger="polled"/> + */ +public class ConfigMonitorElement extends ConfigElement { + + private String updateTrigger; + + private String monitorInterval; + + /** + * @return the updateTrigger + */ + public String getUpdateTrigger() { + return updateTrigger; + } + + /** + * @param updateTrigger the updateTrigger to set + */ + @XmlAttribute(name = "updateTrigger") + public void setUpdateTrigger(String updateTrigger) { + this.updateTrigger = updateTrigger; + } + + /** + * @return the monitorInterval + */ + public String getMonitorInterval() { + return monitorInterval; + } + + /** + * @param monitorInterval the monitorInterval to set + */ + @XmlAttribute(name = "monitorInterval") + public void setMonitorInterval(String monitorInterval) { + this.monitorInterval = monitorInterval; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("ConfigMonitorElement{"); + if (updateTrigger != null) + buf.append("updateTrigger=\"" + updateTrigger + "\" "); + if (monitorInterval != null) + buf.append("monitorInterval=\"" + monitorInterval + "\" "); + buf.append("}"); + + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConnectionFactory.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConnectionFactory.java new file mode 100755 index 000000000000..15d2086df288 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConnectionFactory.java @@ -0,0 +1,121 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.Arrays; +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +public class ConnectionFactory extends ConfigElement { + // attributes + private String connectionManagerRef; + private String containerAuthDataRef; + private String jndiName; + private String recoveryAuthDataRef; + + // nested elements + @XmlElement(name = "connectionManager") + private ConfigElementList connectionManagers; + @XmlElement(name = "containerAuthData") + private ConfigElementList containerAuthData; + @XmlElement(name = "properties.dcra") + private ConfigElementList properties_dcra; + @XmlElement(name = "properties.FAT1") + private ConfigElementList properties_FAT1; + @XmlElement(name = "properties.wasJms") + private ConfigElementList wasJmsProperties; + @XmlElement(name = "recoveryAuthData") + private ConfigElementList recoveryAuthData; + + public ConfigElementList getConnectionManager() { + return connectionManagers == null ? (connectionManagers = new ConfigElementList()) : connectionManagers; + } + + public String getConnectionManagerRef() { + return connectionManagerRef; + } + + public ConfigElementList getContainerAuthData() { + return containerAuthData == null ? (containerAuthData = new ConfigElementList()) : containerAuthData; + } + + public String getContainerAuthDataRef() { + return containerAuthDataRef; + } + + public String getJndiName() { + return this.jndiName; + } + + public ConfigElementList getProperties_dcra() { + return properties_dcra == null ? (properties_dcra = new ConfigElementList()) : properties_dcra; + } + + public ConfigElementList getProperties_FAT1() { + return properties_FAT1 == null ? (properties_FAT1 = new ConfigElementList()) : properties_FAT1; + } + + public ConfigElementList getRecoveryAuthData() { + return recoveryAuthData == null ? (recoveryAuthData = new ConfigElementList()) : recoveryAuthData; + } + + public String getRecoveryAuthDataRef() { + return recoveryAuthDataRef; + } + + public ConfigElementList getWasJmsProperties() { + if (wasJmsProperties == null) { + wasJmsProperties = new ConfigElementList(); + } + return wasJmsProperties; + } + + @XmlAttribute + public void setConnectionManagerRef(String connectionManagerRef) { + this.connectionManagerRef = connectionManagerRef; + } + + @XmlAttribute + public void setContainerAuthDataRef(String containerAuthDataRef) { + this.containerAuthDataRef = containerAuthDataRef; + } + + @XmlAttribute + public void setJndiName(String jndiName) { + this.jndiName = ConfigElement.getValue(jndiName); + } + + @XmlAttribute + public void setRecoveryAuthDataRef(String recoveryAuthDataRef) { + this.recoveryAuthDataRef = recoveryAuthDataRef; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + if (connectionManagerRef != null) + buf.append("connectionManagerRef=\"" + connectionManagerRef + "\" "); + if (containerAuthDataRef != null) + buf.append("containerAuthDataRef=\"" + containerAuthDataRef + "\" "); + if (jndiName != null) + buf.append("jndiName=\"" + jndiName + "\" "); + if (recoveryAuthDataRef != null) + buf.append("recoveryAuthDataRef=\"" + recoveryAuthDataRef + "\" "); + + @SuppressWarnings("unchecked") + List> nestedElementsList = Arrays.asList(connectionManagers, + containerAuthData, + properties_dcra, + properties_FAT1, + recoveryAuthData, + wasJmsProperties + ); + for (ConfigElementList nestedElements : nestedElementsList) + if (nestedElements != null && nestedElements.size() > 0) + for (Object o : nestedElements) + buf.append(", " + o); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConnectionManager.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConnectionManager.java new file mode 100755 index 000000000000..3de57de898d5 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ConnectionManager.java @@ -0,0 +1,236 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * A connectionManager element for holding a set of properties + * relating to a connection manager; + */ +public class ConnectionManager extends ConfigElement { + private String agedTimeout; + private String connectionTimeout; + private String maxIdleTime; + private String maxPoolSize; + private String minPoolSize; + private String purgePolicy; + private String reapTime; + private String maxConnectionsPerThread; + private String numConnectionsPerThreadLocal; + private String maxReservePoolConnectionsAllowed; + private String numberOfReservePools; + private String stuckThreshold; + private String stuckTimerTime; + private String stuckTime; + private String surgeCreationInterval; + private String surgeThreshold; + + // Not supported yet. + @XmlAttribute(name = "stuckThreshold") + public void setStuckThreshold(String stuckThreshold) { + this.stuckThreshold = stuckThreshold; + } + + // Not supported yet. + public String getStuckThreshold() { + return this.stuckThreshold; + } + + // Not supported yet. + @XmlAttribute(name = "stuckTimerTime") + public void setStuckTimerTime(String stuckTimerTime) { + this.stuckTimerTime = stuckTimerTime; + } + + // Not supported yet. + public String getStuckTimerTime() { + return this.stuckTimerTime; + } + + // Not supported yet. + @XmlAttribute(name = "stuckTime") + public void setStuckTime(String stuckTime) { + this.stuckTime = stuckTime; + } + + // Not supported yet. + public String getStuckTime() { + return this.stuckTime; + } + + // Not supported yet. + @XmlAttribute(name = "surgeCreationInterval") + public void setSurgeCreationInterval(String surgeCreationInterval) { + this.surgeCreationInterval = surgeCreationInterval; + } + + // Not supported yet. + public String getSurgeCreationInterval() { + return this.surgeCreationInterval; + } + + // Not supported yet. + @XmlAttribute(name = "surgeThreshold") + public void setSurgeThreshold(String surgeThreshold) { + this.surgeThreshold = surgeThreshold; + } + + // Not supported yet. + public String getSurgeThreshold() { + return this.surgeThreshold; + } + + // Not supported yet. + @XmlAttribute(name = "maxReservePoolConnectionsAllowed") + public void setMaxReservePoolConnectionsAllowed(String maxReservePoolConnectionsAllowed) { + this.maxReservePoolConnectionsAllowed = maxReservePoolConnectionsAllowed; + } + + // Not supported yet. + public String getMaxReservePoolConnectionsAllowed() { + return this.maxReservePoolConnectionsAllowed; + } + + // Not supported yet. + @XmlAttribute(name = "numberOfReservePools") + public void setNumberOfReservePools(String numberOfReservePools) { + this.numberOfReservePools = numberOfReservePools; + } + + // Not supported yet. + public String getNumberOfReservePools() { + return this.numberOfReservePools; + } + + @XmlAttribute + public void setAgedTimeout(String agedTimeout) { + this.agedTimeout = agedTimeout; + } + + public String getAgedTimeout() { + return agedTimeout; + } + + @XmlAttribute + public void setConnectionTimeout(String connectionTimeout) { + this.connectionTimeout = connectionTimeout; + } + + public String getConnectionTimeout() { + return connectionTimeout; + } + + @XmlAttribute + public void setMaxIdleTime(String maxIdleTime) { + this.maxIdleTime = maxIdleTime; + } + + public String getMaxIdleTime() { + return maxIdleTime; + } + + @XmlAttribute + public void setMaxPoolSize(String maxPoolSize) { + this.maxPoolSize = maxPoolSize; + } + + public String getMaxPoolSize() { + return maxPoolSize; + } + + @XmlAttribute + public void setMinPoolSize(String minPoolSize) { + this.minPoolSize = minPoolSize; + } + + public String getMinPoolSize() { + return minPoolSize; + } + + @XmlAttribute + public void setPurgePolicy(String purgePolicy) { + this.purgePolicy = purgePolicy; + } + + public String getPurgePolicy() { + return purgePolicy; + } + + @XmlAttribute + public void setReapTime(String reapTime) { + this.reapTime = reapTime; + } + + public String getReapTime() { + return reapTime; + } + + public String getMaxConnectionsPerThread() { + return maxConnectionsPerThread; + } + + @XmlAttribute(name = "maxConnectionsPerThread") + public void setMaxConnectionsPerThread(String maxConnectionsPerThread) { + this.maxConnectionsPerThread = maxConnectionsPerThread; + } + + public String getNumConnectionsPerThreadLocal() { + return numConnectionsPerThreadLocal; + } + + @XmlAttribute(name = "numConnectionsPerThreadLocal") + public void setNumConnectionsPerThreadLocal(String numConnectionsPerThreadLocal) { + this.numConnectionsPerThreadLocal = numConnectionsPerThreadLocal; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("ConnectionManager{"); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + if (agedTimeout != null) + buf.append("agedTimeout=\"" + agedTimeout + "\" "); + if (connectionTimeout != null) + buf.append("connectionTimeout=\"" + connectionTimeout + "\" "); + if (maxIdleTime != null) + buf.append("maxIdleTime=\"" + maxIdleTime + "\" "); + if (maxPoolSize != null) + buf.append("maxPoolSize=\"" + maxPoolSize + "\" "); + if (minPoolSize != null) + buf.append("minPoolSize=\"" + minPoolSize + "\" "); + if (purgePolicy != null) + buf.append("purgePolicy=\"" + purgePolicy + "\" "); + if (reapTime != null) + buf.append("reapTime=\"" + reapTime + "\" "); + if (numConnectionsPerThreadLocal != null) + buf.append("numConnectionsPerThreadLocal=\"" + numConnectionsPerThreadLocal + "\" "); + if (maxConnectionsPerThread != null) + buf.append("maxConnectionsPerThread=\"" + maxConnectionsPerThread + "\" "); + if (maxReservePoolConnectionsAllowed != null) + buf.append("maxReservePoolConnectionsAllowed=\"" + maxReservePoolConnectionsAllowed + "\" "); + if (numberOfReservePools != null) + buf.append("numberOfReservePools=\"" + numberOfReservePools + "\" "); + if (stuckThreshold != null) + buf.append("stuckThreshold=\"" + stuckThreshold + "\" "); + if (stuckTimerTime != null) + buf.append("stuckTimerTime=\"" + stuckTimerTime + "\" "); + if (stuckTime != null) + buf.append("stuckTime=\"" + stuckTime + "\" "); + if (surgeCreationInterval != null) + buf.append("surgeCreationInterval=\"" + surgeCreationInterval + "\" "); + if (surgeThreshold != null) + buf.append("surgeThreshold=\"" + surgeThreshold + "\" "); + buf.append("}"); + + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ContextService.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ContextService.java new file mode 100755 index 000000000000..5f1ae05f37bd --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ContextService.java @@ -0,0 +1,126 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +import com.ibm.websphere.simplicity.config.context.ClassloaderContext; +import com.ibm.websphere.simplicity.config.context.JEEMetadataContext; +import com.ibm.websphere.simplicity.config.context.SecurityContext; +import com.ibm.websphere.simplicity.config.context.SyncToOSThreadContext; +import com.ibm.websphere.simplicity.config.context.ZOSWLMContext; + +/** + * Represents the element in server.xml + */ +public class ContextService extends ConfigElement { + // attributes + + private String baseContextRef; + private String jndiName; + private String onError; + + // nested elements + + @XmlElement(name = "classloaderContext") + private ConfigElementList classloaderContexts; + + @XmlElement(name = "jeeMetadataContext") + private ConfigElementList jeeMetadataContexts; + + @XmlElement(name = "securityContext") + private ConfigElementList securityContexts; + + @XmlElement(name = "syncToOSThreadContext") + private ConfigElementList syncToOSThreadContexts; + + @XmlElement(name = "zosWLMContext") + private ConfigElementList zosWLMContexts; + + public String getBaseContextRef() { + return baseContextRef; + } + + public String getJndiName() { + return jndiName; + } + + public String getOnError() { + return onError; + } + + // only one nested is valid, but we must allow for testing invalid config, too + public ConfigElementList getClassloaderContexts() { + return classloaderContexts == null ? (classloaderContexts = new ConfigElementList()) : classloaderContexts; + } + + // only one nested is valid, but we must allow for testing invalid config, too + public ConfigElementList getJEEMetadataContexts() { + return jeeMetadataContexts == null ? (jeeMetadataContexts = new ConfigElementList()) : jeeMetadataContexts; + } + + // only one nested is valid, but we must allow for testing invalid config, too + public ConfigElementList getSecurityContexts() { + return securityContexts == null ? (securityContexts = new ConfigElementList()) : securityContexts; + } + + // only one nested is valid, but we must allow for testing invalid config, too + public ConfigElementList getSyncToOSThreadContexts() { + return syncToOSThreadContexts == null ? (syncToOSThreadContexts = new ConfigElementList()) : syncToOSThreadContexts; + } + + // only one nested is valid, but we must allow for testing invalid config, too + public ConfigElementList getZOSWLMContexts() { + return zosWLMContexts == null ? (zosWLMContexts = new ConfigElementList()) : zosWLMContexts; + } + + @XmlAttribute + public void setBaseContextRef(String baseContextRef) { + this.baseContextRef = baseContextRef; + } + + @XmlAttribute + public void setJndiName(String jndiName) { + this.jndiName = jndiName; + } + + @XmlAttribute + public void setOnError(String onError) { + this.onError = onError; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + if (baseContextRef != null) + buf.append("baseContextRef=").append(baseContextRef).append(' '); + if (jndiName != null) + buf.append("jndiName=").append(jndiName).append(' '); + if (onError != null) + buf.append("onError=").append(onError).append(' '); + if (classloaderContexts != null) + buf.append(classloaderContexts).append(' '); + if (jeeMetadataContexts != null) + buf.append(jeeMetadataContexts).append(' '); + if (securityContexts != null) + buf.append(securityContexts).append(' '); + if (syncToOSThreadContexts != null) + buf.append(syncToOSThreadContexts).append(' '); + if (zosWLMContexts != null) + buf.append(zosWLMContexts).append(' '); + buf.append('}'); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/CouchDBElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/CouchDBElement.java new file mode 100755 index 000000000000..cba9f60d4e9f --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/CouchDBElement.java @@ -0,0 +1,261 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +public class CouchDBElement extends ConfigElement { + private String jndiName, libraryRef, host, username, password, connectionTimeout, socketTimeout; + private Boolean enableSSL, relaxedSSLSettings, caching, useExpectContinue, cleanupIdleConnections; + private Integer port, maxConnections, maxCacheEntries, maxObjectSizeBytes; + + /** + * @return the host + */ + public String getHost() { + return host; + } + + /** + * @param host the host to set + */ + @XmlAttribute + public void setHost(String host) { + this.host = host; + } + + /** + * @return enableSSL + */ + public Boolean getEnableSSL() { + return enableSSL; + } + + /** + * @param enableSSL the enableSSL to set + */ + @XmlAttribute + public void setEnableSSL(Boolean enableSSL) { + this.enableSSL = enableSSL; + } + + /** + * @return relaxedSSLSettings + */ + public Boolean getRelaxedSSLSettings() { + return relaxedSSLSettings; + } + + /** + * @param relaxedSSLSettings the relaxedSSLSettings to set + */ + @XmlAttribute + public void setRelaxedSSLSettings(Boolean relaxedSSLSettings) { + this.relaxedSSLSettings = relaxedSSLSettings; + } + + /** + * @return caching + */ + public Boolean getCaching() { + return caching; + } + + /** + * @param caching the caching to set + */ + @XmlAttribute + public void setCaching(Boolean caching) { + this.caching = caching; + } + + /** + * @return useExpectContinue + */ + public Boolean getUseExpectContinue() { + return useExpectContinue; + } + + /** + * @param useExpectContinue the useExpectContinue to set + */ + @XmlAttribute + public void setUseExpectContinue(Boolean useExpectContinue) { + this.useExpectContinue = useExpectContinue; + } + + /** + * @return cleanupIdleConnections + */ + public Boolean getCleanupIdleConnections() { + return cleanupIdleConnections; + } + + /** + * @param cleanupIdleConnections the cleanupIdleConnections to set + */ + @XmlAttribute + public void setCleanupIdleConnections(Boolean cleanupIdleConnections) { + this.cleanupIdleConnections = cleanupIdleConnections; + } + + /** + * @return the jndiName + */ + public String getJndiName() { + return jndiName; + } + + /** + * @param jndiName the jndiName to set + */ + @XmlAttribute + public void setJndiName(String jndiName) { + this.jndiName = jndiName; + } + + /** + * @return the libraryRef + */ + public String getLibraryRef() { + return libraryRef; + } + + /** + * @param libraryRef the libraryRef to set + */ + @XmlAttribute + public void setLibraryRef(String libraryRef) { + this.libraryRef = libraryRef; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + @XmlAttribute + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @param user the username to set + */ + @XmlAttribute + public void setUsername(String username) { + this.username = username; + } + + /** + * @return the connectTimeout + */ + public String getConnectionTimeout() { + return connectionTimeout; + } + + /** + * @param connectTimeout the connectTimeout to set + */ + @XmlAttribute + public void setConnectionTimeout(String connectionTimeout) { + this.connectionTimeout = connectionTimeout; + } + + /** + * @return the socketTimeout + */ + public String getSocketTimeout() { + return socketTimeout; + } + + /** + * @param socketTimeout the socketTimeout to set + */ + @XmlAttribute + public void setSocketTimeout(String socketTimeout) { + this.socketTimeout = socketTimeout; + } + + /** + * @return the port + */ + public Integer getPort() { + return port; + } + + /** + * @param port the port to set + */ + @XmlAttribute + public void setPort(Integer port) { + this.port = port; + } + + /** + * @return the maxConnections + */ + public Integer getMaxConnections() { + return maxConnections; + } + + /** + * @param maxConnections the maxConnections to set + */ + @XmlAttribute + public void setMaxConnections(Integer maxConnections) { + this.maxConnections = maxConnections; + } + + /** + * @return the maxCacheEntries + */ + public Integer getMaxCacheEntries() { + return maxCacheEntries; + } + + /** + * @param maxCacheEntries the maxCacheEntries to set + */ + @XmlAttribute + public void setMaxCacheEntries(Integer maxCacheEntries) { + this.maxCacheEntries = maxCacheEntries; + } + + /** + * @return the maxObjectSizeBytes + */ + public Integer getMaxObjectSizeBytes() { + return maxObjectSizeBytes; + } + + /** + * @param maxObjectSizeBytes the maxObjectSizeBytes to set + */ + @XmlAttribute + public void setMaxObjectSizeBytes(Integer maxObjectSizeBytes) { + this.maxObjectSizeBytes = maxObjectSizeBytes; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Customize.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Customize.java new file mode 100755 index 000000000000..628bc9806ea1 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Customize.java @@ -0,0 +1,66 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * Represents the element which can be nested under in server.xml + */ +public class Customize extends ConfigElement { + // attributes + private String implementation; + private String interfaceName; + private String suffix; + + public String getImplementation() { + return implementation; + } + + public String getInterface() { + return interfaceName; + } + + public String getSuffix() { + return suffix; + } + + @XmlAttribute + public void setImplementation(String implementation) { + this.implementation = implementation; + } + + @XmlAttribute + public void setInterface(String interfaceName) { + this.interfaceName = interfaceName; + } + + @XmlAttribute + public void setSuffix(String suffix) { + this.suffix = suffix; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + if (implementation != null) + buf.append("implementation=").append(implementation).append(' '); + if (interfaceName != null) + buf.append("interfaceName=").append(interfaceName).append(' '); + if (suffix != null) + buf.append("suffix=").append(suffix).append(' '); + buf.append('}'); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DataSource.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DataSource.java new file mode 100755 index 000000000000..c8103fb6985e --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DataSource.java @@ -0,0 +1,770 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +import com.ibm.websphere.simplicity.config.dsprops.Properties; +import com.ibm.websphere.simplicity.config.dsprops.Properties_datadirect_sqlserver; +import com.ibm.websphere.simplicity.config.dsprops.Properties_db2_i_native; +import com.ibm.websphere.simplicity.config.dsprops.Properties_db2_i_toolbox; +import com.ibm.websphere.simplicity.config.dsprops.Properties_db2_jcc; +import com.ibm.websphere.simplicity.config.dsprops.Properties_derby_client; +import com.ibm.websphere.simplicity.config.dsprops.Properties_derby_embedded; +import com.ibm.websphere.simplicity.config.dsprops.Properties_informix; +import com.ibm.websphere.simplicity.config.dsprops.Properties_informix_jcc; +import com.ibm.websphere.simplicity.config.dsprops.Properties_microsoft_sqlserver; +import com.ibm.websphere.simplicity.config.dsprops.Properties_oracle; +import com.ibm.websphere.simplicity.config.dsprops.Properties_oracle_ucp; +import com.ibm.websphere.simplicity.config.dsprops.Properties_sybase; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; +import componenttest.topology.utils.FATServletClient; + +/** + * Defines a data source in the server configuration + * + * @author Tim Burns + * + */ +public class DataSource extends ConfigElement implements ModifiableConfigElement { + + private static final Class c = DataSource.class; + + private String jndiName; + private String jdbcDriverRef; + private String connectionManagerRef; + private String propertiesRef; + private String type; + private String connectionSharing; + private String isolationLevel; + private String statementCacheSize; + private String transactional; + private String beginTranForResultSetScrollingAPIs; + private String beginTranForVendorAPIs; + private String commitOrRollbackOnCleanup; + private String containerAuthDataRef; + private String enableConnectionCasting; + private String enableMultithreadedAccessDetection; + private String onConnect; + private String queryTimeout; + private String recoveryAuthDataRef; + private String syncQueryTimeoutWithTransactionTimeout; + private String supplementalJDBCTrace; + private String validationTimeout; + protected ServerConfiguration parentConfig; + private String badProperty; + private String fatModify; + + // nested elements + @XmlElement(name = "connectionManager") + private ConfigElementList connectionManagers; + + @XmlElement(name = "containerAuthData") + private ConfigElementList containerAuthDatas; + + @XmlElement(name = "jdbcDriver") + private ConfigElementList jdbcDrivers; + + @XmlElement(name = "onConnect") + private LinkedHashSet onConnects; + + @XmlElement(name = "recoveryAuthData") + private ConfigElementList recoveryAuthDatas; + + @XmlElement(name = DataSourceProperties.DB2_I_NATIVE) + private ConfigElementList db2iNativeProps; + + @XmlElement(name = DataSourceProperties.DB2_I_TOOLBOX) + private ConfigElementList db2iToolboxProps; + + @XmlElement(name = DataSourceProperties.DB2_JCC) + private ConfigElementList db2JccProps; + + @XmlElement(name = DataSourceProperties.DERBY_EMBEDDED) + private ConfigElementList derbyEmbeddedProps; + + @XmlElement(name = DataSourceProperties.DERBY_CLIENT) + private ConfigElementList derbyNetClientProps; + + @XmlElement(name = DataSourceProperties.GENERIC) + private ConfigElementList genericProps; + + @XmlElement(name = DataSourceProperties.INFORMIX_JCC) + private ConfigElementList informixJccProps; + + @XmlElement(name = DataSourceProperties.INFORMIX_JDBC) + private ConfigElementList informixJdbcProps; + + @XmlElement(name = DataSourceProperties.ORACLE_JDBC) + private ConfigElementList oracleProps; + + @XmlElement(name = DataSourceProperties.ORACLE_UCP) + private ConfigElementList oracleUcpProps; + + @XmlElement(name = DataSourceProperties.DATADIRECT_SQLSERVER) + private ConfigElementList sqlServerDataDirectProps; + + @XmlElement(name = DataSourceProperties.MICROSOFT_SQLSERVER) + private ConfigElementList sqlServerProps; + + @XmlElement(name = DataSourceProperties.SYBASE) + private ConfigElementList sybaseProps; + + public ConfigElementList getConnectionManagers() { + return connectionManagers == null ? (connectionManagers = new ConfigElementList()) : connectionManagers; + } + + public ConfigElementList getContainerAuthDatas() { + return containerAuthDatas == null ? (containerAuthDatas = new ConfigElementList()) : containerAuthDatas; + } + + /** + * @return the JNDI name of this data source + */ + public String getJndiName() { + return this.jndiName; + } + + /** + * @param jndiName the JNDI name of this data source + */ + @XmlAttribute + public void setJndiName(String jndiName) { + this.jndiName = ConfigElement.getValue(jndiName); + } + + /** + * @return the ID of the JDBC Driver to used for this data source + */ + public String getJdbcDriverRef() { + return this.jdbcDriverRef; + } + + /** + * @param jdbcDriverRef the ID of the JDBC Driver to used for this data source + */ + @XmlAttribute + public void setJdbcDriverRef(String jdbcDriverRef) { + this.jdbcDriverRef = ConfigElement.getValue(jdbcDriverRef); + } + + public ConfigElementList getJdbcDrivers() { + return jdbcDrivers == null ? (jdbcDrivers = new ConfigElementList()) : jdbcDrivers; + } + + public Set getOnConnects() { + return onConnects == null ? (onConnects = new LinkedHashSet()) : onConnects; + } + + public ConfigElementList getRecoveryAuthDatas() { + return recoveryAuthDatas == null ? (recoveryAuthDatas = new ConfigElementList()) : recoveryAuthDatas; + } + + public String getDataSourcePropertiesUsedAlias() { + if (db2iNativeProps != null) + return DataSourceProperties.DB2_I_NATIVE; + else if (db2iToolboxProps != null) + return DataSourceProperties.DB2_I_TOOLBOX; + else if (db2JccProps != null) + return DataSourceProperties.DB2_JCC; + else if (derbyEmbeddedProps != null) + return DataSourceProperties.DERBY_EMBEDDED; + else if (derbyNetClientProps != null) + return DataSourceProperties.DERBY_CLIENT; + else if (genericProps != null) + return DataSourceProperties.GENERIC; + else if (informixJccProps != null) + return DataSourceProperties.INFORMIX_JCC; + else if (informixJdbcProps != null) + return DataSourceProperties.INFORMIX_JDBC; + else if (oracleProps != null) + return DataSourceProperties.ORACLE_JDBC; + else if (oracleUcpProps != null) + return DataSourceProperties.ORACLE_UCP; + else if (sqlServerDataDirectProps != null) + return DataSourceProperties.DATADIRECT_SQLSERVER; + else if (sqlServerProps != null) + return DataSourceProperties.MICROSOFT_SQLSERVER; + else if (sybaseProps != null) + return DataSourceProperties.SYBASE; + else + return null; + } + + public Set getDataSourceProperties() { + Set nestedPropElements = new HashSet(); + if (this.db2iNativeProps != null) + nestedPropElements.addAll(this.db2iNativeProps); + if (this.db2iToolboxProps != null) + nestedPropElements.addAll(this.db2iToolboxProps); + if (this.db2JccProps != null) + nestedPropElements.addAll(this.db2JccProps); + if (this.derbyEmbeddedProps != null) + nestedPropElements.addAll(this.derbyEmbeddedProps); + if (this.derbyNetClientProps != null) + nestedPropElements.addAll(this.derbyNetClientProps); + if (this.genericProps != null) + nestedPropElements.addAll(this.genericProps); + if (this.informixJccProps != null) + nestedPropElements.addAll(this.informixJccProps); + if (this.informixJdbcProps != null) + nestedPropElements.addAll(this.informixJdbcProps); + if (this.oracleProps != null) + nestedPropElements.addAll(this.oracleProps); + if (this.oracleUcpProps != null) + nestedPropElements.addAll(this.oracleUcpProps); + if (this.sqlServerDataDirectProps != null) + nestedPropElements.addAll(this.sqlServerDataDirectProps); + if (this.sqlServerProps != null) + nestedPropElements.addAll(this.sqlServerProps); + if (this.sybaseProps != null) + nestedPropElements.addAll(this.sybaseProps); + return nestedPropElements; + } + + public void clearDataSourceDBProperties() { + if (this.db2iNativeProps != null) + this.db2iNativeProps.clear(); + if (this.db2iToolboxProps != null) + this.db2iToolboxProps.clear(); + if (this.db2JccProps != null) + this.db2JccProps.clear(); + if (this.derbyEmbeddedProps != null) + this.derbyEmbeddedProps.clear(); + if (this.derbyNetClientProps != null) + this.derbyNetClientProps.clear(); + if (this.genericProps != null) + this.genericProps.clear(); + if (this.informixJccProps != null) + this.informixJccProps.clear(); + if (this.informixJdbcProps != null) + this.informixJdbcProps.clear(); + if (this.oracleProps != null) + this.oracleProps.clear(); + if (this.oracleUcpProps != null) + this.oracleUcpProps.clear(); + if (this.sqlServerDataDirectProps != null) + this.sqlServerDataDirectProps.clear(); + if (this.sqlServerProps != null) + this.sqlServerProps.clear(); + if (this.sybaseProps != null) + this.sybaseProps.clear(); + } + + /** + * Update from bootstrapping.properties. + *
    + *
  • Update nested . + *
  • Remove the existing nested properties entries. + *
  • Create a nested entry based on bootstrapping.properties + * and add it to the . + * + */ + public void updateDataSourceFromBootstrap(ServerConfiguration config) throws Exception { + Log.entering(c, "updateDataSourceFromBootstrap"); + Bootstrap bs = Bootstrap.getInstance(); + if (bs.getValue(BootstrapProperty.DB_DRIVERNAME.getPropertyName()) == null) { + return; + } + + Log.info(c, "updateDataSourceFromBootstrap", "Updating dataSource " + getId()); + for (JdbcDriver jdbcDriver : getJdbcDrivers()) { + Log.info(c, "updateDataSourceFromBootstrap", "Update nested JDBC Driver"); + if (!"false".equalsIgnoreCase(jdbcDriver.getFatModify())) + jdbcDriver.updateJdbcDriverFromBootstrap(config); + } + + Log.info(c, "updateDataSourceFromBootstrap", "Delete properties and create new one"); + + DataSourceProperties dsp = getDataSourceProperties().iterator().next(); + boolean hasUser = (dsp.getUser() != null); + boolean hasPass = (dsp.getPassword() != null); + + String database_hostname = bs.getValue(BootstrapProperty.DB_HOSTNAME.getPropertyName()); + String database_port = bs.getValue(BootstrapProperty.DB_PORT.getPropertyName()); + String database_name = bs.getValue(BootstrapProperty.DB_NAME.getPropertyName()); + String database_user1 = (hasUser ? bs.getValue(BootstrapProperty.DB_USER1.getPropertyName()) : null); + String database_password1 = (hasPass ? bs.getValue(BootstrapProperty.DB_PASSWORD1.getPropertyName()) : null); + String database_drivername = bs.getValue(BootstrapProperty.DB_DRIVERNAME.getPropertyName()); + String database_vendorname = bs.getValue(BootstrapProperty.DB_VENDORNAME.getPropertyName()); + String database_servername = bs.getValue(BootstrapProperty.DB_IFXSERVERNAME.getPropertyName()); + + clearDataSourceDBProperties(); + + if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_DERBYEMB.getPropertyName()) + && (database_drivername.equalsIgnoreCase(BootstrapProperty.DB_DERBY_EMBEDDED_DRIVER.getPropertyName()) + || database_drivername.equalsIgnoreCase(BootstrapProperty.DB_DERBY_EMBEDDED_DRIVER_40.getPropertyName()))) { + // TODO Derby Embedded is not yet supported as a specified database + Properties_derby_embedded properties = new Properties_derby_embedded(); + properties.setCreateDatabase("create"); + properties.setDatabaseName("${shared.resource.dir}/data/" + database_name); + properties.setPassword(database_password1); + properties.setPortNumber(database_port); // may not need this + properties.setUser(database_user1); + properties.setServerName(database_hostname); + derbyEmbeddedProps = new ConfigElementList(); + derbyEmbeddedProps.add(properties); + throw new Exception("Database or driver not yet supported"); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_DERBYNET.getPropertyName()) + && (database_drivername.equalsIgnoreCase(BootstrapProperty.DB_DERBY_NETWORK_CLIENT_DRIVER.getPropertyName()) + || database_drivername.equalsIgnoreCase(BootstrapProperty.DB_DERBY_NETWORK_CLIENT_DRIVER_40.getPropertyName()))) { + // TODO Derby Network is not yet supported as a specified database + Properties_derby_client properties = new Properties_derby_client(); + properties.setCreateDatabase("create"); + properties.setDatabaseName("${shared.resource.dir}/data/" + database_name); + properties.setPassword(database_password1); + properties.setPortNumber(database_port); + properties.setUser(database_user1); + properties.setServerName(database_hostname); + derbyNetClientProps = new ConfigElementList(); + derbyNetClientProps.add(properties); + throw new Exception("Database or driver not yet supported"); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_DB2.getPropertyName()) + && database_drivername.equalsIgnoreCase(BootstrapProperty.DB_DB2_JCC_DRIVER.getPropertyName())) { + Properties_db2_jcc properties = new Properties_db2_jcc(); + properties.setDatabaseName(database_name); + properties.setPassword(database_password1); + properties.setPortNumber(database_port); + properties.setUser(database_user1); + properties.setServerName(database_hostname); + db2JccProps = new ConfigElementList(); + db2JccProps.add(properties); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_DB2_ISERIES.getPropertyName()) + && database_drivername.equalsIgnoreCase(BootstrapProperty.DB_DB2_INATIVE_DRIVER.getPropertyName())) { + // TODO iSeries is not yet supported as a specified database + Properties_db2_i_native properties = new Properties_db2_i_native(); + // TODO finish setting the properties + db2iNativeProps = new ConfigElementList(); + db2iNativeProps.add(properties); + throw new Exception("Database or driver not yet supported"); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_DB2_ISERIES.getPropertyName()) + && database_drivername.equalsIgnoreCase(BootstrapProperty.DB_DB2_ITOOLBOX_DRIVER.getPropertyName())) { + // TODO iSeries is not yet supported as a specified database + Properties_db2_i_toolbox properties = new Properties_db2_i_toolbox(); + // TODO finish setting the properties + db2iToolboxProps = new ConfigElementList(); + db2iToolboxProps.add(properties); + throw new Exception("Database or driver not yet supported"); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_DB2_ZOS.getPropertyName()) + && database_drivername.equalsIgnoreCase(BootstrapProperty.DB_DB2_JCC_DRIVER.getPropertyName())) { + // TODO zOS is not yet supported as a specified database + Properties_db2_jcc properties = new Properties_db2_jcc(); + // TODO finish setting the properties + db2JccProps = new ConfigElementList(); + db2JccProps.add(properties); + throw new Exception("Database or driver not yet supported"); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_INFORMIX.getPropertyName()) + && database_drivername.equalsIgnoreCase(BootstrapProperty.DB_DB2_JCC_DRIVER.getPropertyName())) { + Properties_informix_jcc properties = new Properties_informix_jcc(); + properties.setDatabaseName(database_name); + properties.setPassword(database_password1); + properties.setPortNumber(database_port); + properties.setUser(database_user1); + properties.setServerName(database_hostname); + informixJccProps = new ConfigElementList(); + informixJccProps.add(properties); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_INFORMIX.getPropertyName()) + && database_drivername.equalsIgnoreCase(BootstrapProperty.DB_INFORMIX_DRIVER.getPropertyName())) { + Properties_informix properties = new Properties_informix(); + properties.setDatabaseName(database_name); + properties.setPassword(database_password1); + properties.setPortNumber(database_port); + properties.setUser(database_user1); + properties.setServerName(database_servername); + properties.setIfxIFXHOST(database_hostname); + informixJdbcProps = new ConfigElementList(); + informixJdbcProps.add(properties); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_ORACLE.getPropertyName()) + && database_drivername.equalsIgnoreCase(BootstrapProperty.DB_ORACLE_DRIVER.getPropertyName())) { + Properties_oracle properties = new Properties_oracle(); + String URL = "jdbc:oracle:thin:@//" + database_hostname + ":" + database_port + "/" + database_name; + properties.setPassword(database_password1); + properties.setUser(database_user1); + properties.setURL(URL); + oracleProps = new ConfigElementList(); + oracleProps.add(properties); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_ORACLE.getPropertyName()) + && database_drivername.equalsIgnoreCase("OracleUCP ???")) { + // TODO add processing for Oracle UCP at some point in the future + Properties_oracle_ucp properties = new Properties_oracle_ucp(); + String URL = "jdbc:oracle:thin:@//" + database_hostname + ":" + database_port + "/" + database_name; + properties.setPassword(database_password1); + properties.setUser(database_user1); + properties.setURL(URL); + oracleUcpProps = new ConfigElementList(); + oracleUcpProps.add(properties); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_SQLSERVER.getPropertyName()) + && database_drivername.equalsIgnoreCase(BootstrapProperty.DB_SQLSERVER_DRIVER.getPropertyName())) { + Properties_microsoft_sqlserver properties = new Properties_microsoft_sqlserver(); + properties.setDatabaseName(database_name); + properties.setPassword(database_password1); + properties.setPortNumber(database_port); + properties.setUser(database_user1); + properties.setServerName(database_hostname); + sqlServerProps = new ConfigElementList(); + sqlServerProps.add(properties); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_SQLSERVER.getPropertyName()) + && database_drivername.equalsIgnoreCase(BootstrapProperty.DB_DATADIRECT_DRIVER.getPropertyName())) { + Properties_datadirect_sqlserver properties = new Properties_datadirect_sqlserver(); + properties.setDatabaseName(database_name); + properties.setPassword(database_password1); + properties.setPortNumber(database_port); + properties.setUser(database_user1); + properties.setServerName(database_hostname); + sqlServerDataDirectProps = new ConfigElementList(); + sqlServerDataDirectProps.add(properties); + } else if (database_vendorname.equalsIgnoreCase(BootstrapProperty.DB_SYBASE.getPropertyName()) + && (database_drivername.equalsIgnoreCase(BootstrapProperty.DB_SYBASE_DRIVER6.getPropertyName()) + || database_drivername.equalsIgnoreCase(BootstrapProperty.DB_SYBASE_DRIVER7.getPropertyName()))) { + Properties_sybase properties = new Properties_sybase(); + properties.setDatabaseName(database_name); + properties.setPassword(database_password1); + properties.setPortNumber(database_port); + properties.setUser(database_user1); + properties.setServerName(database_hostname); + sybaseProps = new ConfigElementList(); + sybaseProps.add(properties); + } else { + throw new Exception("Database or driver not supported"); + } + Log.exiting(c, "updateDataSourceFromBootstrap"); + } + + /** + * Retrieves custom properties configured on this instance, if any already exist + * + * @return custom properties configured on this instance, if any already exist + */ + public ConfigElementList getProperties() { + return this.genericProps == null ? (genericProps = new ConfigElementList()) : genericProps; + } + + public ConfigElementList getProperties_datadirect_sqlserver() { + return this.sqlServerDataDirectProps == null ? (sqlServerDataDirectProps = new ConfigElementList()) : sqlServerDataDirectProps; + } + + public ConfigElementList getProperties_db2_i_native() { + return this.db2iNativeProps == null ? (db2iNativeProps = new ConfigElementList()) : db2iNativeProps; + } + + public ConfigElementList getProperties_db2_i_toolbox() { + return this.db2iToolboxProps == null ? (db2iToolboxProps = new ConfigElementList()) : db2iToolboxProps; + } + + public ConfigElementList getProperties_db2_jcc() { + return this.db2JccProps == null ? (db2JccProps = new ConfigElementList()) : db2JccProps; + } + + public ConfigElementList getProperties_derby_client() { + return this.derbyNetClientProps == null ? (derbyNetClientProps = new ConfigElementList()) : derbyNetClientProps; + } + + public ConfigElementList getProperties_derby_embedded() { + return this.derbyEmbeddedProps == null ? (derbyEmbeddedProps = new ConfigElementList()) : derbyEmbeddedProps; + } + + public ConfigElementList getProperties_informix_jcc() { + return this.informixJccProps == null ? (informixJccProps = new ConfigElementList()) : informixJccProps; + } + + public ConfigElementList getProperties_informix() { + return this.informixJdbcProps == null ? (informixJdbcProps = new ConfigElementList()) : informixJdbcProps; + } + + public ConfigElementList getProperties_microsoft_sqlserver() { + return this.sqlServerProps == null ? (sqlServerProps = new ConfigElementList()) : sqlServerProps; + } + + public ConfigElementList getProperties_oracle() { + return this.oracleProps == null ? (oracleProps = new ConfigElementList()) : oracleProps; + } + + public ConfigElementList getProperties_oracle_ucp() { + return this.oracleUcpProps == null ? (oracleUcpProps = new ConfigElementList()) : oracleUcpProps; + } + + public ConfigElementList getProperties_sybase() { + return this.sybaseProps == null ? (sybaseProps = new ConfigElementList()) : sybaseProps; + } + + public String getConnectionManagerRef() { + return connectionManagerRef; + } + + @XmlAttribute + public void setConnectionManagerRef(String connectionManagerRef) { + this.connectionManagerRef = connectionManagerRef; + } + + public String getPropertiesRef() { + return propertiesRef; + } + + @XmlAttribute + public void setPropertiesRef(String propertiesRef) { + this.propertiesRef = propertiesRef; + } + + public String getType() { + return type; + } + + @XmlAttribute + public void setType(String type) { + this.type = type; + } + + public String getConnectionSharing() { + return connectionSharing; + } + + @XmlAttribute + public void setConnectionSharing(String connectionSharing) { + this.connectionSharing = connectionSharing; + } + + public String getIsolationLevel() { + return isolationLevel; + } + + @XmlAttribute + public void setIsolationLevel(String isolationLevel) { + this.isolationLevel = isolationLevel; + } + + public String getStatementCacheSize() { + return statementCacheSize; + } + + @XmlAttribute + public void setStatementCacheSize(String statementCacheSize) { + this.statementCacheSize = statementCacheSize; + } + + public String getTransactional() { + return transactional; + } + + @XmlAttribute + public void setTransactional(String transactional) { + this.transactional = transactional; + } + + public String getBeginTranForResultSetScrollingAPIs() { + return beginTranForResultSetScrollingAPIs; + } + + @XmlAttribute + public void setBeginTranForResultSetScrollingAPIs(String beginTranForResultSetScrollingAPIs) { + this.beginTranForResultSetScrollingAPIs = beginTranForResultSetScrollingAPIs; + } + + public String getBeginTranForVendorAPIs() { + return beginTranForVendorAPIs; + } + + @XmlAttribute + public void setBeginTranForVendorAPIs(String beginTranForVendorAPIs) { + this.beginTranForVendorAPIs = beginTranForVendorAPIs; + } + + public String getCommitOrRollbackOnCleanup() { + return commitOrRollbackOnCleanup; + } + + @XmlAttribute + public void setCommitOrRollbackOnCleanup(String commitOrRollbackOnCleanup) { + this.commitOrRollbackOnCleanup = commitOrRollbackOnCleanup; + } + + public String getContainerAuthDataRef() { + return containerAuthDataRef; + } + + @XmlAttribute + public void setContainerAuthDataRef(String containerAuthDataRef) { + this.containerAuthDataRef = containerAuthDataRef; + } + + public String getEnableConnectionCasting() { + return enableConnectionCasting; + } + + @XmlAttribute + public void setEnableConnectionCasting(String enableConnectionCasting) { + this.enableConnectionCasting = enableConnectionCasting; + } + + public String getEnableMultithreadedAccessDetection() { + return enableMultithreadedAccessDetection; + } + + @XmlAttribute + public void setEnableMultithreadedAccessDetection(String enableMultithreadedAccessDetection) { + this.enableMultithreadedAccessDetection = enableMultithreadedAccessDetection; + } + + public String getOnConnect() { + return onConnect; + } + + public String getQueryTimeout() { + return queryTimeout; + } + + @XmlAttribute + public void setOnConnect(String onConnect) { + this.onConnect = onConnect; + } + + @XmlAttribute + public void setQueryTimeout(String queryTimeout) { + this.queryTimeout = queryTimeout; + } + + public String getRecoveryAuthDataRef() { + return recoveryAuthDataRef; + } + + @XmlAttribute + public void setRecoveryAuthDataRef(String recoveryAuthDataRef) { + this.recoveryAuthDataRef = recoveryAuthDataRef; + } + + public String getSyncQueryTimeoutWithTransactionTimeout() { + return syncQueryTimeoutWithTransactionTimeout; + } + + @XmlAttribute + public void setSyncQueryTimeoutWithTransactionTimeout(String syncQueryTimeoutWithTransactionTimeout) { + this.syncQueryTimeoutWithTransactionTimeout = syncQueryTimeoutWithTransactionTimeout; + } + + public String getSupplementalJDBCTrace() { + return supplementalJDBCTrace; + } + + @XmlAttribute + public void setSupplementalJDBCTrace(String supplementalJDBCTrace) { + this.supplementalJDBCTrace = supplementalJDBCTrace; + } + + public String getValidationTimeout() { + return validationTimeout; + } + + @XmlAttribute + public void setValidationTimeout(String validationTimeout) { + this.validationTimeout = validationTimeout; + } + + public String getBadProperty() { + return badProperty; + } + + @XmlAttribute + public void setBadProperty(String badProperty) { + this.badProperty = badProperty; + } + + @XmlAttribute(name = "fat.modify") + public void setFatModify(String fatModify) { + this.fatModify = fatModify; + } + + public String getFatModify() { + return fatModify; + } + + /** + * Modifies the element if the fat.modify="true" attribute was configured for this element. + * + * @param config The ServerConfiguration instance. + */ + @Override + public void modify(ServerConfiguration config) throws Exception { + if (fatModify != null && fatModify.toLowerCase().equals("true")) { + updateDataSourceFromBootstrap(config); + + if (FATServletClient.onlyRule.getDataSource() == null) + FATServletClient.onlyRule.setDataSource(this); + if (FATServletClient.skipRule.getDataSource() == null) + FATServletClient.skipRule.setDataSource(this); + } + } + + /** + * Returns a string containing a list of the property names and their values + * for this DataSource object. + * + * @return String representing the data held + */ + @Override + public String toString() { + Set properties = getDataSourceProperties(); + StringBuffer buf = new StringBuffer("DataSource{"); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + if (beginTranForResultSetScrollingAPIs != null) + buf.append("beginTranForResultSetScrollingAPIs=\"" + beginTranForResultSetScrollingAPIs + "\" "); + if (beginTranForVendorAPIs != null) + buf.append("beginTranForVendorAPIs=\"" + beginTranForVendorAPIs + "\" "); + if (commitOrRollbackOnCleanup != null) + buf.append("commitOrRollbackOnCleanup=\"" + commitOrRollbackOnCleanup + "\" "); + if (connectionManagerRef != null) + buf.append("connectionManagerRef=\"" + connectionManagerRef + "\" "); + if (connectionSharing != null) + buf.append("connectionSharing=\"" + connectionSharing + "\" "); + if (containerAuthDataRef != null) + buf.append("containerAuthDataRef=\"" + containerAuthDataRef + "\" "); + if (enableConnectionCasting != null) + buf.append("enableConnectionCasting=\"" + enableConnectionCasting + "\" "); + if (enableMultithreadedAccessDetection != null) + buf.append("enableMultithreadedAccessDetection=\"" + enableMultithreadedAccessDetection + "\" "); + if (isolationLevel != null) + buf.append("isolationLevel=\"" + isolationLevel + "\" "); + if (jdbcDriverRef != null) + buf.append("jdbcDriverRef=\"" + jdbcDriverRef + "\" "); + if (jndiName != null) + buf.append("jndiName=\"" + jndiName + "\" "); + if (propertiesRef != null) + buf.append("propertiesRef=\"" + propertiesRef + "\" "); + if (onConnect != null) + buf.append("onConnect=\"" + onConnects + "\" "); + if (queryTimeout != null) + buf.append("queryTimeout=\"" + queryTimeout + "\" "); + if (recoveryAuthDataRef != null) + buf.append("recoveryAuthDataRef=\"" + recoveryAuthDataRef + "\" "); + if (statementCacheSize != null) + buf.append("statementCacheSize=\"" + statementCacheSize + "\" "); + if (supplementalJDBCTrace != null) + buf.append("supplementalJDBCTrace=\"" + supplementalJDBCTrace + "\" "); + if (syncQueryTimeoutWithTransactionTimeout != null) + buf.append("syncQueryTimeoutWithTransactionTimeout=\"" + syncQueryTimeoutWithTransactionTimeout + "\" "); + if (transactional != null) + buf.append("transactional=\"" + transactional + "\" "); + if (type != null) + buf.append("type=\"" + type + "\" "); + if (validationTimeout != null) + buf.append("validationTimeout=\"" + validationTimeout + "\" "); + buf.append(properties == null ? "no vendor properties" : properties.toString()); + if (connectionManagers != null) + buf.append(connectionManagers).append(' '); + if (containerAuthDatas != null) + buf.append(containerAuthDatas).append(' '); + if (jdbcDrivers != null) + buf.append(jdbcDrivers).append(' '); + if (onConnects != null) + buf.append("onConnects:").append(onConnects).append(' '); + if (recoveryAuthDatas != null) + buf.append(recoveryAuthDatas).append(' '); + buf.append("}"); + return buf.toString(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DataSourceProperties.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DataSourceProperties.java new file mode 100755 index 000000000000..d7d0949ddf80 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DataSourceProperties.java @@ -0,0 +1,95 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +public class DataSourceProperties extends ConfigElement { + + public static final String DB2_I_NATIVE = "properties.db2.i.native"; + public static final String DB2_I_TOOLBOX = "properties.db2.i.toolbox"; + public static final String DB2_JCC = "properties.db2.jcc"; + public static final String DERBY_EMBEDDED = "properties.derby.embedded"; + public static final String DERBY_CLIENT = "properties.derby.client"; + public static final String GENERIC = "properties"; + public static final String INFORMIX_JCC = "properties.informix.jcc"; + public static final String INFORMIX_JDBC = "properties.informix"; + public static final String ORACLE_JDBC = "properties.oracle"; + public static final String ORACLE_UCP = "properties.oracle.ucp"; + public static final String DATADIRECT_SQLSERVER = "properties.datadirect.sqlserver"; + public static final String MICROSOFT_SQLSERVER = "properties.microsoft.sqlserver"; + public static final String SYBASE = "properties.sybase"; + + private String databaseName; + private String loginTimeout; + private String password; + private String portNumber; + private String serverName; + private String user; + private String badVendorProperty; + + public String getElementName() { + return GENERIC; + } + + @XmlAttribute(name = "databaseName") + public void setDatabaseName(String databaseName) { + this.databaseName = databaseName; + } + + public String getDatabaseName() { + return this.databaseName; + } + + @XmlAttribute(name = "loginTimeout") + public void setLoginTimeout(String loginTimeout) { + this.loginTimeout = loginTimeout; + } + + public String getLoginTimeout() { + return this.loginTimeout; + } + + @XmlAttribute(name = "password") + public void setPassword(String password) { + this.password = password; + } + + public String getPassword() { + return this.password; + } + + @XmlAttribute(name = "portNumber") + public void setPortNumber(String portNumber) { + this.portNumber = portNumber; + } + + public String getPortNumber() { + return this.portNumber; + } + + @XmlAttribute(name = "serverName") + public void setServerName(String serverName) { + this.serverName = serverName; + } + + public String getServerName() { + return this.serverName; + } + + @XmlAttribute(name = "user") + public void setUser(String user) { + this.user = user; + } + + public String getUser() { + return this.user; + } + + public String getBadVendorProperty() { + return badVendorProperty; + } + + @XmlAttribute(name = "badVendorProperty") + public void setBadVendorProperty(String badVendorProperty) { + this.badVendorProperty = badVendorProperty; + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DatabaseStore.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DatabaseStore.java new file mode 100755 index 000000000000..fc379bdb8baf --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DatabaseStore.java @@ -0,0 +1,184 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * databaseStore element representation. + */ +public class DatabaseStore extends ConfigElement { + + /** Config reference to the authData attribute. */ + private String authDataRef; + + @XmlElement(name = "authData") + private ConfigElementList authDatas; + + /** Config reference to the dataSource attribute. */ + private String dataSourceRef; + + @XmlElement(name = "dataSource") + private ConfigElementList dataSources; + + private String keyGenerationStrategy; + + /** The database schema name attribute. */ + private String schema; + + /** The table name prefix attribute. */ + private String tablePrefix; + + /** The create tables indicator. */ + private String createTables; + + /** + * Set the authDataRef attribute. + * + * @param authDataRef The authDataRef attribute to be set. + */ + @XmlAttribute + public void setAuthDataRef(String authDataRef) { + this.authDataRef = authDataRef; + } + + /** + * Returns the authDataRef attribute value. + * + * @return The authDataRef attribute value. + */ + public String getAuthDataRef() { + return authDataRef; + } + + public ConfigElementList getAuthDatas() { + return authDatas == null ? (authDatas = new ConfigElementList()) : authDatas; + } + + /** + * Sets the dataSourceRef attribute. + * + * @param dataSourceRef The set attribute. + */ + @XmlAttribute + public void setDataSourceRef(String dataSourceRef) { + this.dataSourceRef = dataSourceRef; + } + + /** + * Returns the dataSourceRef attribute value. + * + * @return The dataSourceRef attribute value. + */ + public String getDataSourceRef() { + return dataSourceRef; + } + + public ConfigElementList getDataSources() { + return dataSources == null ? (dataSources = new ConfigElementList()) : dataSources; + } + + @XmlAttribute + public void setKeyGenerationStrategy(String keyGenerationStrategy) { + this.keyGenerationStrategy = keyGenerationStrategy; + } + + public String getKeyGenerationStrategy() { + return keyGenerationStrategy; + } + + /** + * Sets the schema name attribute value. + * + * @param schema The schema name attribute value. + */ + @XmlAttribute + public void setSchema(String schema) { + this.schema = schema; + } + + /** + * Returns the schema name attribute value. + * + * @return The schema name attribute value. + */ + public String getSchema() { + return schema; + } + + /** + * Sets the table prefix name attribute value. + * + * @param tablePrefix the table prefix name attribute value. + */ + @XmlAttribute + public void setTablePrefix(String tablePrefix) { + this.tablePrefix = tablePrefix; + } + + /** + * Returns the table prefix name. + * + * @return The table prefix name. + */ + public String getTablePrefix() { + return tablePrefix; + } + + /** + * Sets the create tables indicator attribute value. + * + * @param createTables The create tables indicator. + */ + @XmlAttribute + public void setCreateTables(String createTables) { + this.createTables = createTables; + } + + /** + * Returns the create tables indicator. + * + * @return The create tables indicator. + */ + public String getCreateTables() { + return createTables; + } + + /** + * Returns a String representation of this object. + */ + @Override + public String toString() { + StringBuilder buf = new StringBuilder("DatabaseStore {"); + if (super.getId() != null) + buf.append("id=\"" + super.getId() + "\", "); + if (keyGenerationStrategy != null) + buf.append("keyGenerationStrategy=\"" + keyGenerationStrategy + "\", "); + if (tablePrefix != null) + buf.append("tablePrefix=\"" + tablePrefix + "\", "); + if (schema != null) + buf.append("schema=\"" + schema + "\", "); + if (dataSourceRef != null) + buf.append("dataSourceRef=\"" + dataSourceRef + "\", "); + if (authDataRef != null) + buf.append("authDataRef=\"" + authDataRef + "\", "); + if (createTables != null) + buf.append("createTables=\"" + createTables + "\", "); + if (dataSources != null) + buf.append(dataSources).append(' '); + if (authDatas != null) + buf.append(authDatas).append(' '); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DefaultScalingPolicy.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DefaultScalingPolicy.java new file mode 100755 index 000000000000..40cd153c006d --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/DefaultScalingPolicy.java @@ -0,0 +1,116 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * The default scaling policy. See /com.ibm.ws.security.registry.basic/resources/OSGI-INF/metatype/metatype.xml + * + */ +public class DefaultScalingPolicy extends ConfigElement { + + private boolean enabled = true; + private int min = 2; + private int max = -1; + + // Other nested elements to be implemented + + /** + * Returns the 'enabled' attribute + * + * @return The 'enabled' attribute + */ + public boolean getEnabled() { + return this.enabled; + } + + /** + * Set the 'enabled' attribute value. + * + * @param enabled The new value for the enabled attribute + */ + @XmlAttribute(name = "enabled") + public void setEnabled(final boolean enabled) { + this.enabled = enabled; + } + + /** + * Shortcut to enable the scaling policy. + */ + public void enable() { + this.enabled = true; + } + + /** + * Shortcut to disable the scaling policy. + */ + public void disable() { + this.enabled = false; + } + + /** + * Returns the 'min' attribute + * + * @return The 'min' attribute + */ + public int getMin() { + return this.min; + } + + /** + * Set the 'min' attribute value. + * + * @param min The new value for the 'min' attribute + */ + @XmlAttribute(name = "min") + public void setMin(final int min) { + this.min = min; + } + + /** + * Returns the 'max' attribute + * + * @return The 'max' attribute + */ + public int getMax() { + return this.max; + } + + /** + * Set the 'max' attribute value. + * + * @param max The new value for the 'max' attribute + */ + @XmlAttribute(name = "max") + public void setMax(final int max) { + this.max = max; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer(this.getClass().getSimpleName()); + buf.append("{"); + buf.append("enabled=\"" + this.enabled + "\" "); + buf.append("min=\"" + this.min + "\" "); + buf.append("max=\"" + this.max + "\" "); + buf.append("}"); + return buf.toString(); + } + + @Override + public DefaultScalingPolicy clone() throws CloneNotSupportedException { + DefaultScalingPolicy clone = (DefaultScalingPolicy) super.clone(); + return clone; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/EJBAsynchronousElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/EJBAsynchronousElement.java new file mode 100755 index 000000000000..38b746ce51c2 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/EJBAsynchronousElement.java @@ -0,0 +1,66 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * + */ +public class EJBAsynchronousElement extends ConfigElement { + + private String contextServiceRef; + private String unclaimedRemoteResultTimeout; + private String maxUnclaimedRemoteResults; + + public String getContextServiceRef() { + return contextServiceRef; + } + + @XmlAttribute(name = "contextServiceRef") + public void setContextServiceRef(String contextServiceRef) { + this.contextServiceRef = contextServiceRef; + } + + public String getUnclaimedRemoteResultTimeout() { + return unclaimedRemoteResultTimeout; + } + + @XmlAttribute(name = "unclaimedRemoteResultTimeout") + public void setUnclaimedRemoteResultTimeout(String unclaimedRemoteResultTimeout) { + this.unclaimedRemoteResultTimeout = unclaimedRemoteResultTimeout; + } + + public String getMaxUnclaimedRemoteResults() { + return maxUnclaimedRemoteResults; + } + + @XmlAttribute(name = "maxUnclaimedRemoteResults") + public void setMaxUnclaimedRemoteResults(String maxUnclaimedRemoteResults) { + this.maxUnclaimedRemoteResults = maxUnclaimedRemoteResults; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("EJBAsynchronousElement {"); + + if (contextServiceRef != null) + buf.append("contextServiceRef=\"" + contextServiceRef + "\" "); + if (unclaimedRemoteResultTimeout != null) + buf.append("unclaimedRemoteResultTimeout=\"").append(unclaimedRemoteResultTimeout).append("\" "); + if (maxUnclaimedRemoteResults != null) + buf.append("maxUnclaimedRemoteResults=\"").append(maxUnclaimedRemoteResults).append("\" "); + + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/EJBContainerElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/EJBContainerElement.java new file mode 100755 index 000000000000..532e66b9fc55 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/EJBContainerElement.java @@ -0,0 +1,101 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * + */ +public class EJBContainerElement extends ConfigElement { + + private Integer cacheSize; + private Long poolCleanupInterval; + private Long cacheCleanupInterval; + private Boolean startEJBsAtAppStart; + private EJBAsynchronousElement asynchronous; + private EJBTimerServiceElement timerService; + + public Integer getCacheSize() { + return cacheSize; + } + + @XmlAttribute(name = "cacheSize") + public void setCacheSize(Integer cacheSize) { + this.cacheSize = cacheSize; + } + + public Long getPoolCleanupInterval() { + return poolCleanupInterval; + } + + @XmlAttribute(name = "poolCleanupInterval") + public void setPoolCleanupInterval(Long poolCleanupInterval) { + this.poolCleanupInterval = poolCleanupInterval; + } + + public Long getCacheCleanupInterval() { + return cacheCleanupInterval; + } + + @XmlAttribute(name = "cacheCleanupInterval") + public void setCacheCleanupInterval(Long cacheCleanupInterval) { + this.cacheCleanupInterval = cacheCleanupInterval; + } + + public Boolean getStartEJBsAtAppStart() { + return startEJBsAtAppStart; + } + + @XmlAttribute(name = "startEJBsAtAppStart") + public void setStartEJBsAtAppStart(Boolean startEJBsAtAppStart) { + this.startEJBsAtAppStart = startEJBsAtAppStart; + } + + public EJBAsynchronousElement getAsynchronous() { + return asynchronous; + } + + @XmlElement(name = "asynchronous") + public void setAsynchronous(EJBAsynchronousElement asynchronous) { + this.asynchronous = asynchronous; + } + + public EJBTimerServiceElement getTimerService() { + return timerService; + } + + @XmlElement(name = "timerService") + public void setTimerService(EJBTimerServiceElement timerService) { + this.timerService = timerService; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("EJBContainerElement {"); + + if (cacheSize != null) + buf.append("cacheSize=\"" + cacheSize + "\" "); + if (poolCleanupInterval != null) + buf.append("poolCleanupInterval=\"" + poolCleanupInterval + "\" "); + if (cacheCleanupInterval != null) + buf.append("cacheCleanupInterval=\"" + cacheCleanupInterval + "\" "); + if (asynchronous != null) + buf.append(", " + asynchronous); + if (timerService != null) + buf.append(", " + timerService); + + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/EJBTimerServiceElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/EJBTimerServiceElement.java new file mode 100755 index 000000000000..8d8a61bac453 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/EJBTimerServiceElement.java @@ -0,0 +1,66 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014, 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * + */ +public class EJBTimerServiceElement extends ConfigElement { + + private Long lateTimerThreshold; + private Long nonPersistentRetryInterval; + private Integer nonPersistentMaxRetries; + + public Long getLateTimerThreshold() { + return lateTimerThreshold; + } + + @XmlAttribute(name = "lateTimerThreshold") + public void setLateTimerThreshold(Long lateTimerThreshold) { + this.lateTimerThreshold = lateTimerThreshold; + } + + public Long getNonPersistentRetryInterval() { + return nonPersistentRetryInterval; + } + + @XmlAttribute(name = "nonPersistentRetryInterval") + public void setNonPersistentRetryInterval(Long nonPersistentRetryInterval) { + this.nonPersistentRetryInterval = nonPersistentRetryInterval; + } + + public Integer getNonPersistentMaxRetries() { + return nonPersistentMaxRetries; + } + + @XmlAttribute(name = "nonPersistentMaxRetries") + public void setNonPersistentMaxRetries(Integer nonPersistentMaxRetries) { + this.nonPersistentMaxRetries = nonPersistentMaxRetries; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("EJBTimerServiceElement {"); + + if (nonPersistentRetryInterval != null) { + buf.append("nonPersistentRetryInterval=\"" + nonPersistentRetryInterval + "\" "); + } + if (nonPersistentMaxRetries != null) { + buf.append("nonPersistentMaxRetries=\"" + nonPersistentMaxRetries + "\" "); + } + + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ExecutorElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ExecutorElement.java new file mode 100755 index 000000000000..33deb2febc06 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ExecutorElement.java @@ -0,0 +1,98 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +public class ExecutorElement extends ConfigElement { + private String coreThreads; + private String name; + private String maxThreads; + private String keepAlive; + private String stealPolicy; + private String rejectedWorkPolicy; + + @XmlAttribute(name = "name") + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + @XmlAttribute(name = "maxThreads") + public void setMaxThreads(String maxThreads) { + this.maxThreads = maxThreads; + } + + public String getMaxThreads() { + return maxThreads; + } + + @XmlAttribute(name = "keepAlive") + public void setKeepAlive(String keepAlive) { + this.keepAlive = keepAlive; + } + + public String getKeepAlive() { + return keepAlive; + } + + @XmlAttribute(name = "stealPolicy") + public void setStealPolicy(String stealPolicy) { + this.stealPolicy = stealPolicy; + } + + public String getStealPolicy() { + return stealPolicy; + } + + @XmlAttribute(name = "rejectedWorkPolicy") + public void setRejectedWorkPolicy(String rejectedWorkPolicy) { + this.rejectedWorkPolicy = rejectedWorkPolicy; + } + + public String getRejectedWorkPolicy() { + return rejectedWorkPolicy; + } + + public String getCoreThreads() { + return coreThreads; + } + + @XmlAttribute(name = "coreThreads") + public void setCoreThreads(String s) { + this.coreThreads = s; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("ExecutorElement{"); + if (coreThreads != null) + buf.append("coreThreads=\"" + coreThreads + "\""); + buf.append("}"); + + return buf.toString(); + } + + public class StealPolicyValues { + public static final String STRICT = "STRICT"; + public static final String LOCAL = "LOCAL"; + public static final String NEVER = "NEVER"; + } + + public class RejectedWorkPolicyValues { + public static final String ABORT = "ABORT"; + public static final String CALLER_RUNS = "CALLER_RUNS"; + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/FeatureManager.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/FeatureManager.java new file mode 100755 index 000000000000..864800a2b868 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/FeatureManager.java @@ -0,0 +1,74 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.Set; +import java.util.TreeSet; + +import javax.xml.bind.annotation.XmlElement; + +/** + * Represents the list of features enabled in a server configuration + * + * @author Tim Burns + * + */ +public class FeatureManager extends ConfigElement { + + /** + * Kills the server after 20 minutes in case of emergency; + * change timeout with System property (ms): "com.ibm.ws.timedexit.timetolive"
    + * (See com.ibm.ws.timedexit/src/com/ibm/ws/timedexit/internal/TimedExitComponent.java) + */ + public static final String FEATURE_TIMED_EXIT_1_0 = "timedexit-1.0"; + public static final String FEATURE_SERVLET_3_0 = "servlet-3.0"; + public static final String FEATURE_JSP_2_2 = "jsp-2.2"; + public static final String FEATURE_SESSION_DATABASE_1_0 = "sessionDatabase-1.0"; + public static final String FEATURE_SSL_1_0 = "ssl-1.0"; + public static final String FEATURE_APP_SECURITY_1_0 = "appSecurity-1.0"; + + @XmlElement(name = "feature") + private Set features; + + /** + * Retrieves the list of features in this configuration. Uses Strings to + * define feature names to provide flexability for unknown/future features. + * + * @return the list of features in this configuration + */ + public Set getFeatures() { + if (this.features == null) { + this.features = new TreeSet(); + } + return this.features; + } + + @Override + public FeatureManager clone() throws CloneNotSupportedException { + FeatureManager clone = (FeatureManager) super.clone(); + + if (this.features != null) { + clone.features = new TreeSet(); + for (String feature : this.features) + clone.features.add(feature); + } + + return clone; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("FeatureManager{"); + if (this.features != null) + for (String feature : features) + buf.append("feature=\"" + feature + "\" "); + buf.append("}"); + + return buf.toString(); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof FeatureManager)) + return false; + return getFeatures().equals(((FeatureManager) o).getFeatures()); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/File.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/File.java new file mode 100755 index 000000000000..be4ef9d3982f --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/File.java @@ -0,0 +1,38 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * A file on the file system local to the server configuration. Note + * that these file may be remote to the local JVM. + * + * + */ +public class File extends ConfigElement { + + private String name; + + /** + * @return value of the name attribute + */ + public String getName() { + return this.name; + } + + /** + * @param name value to use for the name attribute + */ + @XmlAttribute + public void setName(String name) { + this.name = ConfigElement.getValue(name); + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("File{"); + if (name != null) + buf.append("name=\"" + name + "\" "); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Fileset.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Fileset.java new file mode 100755 index 000000000000..b10d48a4bf62 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Fileset.java @@ -0,0 +1,111 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * A set of files on the file system local to the server configuration. Note + * that these files may be remote to the local JVM. + * + * @author Tim Burns + * + */ +public class Fileset extends ConfigElement { + + private String caseSensitive; + private String dir; + private String excludes; + private String includes; + private String scanInterval; + + /** + * @return value of the caseSensitive attribute + */ + public String getCaseSensitive() { + return this.caseSensitive; + } + + /** + * @param caseSensitive value to use for the caseSensitive attribute + */ + @XmlAttribute + public void setCaseSensitive(String caseSensitive) { + this.caseSensitive = ConfigElement.getValue(caseSensitive); + } + + /** + * @return the parent directory represented by this instance + */ + public String getDir() { + return this.dir; + } + + /** + * @param dir the parent directory represented by this instance + */ + @XmlAttribute + public void setDir(String dir) { + this.dir = ConfigElement.getValue(dir); + } + + /** + * @return the pattern to exclude from the target directory + */ + public String getExcludes() { + return this.excludes; + } + + /** + * @param includes the pattern to exclude from the target directory + */ + @XmlAttribute + public void setExcludes(String excludes) { + this.excludes = ConfigElement.getValue(excludes); + } + + /** + * @return the pattern to include from the target directory + */ + public String getIncludes() { + return this.includes; + } + + /** + * @param includes the pattern to include from the target directory + */ + @XmlAttribute + public void setIncludes(String includes) { + this.includes = ConfigElement.getValue(includes); + } + + /** + * @return the scan interval + */ + public String getScanInterval() { + return this.scanInterval; + } + + /** + * @param scanInterval the scan interval + */ + @XmlAttribute + public void setScanInterval(String scanInterval) { + this.scanInterval = ConfigElement.getValue(scanInterval); + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("Fileset{"); + if (caseSensitive != null) + buf.append("caseSensitive=\"" + caseSensitive + "\" "); + if (dir != null) + buf.append("dir=\"" + dir + "\" "); + if (excludes != null) + buf.append("excludes=\"" + excludes + "\" "); + if (includes != null) + buf.append("includes=\"" + includes + "\" "); + if (scanInterval != null) + buf.append("scanInterval=\"" + scanInterval + "\" "); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Folder.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Folder.java new file mode 100755 index 000000000000..0ea53bcabccc --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Folder.java @@ -0,0 +1,38 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * A folder on the file system local to the server configuration. Note + * that these files may be remote to the local JVM. + * + * + */ +public class Folder extends ConfigElement { + + private String dir; + + /** + * @return value of the dir attribute + */ + public String getDir() { + return this.dir; + } + + /** + * @param dir value to use for the dir attribute + */ + @XmlAttribute + public void setDir(String dir) { + this.dir = ConfigElement.getValue(dir); + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("Folder{"); + if (dir != null) + buf.append("dir=\"" + dir + "\" "); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/HttpEndpoint.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/HttpEndpoint.java new file mode 100755 index 000000000000..b135cfd62914 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/HttpEndpoint.java @@ -0,0 +1,91 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * Defines an HTTP endpoint (host/port mapping) + * + * @author Tim Burns + * + */ +public class HttpEndpoint extends ConfigElement { + + @XmlElement(name = "tcpOptions") + private TcpOptions tcpOptions; + private String host; + private Integer httpPort; + private Integer httpsPort; + + /** + * @return TCP options for this configuration + */ + public TcpOptions getTcpOptions() { + if (this.tcpOptions == null) { + this.tcpOptions = new TcpOptions(); + } + return this.tcpOptions; + } + + /** + * @return the host mapping for this entry + */ + public String getHost() { + return this.host; + } + + /** + * @param host the host mapping for this entry + */ + @XmlAttribute + public void setHost(String host) { + this.host = ConfigElement.getValue(host); + } + + /** + * @return the port to use for non-secure traffic + */ + public Integer getHttpPort() { + return this.httpPort; + } + + /** + * @param httpPort the port to use for non-secure traffic + */ + @XmlAttribute + public void setHttpPort(Integer httpPort) { + this.httpPort = httpPort; + } + + /** + * @return the port to use for secure traffic + */ + public Integer getHttpsPort() { + return this.httpsPort; + } + + /** + * @param httpsPort the port to use for secure traffic + */ + @XmlAttribute + public void setHttpsPort(Integer httpsPort) { + this.httpsPort = httpsPort; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("HttpEndpoint{"); + buf.append("id=\"" + this.getId() + "\" "); + if (this.host != null) + buf.append("host=\"" + this.host + "\" "); + if (this.httpPort != null) + buf.append("httpPort=\"" + this.httpPort + "\" "); + if (this.httpsPort != null) + buf.append("httpsPort=\"" + this.httpsPort + "\" "); + if (this.tcpOptions != null) + buf.append(tcpOptions.toString()); + + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/HttpSession.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/HttpSession.java new file mode 100755 index 000000000000..8f4c4da061d4 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/HttpSession.java @@ -0,0 +1,430 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlTransient; + +/** + * Defines configuration attributes of the HTTP Session Manager + * + * @author Tim Burns + * + */ +public class HttpSession extends ConfigElement { + + private String storageRef; + private Boolean sslTrackingEnabled; + private Boolean urlRewritingEnabled; + private Boolean protocolSwitchRewritingEnabled; + private Boolean cookiesEnabled; + private String cookieName; + private String cookieDomain; + private Integer cookieMaxAge; + private String cookiePath; + private Boolean cookieSecure; + private Boolean cookieHttpOnly; + private Integer maxInMemorySessionCount; + private Boolean allowOverflow; + private Integer invalidationTimeout; + private Boolean securityIntegrationEnabled; + private Integer idLength; + private Boolean useContextRootAsCookiePath; + private Boolean alwaysEncodeUrl; + private String cloneId; + private String cloneSeparator; + private Boolean debugCrossover; + private Integer forceInvalidationMultiple; + private Boolean idReuse; + private Boolean noAdditionalInfo; + private Long reaperPollInterval; + private String rewriteId; + private Boolean securityUserIgnoreCase; + private Boolean throwSecurityExceptionOnGetSessionFalse; + private Boolean allowSerializedAccess; + private Boolean accessOnTimeout; + private Integer maxWaitTime; + + @XmlTransient + public void setStorage(HttpSessionDatabase httpSessionDatabase) { + this.setStorageRef(httpSessionDatabase == null ? null : httpSessionDatabase.getId()); + } + + public String getStorageRef() { + return storageRef; + } + + @XmlAttribute + public void setStorageRef(String storageRef) { + this.storageRef = storageRef; + } + + /** + * @return the number of minutes before sessions become eligible for invalidation + */ + public Integer getInvalidationTimeout() { + return this.invalidationTimeout; + } + + /** + * @param invalidationTimeout the number of minutes before sessions become eligible for invalidation + */ + @XmlAttribute + public void setInvalidationTimeout(Integer invalidationTimeout) { + this.invalidationTimeout = invalidationTimeout; + } + + public Boolean isSslTrackingEnabled() { + return this.sslTrackingEnabled; + } + + @XmlAttribute + public void setSslTrackingEnabled(Boolean sslTrackingEnabled) { + this.sslTrackingEnabled = sslTrackingEnabled; + } + + public Boolean isUrlRewritingEnabled() { + return this.urlRewritingEnabled; + } + + @XmlAttribute + public void setUrlRewritingEnabled(Boolean urlRewritingEnabled) { + this.urlRewritingEnabled = urlRewritingEnabled; + } + + public Boolean isProtocolSwitchRewritingEnabled() { + return this.protocolSwitchRewritingEnabled; + } + + @XmlAttribute + public void setProtocolSwitchRewritingEnabled(Boolean protocolSwitchRewritingEnabled) { + this.protocolSwitchRewritingEnabled = protocolSwitchRewritingEnabled; + } + + public Boolean isCookiesEnabled() { + return this.cookiesEnabled; + } + + @XmlAttribute + public void setCookiesEnabled(Boolean cookiesEnabled) { + this.cookiesEnabled = cookiesEnabled; + } + + public String getCookieName() { + return this.cookieName; + } + + @XmlAttribute + public void setCookieName(String cookieName) { + this.cookieName = ConfigElement.getValue(cookieName); + } + + public String getCookieDomain() { + return this.cookieDomain; + } + + @XmlAttribute + public void setCookieDomain(String cookieDomain) { + this.cookieDomain = ConfigElement.getValue(cookieDomain); + } + + public Integer getCookieMaxAge() { + return this.cookieMaxAge; + } + + @XmlAttribute + public void setCookieMaxAge(Integer cookieMaxAge) { + this.cookieMaxAge = cookieMaxAge; + } + + public String getCookiePath() { + return this.cookiePath; + } + + @XmlAttribute + public void setCookiePath(String cookiePath) { + this.cookiePath = ConfigElement.getValue(cookiePath); + } + + public Boolean isCookieSecure() { + return this.cookieSecure; + } + + @XmlAttribute + public void setCookieSecure(Boolean cookieSecure) { + this.cookieSecure = cookieSecure; + } + + public Integer getMaxInMemorySessionCount() { + return this.maxInMemorySessionCount; + } + + @XmlAttribute + public void setMaxInMemorySessionCount(Integer maxInMemorySessionCount) { + this.maxInMemorySessionCount = maxInMemorySessionCount; + } + + public Boolean isAllowOverflow() { + return this.allowOverflow; + } + + @XmlAttribute + public void setAllowOverflow(Boolean allowOverflow) { + this.allowOverflow = allowOverflow; + } + + public Boolean isSecurityIntegrationEnabled() { + return this.securityIntegrationEnabled; + } + + @XmlAttribute + public void setSecurityIntegrationEnabled(Boolean securityIntegrationEnabled) { + this.securityIntegrationEnabled = securityIntegrationEnabled; + } + + public Integer getIdLength() { + return this.idLength; + } + + @XmlAttribute + public void setIdLength(Integer idLength) { + this.idLength = idLength; + } + + public Boolean getUseContextRootAsCookiePath() { + return useContextRootAsCookiePath; + } + + @XmlAttribute + public void setUseContextRootAsCookiePath(Boolean useContextRootAsCookiePath) { + this.useContextRootAsCookiePath = useContextRootAsCookiePath; + } + + public Boolean getAlwaysEncodeUrl() { + return alwaysEncodeUrl; + } + + @XmlAttribute + public void setAlwaysEncodeUrl(Boolean alwaysEncodeUrl) { + this.alwaysEncodeUrl = alwaysEncodeUrl; + } + + public String getCloneId() { + return cloneId; + } + + @XmlAttribute + public void setCloneId(String cloneId) { + this.cloneId = cloneId; + } + + public String getCloneSeparator() { + return cloneSeparator; + } + + @XmlAttribute + public void setCloneSeparator(String cloneSeparator) { + this.cloneSeparator = cloneSeparator; + } + + public Boolean getDebugCrossover() { + return debugCrossover; + } + + @XmlAttribute + public void setDebugCrossover(Boolean debugCrossover) { + this.debugCrossover = debugCrossover; + } + + public Integer getForceInvalidationMultiple() { + return forceInvalidationMultiple; + } + + @XmlAttribute + public void setForceInvalidationMultiple(Integer forceInvalidationMultiple) { + this.forceInvalidationMultiple = forceInvalidationMultiple; + } + + public Boolean getIdReuse() { + return idReuse; + } + + @XmlAttribute + public void setIdReuse(Boolean idReuse) { + this.idReuse = idReuse; + } + + public Boolean getNoAdditionalInfo() { + return noAdditionalInfo; + } + + @XmlAttribute + public void setNoAdditionalInfo(Boolean noAdditionalInfo) { + this.noAdditionalInfo = noAdditionalInfo; + } + + public Long getReaperPollInterval() { + return reaperPollInterval; + } + + @XmlAttribute + public void setReaperPollInterval(Long reaperPollInterval) { + this.reaperPollInterval = reaperPollInterval; + } + + public String getRewriteId() { + return rewriteId; + } + + @XmlAttribute + public void setRewriteId(String rewriteId) { + this.rewriteId = rewriteId; + } + + public Boolean getSecurityUserIgnoreCase() { + return securityUserIgnoreCase; + } + + @XmlAttribute + public void setSecurityUserIgnoreCase(Boolean securityUserIgnoreCase) { + this.securityUserIgnoreCase = securityUserIgnoreCase; + } + + public Boolean getSslTrackingEnabled() { + return sslTrackingEnabled; + } + + public Boolean getUrlRewritingEnabled() { + return urlRewritingEnabled; + } + + public Boolean getProtocolSwitchRewritingEnabled() { + return protocolSwitchRewritingEnabled; + } + + public Boolean getCookiesEnabled() { + return cookiesEnabled; + } + + public Boolean getCookieSecure() { + return cookieSecure; + } + + public Boolean getCookieHttpOnly() { + return this.cookieHttpOnly; + } + + @XmlAttribute + public void setCookieHttpOnly(Boolean cookieHttpOnly) { + this.cookieHttpOnly = cookieHttpOnly; + } + + public Boolean getAllowOverflow() { + return allowOverflow; + } + + public Boolean getSecurityIntegrationEnabled() { + return securityIntegrationEnabled; + } + + public Boolean getThrowSecurityExceptionOnGetSessionFalse() { + return throwSecurityExceptionOnGetSessionFalse; + } + + @XmlAttribute + public void setThrowSecurityExceptionOnGetSessionFalse(Boolean throwSecurityExceptionOnGetSessionFalse) { + this.throwSecurityExceptionOnGetSessionFalse = throwSecurityExceptionOnGetSessionFalse; + } + + public Boolean getAllowSerializedAccess() { + return allowSerializedAccess; + } + + @XmlAttribute + public void setAllowSerializedAccess(Boolean allowSerializedAccess) { + this.allowSerializedAccess = allowSerializedAccess; + } + + public Boolean getAccessOnTimeout() { + return accessOnTimeout; + } + + @XmlAttribute + public void setAccessOnTimeout(Boolean accessOnTimeout) { + this.accessOnTimeout = accessOnTimeout; + } + + public Integer getMaxWaitTime() { + return maxWaitTime; + } + + @XmlAttribute + public void setMaxWaitTime(Integer maxWaitTime) { + this.maxWaitTime = maxWaitTime; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("HttpSession{"); + buf.append("id=\"" + this.getId() + "\" "); + if (allowOverflow != null) + buf.append("allowOverflow=\"" + allowOverflow + "\" "); + if (cookieDomain != null) + buf.append("cookieDomain=\"" + cookieDomain + "\" "); + if (cookieMaxAge != null) + buf.append("cookieMaxAge=\"" + cookieMaxAge + "\" "); + if (cookieName != null) + buf.append("cookieName=\"" + cookieName + "\" "); + if (cookiePath != null) + buf.append("cookiePath=\"" + cookiePath + "\" "); + if (cookieSecure != null) + buf.append("cookieSecure=\"" + cookieSecure + "\" "); + if (cookiesEnabled != null) + buf.append("cookiesEnabled=\"" + cookiesEnabled + "\" "); + if (idLength != null) + buf.append("idLength=\"" + idLength + "\" "); + if (invalidationTimeout != null) + buf.append("invalidationTimeout=\"" + invalidationTimeout + "\" "); + if (maxInMemorySessionCount != null) + buf.append("maxInMemorySessionCount=\"" + maxInMemorySessionCount + "\" "); + if (protocolSwitchRewritingEnabled != null) + buf.append("protocolSwitchRewritingEnabled=\"" + protocolSwitchRewritingEnabled + "\" "); + if (securityIntegrationEnabled != null) + buf.append("securityIntegrationEnabled=\"" + securityIntegrationEnabled + "\" "); + if (sslTrackingEnabled != null) + buf.append("sslTrackingEnabled=\"" + sslTrackingEnabled + "\" "); + if (urlRewritingEnabled != null) + buf.append("urlRewritingEnabled=\"" + urlRewritingEnabled + "\" "); + if (useContextRootAsCookiePath != null) + buf.append("useContextRootAsCookiePath=\"" + useContextRootAsCookiePath + "\" "); + if (alwaysEncodeUrl != null) + buf.append("alwaysEncodeUrl=\"" + alwaysEncodeUrl + "\" "); + if (cloneId != null) + buf.append("cloneId=\"" + cloneId + "\" "); + if (cloneSeparator != null) + buf.append("cloneSeparator=\"" + cloneSeparator + "\" "); + if (debugCrossover != null) + buf.append("debugCrossover=\"" + debugCrossover + "\" "); + if (forceInvalidationMultiple != null) + buf.append("forceInvalidationMultiple=\"" + forceInvalidationMultiple + "\" "); + if (idReuse != null) + buf.append("idReuse=\"" + idReuse + "\" "); + if (noAdditionalInfo != null) + buf.append("noAdditionalInfo=\"" + noAdditionalInfo + "\" "); + if (reaperPollInterval != null) + buf.append("reaperPollInterval=\"" + reaperPollInterval + "\" "); + if (rewriteId != null) + buf.append("rewriteId=\"" + rewriteId + "\" "); + if (securityUserIgnoreCase != null) + buf.append("securityUserIgnoreCase=\"" + securityUserIgnoreCase + "\" "); + if (throwSecurityExceptionOnGetSessionFalse != null) + buf.append("throwSecurityExceptionOnGetSessionFalse=\"" + throwSecurityExceptionOnGetSessionFalse + "\" "); + if (allowSerializedAccess != null) + buf.append("allowSerializedAccess=\"" + allowSerializedAccess + "\" "); + if (accessOnTimeout != null) + buf.append("accessOnTimeout=\"" + accessOnTimeout + "\" "); + if (maxWaitTime != null) + buf.append("maxWaitTime=\"" + maxWaitTime + "\" "); + buf.append("}"); + return buf.toString(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/HttpSessionDatabase.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/HttpSessionDatabase.java new file mode 100755 index 000000000000..2cdb5311e1c8 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/HttpSessionDatabase.java @@ -0,0 +1,279 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlTransient; + +/** + * Defines configuration attributes of the HTTP Session Database + * + * @author Tim Burns + */ +public class HttpSessionDatabase extends ConfigElement { + + /** + * Enumerates all allowed values for db2RowSize attribute + */ + public static enum Db2RowSize { + _4KB("4KB"), + _8KB("8KB"), + _16KB("16KB"), + _32KB("32KB"); + private final String value; + + private Db2RowSize(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value; + } + } + + /** + * Enumerates all allowed values for writeFrequency attribute + */ + public static enum WriteFrequency { + END_OF_SERVLET_SERVICE, + MANUAL_UPDATE, + TIME_BASED_WRITE + } + + /** + * Enumerates all allowed values for writeContents attribute + */ + public static enum WriteContents { + ONLY_UPDATED_ATTRIBUTES, + ALL_SESSION_ATTRIBUTES + } + + private String dataSourceRef; + private Boolean useMultiRowSchema; + private String db2RowSize; + private String tableSpaceName; + private Boolean scheduleInvalidation; + private Integer scheduleInvalidationFirstHour; + private Integer scheduleInvalidationSecondHour; + private String writeFrequency; + private Integer writeInterval; + private String writeContents; + private Boolean noAffinitySwitchBack; + private Boolean onlyCheckInCacheDuringPreInvoke; + private Boolean optimizeCacheIdIncrements; + private String tableName; + private Boolean useInvalidatedId; + private Boolean useOracleBlob; + + public void set(Db2RowSize db2RowSize) { + this.setDb2RowSize(db2RowSize == null ? null : db2RowSize.toString()); + } + + public void set(WriteFrequency writeFrequency) { + this.setWriteFrequency(writeFrequency == null ? null : writeFrequency.toString()); + } + + public void set(WriteContents writeContents) { + this.setWriteContents(writeContents == null ? null : writeContents.toString()); + } + + @XmlTransient + public void setDataSource(DataSource dataSource) { + this.setDataSourceRef(dataSource == null ? null : dataSource.getId()); + } + + public String getDataSourceRef() { + return this.dataSourceRef; + } + + @XmlAttribute + public void setDataSourceRef(String dataSourceRef) { + this.dataSourceRef = dataSourceRef; + } + + public Boolean getUseMultiRowSchema() { + return useMultiRowSchema; + } + + @XmlAttribute + public void setUseMultiRowSchema(Boolean useMultiRowSchema) { + this.useMultiRowSchema = useMultiRowSchema; + } + + public String getDb2RowSize() { + return this.db2RowSize; + } + + @XmlAttribute + public void setDb2RowSize(String db2RowSize) { + this.db2RowSize = db2RowSize; + } + + public String getTableSpaceName() { + return this.tableSpaceName; + } + + @XmlAttribute + public void setTableSpaceName(String tableSpaceName) { + this.tableSpaceName = tableSpaceName; + } + + public Boolean getScheduleInvalidation() { + return this.scheduleInvalidation; + } + + @XmlAttribute + public void setScheduleInvalidation(Boolean scheduleInvalidation) { + this.scheduleInvalidation = scheduleInvalidation; + } + + public Integer getScheduleInvalidationFirstHour() { + return this.scheduleInvalidationFirstHour; + } + + @XmlAttribute + public void setScheduleInvalidationFirstHour(Integer scheduleInvalidationFirstHour) { + this.scheduleInvalidationFirstHour = scheduleInvalidationFirstHour; + } + + public Integer getScheduleInvalidationSecondHour() { + return this.scheduleInvalidationSecondHour; + } + + @XmlAttribute + public void setScheduleInvalidationSecondHour(Integer scheduleInvalidationSecondHour) { + this.scheduleInvalidationSecondHour = scheduleInvalidationSecondHour; + } + + public String getWriteFrequency() { + return this.writeFrequency; + } + + @XmlAttribute + public void setWriteFrequency(String writeFrequency) { + this.writeFrequency = writeFrequency; + } + + public Integer getWriteInterval() { + return this.writeInterval; + } + + @XmlAttribute + public void setWriteInterval(Integer writeInterval) { + this.writeInterval = writeInterval; + } + + public String getWriteContents() { + return this.writeContents; + } + + @XmlAttribute + public void setWriteContents(String writeContents) { + this.writeContents = writeContents; + } + + public Boolean getNoAffinitySwitchBack() { + return noAffinitySwitchBack; + } + + @XmlAttribute + public void setNoAffinitySwitchBack(Boolean noAffinitySwitchBack) { + this.noAffinitySwitchBack = noAffinitySwitchBack; + } + + public Boolean getOnlyCheckInCacheDuringPreInvoke() { + return onlyCheckInCacheDuringPreInvoke; + } + + @XmlAttribute + public void setOnlyCheckInCacheDuringPreInvoke(Boolean onlyCheckInCacheDuringPreInvoke) { + this.onlyCheckInCacheDuringPreInvoke = onlyCheckInCacheDuringPreInvoke; + } + + public Boolean getOptimizeCacheIdIncrements() { + return optimizeCacheIdIncrements; + } + + @XmlAttribute + public void setOptimizeCacheIdIncrements(Boolean optimizeCacheIdIncrements) { + this.optimizeCacheIdIncrements = optimizeCacheIdIncrements; + } + + public String getTableName() { + return tableName; + } + + @XmlAttribute + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public Boolean getUseInvalidatedId() { + return useInvalidatedId; + } + + @XmlAttribute + public void setUseInvalidatedId(Boolean useInvalidatedId) { + this.useInvalidatedId = useInvalidatedId; + } + + public Boolean getUseOracleBlob() { + return useOracleBlob; + } + + @XmlAttribute + public void setUseOracleBlob(Boolean useOracleBlob) { + this.useOracleBlob = useOracleBlob; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("HttpSessionDatabase{"); + buf.append("id=\"" + this.getId() + "\" "); + if (dataSourceRef != null) + buf.append("dataSourceRef=\"" + dataSourceRef + "\" "); + if (useMultiRowSchema != null) + buf.append("useMultiRowSchema=\"" + useMultiRowSchema + "\" "); + if (db2RowSize != null) + buf.append("db2RowSize=\"" + db2RowSize + "\" "); + if (tableSpaceName != null) + buf.append("tableSpaceName=\"" + tableSpaceName + "\" "); + if (scheduleInvalidation != null) + buf.append("scheduleInvalidation=\"" + scheduleInvalidation + "\" "); + if (scheduleInvalidationFirstHour != null) + buf.append("scheduleInvalidationFirstHour=\"" + scheduleInvalidationFirstHour + "\" "); + if (scheduleInvalidationSecondHour != null) + buf.append("scheduleInvalidationSecondHour=\"" + scheduleInvalidationSecondHour + "\" "); + if (writeFrequency != null) + buf.append("writeFrequency=\"" + writeFrequency + "\" "); + if (writeInterval != null) + buf.append("writeInterval=\"" + writeInterval + "\" "); + if (writeContents != null) + buf.append("writeContents=\"" + writeContents + "\" "); + if (noAffinitySwitchBack != null) + buf.append("noAffinitySwitchBack=\"" + noAffinitySwitchBack + "\" "); + if (onlyCheckInCacheDuringPreInvoke != null) + buf.append("onlyCheckInCacheDuringPreInvoke=\"" + onlyCheckInCacheDuringPreInvoke + "\" "); + if (optimizeCacheIdIncrements != null) + buf.append("optimizeCacheIdIncrements=\"" + optimizeCacheIdIncrements + "\" "); + if (tableName != null) + buf.append("tableName=\"" + tableName + "\" "); + if (useInvalidatedId != null) + buf.append("useInvalidatedId=\"" + useInvalidatedId + "\" "); + if (useOracleBlob != null) + buf.append("useOracleBlob=\"" + useOracleBlob + "\" "); + buf.append("}"); + return buf.toString(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/IncludeElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/IncludeElement.java new file mode 100755 index 000000000000..db1e8138739e --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/IncludeElement.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * + */ +public class IncludeElement extends ConfigElement { + private String location; + + public String getLocation() { + return location; + } + + @XmlAttribute(name = "location") + public void setLocation(String s) { + this.location = s; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("IncludeElement{"); + if (this.getId() != null) + buf.append("id=\"" + this.getId() + "\" "); + if (location != null) + buf.append("location=\"" + location + "\" "); + + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JCAGeneratedProperties.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JCAGeneratedProperties.java new file mode 100755 index 000000000000..56e26fdfa1e6 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JCAGeneratedProperties.java @@ -0,0 +1,304 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.Arrays; +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +public class JCAGeneratedProperties extends ConfigElement { + // attributes + private String clientID; + private String createDatabase; + private String databaseName; + private String date; + private String derbyRef; + private String destinationRef; + private String destinationType; + private String firstDayOfWeek; + private String lenient; + private String loginTimeout; + private String messageFilterMax; + private String messageFilterMin; + private String minimalDaysInFirstWeek; + private String month; + private String password; + private String queueName; + private String tableName; + private String timeInMillis; + private String topicName; + private String userName; + private String year; + + // nested elements + @XmlElement(name = "jmsDestination") + private ConfigElementList jmsDestinations; + + @XmlElement(name = "jmsQueue") + private ConfigElementList jmsQueues; + + @XmlElement(name = "jmsTopic") + private ConfigElementList jmsTopics; + + public String getClientID() { + return this.clientID; + } + + public String getCreateDatabase() { + return createDatabase; + } + + public String getDatabaseName() { + return databaseName; + } + + public String getDate() { + return date; + } + + public String getDerbyRef() { + return derbyRef; + } + + public String getDestinationRef() { + return this.destinationRef; + } + + public String getDestinationType() { + return this.destinationType; + } + + public ConfigElementList getJMSDestinations() { + return jmsDestinations == null ? (jmsDestinations = new ConfigElementList()) : jmsDestinations; + } + + public ConfigElementList getJMSQueues() { + return jmsQueues == null ? (jmsQueues = new ConfigElementList()) : jmsQueues; + } + + public ConfigElementList getJMSTopics() { + return jmsTopics == null ? (jmsTopics = new ConfigElementList()) : jmsTopics; + } + + public String getFirstDayOfWeek() { + return firstDayOfWeek; + } + + public String getLenient() { + return lenient; + } + + public String getLoginTimeout() { + return loginTimeout; + } + + public String getMessageFilterMax() { + return messageFilterMax; + } + + public String getMessageFilterMin() { + return messageFilterMin; + } + + public String getMinimalDaysInFirstWeek() { + return minimalDaysInFirstWeek; + } + + public String getMonth() { + return month; + } + + public String getPassword() { + return this.password; + } + + public String getQueueName() { + return this.queueName; + } + + public String getTableName() { + return this.tableName; + } + + public String getTimeInMillis() { + return this.timeInMillis; + } + + public String getTopicName() { + return this.topicName; + } + + public String getUserName() { + return this.userName; + } + + public String getYear() { + return year; + } + + @XmlAttribute(name = "clientID") + public void setClientID(String clientID) { + this.clientID = clientID; + } + + @XmlAttribute(name = "createDatabase") + public void setCreateDatabase(String createDatabase) { + this.createDatabase = createDatabase; + } + + @XmlAttribute(name = "databaseName") + public void setDatabaseName(String databaseName) { + this.databaseName = databaseName; + } + + @XmlAttribute(name = "date") + public void setDate(String date) { + this.date = date; + } + + @XmlAttribute(name = "derbyRef") + public void setDerbyRef(String derbyRef) { + this.derbyRef = derbyRef; + } + + @XmlAttribute(name = "destinationRef") + public void setDestinationRef(String destinationRef) { + this.destinationRef = destinationRef; + } + + @XmlAttribute(name = "destinationType") + public void setDestinationType(String destinationType) { + this.destinationType = destinationType; + } + + @XmlAttribute(name = "firstDayOfWeek") + public void setFirstDayOfWeek(String firstDayOfWeek) { + this.firstDayOfWeek = firstDayOfWeek; + } + + @XmlAttribute(name = "lenient") + public void setLenient(String lenient) { + this.lenient = lenient; + } + + @XmlAttribute(name = "loginTimeout") + public void setLoginTimeout(String loginTimeout) { + this.loginTimeout = loginTimeout; + } + + @XmlAttribute(name = "messageFilterMax") + public void setMessageFilterMax(String messageFilterMax) { + this.messageFilterMax = messageFilterMax; + } + + @XmlAttribute(name = "messageFilterMin") + public void setMessageFilterMin(String messageFilterMin) { + this.messageFilterMin = messageFilterMin; + } + + @XmlAttribute(name = "minimalDaysInFirstWeek") + public void setMinimalDaysInFirstWeek(String minimalDaysInFirstWeek) { + this.minimalDaysInFirstWeek = minimalDaysInFirstWeek; + } + + @XmlAttribute(name = "month") + public void setMonth(String month) { + this.month = month; + } + + @XmlAttribute(name = "password") + public void setPassword(String password) { + this.password = password; + } + + @XmlAttribute(name = "queueName") + public void setQueueName(String queueName) { + this.queueName = queueName; + } + + @XmlAttribute(name = "tableName") + public void setTableName(String tableName) { + this.tableName = tableName; + } + + @XmlAttribute(name = "timeInMillis") + public void setTimeInMillis(String timeInMillis) { + this.timeInMillis = timeInMillis; + } + + @XmlAttribute(name = "topicName") + public void setTopicName(String topicName) { + this.topicName = topicName; + } + + @XmlAttribute(name = "userName") + public void setUserName(String userName) { + this.userName = userName; + } + + @XmlAttribute(name = "year") + public void setYear(String year) { + this.year = year; + } + + @SuppressWarnings("unchecked") + @Override + public String toString() { + StringBuilder buf = new StringBuilder("Properties_FAT1{"); + if (clientID != null) + buf.append("clientID=\"" + clientID + "\" "); + if (createDatabase != null) + buf.append("createDatabase=\"" + createDatabase + "\" "); + if (databaseName != null) + buf.append("databaseName=\"" + databaseName + "\" "); + if (date != null) + buf.append("date=\"" + date + "\" "); + if (derbyRef != null) + buf.append("derbyRef=\"" + derbyRef + "\" "); + if (destinationRef != null) + buf.append("destinationRef=\"" + destinationRef + "\" "); + if (destinationType != null) + buf.append("destinationType=\"" + destinationType + "\" "); + if (firstDayOfWeek != null) + buf.append("firstDayOfWeek=\"" + firstDayOfWeek + "\" "); + if (lenient != null) + buf.append("lenient=\"" + lenient + "\" "); + if (loginTimeout != null) + buf.append("loginTimeout=\"" + loginTimeout + "\" "); + if (messageFilterMax != null) + buf.append("messageFilterMax=\"" + messageFilterMax + "\" "); + if (messageFilterMin != null) + buf.append("messageFilterMin=\"" + messageFilterMin + "\" "); + if (minimalDaysInFirstWeek != null) + buf.append("minimalDaysInFirstWeek=\"" + minimalDaysInFirstWeek + "\" "); + if (month != null) + buf.append("month=\"" + month + "\" "); + if (password != null) + buf.append("password=\"" + password + "\" "); + if (queueName != null) + buf.append("queueName=\"" + queueName + "\" "); + if (tableName != null) + buf.append("tableName=\"" + tableName + "\" "); + if (timeInMillis != null) + buf.append("timeInMillis=\"" + timeInMillis + "\" "); + if (topicName != null) + buf.append("topicName=\"" + topicName + "\" "); + if (userName != null) + buf.append("userName=\"" + userName + "\" "); + if (year != null) + buf.append("year=\"" + year + "\" "); + + List nestedElementsList = Arrays.asList( + jmsDestinations, + jmsQueues, + jmsTopics + ); + for (ConfigElementList nestedElements : (List>) nestedElementsList) + if (nestedElements != null && nestedElements.size() > 0) + for (Object o : nestedElements) + buf.append(", " + o); + + buf.append("}"); + return buf.toString(); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSActivationSpec.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSActivationSpec.java new file mode 100755 index 000000000000..db56566a2850 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSActivationSpec.java @@ -0,0 +1,56 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlElement; + +public class JMSActivationSpec extends ActivationSpec { + + @XmlElement(name = "properties.wasJms") + private ConfigElementList wasJmsProperties; + + /** + * @return the wasJmsProperties + */ + public ConfigElementList getWasJmsProperties() { + if (wasJmsProperties == null) { + wasJmsProperties = new ConfigElementList(); + } + return wasJmsProperties; + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.config.ConfigElement#clone() + */ + @Override + public Object clone() throws CloneNotSupportedException { + JMSActivationSpec clone = (JMSActivationSpec) super.clone(); + if (wasJmsProperties != null) { + for (WasJmsProperties props : wasJmsProperties) { + clone.getWasJmsProperties().add((WasJmsProperties) props.clone()); + } + } + return clone; + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.config.ActivationSpec#toString() + */ + @Override + public String toString() { + String nl = System.getProperty("line.separator"); + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + if (this.getAuthData() != null) + buf.append("authDataRef=\"" + this.getAuthData() + "\" "); + if (wasJmsProperties != null) { + for (WasJmsProperties props : wasJmsProperties) { + buf.append(props.toString()).append(nl); + } + } + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSConnectionFactory.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSConnectionFactory.java new file mode 100755 index 000000000000..7b56f9eaf5d9 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSConnectionFactory.java @@ -0,0 +1,3 @@ +package com.ibm.websphere.simplicity.config; + +public class JMSConnectionFactory extends ConnectionFactory {} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSDestination.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSDestination.java new file mode 100755 index 000000000000..24ea3e00d240 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSDestination.java @@ -0,0 +1,37 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.Arrays; +import java.util.List; + +public class JMSDestination extends AdminObject { + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.config.ConfigElement#clone() + */ + @Override + public Object clone() throws CloneNotSupportedException { + JMSDestination clone = (JMSDestination) super.clone(); + return clone; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + if (getJndiName() != null) + buf.append("jndiName=\"" + getJndiName() + "\" "); + + List nestedElementsList = Arrays.asList( + getProperties_FAT1() + ); + for (ConfigElementList nestedElements : (List>) nestedElementsList) + if (nestedElements != null && nestedElements.size() > 0) + for (Object o : nestedElements) + buf.append(", " + o); + buf.append("}"); + return buf.toString(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSQueue.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSQueue.java new file mode 100755 index 000000000000..a0b4b12e1323 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSQueue.java @@ -0,0 +1,58 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.Arrays; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; + +public class JMSQueue extends AdminObject { + + @XmlElement(name = "properties.wasJms") + private ConfigElementList wasJmsProperties; + + /** + * @return the wasJmsProperties + */ + public ConfigElementList getWasJmsProperties() { + if (wasJmsProperties == null) { + wasJmsProperties = new ConfigElementList(); + } + return wasJmsProperties; + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.config.ConfigElement#clone() + */ + @Override + public Object clone() throws CloneNotSupportedException { + JMSQueue clone = (JMSQueue) super.clone(); + if (wasJmsProperties != null) { + for (WasJmsProperties props : wasJmsProperties) { + clone.getWasJmsProperties().add((WasJmsProperties) props.clone()); + } + } + return clone; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + if (getJndiName() != null) + buf.append("jndiName=\"" + getJndiName() + "\" "); + + List nestedElementsList = Arrays.asList( + getProperties_FAT1(), + getWasJmsProperties() + ); + for (ConfigElementList nestedElements : (List>) nestedElementsList) + if (nestedElements != null && nestedElements.size() > 0) + for (Object o : nestedElements) + buf.append(", " + o); + buf.append("}"); + return buf.toString(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSQueueConnectionFactory.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSQueueConnectionFactory.java new file mode 100755 index 000000000000..6d11bda6e0e0 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSQueueConnectionFactory.java @@ -0,0 +1,4 @@ +package com.ibm.websphere.simplicity.config; + + +public class JMSQueueConnectionFactory extends ConnectionFactory {} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSTopic.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSTopic.java new file mode 100755 index 000000000000..a7c53dcb48c4 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSTopic.java @@ -0,0 +1,58 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.Arrays; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; + +public class JMSTopic extends AdminObject { + + @XmlElement(name = "properties.wasJms") + private ConfigElementList wasJmsProperties; + + /** + * @return the wasJmsProperties + */ + public ConfigElementList getWasJmsProperties() { + if (wasJmsProperties == null) { + wasJmsProperties = new ConfigElementList(); + } + return wasJmsProperties; + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.config.ConfigElement#clone() + */ + @Override + public Object clone() throws CloneNotSupportedException { + JMSTopic clone = (JMSTopic) super.clone(); + if (wasJmsProperties != null) { + for (WasJmsProperties props : wasJmsProperties) { + clone.getWasJmsProperties().add((WasJmsProperties) props.clone()); + } + } + return clone; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + if (getJndiName() != null) + buf.append("jndiName=\"" + getJndiName() + "\" "); + + List nestedElementsList = Arrays.asList( + getProperties_FAT1(), + getWasJmsProperties() + ); + for (ConfigElementList nestedElements : (List>) nestedElementsList) + if (nestedElements != null && nestedElements.size() > 0) + for (Object o : nestedElements) + buf.append(", " + o); + buf.append("}"); + return buf.toString(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSTopicConnectionFactory.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSTopicConnectionFactory.java new file mode 100755 index 000000000000..e0dc44a56ce2 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JMSTopicConnectionFactory.java @@ -0,0 +1,4 @@ +package com.ibm.websphere.simplicity.config; + + +public class JMSTopicConnectionFactory extends ConnectionFactory {} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JNDIEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JNDIEntry.java new file mode 100755 index 000000000000..7f309baab411 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JNDIEntry.java @@ -0,0 +1,68 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * An authData element for holding usernames and passwords + */ +public class JNDIEntry extends ConfigElement { + private String jndiName; + private String value; + + /** + * @return the jndiName + */ + public String getJndiName() { + return jndiName; + } + + /** + * @param jndiName the jndiName to set + */ + @XmlAttribute + public void setJndiName(String jndiName) { + this.jndiName = jndiName; + } + + /** + * @return the value + */ + public String getValue() { + return value; + } + + /** + * @param value the value to set + */ + @XmlAttribute + public void setValue(String value) { + this.value = value; + } + + /** + * Returns a string containing a list of the properties and their values stored + * for this JNDIEntry object. + * + * @return String representing the data + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("JNDIEntry{"); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + buf.append("jndiName=\"" + (jndiName == null ? "" : jndiName) + "\""); + buf.append("value=\"" + (value == null ? "" : value) + "\" "); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JNDIURLEntry.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JNDIURLEntry.java new file mode 100755 index 000000000000..3828741beeb6 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JNDIURLEntry.java @@ -0,0 +1,68 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * An authData element for holding usernames and passwords + */ +public class JNDIURLEntry extends ConfigElement { + private String jndiName; + private String value; + + /** + * @return the jndiName + */ + public String getJndiName() { + return jndiName; + } + + /** + * @param jndiName the jndiName to set + */ + @XmlAttribute + public void setJndiName(String jndiName) { + this.jndiName = jndiName; + } + + /** + * @return the value + */ + public String getValue() { + return value; + } + + /** + * @param value the value to set + */ + @XmlAttribute + public void setValue(String value) { + this.value = value; + } + + /** + * Returns a string containing a list of the properties and their values stored + * for this JNDIEntry object. + * + * @return String representing the data + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("JNDIURLEntry{"); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + buf.append("jndiName=\"" + (jndiName == null ? "" : jndiName) + "\""); + buf.append("value=\"" + (value == null ? "" : value) + "\" "); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JPA.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JPA.java new file mode 100644 index 000000000000..b58ab84b2668 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JPA.java @@ -0,0 +1,60 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +public class JPA extends ConfigElement { + private String defaultJtaDataSourceJndiName; + private String defaultNonJtaDataSourceJndiName; + private String defaultPersistenceProvider; + private String entityManagerPoolCapacity; + + public String getDefaultJtaDataSourceJndiName() { + return defaultJtaDataSourceJndiName; + } + + public String getDefaultNonJtaDataSourceJndiName() { + return defaultNonJtaDataSourceJndiName; + } + + public String getDefaultPersistenceProvider() { + return defaultPersistenceProvider; + } + + public String getEntityManagerPoolCapacity() { + return entityManagerPoolCapacity; + } + + @XmlAttribute + public void setDefaultJtaDataSourceJndiName(String value) { + defaultJtaDataSourceJndiName = value; + } + + @XmlAttribute + public void setDefaultNonJtaDataSourceJndiName(String value) { + defaultNonJtaDataSourceJndiName = value; + } + + @XmlAttribute + public void setDefaultPersistenceProvider(String value) { + defaultPersistenceProvider = value; + } + + @XmlAttribute + public void setEntityManagerPoolCapacity(String value) { + entityManagerPoolCapacity = value; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder("jpa{"); + buf.append("defaultJtaDataSourceJndiName=\"" + defaultJtaDataSourceJndiName + "\""); + if (defaultNonJtaDataSourceJndiName != null) + buf.append("defaultNonJtaDataSourceJndiName=\"" + defaultNonJtaDataSourceJndiName + "\" "); + if (defaultPersistenceProvider != null) + buf.append("defaultPersistenceProvider=\"" + defaultPersistenceProvider + "\" "); + if (entityManagerPoolCapacity != null) + buf.append("entityManagerPoolCapacity=\"" + entityManagerPoolCapacity + "\" "); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JdbcDriver.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JdbcDriver.java new file mode 100755 index 000000000000..a5b799708ae0 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JdbcDriver.java @@ -0,0 +1,208 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlTransient; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; + +/** + * Defines a JDBC driver + * + * @author Tim Burns + * + */ +public class JdbcDriver extends ConfigElement implements ModifiableConfigElement { + + private static final Class c = JdbcDriver.class; + + private String libraryRef; + private Library nestedLibrary; + private String javaxSqlConnectionPoolDataSource; + private String javaxSqlDataSource; + private String javaxSqlXADataSource; + private String fatModify; + + private String bootstrapJdbcDriverVersion; + + /** + * @return the ID of the shared library where this driver's classes are stored + */ + public String getLibraryRef() { + return this.libraryRef; + } + + /** + * @param libraryRef the ID of the shared library where this driver's classes are stored + */ + @XmlAttribute + public void setLibraryRef(String libraryRef) { + this.libraryRef = ConfigElement.getValue(libraryRef); + } + + /** + * @param library the shared library where this driver's classes are stored + */ + @XmlTransient + public void setLibrary(Library library) { + if (library != null) { + this.setLibraryRef(library.getId()); + } + } + + @XmlElement(name = "library") + public void setNestedLibrary(Library nestedLibrary) { + this.nestedLibrary = nestedLibrary; + } + + public Library getNestedLibrary() { + return this.nestedLibrary; + } + + @XmlAttribute(name = "javax.sql.ConnectionPoolDataSource") + public void setJavaxSqlConnectionPoolDataSource(String javaxSqlConnectionPoolDataSource) { + this.javaxSqlConnectionPoolDataSource = javaxSqlConnectionPoolDataSource; + } + + public String getJavaxSqlConnectionPoolDataSource() { + return this.javaxSqlConnectionPoolDataSource; + } + + @XmlAttribute(name = "javax.sql.DataSource") + public void setJavaxSqlDataSource(String javaxSqlDataSource) { + this.javaxSqlDataSource = javaxSqlDataSource; + } + + public String getJavaxSqlDataSource() { + return this.javaxSqlDataSource; + } + + @XmlAttribute(name = "javax.sql.XADataSource") + public void setJavaxSqlXADataSource(String javaxSqlXADataSource) { + this.javaxSqlXADataSource = javaxSqlXADataSource; + } + + public String getJavaxSqlXADataSource() { + return this.javaxSqlXADataSource; + } + + @XmlAttribute(name = "fat.modify") + public void setFatModify(String fatModify) { + this.fatModify = fatModify; + } + + public String getFatModify() { + return fatModify; + } + + /** + * Modifies the element if the fat.modify="true" attribute was configured for this element. + * + * @param config The ServerConfiguration instance. + */ + @Override + public void modify(ServerConfiguration config) throws Exception { + if (fatModify != null && fatModify.toLowerCase().equals("true")) { + updateJdbcDriverFromBootstrap(config); + } + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("JdbcDriver{"); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\", "); + buf.append("libraryRef=\"" + (libraryRef == null ? "" : libraryRef) + "\""); + if (javaxSqlConnectionPoolDataSource != null) + buf.append("javax.sql.ConnectionPoolDataSource=\"" + javaxSqlConnectionPoolDataSource + "\" "); + if (javaxSqlDataSource != null) + buf.append("javax.sql.DataSource=\"" + javaxSqlDataSource + "\" "); + if (javaxSqlXADataSource != null) + buf.append("javax.sql.XADataSource=\"" + javaxSqlXADataSource + "\" "); + if (nestedLibrary != null) + buf.append(", " + nestedLibrary.toString()); + buf.append("}"); + return buf.toString(); + } + + public String getBootStrapJdbcDriverVersion() throws Exception { + if (bootstrapJdbcDriverVersion == null) { + Bootstrap bs = Bootstrap.getInstance(); + if (bs.getValue(BootstrapProperty.DB_DRIVERVERSION.getPropertyName()) == null) { + bootstrapJdbcDriverVersion = BootstrapProperty.DB_DRIVERVERSION_DEFAULT.toString(); + } else { + bootstrapJdbcDriverVersion = bs.getValue(BootstrapProperty.DB_DRIVERVERSION.getPropertyName()); + } + } + return this.bootstrapJdbcDriverVersion; + } + + public void updateJdbcDriverFromBootstrap(ServerConfiguration config) throws Exception { + Log.entering(c, "updateJdbcDriverFromBootstrap"); + Bootstrap bs = Bootstrap.getInstance(); + if (bs.getValue(BootstrapProperty.DB_DRIVERNAME.getPropertyName()) == null) { + return; + } + + String liberty_db_jars = bs.getValue(BootstrapProperty.LIBERTY_DBJARS.getPropertyName()); + String database_jdbcjar = bs.getValue(BootstrapProperty.DB_JDBCJAR.getPropertyName()); + + // Update JdbcDriver nested library with bootstrapping properties + Log.info(c, "updateJdbcDriverFromBootstrap", "Updating jdbcDriver " + getId()); + + if (getNestedLibrary() != null) { + Log.info(c, "updateJdbcDriverFromBootstrap", "jdbcDriver has nested library"); + // Update nested fileset + if (getNestedLibrary().getNestedFileset() != null) { + Fileset fileset = getNestedLibrary().getNestedFileset(); + fileset.setDir(liberty_db_jars); + fileset.setIncludes(database_jdbcjar); + Log.info(c, "updateJdbcDriverFromBootstrap", "Updated nested fileset for nested library"); + } + // Update referenced fileset + if (getNestedLibrary().getFilesetRef() != null) { + Fileset fileset = config.getFilesetById(getNestedLibrary().getFilesetRef()); + fileset.setDir(liberty_db_jars); + fileset.setIncludes(database_jdbcjar); + Log.info(c, "updateJdbcDriverFromBootstrap", "Updated fileset referred to by nested library"); + } + } + if (getLibraryRef() != null) { + // Update JdbcDriver referenced library with bootstrapping properties + Log.info(c, "updateJdbcDriverFromBootstrap", "jdbcDriver has referenced library"); + Library library = config.getLibraries().getBy("id", getLibraryRef()); + if (library.getNestedFileset() != null) { + Fileset fileset = library.getNestedFileset(); + fileset.setDir(liberty_db_jars); + fileset.setIncludes(database_jdbcjar); + Log.info(c, "updateJdbcDriverFromBootstrap", "Updated nested fileset for referenced library"); + } + if (library.getFilesetRef() != null) { + Fileset fileset = config.getFilesetById(library.getFilesetRef()); + fileset.setDir(liberty_db_jars); + fileset.setIncludes(database_jdbcjar); + Log.info(c, "updateJdbcDriverFromBootstrap", "Updated fileset referred to by referenced library"); + } + + // Handle a nested file element entry. If the database_jdbcjar entry in the properties file contains + // more than one archive separated by spaces or commas (FileSet), convert the File into a FileSet. + if (library.getNestedFile() != null) { + File file = library.getNestedFile(); + String[] jars = database_jdbcjar.split("\\s*,\\s*|\\s+"); + if (jars != null && jars.length >= 1) { + library.setNestedFile(null); + Fileset fileset = new Fileset(); + fileset.setDir(liberty_db_jars); + fileset.setIncludes(database_jdbcjar); + library.setNestedFileset(fileset); + } else { + file.setName(database_jdbcjar); + } + + Log.info(c, "updateJdbcDriverFromBootstrap", "Updated nested file for referenced library"); + } + } + Log.exiting(c, "updateJdbcDriverFromBootstrap"); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JmsEndpoint.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JmsEndpoint.java new file mode 100755 index 000000000000..477b187faf65 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JmsEndpoint.java @@ -0,0 +1,90 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * + */ +public class JmsEndpoint extends ConfigElement { + + private String host; + private String wasJmsPort; + private String wasJmsSSLPort; + + /** + * @return the host + */ + public String getHost() { + return host; + } + + /** + * @param host the host to set + */ + @XmlAttribute + public void setHost(String host) { + this.host = host; + } + + /** + * @return the wasJmsPort + */ + public String getWasJmsPort() { + return wasJmsPort; + } + + /** + * @param wasJmsPort the wasJmsPort to set + */ + @XmlAttribute + public void setWasJmsPort(String wasJmsPort) { + this.wasJmsPort = wasJmsPort; + } + + /** + * @return the wasJmsSSLPort + */ + public String getWasJmsSSLPort() { + return wasJmsSSLPort; + } + + /** + * @param wasJmsSSLPort the wasJmsSSLPort to set + */ + @XmlAttribute + public void setWasJmsSSLPort(String wasJmsSSLPort) { + this.wasJmsSSLPort = wasJmsSSLPort; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("JmsEndpoint{"); + buf.append("id=\"" + this.getId() + "\" "); + if (this.host != null) + buf.append("host=\"" + this.host + "\" "); + if (this.wasJmsPort != null) + buf.append("wasJmsPort=\"" + this.wasJmsPort + "\" "); + if (this.wasJmsSSLPort != null) + buf.append("wasJmsSSLPort=\"" + this.wasJmsSSLPort + "\" "); + + buf.append("}"); + return buf.toString(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JspEngineElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JspEngineElement.java new file mode 100755 index 000000000000..cf927428970b --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JspEngineElement.java @@ -0,0 +1,132 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * + */ +public class JspEngineElement extends ConfigElement { + private Boolean useStringCast; + private Boolean usescriptvardupinit; + private String jdkSourceLevel; + private Boolean disableResourceInjection; + private Boolean disableTldSearch; + private String scratchdir; + private Boolean keepGenerated; + + /** + * @return the useStringCast + */ + public Boolean getUseStringCast() { + return useStringCast; + } + + @XmlAttribute(name = "useStringCast") + public void setUseStringCast(Boolean b) { + this.useStringCast = b; + } + + /** + * @return the usescriptvardupinit + */ + public Boolean isUsescriptvardupinit() { + return usescriptvardupinit; + } + + @XmlAttribute(name = "useScriptVarDupInit") + public void setUsescriptvardupinit(Boolean b) { + this.usescriptvardupinit = b; + } + + /** + * @return the jdkSourceLevel + */ + public String getJdkSourceLevel() { + return jdkSourceLevel; + } + + @XmlAttribute(name = "jdkSourceLevel") + public void setJdkSourceLevel(String s) { + this.jdkSourceLevel = s; + } + + /** + * @return the disableResourceInjection + */ + public Boolean isDisableResourceInjection() { + return disableResourceInjection; + } + + @XmlAttribute(name = "disableResourceInjection") + public void setDisableResourceInjection(Boolean b) { + this.disableResourceInjection = b; + } + + /** + * @return the disableTldSearch + */ + public Boolean isDisableTldSearch() { + return disableTldSearch; + } + + @XmlAttribute(name = "disableTldSearch") + public void setDisableTldSearch(Boolean b) { + this.disableTldSearch = b; + } + + @XmlAttribute(name = "scratchdir") + public void setScratchdir(String value) { + this.scratchdir = value; + + } + + public String getScratchdir() { + return scratchdir; + } + + /** + * @return the keepGenerated + */ + public Boolean isKeepGenerated() { + return keepGenerated; + } + + @XmlAttribute(name = "keepGenerated") + public void setKeepGenerated(Boolean b) { + this.keepGenerated = b; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("JspElement{"); + if (useStringCast != null) + buf.append("useStringCast=\"" + useStringCast + "\" "); + if (usescriptvardupinit != null) + buf.append("usescriptvardupinit=\"" + usescriptvardupinit + "\" "); + if (jdkSourceLevel != null) + buf.append("jdkSourceLevel=\"" + jdkSourceLevel + "\" "); + if (disableResourceInjection != null) + buf.append("disableResourceInjection=\"" + disableResourceInjection + "\" "); + if (disableTldSearch != null) + buf.append("disableTldSearch=\"" + disableTldSearch + "\" "); + if (scratchdir != null) + buf.append("scratchdir=\"" + scratchdir + "\" "); + if (keepGenerated != null) + buf.append("keepGenerated=\"" + keepGenerated + "\" "); + + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/KeyStore.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/KeyStore.java new file mode 100755 index 000000000000..cc80274925c8 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/KeyStore.java @@ -0,0 +1,84 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * KeyStore element is defined here:
    + * /com.ibm.ws.ssl/resources/OSGI-INF/metatype/metatype.xml + */ +public class KeyStore extends ConfigElement { + + private String password; + private String location; + private String type; + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + @XmlAttribute(name = "password") + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the location + */ + public String getLocation() { + return location; + } + + /** + * @param location the location to set + */ + @XmlAttribute(name = "location") + public void setLocation(String location) { + this.location = location; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + @XmlAttribute(name = "type") + public void setType(String type) { + this.type = type; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("KeyStore{"); + if (password != null) + buf.append("password=\"" + password + "\" "); + if (location != null) + buf.append("location=\"" + location + "\" "); + if (type != null) + buf.append("type=\"" + type + "\" "); + buf.append("}"); + return buf.toString(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Library.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Library.java new file mode 100755 index 000000000000..85791c0bf78c --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Library.java @@ -0,0 +1,146 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlTransient; + +/** + * A shared library (which is a set of reusable class files) + * + * @author Tim Burns + * + */ +public class Library extends ConfigElement { + + private String filesetRef; + private Fileset nestedFileset; + + private String fileRef; + private File nestedFile; + + private String folderRef; + private Folder nestedFolder; + + private String apiTypeVisibility; + + /** + * @return the ID of the fileset that this library uses + */ + public String getFilesetRef() { + return this.filesetRef; + } + + /** + * @param filesetRef the ID of the fileset that this library uses + */ + @XmlAttribute + public void setFilesetRef(String filesetRef) { + this.filesetRef = ConfigElement.getValue(filesetRef); + } + + /** + * @return the ID of the file that this library uses + */ + public String getFileRef() { + return this.fileRef; + } + + /** + * @param fileRef the ID of the file that this library uses + */ + @XmlAttribute + public void setFileRef(String fileRef) { + this.fileRef = ConfigElement.getValue(fileRef); + } + + /** + * @return the ID of the folder that this library uses + */ + public String getFolderRef() { + return this.folderRef; + } + + /** + * @param folderRef the ID of the folder that this library uses + */ + @XmlAttribute + public void setFolderRef(String folderRef) { + this.folderRef = ConfigElement.getValue(folderRef); + } + + @XmlTransient + public void setFileset(Fileset fileset) { + if (fileset != null) { + this.setFilesetRef(fileset.getId()); + } + } + + @XmlElement(name = "fileset") + public void setNestedFileset(Fileset fileset) { + this.nestedFileset = fileset; + } + + @XmlTransient + public void setFile(File file) { + if (file != null) { + this.setFileRef(file.getId()); + } + } + + @XmlElement(name = "file") + public void setNestedFile(File file) { + this.nestedFile = file; + } + + @XmlTransient + public void setFolder(Folder folder) { + if (folder != null) { + this.setFolderRef(folder.getId()); + } + } + + @XmlElement(name = "folder") + public void setNestedFolder(Folder folder) { + this.nestedFolder = folder; + } + + public Fileset getNestedFileset() { + return this.nestedFileset; + } + + public File getNestedFile() { + return this.nestedFile; + } + + public Folder getNestedFolder() { + return this.nestedFolder; + } + + @XmlAttribute(name = "apiTypeVisibility") + public void setApiTypeVisibility(String apiTypes) { + this.apiTypeVisibility = apiTypes; + } + + public String getApiTypeVisibility() { + return this.apiTypeVisibility; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("Library{"); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + buf.append("filesetRef=\"" + (filesetRef == null ? "" : filesetRef) + "\" "); + buf.append("fileRef=\"" + (fileRef == null ? "" : fileRef) + "\" "); + buf.append("folderRef=\"" + (folderRef == null ? "" : folderRef) + "\" "); + buf.append("apiTypeVisibility=\"" + (apiTypeVisibility == null ? "" : apiTypeVisibility) + "\" "); + if (nestedFileset != null) + buf.append(nestedFileset.toString()); + if (nestedFile != null) + buf.append(nestedFile.toString()); + if (nestedFolder != null) + buf.append(nestedFolder.toString()); + buf.append("}"); + + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Logging.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Logging.java new file mode 100755 index 000000000000..1f5083d6265a --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Logging.java @@ -0,0 +1,197 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * Allows you to configure logging (group=kernal, component=com.ibm.ws.logging, + * see resources/OSGI-INF/metatype/metatype.xml) + * + * @author Tim Burns + * + */ +public class Logging extends ConfigElement { + + private Integer maxFileSize; + private Integer maxFiles; + private String consoleLogLevel; + private String messageFileName; + private String traceFileName; + private String traceSpecification; + private String traceFormat; + private String logDirectory; + private boolean isoDateFormat; + + /** + * @return the configured log directory + */ + public String getLogDirectory() { + return this.logDirectory; + } + + /** + * @param logDirectory new log directory + */ + @XmlAttribute(name = "logDirectory") + public void setLogDirectory(String logDirectory) { + this.logDirectory = ConfigElement.getValue(logDirectory); + } + + /** + * @return the configured trace specification + */ + public String getTraceSpecification() { + return this.traceSpecification; + } + + /** + * @param traceSpecification the traceSpecification to set + */ + @XmlAttribute(name = "traceSpecification") + public void setTraceSpecification(String traceSpecification) { + this.traceSpecification = ConfigElement.getValue(traceSpecification); + } + + /** + * @return the traceFileName + */ + public String getTraceFileName() { + return this.traceFileName; + } + + /** + * default="trace.log" + * + * @param traceFileName the traceFileName to set + */ + @XmlAttribute(name = "traceFileName") + public void setTraceFileName(String traceFileName) { + this.traceFileName = ConfigElement.getValue(traceFileName); + } + + /** + * @return the max file size + */ + public Integer getMaxFileSize() { + return this.maxFileSize; + } + + /** + * default="20" + * + * @param maxFileSize the max file size to set + */ + @XmlAttribute(name = "maxFileSize") + public void setMaxFileSize(Integer maxFileSize) { + this.maxFileSize = maxFileSize; + } + + /** + * @return the max number of files + */ + public Integer getMaxFiles() { + return this.maxFiles; + } + + /** + * default="2" + * + * @param maxCiles the new value for maximum number of files + */ + @XmlAttribute(name = "maxFiles") + public void setMaxFiles(Integer maxFiles) { + this.maxFiles = maxFiles; + } + + /** + * @return the traceFormat + */ + public String getTraceFormat() { + return this.traceFormat; + } + + /** + * default="BASIC"; options= "BASIC", "ENHANCED", "ADVANCED" + * + * @param traceFormat the traceFormat to set + */ + @XmlAttribute(name = "traceFormat") + public void setTraceFormat(String traceFormat) { + this.traceFormat = ConfigElement.getValue(traceFormat); + } + + /** + * @return the messages file name + */ + public String getMessageFileName() { + return this.messageFileName; + } + + /** + * default="stdout" + * + * @param consoleFileName the consoleFileName to set + */ + @XmlAttribute(name = "messageFileName") + public void setMessageFileName(String messageFileName) { + this.messageFileName = ConfigElement.getValue(messageFileName); + } + + /** + * default="AUDIT"; options= "INFO", "AUDIT", "WARNING", "ERROR" + * + * @param consoleLogLevel The level filter for messages sent to system out or system err. + */ + @XmlAttribute(name = "consoleLogLevel") + public void setConsoleLogLevel(String consoleLogLevel) { + this.consoleLogLevel = ConfigElement.getValue(consoleLogLevel); + } + + /** + * @return the console log level name + */ + public String getConsoleLogLevel() { + return this.consoleLogLevel; + } + + /** + * default="false" + * + * @param isoDateFormat A boolean to determine if the date and time in the Liberty logs should be in ISO-8601 format. + */ + @XmlAttribute(name = "isoDateFormat") + public void setIsoDateFormat(boolean isoDateFormat) { + this.isoDateFormat = isoDateFormat; + } + + /** + * @return the boolean value set to use the ISO 8601 date format + */ + public boolean getIsoDateFormat() { + return this.isoDateFormat; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("Logging{"); + if (maxFileSize != null) + buf.append("maxFileSize=\"" + maxFileSize + "\" "); + if (maxFiles != null) + buf.append("maxFiles=\"" + maxFiles + "\" "); + if (consoleLogLevel != null) + buf.append("consoleLogLevel=\"" + consoleLogLevel + "\" "); + if (messageFileName != null) + buf.append("consoleFileName=\"" + messageFileName + "\" "); + if (traceFileName != null) + buf.append("traceFileName=\"" + traceFileName + "\" "); + if (traceFormat != null) + buf.append("traceFormat=\"" + traceFormat + "\" "); + if (traceSpecification != null) + buf.append("traceSpecification=\"" + traceSpecification + "\""); + if (logDirectory != null) + buf.append("logDirectory=\"" + logDirectory + "\""); + + buf.append("isoDateFormat=\"" + isoDateFormat + "\""); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ManagedExecutorService.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ManagedExecutorService.java new file mode 100755 index 000000000000..dddb92c3f574 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ManagedExecutorService.java @@ -0,0 +1,65 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * Represents the element in server.xml + */ +public class ManagedExecutorService extends ConfigElement { + + private String contextServiceRef; + private String jndiName; + + @XmlElement(name = "contextService") + private ConfigElementList contextServices; + + public String getContextServiceRef() { + return contextServiceRef; + } + + public String getJndiName() { + return jndiName; + } + + // only one nested is valid, but we must allow for testing invalid config, too + public ConfigElementList getContextServices() { + return contextServices == null ? (contextServices = new ConfigElementList()) : contextServices; + } + + @XmlAttribute + public void setContextServiceRef(String contextServiceRef) { + this.contextServiceRef = contextServiceRef; + } + + @XmlAttribute + public void setJndiName(String jndiName) { + this.jndiName = jndiName; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + if (contextServiceRef != null) + buf.append("contextServiceRef=").append(contextServiceRef).append(' '); + if (jndiName != null) + buf.append("jndiName=").append(jndiName).append(' '); + if (contextServices != null) + buf.append(contextServices).append(' '); + buf.append('}'); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ManagedScheduledExecutorService.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ManagedScheduledExecutorService.java new file mode 100755 index 000000000000..4e301bb1725f --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ManagedScheduledExecutorService.java @@ -0,0 +1,19 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +/** + * Represents the element in server.xml + */ +public class ManagedScheduledExecutorService extends ManagedExecutorService { + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ManagedThreadFactory.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ManagedThreadFactory.java new file mode 100755 index 000000000000..b4a36e87e387 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ManagedThreadFactory.java @@ -0,0 +1,101 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * Represents the element in server.xml + */ +public class ManagedThreadFactory extends ConfigElement { + + private String contextServiceRef; + private String createDaemonThreads; + private String defaultPriority; + private String jndiName; + private String maxPriority; + + @XmlElement(name = "contextService") + private ConfigElementList contextServices; + + public String getContextServiceRef() { + return contextServiceRef; + } + + public String getCreateDaemonThreads() { + return createDaemonThreads; + } + + public String getDefaultPriority() { + return defaultPriority; + } + + public String getJndiName() { + return jndiName; + } + + public String getMaxPriority() { + return maxPriority; + } + + // only one nested is valid, but we must allow for testing invalid config, too + public ConfigElementList getContextServices() { + return contextServices == null ? (contextServices = new ConfigElementList()) : contextServices; + } + + @XmlAttribute + public void setContextServiceRef(String contextServiceRef) { + this.contextServiceRef = contextServiceRef; + } + + @XmlAttribute + public void setCreateDaemonThreads(String createDaemonThreads) { + this.createDaemonThreads = createDaemonThreads; + } + + @XmlAttribute + public void setDefaultPriority(String defaultPriority) { + this.defaultPriority = defaultPriority; + } + + @XmlAttribute + public void setJndiName(String jndiName) { + this.jndiName = jndiName; + } + + @XmlAttribute + public void setMaxPriority(String maxPriority) { + this.maxPriority = maxPriority; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + if (contextServiceRef != null) + buf.append("contextServiceRef=").append(contextServiceRef).append(' '); + if (createDaemonThreads != null) + buf.append("createDaemonThreads=").append(createDaemonThreads).append(' '); + if (defaultPriority != null) + buf.append("defaultPriority=").append(defaultPriority).append(' '); + if (jndiName != null) + buf.append("jndiName=").append(jndiName).append(' '); + if (maxPriority != null) + buf.append("maxPriority=").append(maxPriority).append(' '); + if (contextServices != null) + buf.append(contextServices).append(' '); + buf.append('}'); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/MessagingEngine.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/MessagingEngine.java new file mode 100755 index 000000000000..37f63204644f --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/MessagingEngine.java @@ -0,0 +1,92 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlElement; + +/** + * + */ +public class MessagingEngine extends ConfigElement { + + @XmlElement(name = "queue") + private ConfigElementList queues; + + @XmlElement(name = "topicSpace") + private ConfigElementList topicSpace; + + /** + * @return the queues + */ + public ConfigElementList getQueues() { + if (this.queues == null) { + this.queues = new ConfigElementList(); + } + return this.queues; + } + + /** + * @return the topicSpace + */ + public ConfigElementList getTopicSpace() { + if (this.topicSpace == null) { + this.topicSpace = new ConfigElementList(); + } + return this.topicSpace; + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.config.ConfigElement#toString() + */ + @Override + public String toString() { + String nl = System.getProperty("line.separator"); + Class clazz = this.getClass(); + StringBuilder buf = new StringBuilder(clazz.getSimpleName()) + .append('{'); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + + if (this.queues != null) + for (Queue queue : this.queues) + buf.append(queue.toString()).append(nl); + if (this.topicSpace != null) + for (ConfigElement topic : this.topicSpace) + buf.append(topic.toString()).append(nl); + buf.append("}"); + return buf.toString(); + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.config.ConfigElement#clone() + */ + @Override + public Object clone() throws CloneNotSupportedException { + MessagingEngine clone = (MessagingEngine) super.clone(); + + if (this.queues != null) { + clone.queues = new ConfigElementList(); + for (Queue queue : this.queues) + clone.queues.add((Queue) queue.clone()); + } + if (this.topicSpace != null) { + clone.topicSpace = new ConfigElementList(); + for (ConfigElement topic : this.topicSpace) + clone.topicSpace.add((ConfigElement) topic.clone()); + } + return clone; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ModifiableConfigElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ModifiableConfigElement.java new file mode 100755 index 000000000000..a8b551f499d6 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ModifiableConfigElement.java @@ -0,0 +1,23 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +/** + * Represents a config element that allows modification. + */ +public interface ModifiableConfigElement { + + /** + * Modifies the element. + */ + public void modify(ServerConfiguration config) throws Exception; +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/MongoDBElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/MongoDBElement.java new file mode 100755 index 000000000000..3b8067add200 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/MongoDBElement.java @@ -0,0 +1,90 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * MongoDB config element + */ +public class MongoDBElement extends ConfigElement { + private String databaseName, jndiName, mongoRef; + + private MongoElement nestedMongo; + + /** + * @return the databaseName + */ + public String getDatabaseName() { + return databaseName; + } + + /** + * @param databaseName the databaseName to set + */ + @XmlAttribute + public void setDatabaseName(String d) { + databaseName = d; + } + + /** + * @return the jndiName + */ + + public String getJndiName() { + return jndiName; + } + + /** + * @param jndiName the jndiName to set + */ + @XmlAttribute + public void setJndiName(String j) { + jndiName = j; + } + + /** + * @return the mongoRef + */ + public String getMongoRef() { + return mongoRef; + } + + /** + * @param mongoRef the mongoRef to set + */ + @XmlAttribute + public void setMongoRef(String m) { + mongoRef = m; + } + + public MongoElement getMongo() { + return nestedMongo; + } + + @XmlElement + public void setMongo(MongoElement mongo) { + nestedMongo = mongo; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "MongoDBElement [databaseName=" + databaseName + ", jndiName=" + jndiName + ", mongoRef=" + mongoRef + ", nestedMongo=" + nestedMongo + "]"; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/MongoElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/MongoElement.java new file mode 100755 index 000000000000..beab01cb6557 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/MongoElement.java @@ -0,0 +1,437 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.adapters.XmlAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +// +// +// +// +// +// +// +// +// +// +// +//// +// +// +// +// +// +// +// +// +public class MongoElement extends ConfigElement { + private String hostNames, libraryRef, password, user, description, readPreference, writeConcern, sslRef; + private Boolean alwaysUserMBeans, autoConnectRetry, cursorFinalizerEnabled, socketKeepAlive, sslEnabled; + private Integer connectionsPerHost, threadsAllowedToBlockForConnectionMultiplier, connectTimeout, maxWaitTime, socketTimeout; + private Long maxAutoConnectRetryTime; + + /* + * PortsAdapter is required for JAXB to unmarshal a comma-separated list of ports into an + * integer array. + */ + private static class PortsAdapter extends XmlAdapter { + @Override + public Integer[] unmarshal(String v) throws Exception { + if (v == null) + return null; + + String[] portStrings = v.split(","); + Integer[] ports = new Integer[portStrings.length]; + + for (int i = 0; i < portStrings.length; ++i) { + ports[i] = Integer.parseInt(portStrings[i]); + } + + return ports; + } + + @Override + public String marshal(Integer[] v) throws Exception { + if (v == null) { + return null; + } + + StringBuilder sb = new StringBuilder(); + + for (int i = 0; i < v.length - 1; ++i) { + sb.append(v[i]); + sb.append(","); + } + + // Append the last element without the ',' + sb.append(v[v.length - 1]); + + return sb.toString(); + } + } + + @XmlAttribute + @XmlJavaTypeAdapter(MongoElement.PortsAdapter.class) + private Integer[] ports; + + @XmlElement(name = "hostNames") + private List hostNamesElements; + + @XmlElement(name = "ports") + private List portsElements; + + /** + * @return the hostNames + */ + public String getHostNames() { + return hostNames; + } + + /** + * @param hostNames the hostNames to set + */ + @XmlAttribute + public void setHostNames(String hostNames) { + this.hostNames = hostNames; + } + + /** + * @return the libraryRef + */ + public String getLibraryRef() { + return libraryRef; + } + + /** + * @param libraryRef the libraryRef to set + */ + @XmlAttribute + public void setLibraryRef(String libraryRef) { + this.libraryRef = libraryRef; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + @XmlAttribute + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the user + */ + public String getUser() { + return user; + } + + /** + * @param user the user to set + */ + @XmlAttribute + public void setUser(String user) { + this.user = user; + } + + /** + * @return the connectTimeout + */ + public Integer getConnectTimeout() { + return connectTimeout; + } + + /** + * @param connectTimeout the connectTimeout to set + */ + @XmlAttribute + public void setConnectTimeout(Integer connectTimeout) { + this.connectTimeout = connectTimeout; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + @XmlAttribute + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the maxAutoConnectRetryTime + */ + public Long getMaxAutoConnectRetryTime() { + return maxAutoConnectRetryTime; + } + + /** + * @param maxAutoConnectRetryTime the maxAutoConnectRetryTime to set + */ + @XmlAttribute + public void setMaxAutoConnectRetryTime(Long maxAutoConnectRetryTime) { + this.maxAutoConnectRetryTime = maxAutoConnectRetryTime; + } + + /** + * @return the maxWaitTime + */ + public Integer getMaxWaitTime() { + return maxWaitTime; + } + + /** + * @param maxWaitTime the maxWaitTime to set + */ + @XmlAttribute + public void setMaxWaitTime(Integer maxWaitTime) { + this.maxWaitTime = maxWaitTime; + } + + /** + * @return the readPreference + */ + public String getReadPreference() { + return readPreference; + } + + /** + * @param readPreference the readPreference to set + */ + @XmlAttribute + public void setReadPreference(String readPreference) { + this.readPreference = readPreference; + } + + /** + * @return the socketTimeout + */ + public Integer getSocketTimeout() { + return socketTimeout; + } + + /** + * @param socketTimeout the socketTimeout to set + */ + @XmlAttribute + public void setSocketTimeout(Integer socketTimeout) { + this.socketTimeout = socketTimeout; + } + + /** + * @return the writeConcern + */ + public String getWriteConcern() { + return writeConcern; + } + + /** + * @param wtimeout the writeConcern to set + */ + @XmlAttribute + public void setWriteConcern(String writeConcern) { + this.writeConcern = writeConcern; + } + + /** + * @return the alwaysUserMBeans + */ + public Boolean getAlwaysUserMBeans() { + return alwaysUserMBeans; + } + + /** + * @param alwaysUserMBeans the alwaysUserMBeans to set + */ + @XmlAttribute + public void setAlwaysUserMBeans(Boolean alwaysUserMBeans) { + this.alwaysUserMBeans = alwaysUserMBeans; + } + + /** + * @return the autoConnectRetry + */ + public Boolean getAutoConnectRetry() { + return autoConnectRetry; + } + + /** + * @param autoConnectRetry the autoConnectRetry to set + */ + @XmlAttribute + public void setAutoConnectRetry(Boolean autoConnectRetry) { + this.autoConnectRetry = autoConnectRetry; + } + + /** + * @return the cursorFinalizerEnabled + */ + public Boolean getCursorFinalizerEnabled() { + return cursorFinalizerEnabled; + } + + /** + * @param cursorFinalizerEnabled the cursorFinalizerEnabled to set + */ + @XmlAttribute + public void setCursorFinalizerEnabled(Boolean cursorFinalizerEnabled) { + this.cursorFinalizerEnabled = cursorFinalizerEnabled; + } + + /** + * @return the socketKeepAlive + */ + public Boolean getSocketKeepAlive() { + return socketKeepAlive; + } + + /** + * @param socketKeepAlive the socketKeepAlive to set + */ + @XmlAttribute + public void setSocketKeepAlive(Boolean socketKeepAlive) { + this.socketKeepAlive = socketKeepAlive; + } + + /** + * @return the connectionsPerHost + */ + public Integer getConnectionsPerHost() { + return connectionsPerHost; + } + + /** + * @param connectionsPerHost the connectionsPerHost to set + */ + @XmlAttribute + public void setConnectionsPerHost(Integer connectionsPerHost) { + this.connectionsPerHost = connectionsPerHost; + } + + /** + * @return the threadsAllowedToBlockForConnectionMultiplier + */ + public Integer getThreadsAllowedToBlockForConnectionMultiplier() { + return threadsAllowedToBlockForConnectionMultiplier; + } + + /** + * @param threadsAllowedToBlockForConnectionMultiplier the threadsAllowedToBlockForConnectionMultiplier to set + */ + @XmlAttribute + public void setThreadsAllowedToBlockForConnectionMultiplier(Integer threadsAllowedToBlockForConnectionMultiplier) { + this.threadsAllowedToBlockForConnectionMultiplier = threadsAllowedToBlockForConnectionMultiplier; + } + + /** + * @return the sslEnabled + */ + public Boolean getSslEnabled() { + return sslEnabled; + } + + /** + * @param sslEnabled the sslEnabled to set + */ + @XmlAttribute + public void setSslEnabled(Boolean sslEnabled) { + this.sslEnabled = sslEnabled; + } + + /** + * @return the sslRef + */ + public String getSslRef() { + return sslRef; + } + + /** + * @param sslRef the sslRef to set + */ + @XmlAttribute + public void setSslRef(String sslRef) { + this.sslRef = sslRef; + } + + /** + * @param ports the ports to set + */ + public void setPorts(Integer[] ports) { + this.ports = ports; + } + + /** + * Get the list of values from <hostNames> sub-elements + * + * @return the hostnames + */ + public List getHostNamesElements() { + if (hostNamesElements == null) { + hostNamesElements = new ArrayList(); + } + return hostNamesElements; + } + + /** + * Get the list of values from <ports> sub-elements + * + * @return the ports + */ + public List getPortsElements() { + if (portsElements == null) { + portsElements = new ArrayList(); + } + return portsElements; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "MongoElement [hostNames=" + hostNames + ", libraryRef=" + libraryRef + ", password=" + password + ", user=" + user + ", description=" + description + + ", readPreference=" + readPreference + ", writeConcern=" + writeConcern + ", alwaysUserMBeans=" + alwaysUserMBeans + ", autoConnectRetry=" + autoConnectRetry + + ", cursorFinalizerEnabled=" + cursorFinalizerEnabled + ", socketKeepAlive=" + socketKeepAlive + ", connectionsPerHost=" + connectionsPerHost + + ", threadsAllowedToBlockForConnectionMultiplier=" + threadsAllowedToBlockForConnectionMultiplier + ", connectTimeout=" + connectTimeout + ", maxWaitTime=" + + maxWaitTime + ", socketTimeout=" + socketTimeout + ", maxAutoConnectRetryTime=" + maxAutoConnectRetryTime + ", sslEnabled=" + sslEnabled + ", sslRef=" + sslRef + + ", ports=" + Arrays.toString(ports) + "]"; + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/OsgiLibraryElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/OsgiLibraryElement.java new file mode 100755 index 000000000000..d4a19f4f6cef --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/OsgiLibraryElement.java @@ -0,0 +1,61 @@ +package com.ibm.websphere.simplicity.config; + +import java.util.Set; +import java.util.TreeSet; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * Represents an shared library for OSGi applications + * + */ +public class OsgiLibraryElement extends ConfigElement { + + @XmlAttribute(name = "libraryRef") + private Set libraryRefs; + + @XmlElement(name = "package") + private Set packages; + + public Set getLibraryRefs() { + if (this.libraryRefs == null) { + this.libraryRefs = new TreeSet(); + } + return this.libraryRefs; + } + + public Set getPackages() { + if (this.packages == null) { + this.packages = new TreeSet(); + } + return this.packages; + } + + @Override + public OsgiLibraryElement clone() throws CloneNotSupportedException { + OsgiLibraryElement clone = (OsgiLibraryElement) super.clone(); + + if (this.libraryRefs != null) { + clone.libraryRefs = new TreeSet(); + for (String ref : this.libraryRefs) + clone.libraryRefs.add(ref); + } + + return clone; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("OsgiLibraryElement{"); + if (libraryRefs != null) + for (String ref : this.libraryRefs) + buf.append("libraryRefs=\"" + ref + "\" "); + if (packages != null) + for (String pkg : this.packages) + buf.append("package=\"" + pkg + "\" "); + buf.append("}"); + + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/PersistentExecutor.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/PersistentExecutor.java new file mode 100755 index 000000000000..8d8b354aeac4 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/PersistentExecutor.java @@ -0,0 +1,260 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * Concurrent persistent PersistentExecutor element representation. + */ +public class PersistentExecutor extends ConfigElement { + + /** Config reference to the contextServiceRef attribute. */ + private String contextServiceRef; + + @XmlElement(name = "contextService") + private ConfigElementList contextServices; + + /** Config reference to the taskStoreRef attribute. */ + private String taskStoreRef; + + /** Enable task execution attribute. */ + private String enableTaskExecution; + + /** Task execution retry limit attribute. */ + private String retryLimit; + + /** Task execution retry interval attribute. */ + private String retryInterval; + + private String initialControllerDelay; + + /** Initial server polling delay attribute. */ + private String initialPollDelay; + + /** JNDI Name attribute. */ + private String jndiName; + + /** Server polling interval attribute. */ + private String pollInterval; + + private String pollSize; + + /** + * Sets the contextServiceRef attribute. + * + * @param contextServiceRef The contextServiceRef attribute to be set. + */ + @XmlAttribute + public void setContextServiceRef(String contextServiceRef) { + this.contextServiceRef = contextServiceRef; + } + + /** + * Returns the contextServiceRef attribute value. + * + * @return The contextServiceRef attribute value. + */ + public String getContextServiceRef() { + return contextServiceRef; + } + + public ConfigElementList getContextServices() { + return contextServices == null ? (contextServices = new ConfigElementList()) : contextServices; + } + + /** + * Sets the taskStoreRef attribute. + * + * @param taskStoreRef attribute to be set. + */ + @XmlAttribute + public void setTaskStoreRef(String taskStoreRef) { + this.taskStoreRef = taskStoreRef; + } + + /** + * Returns the taskStoreRef attribute value. + * + * @return The taskStoreRef attribute value. + */ + public String getTaskStoreRef() { + return taskStoreRef; + } + + /** + * Sets the enableTaskExecution attribute value. + * + * @param schema The enableTaskExecution attribute value. + */ + @XmlAttribute + public void setEnableTaskExecution(String enableTaskExecution) { + this.enableTaskExecution = enableTaskExecution; + } + + /** + * Returns the enableTaskExecution attribute value. + * + * @return The enableTaskExecution attribute value. + */ + public String getEnableTaskExecution() { + return enableTaskExecution; + } + + /** + * Sets the retryLimit attribute value. + * + * @param schema The retryLimit attribute value. + */ + @XmlAttribute + public void setRetryLimit(String retryLimit) { + this.retryLimit = retryLimit; + } + + /** + * Returns the retryLimit attribute value. + * + * @return The retryLimit attribute value. + */ + public String getRetryLimit() { + return retryLimit; + } + + /** + * Sets the retryInterval attribute value. + * + * @param retryInterval The retryInterval attribute value. + */ + @XmlAttribute + public void setRetryInterval(String retryInterval) { + this.retryInterval = retryInterval; + } + + /** + * Returns the retryInterval attribute value + * + * @return The retryInterval attribute value + */ + public String getRetryInterval() { + return retryInterval; + } + + @XmlAttribute + public void setInitialControllerDelay(String initialControllerDelay) { + this.initialControllerDelay = initialControllerDelay; + } + + public String getInitialControllerDelay() { + return initialControllerDelay; + } + + /** + * Sets the initialPollDelay attribute value. + * + * @param schema The initialPollDelay attribute value. + */ + @XmlAttribute + public void setInitialPollDelay(String initialPollDelay) { + this.initialPollDelay = initialPollDelay; + } + + /** + * Returns the initialPollDelay attribute value. + * + * @return The initialPollDelay attribute value. + */ + public String getInitialPollDelay() { + return initialPollDelay; + } + + /** + * Sets the jndiName attribute value. + * + * @param schema The jndiName attribute value. + */ + @XmlAttribute + public void setJndiName(String jndiName) { + this.jndiName = jndiName; + } + + /** + * Returns the jndiName attribute value. + * + * @return The jndiName attribute value. + */ + public String getJndiName() { + return jndiName; + } + + /** + * Sets the pollInterval attribute value. + * + * @param schema The pollInterval attribute value. + */ + @XmlAttribute + public void setPollInterval(String pollInterval) { + this.pollInterval = pollInterval; + } + + /** + * Returns the pollInterval attribute value. + * + * @return The pollInterval attribute value. + */ + public String getPollInterval() { + return pollInterval; + } + + @XmlAttribute + public void setPollSize(String pollSize) { + this.pollSize = pollSize; + } + + public String getPollSize() { + return pollSize; + } + + /** + * Returns a String representation of this object. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("PersistentExecutor {"); + if (super.getId() != null) + buf.append("id=\"" + super.getId() + "\", "); + if (enableTaskExecution != null) + buf.append("enableTaskExecution=\"" + enableTaskExecution + "\", "); + if (retryLimit != null) + buf.append("retryLimit=\"" + retryLimit + "\", "); + if (retryInterval != null) + buf.append("retryInterval=\"" + retryInterval + "\", "); + if (initialControllerDelay != null) + buf.append("initialControllerDelay=\"" + initialControllerDelay + "\", "); + if (initialPollDelay != null) + buf.append("initialPollDelay=\"" + initialPollDelay + "\", "); + if (jndiName != null) + buf.append("jndiName=\"" + jndiName + "\", "); + if (pollInterval != null) + buf.append("pollInterval=\"" + pollInterval + "\", "); + if (pollSize != null) + buf.append("pollSize=\"" + pollSize + "\", "); + if (contextServiceRef != null) + buf.append("contextServiceRef=\"" + contextServiceRef + "\", "); + if (taskStoreRef != null) + buf.append("taskStoreRef=\"" + taskStoreRef + "\", "); + if (contextServices != null) + buf.append(contextServices).append(' '); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ProductInsightsElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ProductInsightsElement.java new file mode 100644 index 000000000000..c5df5adfe064 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ProductInsightsElement.java @@ -0,0 +1,86 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * + */ +public class ProductInsightsElement extends ConfigElement { + private String url; + private String apiKey; + private String proxyUrl; + private String proxyUser; + private String proxyPassword; + private String sslRef; + + public String getUrl() { + return url; + } + + @XmlAttribute(name = "url") + public void setUrl(String url) { + this.url = url; + } + + public String getApiKey() { + return apiKey; + } + + @XmlAttribute(name = "apiKey") + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getProxyUrl() { + return proxyUrl; + } + + @XmlAttribute(name = "proxyUrl") + public void setProxyUrl(String proxyUrl) { + this.proxyUrl = proxyUrl; + } + + public String getProxyUser() { + return proxyUser; + } + + @XmlAttribute(name = "proxyUser") + public void setProxyUser(String proxyUser) { + this.proxyUser = proxyUser; + } + + public String getProxyPassword() { + return proxyPassword; + } + + @XmlAttribute(name = "proxyPassword") + public void setProxyPassword(String proxyPassword) { + this.proxyPassword = proxyPassword; + } + + public String getSslRef() { + return sslRef; + } + + @XmlAttribute(name = "sslRef") + public void setSslRef(String sslRef) { + this.sslRef = sslRef; + } + + @Override + public String toString() { + return "ProductInsightsElement [url=" + url + ", apiKey=" + apiKey + ", proxyUrl=" + proxyUrl + ", proxyUser=" + proxyUser + + ", proxyPassword=" + proxyPassword + ", ssl=" + sslRef + "]"; + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Queue.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Queue.java new file mode 100755 index 000000000000..8dcc6b27d367 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Queue.java @@ -0,0 +1,195 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import java.lang.reflect.Field; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * + */ +// final as the toString impl will only work for this class +public final class Queue extends ConfigElement { + + private String forceReliability; + private String exceptionDestination; + private String redeliveryInterval; + private String maxRedeliveryCount; + private String sendAllowed; + private String receiveAllowed; + private String receiveExclusive; + private String maintainStrictOrder; + private String maxQueueDepth; + + /** + * @return the forceReliability + */ + public String getForceReliability() { + return forceReliability; + } + + /** + * @return the exceptionDestination + */ + public String getExceptionDestination() { + return exceptionDestination; + } + + /** + * @return the redeliveryInterval + */ + public String getRedeliveryInterval() { + return redeliveryInterval; + } + + /** + * @return the maxRedeliveryCount + */ + public String getMaxRedeliveryCount() { + return maxRedeliveryCount; + } + + /** + * @return the sendAllowed + */ + public String getSendAllowed() { + return sendAllowed; + } + + /** + * @return the receiveAllowed + */ + public String getReceiveAllowed() { + return receiveAllowed; + } + + /** + * @return the receiveExclusive + */ + public String getReceiveExclusive() { + return receiveExclusive; + } + + /** + * @return the maintainStrictOrder + */ + public String getMaintainStrictOrder() { + return maintainStrictOrder; + } + + /** + * @return the maxQueueDepth + */ + public String getMaxQueueDepth() { + return maxQueueDepth; + } + + /** + * @param forceReliability the forceReliability to set + */ + @XmlAttribute + public void setForceReliability(String forceReliability) { + this.forceReliability = forceReliability; + } + + /** + * @param exceptionDestination the exceptionDestination to set + */ + @XmlAttribute + public void setExceptionDestination(String exceptionDestination) { + this.exceptionDestination = exceptionDestination; + } + + /** + * @param redeliveryInterval the redeliveryInterval to set + */ + @XmlAttribute + public void setRedeliveryInterval(String redeliveryInterval) { + this.redeliveryInterval = redeliveryInterval; + } + + /** + * @param maxRedeliveryCount the maxRedeliveryCount to set + */ + @XmlAttribute + public void setMaxRedeliveryCount(String maxRedeliveryCount) { + this.maxRedeliveryCount = maxRedeliveryCount; + } + + /** + * @param sendAllowed the sendAllowed to set + */ + @XmlAttribute + public void setSendAllowed(String sendAllowed) { + this.sendAllowed = sendAllowed; + } + + /** + * @param receiveAllowed the receiveAllowed to set + */ + @XmlAttribute + public void setReceiveAllowed(String receiveAllowed) { + this.receiveAllowed = receiveAllowed; + } + + /** + * @param receiveExclusive the receiveExclusive to set + */ + @XmlAttribute + public void setReceiveExclusive(String receiveExclusive) { + this.receiveExclusive = receiveExclusive; + } + + /** + * @param maintainStrictOrder the maintainStrictOrder to set + */ + @XmlAttribute + public void setMaintainStrictOrder(String maintainStrictOrder) { + this.maintainStrictOrder = maintainStrictOrder; + } + + /** + * @param maxQueueDepth the maxQueueDepth to set + */ + @XmlAttribute + public void setMaxQueueDepth(String maxQueueDepth) { + this.maxQueueDepth = maxQueueDepth; + } + + @Override + public String toString() { + Class clazz = this.getClass(); + StringBuilder buf = new StringBuilder(clazz.getSimpleName()) + .append('{'); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + + // Life is too short to type in all those fields! + Field[] fields = clazz.getDeclaredFields(); + for (int i = 0; i < fields.length; i++) { + Field field = fields[i]; + Object value; + try { + value = field.get(this); + if (value != null) + buf.append(field.getName() + "=\"" + value + "\" "); + } catch (IllegalArgumentException e) { + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + buf.append("}"); + return buf.toString(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/RemoteFileAccess.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/RemoteFileAccess.java new file mode 100755 index 000000000000..d46cb33b9315 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/RemoteFileAccess.java @@ -0,0 +1,87 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import java.util.Set; +import java.util.TreeSet; + +import javax.xml.bind.annotation.XmlElement; + +/** + * ConfigElement representing the remoteFileAccess element + * See https://developer.ibm.com/wasdev/docs/using-file-service-and-file-transfer-mbeans-with-liberty/ + */ +public class RemoteFileAccess extends ConfigElement { + + public static final String WLP_INSTALL_DIR_VAR = "${wlp.install.dir}"; + public static final String WLP_USER_DIR_VAR = "${wlp.user.dir}"; + public static final String SERVER_CONFIG_DIR_VAR = "${server.config.dir}"; + public static final String SERVER_OUTPUT_DIR_VAR = "${server.output.dir}"; + + @XmlElement(name = "writeDir") + private Set writeDirs; + + @XmlElement(name = "readDir") + private Set readDirs; + + public Set getWriteDirs() { + if (this.writeDirs == null) { + this.writeDirs = new TreeSet(); + } + return this.writeDirs; + } + + public Set getReadDirs() { + if (this.readDirs == null) { + this.readDirs = new TreeSet(); + } + return this.readDirs; + } + + @Override + public RemoteFileAccess clone() throws CloneNotSupportedException { + RemoteFileAccess clone = (RemoteFileAccess) super.clone(); + + if (this.writeDirs != null) { + clone.writeDirs = new TreeSet(); + for (String writeDir : this.writeDirs) + clone.writeDirs.add(writeDir); + } + + if (this.readDirs != null) { + clone.readDirs = new TreeSet(); + for (String readDir : this.readDirs) + clone.readDirs.add(readDir); + } + + return clone; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("RemoteFileAccess{"); + if (this.writeDirs != null) { + for (String writeDir : writeDirs) { + buf.append("writeDir=\"" + writeDir + "\" "); + } + } + + if (this.readDirs != null) { + for (String readDir : readDirs) { + buf.append("readDir=\"" + readDir + "\" "); + } + } + buf.append("}"); + + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ResourceAdapter.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ResourceAdapter.java new file mode 100755 index 000000000000..1c52e5c77456 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ResourceAdapter.java @@ -0,0 +1,151 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import java.util.Arrays; +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * Represents both of the elements in server.xml + * + * One is for standalone resource adapters, configured at top level, for example, + * + * _ + * + * + * The other is for embedded resource adapters, nested under application, for example, + * + * ___ + * _ + * + */ +public class ResourceAdapter extends ConfigElement { + // attributes + private String alias; // for RARs embedded in apps only + private String autoStart; + private String contextServiceRef; + private String location; // for standalone RARs only + + // nested elements + @XmlElement(name = "classloader") + private ConfigElementList classloaders; // for standalone RARs only + + @XmlElement(name = "contextService") + private ConfigElementList contextServices; + + @XmlElement(name = "customize") + private ConfigElementList customizations; + + @XmlElement(name = "properties.CalendarApp.CalendarRA") + private ConfigElementList properties_CalendarApp_CalendarRA; + + @XmlElement(name = "properties.CalendarRA") + private ConfigElementList properties_CalendarRA; + + @XmlElement(name = "properties.FAT1") + private ConfigElementList properties_FAT1s; + + public String getAlias() { + return alias; + } + + public String getAutoStart() { + return autoStart; + } + + public ConfigElementList getClassloaders() { + return classloaders == null ? (classloaders = new ConfigElementList()) : classloaders; + } + + public ConfigElementList getContextServices() { + return contextServices == null ? (contextServices = new ConfigElementList()) : contextServices; + } + + public String getContextServiceRef() { + return contextServiceRef; + } + + public ConfigElementList getCustomizes() { + return customizations == null ? (customizations = new ConfigElementList()) : customizations; + } + + public String getLocation() { + return location; + } + + public ConfigElementList getProperties_CalendarApp_CalendarRA() { + return properties_CalendarApp_CalendarRA == null ? (properties_CalendarApp_CalendarRA = new ConfigElementList()) : properties_CalendarApp_CalendarRA; + } + + public ConfigElementList getProperties_CalendarRA() { + return properties_CalendarRA == null ? (properties_CalendarRA = new ConfigElementList()) : properties_CalendarRA; + } + + public ConfigElementList getProperties_FAT1s() { + return properties_FAT1s == null ? (properties_FAT1s = new ConfigElementList()) : properties_FAT1s; + } + + @XmlAttribute + public void setAlias(String alias) { + this.alias = alias; + } + + @XmlAttribute + public void setAutoStart(String autoStart) { + this.autoStart = autoStart; + } + + @XmlAttribute + public void setContextServiceRef(String contextServiceRef) { + this.contextServiceRef = contextServiceRef; + } + + @XmlAttribute + public void setLocation(String location) { + this.location = location; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + if (alias != null) + buf.append("alias=").append(alias).append(' '); + if (autoStart != null) + buf.append("autoStart=").append(autoStart).append(' '); + if (contextServiceRef != null) + buf.append("contextServiceRef=").append(contextServiceRef).append(' '); + if (location != null) + buf.append("location=").append(location).append(' '); + + @SuppressWarnings("unchecked") + List> nestedElementsList = Arrays.asList(classloaders, + contextServices, + customizations, + properties_CalendarApp_CalendarRA, + properties_CalendarRA, + properties_FAT1s + ); + for (ConfigElementList nestedElements : nestedElementsList) + if (nestedElements != null && nestedElements.size() > 0) + for (Object o : nestedElements) + buf.append(o).append(' '); + + buf.append('}'); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ScalingDefinitions.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ScalingDefinitions.java new file mode 100755 index 000000000000..a0465e96d215 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ScalingDefinitions.java @@ -0,0 +1,87 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlElement; + +/** + * The scaling definitions. See /com.ibm.ws.scaling.controller/resources/OSGI-INF/metatype/metatype.xml + * + */ +public class ScalingDefinitions extends ConfigElement { + + @XmlElement(name = "defaultScalingPolicy") + private DefaultScalingPolicy defaultScalingPolicy; + + @XmlElement(name = "scalingPolicy") + private ConfigElementList scalingPolicies; + + /** + * Retrieves the default scaling policy. + * + * @return The default scaling policy. + */ + public DefaultScalingPolicy getDefaultScalingPolicy() { + if (this.defaultScalingPolicy == null) { + this.defaultScalingPolicy = new DefaultScalingPolicy(); + } + + return this.defaultScalingPolicy; + } + + /** + * Retrieves the scaling policies. + * + * @return The scaling policies. + */ + public ConfigElementList getScalingPolicies() { + if (this.scalingPolicies == null) { + this.scalingPolicies = new ConfigElementList(); + } + return this.scalingPolicies; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer(this.getClass().getSimpleName()); + buf.append("{"); + + if (this.defaultScalingPolicy != null) { + buf.append("defaultScalingPolicy: " + this.defaultScalingPolicy.toString() + ", "); + } + if (this.scalingPolicies != null) { + buf.append(" scalingPolicies: { "); + for (ScalingPolicy policy : scalingPolicies) { + buf.append(policy.toString() + " ,"); + } + buf.append("}"); + } + buf.append("}"); + return buf.toString(); + } + + @Override + public ScalingDefinitions clone() throws CloneNotSupportedException { + ScalingDefinitions clone = (ScalingDefinitions) super.clone(); + if (this.defaultScalingPolicy != null) { + clone.defaultScalingPolicy = this.defaultScalingPolicy.clone(); + } + if (this.scalingPolicies != null) { + clone.scalingPolicies = new ConfigElementList(); + for (ScalingPolicy policy : scalingPolicies) { + clone.scalingPolicies.add(policy.clone()); + } + } + return clone; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ScalingPolicy.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ScalingPolicy.java new file mode 100755 index 000000000000..d255f4b64fab --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ScalingPolicy.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +/** + * A bind-able scaling policy. See /com.ibm.ws.scaling.controller/resources/OSGI-INF/metatype/metatype.xml + * + */ +public class ScalingPolicy extends ConfigElement { + + // To be implemented + + @Override + public String toString() { + StringBuffer buf = new StringBuffer(this.getClass().getSimpleName()); + buf.append("{"); + + // To be implemented + + buf.append("}"); + return buf.toString(); + } + + @Override + public ScalingPolicy clone() throws CloneNotSupportedException { + ScalingPolicy clone = (ScalingPolicy) super.clone(); + + // To be implemented + + return clone; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/SecurityRole.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/SecurityRole.java new file mode 100755 index 000000000000..3b4a92353b7e --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/SecurityRole.java @@ -0,0 +1,205 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +/** + * A role that is mapped to users and groups in a domain user registry. See /com.ibm.ws.javaee.dd/resources/OSGI-INF/metatype/metatype.xml + * + */ +public class SecurityRole extends ConfigElement { + + public abstract static class SecurityRoleElement extends ConfigElement { + + private String name; + private String accessId; + + public String getName() { + return this.name; + } + + @XmlAttribute + public void setName(String name) { + this.name = name; + } + + /** + * @return A access ID in the general form id:realmName/uniqueId. A value will be generated if one is not specified. + */ + public String getAccessId() { + return accessId; + } + + /** + * @param accessId A access ID in the general form id:realmName/uniqueId. A value will be generated if one is not specified. + */ + @XmlAttribute(name = "access-id") + public void setAccessId(String accessId) { + this.accessId = accessId; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer(this.getClass().getSimpleName()); + buf.append("{"); + if (name != null) + buf.append("name=\"" + name + "\" "); + if (accessId != null) + buf.append("accessId=\"" + accessId + "\" "); + buf.append("}"); + return buf.toString(); + } + + } + + /** + * Represents group configuration for a security-role. Nested inside parent to distinguish from group elements of other types. See + * /com.ibm.ws.javaee.dd/resources/OSGI-INF/metatype/metatype.xml + * + */ + @XmlType(name = "SecurityRoleGroup") + public static class Group extends SecurityRoleElement { + + @Override + public Group clone() throws CloneNotSupportedException { + return (Group) super.clone(); + } + + } + + /** + * Represents user configuration for a security-role. Nested inside parent to distinguish from user elements of other types. See + * /com.ibm.ws.javaee.dd/resources/OSGI-INF/metatype/metatype.xml + * + */ + @XmlType(name = "SecurityRoleUser") + public static class User extends SecurityRoleElement { + + @Override + public User clone() throws CloneNotSupportedException { + return (User) super.clone(); + } + + } + + @XmlElement(name = "user") + private ConfigElementList users; + @XmlElement(name = "group") + private ConfigElementList groups; + @XmlElement(name = "special-subject") + private ConfigElementList specialSubjects; + private String name; + + /** + * @return the name of this role. + */ + public String getName() { + return this.name; + } + + /** + * @param name the name this role. + */ + @XmlAttribute + public void setName(String name) { + this.name = name; + } + + /** + * Retrieves the users for this role + * + * @return the users for this role + */ + public ConfigElementList getUsers() { + if (this.users == null) { + this.users = new ConfigElementList(); + } + return this.users; + } + + /** + * Retrieves the groups for this role + * + * @return the groups for this role + */ + public ConfigElementList getGroups() { + if (this.groups == null) { + this.groups = new ConfigElementList(); + } + return this.groups; + } + + /** + * Retrieves the special subjects for this role + * + * @return the users for this role + */ + public ConfigElementList getSpecialSubjects() { + if (this.specialSubjects == null) { + this.specialSubjects = new ConfigElementList(); + } + return this.specialSubjects; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("SecurityRole{"); + if (name != null) { + buf.append("name=\"" + name + "\" "); + } + if (this.users != null) { + for (User user : this.users) { + buf.append(user.toString() + ","); + } + } + if (this.groups != null) { + for (Group group : this.groups) { + buf.append(group.toString() + ","); + } + } + if (this.specialSubjects != null) { + for (SpecialSubject specialSubject : this.specialSubjects) { + buf.append(specialSubject.toString() + ","); + } + } + buf.append("}"); + return buf.toString(); + } + + @Override + public SecurityRole clone() throws CloneNotSupportedException { + SecurityRole clone = (SecurityRole) super.clone(); + if (this.users != null) { + clone.users = new ConfigElementList(); + for (User user : this.users) { + clone.users.add(user.clone()); + } + } + if (this.groups != null) { + clone.groups = new ConfigElementList(); + for (Group group : this.groups) { + clone.groups.add(group.clone()); + } + } + if (this.specialSubjects != null) { + clone.specialSubjects = new ConfigElementList(); + for (SpecialSubject specialSubject : this.specialSubjects) { + clone.specialSubjects.add(specialSubject.clone()); + } + } + return clone; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ServerConfiguration.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ServerConfiguration.java new file mode 100755 index 000000000000..65ad62324d75 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ServerConfiguration.java @@ -0,0 +1,980 @@ +package com.ibm.websphere.simplicity.config; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.namespace.QName; + +import org.w3c.dom.Element; + +/** + * Represents a server configuration document for the WAS 8.5 Liberty Profile. + */ +@XmlRootElement(name = "server") +public class ServerConfiguration implements Cloneable { + + private String description; + @XmlElement(name = "featureManager") + private FeatureManager featureManager; + + @XmlElement(name = "activationSpec") + private ConfigElementList activationSpecs; + + @XmlElement(name = "adminObject") + private ConfigElementList adminObjects; + + @XmlElement(name = "basicRegistry") + private ConfigElementList basicRegistries; + + @XmlElement(name = "bell") + private ConfigElementList bells; + + @XmlElement(name = "httpEndpoint") + private ConfigElementList httpEndpoints; + + @XmlElement(name = "wasJmsEndpoint") + private ConfigElementList wasJmsEndpoints; + + @XmlElement(name = "messagingEngine") + private ConfigElementList messagingEngines; + + @XmlElement(name = "httpSession") + private HttpSession httpSession; + + @XmlElement(name = "httpSessionDatabase") + private HttpSessionDatabase httpSessionDatabase; + + @XmlElement(name = "application") + private ConfigElementList applications; + + @XmlElement(name = "webApplication") + private ConfigElementList webApplications; + + @XmlElement(name = "cloudant") + private ConfigElementList cloudants; + + @XmlElement(name = "cloudantDatabase") + private ConfigElementList cloudantDatabases; + + @XmlElement(name = "connectionFactory") + private ConfigElementList connectionFactories; + + @XmlElement(name = "contextService") + private ConfigElementList contextServices; + + @XmlElement(name = "jdbcDriver") + private ConfigElementList jdbcDrivers; + + @XmlElement(name = "jmsActivationSpec") + private ConfigElementList jmsActivationSpecs; + + @XmlElement(name = "jmsConnectionFactory") + private ConfigElementList jmsConnectionFactories; + + @XmlElement(name = "jmsDestination") + private ConfigElementList jmsDestinations; + + @XmlElement(name = "jmsQueue") + private ConfigElementList jmsQueues; + + @XmlElement(name = "jmsQueueConnectionFactory") + private ConfigElementList jmsQueueConnectionFactories; + + @XmlElement(name = "jmsTopic") + private ConfigElementList jmsTopics; + + @XmlElement(name = "jmsTopicConnectionFactory") + private ConfigElementList jmsTopicConnectionFactories; + + @XmlElement(name = "jpa") + private ConfigElementList jpas; + + @XmlElement(name = "library") + private ConfigElementList libraries; + + @XmlElement(name = "osgiLibrary") + private ConfigElementList osgiLibraries; + + @XmlElement(name = "managedExecutorService") + private ConfigElementList managedExecutorServices; + + @XmlElement(name = "managedScheduledExecutorService") + private ConfigElementList managedScheduledExecutorServices; + + @XmlElement(name = "managedThreadFactory") + private ConfigElementList managedThreadFactories; + + @XmlElement(name = "resourceAdapter") + private ConfigElementList resourceAdapters; + + // TODO: will be moved to nested element of ResourceAdapter when we add support for config properties for embedded RARs + @XmlElement(name = "com.ibm.ws.jca.resourceAdapter.properties.CalendarApp.CalendarRA") + private ConfigElementList properties_CalendarApp_CalendarRA; + + @XmlElement(name = "fileset") + private ConfigElementList filesets; + + @XmlElement(name = "dataSource") + private ConfigElementList dataSources; + + @XmlElement(name = "connectionManager") + private ConfigElementList connManagers; + + @XmlElement(name = "logging") + private Logging logging; + + @XmlElement(name = "include") + private ConfigElementList includeElements; + + @XmlElement(name = "applicationMonitor") + private ApplicationMonitorElement applicationMonitor; + + @XmlElement(name = "executor") + private ExecutorElement executor; + + @XmlElement(name = "config") + private ConfigMonitorElement config; + + @XmlElement(name = "webContainer") + private WebContainerElement webContainer; + + @XmlElement(name = "keyStore") + private ConfigElementList keyStores; + + @XmlElement(name = "jspEngine") + private JspEngineElement jspEngine; + + @XmlElement(name = "authData") + private ConfigElementList authDataElements; + + @XmlElement(name = "transaction") + private Transaction transaction; + + @XmlElement(name = "jndiEntry") + private ConfigElementList jndiEntryElements; + + @XmlElement(name = "jndiURLEntry") + private ConfigElementList jndiURLEntryElements; + + @XmlElement(name = "variable") + private ConfigElementList variables; + + @XmlElement(name = "ejbContainer") + private EJBContainerElement ejbContainer; + + @XmlElement(name = "couchdb") + private ConfigElementList couchDBs; + + @XmlElement(name = "mongo") + private ConfigElementList mongos; + + @XmlElement(name = "mongoDB") + private ConfigElementList mongoDBs; + + @XmlElement(name = "classloading") + private ClassloadingElement classLoading; + + @XmlElement(name = "databaseStore") + private ConfigElementList databaseStores; + + @XmlElement(name = "persistentExecutor") + private ConfigElementList persistentExecutors; + + @XmlElement(name = "scalingDefinitions") + private ScalingDefinitions scalingDefinitions; + + @XmlElement(name = "remoteFileAccess") + private ConfigElementList remoteFileAccesses; + + @XmlElement(name = "productInsights") + private ProductInsightsElement productInsightsElement; + + @XmlElement(name = "apiDiscovery") + private APIDiscoveryElement apiDiscoveryElement; + + @XmlAnyAttribute + private Map unknownAttributes; + + @XmlAnyElement + private List unknownElements; + + public ServerConfiguration() { + this.description = "Generation date: " + new Date(); + } + + public ConfigElementList getActivationSpecs() { + if (this.activationSpecs == null) + this.activationSpecs = new ConfigElementList(); + return this.activationSpecs; + } + + public ConfigElementList getAdminObjects() { + if (this.adminObjects == null) + this.adminObjects = new ConfigElementList(); + return this.adminObjects; + } + + public boolean removeJdbcDriverById(String id) { + if (jdbcDrivers == null) + return false; + + for (JdbcDriver driver : jdbcDrivers) + if (driver.getId().equals(id)) + return jdbcDrivers.remove(driver); + return false; + } + + public void addConnectionManager(ConnectionManager connManager) { + if (connManagers == null) + connManagers = new ConfigElementList(); + connManagers.add(connManager); + } + + public boolean removeConnectionManagerById(String id) { + if (connManagers == null) + return false; + + for (ConnectionManager connManager : connManagers) + if (connManager.getId().equals(id)) + return connManagers.remove(connManager); + return false; + } + + public ConfigElementList getJndiEntryElements() { + if (this.jndiEntryElements == null) { + this.jndiEntryElements = new ConfigElementList(); + } + return this.jndiEntryElements; + } + + public ConfigElementList getJndiURLEntryElements() { + if (this.jndiURLEntryElements == null) { + this.jndiURLEntryElements = new ConfigElementList(); + } + return this.jndiURLEntryElements; + } + + public ConfigElementList getAuthDataElements() { + if (this.authDataElements == null) { + this.authDataElements = new ConfigElementList(); + } + return this.authDataElements; + } + + /** + * Retrieves a description of this configuration. + * + * @return a description of this configuration + */ + public String getDescription() { + return this.description; + } + + /** + * Sets the description of this configuration + * + * @param description the description of this configuration + */ + @XmlAttribute + public void setDescription(String description) { + this.description = ConfigElement.getValue(description); + } + + /** + * @return the featureManager for this configuration + */ + public FeatureManager getFeatureManager() { + if (this.featureManager == null) { + this.featureManager = new FeatureManager(); + } + return this.featureManager; + } + + public ConfigElementList getBasicRegistries() { + if (this.basicRegistries == null) { + this.basicRegistries = new ConfigElementList(); + } + return this.basicRegistries; + } + + public ConfigElementList getBells() { + if (this.bells == null) { + this.bells = new ConfigElementList(); + } + return this.bells; + } + + public ConfigElementList getCloudants() { + if (this.cloudants == null) + this.cloudants = new ConfigElementList(); + return this.cloudants; + } + + public ConfigElementList getCloudantDatabases() { + if (this.cloudantDatabases == null) + this.cloudantDatabases = new ConfigElementList(); + return this.cloudantDatabases; + } + + public ConfigElementList getContextServices() { + if (this.contextServices == null) + this.contextServices = new ConfigElementList(); + return this.contextServices; + } + + public ConfigElementList getConnectionFactories() { + if (this.connectionFactories == null) + this.connectionFactories = new ConfigElementList(); + return this.connectionFactories; + } + + /** + * Retrieves the list of HttpEndpoints in this configuration + * + * @return the list of HttpEndpoints in this configuration + */ + public ConfigElementList getHttpEndpoints() { + if (this.httpEndpoints == null) { + this.httpEndpoints = new ConfigElementList(); + } + return this.httpEndpoints; + } + + /** + * Retrieves the list of wasJmsEndpoints in this configuration + * + * @return the list of JmsEndpoints in this configuration + */ + public ConfigElementList getWasJmsEndpoints() { + if (this.wasJmsEndpoints == null) { + this.wasJmsEndpoints = new ConfigElementList(); + } + return this.wasJmsEndpoints; + } + + /** + * Retrieves the list of messaging engines in this configuration + * + * @return the list of messagine engines in this configuration + */ + public ConfigElementList getMessagingEngines() { + if (this.messagingEngines == null) { + this.messagingEngines = new ConfigElementList(); + } + return this.messagingEngines; + } + + /** + * @return the HTTP session manager configuration for this server + */ + public HttpSession getHttpSession() { + if (this.httpSession == null) { + this.httpSession = new HttpSession(); + } + return this.httpSession; + } + + /** + * @return the HTTP session manager database configuration for this server + */ + public HttpSessionDatabase getHttpSessionDatabase() { + if (this.httpSessionDatabase == null) { + this.httpSessionDatabase = new HttpSessionDatabase(); + } + return this.httpSessionDatabase; + } + + public ConfigElementList getJMSActivationSpecs() { + if (this.jmsActivationSpecs == null) + this.jmsActivationSpecs = new ConfigElementList(); + return this.jmsActivationSpecs; + } + + public ConfigElementList getJMSConnectionFactories() { + if (this.jmsConnectionFactories == null) + this.jmsConnectionFactories = new ConfigElementList(); + return this.jmsConnectionFactories; + } + + public ConfigElementList getJMSDestinations() { + if (this.jmsDestinations == null) + this.jmsDestinations = new ConfigElementList(); + return this.jmsDestinations; + } + + public ConfigElementList getJMSQueues() { + if (this.jmsQueues == null) + this.jmsQueues = new ConfigElementList(); + return this.jmsQueues; + } + + public ConfigElementList getJMSQueueConnectionFactories() { + if (this.jmsQueueConnectionFactories == null) + this.jmsQueueConnectionFactories = new ConfigElementList(); + return this.jmsQueueConnectionFactories; + } + + public ConfigElementList getJMSTopics() { + if (this.jmsTopics == null) + this.jmsTopics = new ConfigElementList(); + return this.jmsTopics; + } + + public ConfigElementList getJMSTopicConnectionFactories() { + if (this.jmsTopicConnectionFactories == null) + this.jmsTopicConnectionFactories = new ConfigElementList(); + return this.jmsTopicConnectionFactories; + } + + public ConfigElementList getJPAs() { + if (this.jpas == null) + this.jpas = new ConfigElementList(); + return this.jpas; + } + + public ConfigElementList getManagedExecutorServices() { + if (this.managedExecutorServices == null) + this.managedExecutorServices = new ConfigElementList(); + return this.managedExecutorServices; + } + + public ConfigElementList getManagedScheduledExecutorServices() { + if (this.managedScheduledExecutorServices == null) + this.managedScheduledExecutorServices = new ConfigElementList(); + return this.managedScheduledExecutorServices; + } + + public ConfigElementList getManagedThreadFactories() { + if (this.managedThreadFactories == null) + this.managedThreadFactories = new ConfigElementList(); + return this.managedThreadFactories; + } + + public ConfigElementList getResourceAdapters() { + if (this.resourceAdapters == null) + this.resourceAdapters = new ConfigElementList(); + return this.resourceAdapters; + } + + public ConfigElementList getProperties_CalendarApp_CalendarRA() { + return properties_CalendarApp_CalendarRA == null ? (properties_CalendarApp_CalendarRA = new ConfigElementList()) : properties_CalendarApp_CalendarRA; + } + + /** + * @return the WebContainer configuration for this server + */ + public WebContainerElement getWebContainer() { + if (this.webContainer == null) { + this.webContainer = new WebContainerElement(); + } + return this.webContainer; + } + + /** + * @return the KeyStore configurations for this server + */ + public ConfigElementList getKeyStores() { + if (this.keyStores == null) { + this.keyStores = new ConfigElementList(); + } + return this.keyStores; + } + + /** + * @return the EJB Container configuration for this server + */ + public EJBContainerElement getEJBContainer() { + if (this.ejbContainer == null) { + this.ejbContainer = new EJBContainerElement(); + } + return this.ejbContainer; + } + + public ProductInsightsElement getProductInsightsElement() { + if (this.productInsightsElement == null) { + this.productInsightsElement = new ProductInsightsElement(); + } + + return this.productInsightsElement; + } + + public APIDiscoveryElement getAPIDiscoveryElement() { + if (this.apiDiscoveryElement == null) { + this.apiDiscoveryElement = new APIDiscoveryElement(); + } + + return this.apiDiscoveryElement; + } + + /** + * @return the Jsp configuration for this server + */ + public JspEngineElement getJspEngine() { + if (this.jspEngine == null) { + this.jspEngine = new JspEngineElement(); + } + return this.jspEngine; + } + + /** + * @return the includeElement + */ + public ConfigElementList getIncludes() { + if (this.includeElements == null) + this.includeElements = new ConfigElementList(); + return this.includeElements; + } + + /** + * @return the ExecutorElement + */ + public ExecutorElement getExecutor() { + if (this.executor == null) + this.executor = new ExecutorElement(); + return this.executor; + } + + public void setExecutorElement(ExecutorElement exec) { + this.executor = exec; + } + + /** + * @return the applicationMonitor + */ + public ClassloadingElement getClassLoadingElement() { + + if (this.classLoading == null) + this.classLoading = new ClassloadingElement(); + + return this.classLoading; + } + + /** + * @return the applicationMonitor + */ + public ApplicationMonitorElement getApplicationMonitor() { + if (this.applicationMonitor == null) + this.applicationMonitor = new ApplicationMonitorElement(); + + return this.applicationMonitor; + } + + /** + * @return explicitly installed applications + */ + public ConfigElementList getApplications() { + if (this.applications == null) { + this.applications = new ConfigElementList(); + } + return this.applications; + } + + /** + * @return explicitly installed web applications + */ + public ConfigElementList getWebApplications() { + if (this.webApplications == null) { + this.webApplications = new ConfigElementList(); + } + return this.webApplications; + } + + /** + * @return the connection managers + */ + public ConfigElementList getConnectionManagers() { + if (this.connManagers == null) + this.connManagers = new ConfigElementList(); + + return this.connManagers; + } + + /** + * Removes all applications with a specific name + * + * @param name + * the name of the applications to remove + * @return the removed applications (no longer bound to the server + * configuration) + */ + public ConfigElementList removeApplicationsByName(String name) { + ConfigElementList installedApps = this.getApplications(); + ConfigElementList uninstalledApps = new ConfigElementList(); + for (Application app : installedApps) { + if (name != null && name.equals(app.getName())) { + uninstalledApps.add(app); + } + } + installedApps.removeAll(uninstalledApps); + return uninstalledApps; + } + + /** + * Adds an application to the current config, or updates an application with + * a specific name if it already exists + * + * @param name + * the name of the application + * @param path + * the fully qualified path to the application archive on the + * liberty machine + * @param type + * the type of the application (ear/war/etc) + * @return the deployed application + */ + public Application addApplication(String name, String path, String type) { + ConfigElementList apps = this.getApplications(); + Application application = null; + for (Application app : apps) { + if (name != null && name.equals(app.getName())) { + application = app; + } + } + if (application == null) { + application = new Application(); + apps.add(application); + } + application.setName(name); + application.setId(name); // application names must be unique, just like element ID names (other config objects probably aren't sharing the app name) + application.setType(type); + application.setLocation(path); // assumes that archive has already been transferred; see FileSetup.java + return application; + } + + /** + * @return gets all configured JDBC drivers + */ + public ConfigElementList getJdbcDrivers() { + if (this.jdbcDrivers == null) { + this.jdbcDrivers = new ConfigElementList(); + } + return this.jdbcDrivers; + } + + /** + * @return gets all configured shared libraries + */ + public ConfigElementList getLibraries() { + if (this.libraries == null) { + this.libraries = new ConfigElementList(); + } + return this.libraries; + } + + /** + * @return gets all configured osgi libraries + */ + public ConfigElementList getOsgiLibraries() { + if (this.osgiLibraries == null) { + this.osgiLibraries = new ConfigElementList(); + } + return this.osgiLibraries; + } + + /** + * @return gets all configured file sets + */ + public ConfigElementList getFilesets() { + if (this.filesets == null) { + this.filesets = new ConfigElementList(); + } + return this.filesets; + } + + /** + * @return get fileset by id + */ + public Fileset getFilesetById(String id) { + if (this.filesets != null) + for (Fileset fileset : this.filesets) + if (fileset.getId().equals(id)) + return fileset; + + return null; + } + + /** + * @return gets all configured top level dataSource elements. + */ + public ConfigElementList getDataSources() { + if (this.dataSources == null) { + this.dataSources = new ConfigElementList(); + } + return this.dataSources; + } + + /** + * @return gets logging configuration + */ + public Logging getLogging() { + if (this.logging == null) { + this.logging = new Logging(); + } + return this.logging; + } + + /** + * @return the config + */ + public ConfigMonitorElement getConfig() { + if (this.config == null) { + this.config = new ConfigMonitorElement(); + } + return config; + } + + public Transaction getTransaction() { + if (this.transaction == null) + this.transaction = new Transaction(); + return this.transaction; + } + + /** + * @return all configured elements + */ + public ConfigElementList getVariables() { + if (this.variables == null) { + this.variables = new ConfigElementList(); + } + return this.variables; + } + + /** + * @return all configured elements + */ + public ConfigElementList getMongoDBs() { + if (this.mongoDBs == null) { + this.mongoDBs = new ConfigElementList(); + } + return this.mongoDBs; + } + + /** + * @return all configured elements + */ + public ConfigElementList getMongos() { + if (this.mongos == null) { + this.mongos = new ConfigElementList(); + } + return this.mongos; + } + + /** + * @return all configured elements + */ + public ConfigElementList getCouchDBs() { + if (this.couchDBs == null) { + this.couchDBs = new ConfigElementList(); + } + return this.couchDBs; + } + + /** + * Returns a list of configured top level databaseStores elements. + * + * @return A list of configured top level databaseStores elements. + */ + public ConfigElementList getDatabaseStores() { + if (this.databaseStores == null) { + this.databaseStores = new ConfigElementList(); + } + + return this.databaseStores; + } + + /** + * Returns a list of configured top level persistentExecutor elements. + * + * @return A list of configured top level persistentExecutor elements. + */ + public ConfigElementList getPersistentExecutors() { + if (this.persistentExecutors == null) { + this.persistentExecutors = new ConfigElementList(); + } + + return this.persistentExecutors; + } + + /** + * Returns the configured top level scalingDefinitions element. + * + * @return The configured top level scalingDefinitions element. + */ + public ScalingDefinitions getScalingDefinitions() { + if (this.scalingDefinitions == null) { + this.scalingDefinitions = new ScalingDefinitions(); + } + + return this.scalingDefinitions; + } + + /** + * Returns a list of configured top level remoteFileAccess elements. + * + * @return A list of configured top level remoteFileAccess elements. + */ + public ConfigElementList getRemoteFileAccess() { + if (this.remoteFileAccesses == null) { + this.remoteFileAccesses = new ConfigElementList(); + } + + return this.remoteFileAccesses; + } + + private List getAllXmlElements() { + List xmlElements = new ArrayList(); + for (Field field : getClass().getDeclaredFields()) { + if (field.isAnnotationPresent(XmlElement.class)) + xmlElements.add(field); + } + return xmlElements; + } + + @SuppressWarnings("unchecked") + @Override + public ServerConfiguration clone() throws CloneNotSupportedException { + ServerConfiguration clone = (ServerConfiguration) super.clone(); + + for (Field field : getAllXmlElements()) { + try { + Object val = field.get(this); + if (val instanceof ConfigElementList) { + field.set(clone, ((ConfigElementList) val).clone()); + } else if (val != null) { + field.set(clone, ((ConfigElement) val).clone()); + } + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } catch (RuntimeException e) { + throw new RuntimeException("Error on field: " + field); + } + } + return clone; + } + + @Override + public String toString() { + String nl = System.getProperty("line.separator"); + StringBuffer buf = new StringBuffer("ServerConfiguration" + nl); + + for (Field field : getAllXmlElements()) { + try { + buf.append(field.get(this).toString()); + } catch (Exception ignore) { + } + } + return buf.toString(); + } + + @Override + public boolean equals(Object otherConfig) { + if (otherConfig == null) + return false; + if (!(otherConfig instanceof ServerConfiguration)) + return false; + + // Consider server configurations equal if their XmlElements match up + for (Field field : getAllXmlElements()) { + try { + Object thisVal = field.get(this); + Object otherVal = field.get(otherConfig); + if (!(thisVal == null ? otherVal == null : thisVal.equals(otherVal))) + return false; + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + return true; + } + + /** + * Calls modify() on elements in the configuration that implement the ModifiableConfigElement interface. + */ + public void updateDatabaseArtifacts() throws Exception { + List mofiableElementList = new ArrayList(); + findModifiableConfigElements(this, mofiableElementList); + + for (ModifiableConfigElement element : mofiableElementList) { + element.modify(this); + } + } + + /** + * Finds all of the objects in the given config element that implement the + * ModifiableConfigElement interface. + * + * @param element The config element to check. + * @param modifiableConfigElements The list containing all modifiable elements. + * @throws Exception + */ + private void findModifiableConfigElements(Object element, List modifiableConfigElements) throws Exception { + + // If the current element implements ModifiableConfigElement add it to the list. + if (element instanceof ModifiableConfigElement) { + modifiableConfigElements.add((ModifiableConfigElement) element); + } + + // Iterate over all of the elements. + for (Field field : element.getClass().getDeclaredFields()) { + if (!field.isAccessible()) + field.setAccessible(true); + + Object fieldValue = field.get(element); + + if (fieldValue != null) { + if (fieldValue instanceof ConfigElement) { + findModifiableConfigElements(fieldValue, modifiableConfigElements); + } else if (fieldValue instanceof ConfigElementList) { + for (ConfigElement e : (ConfigElementList) fieldValue) + findModifiableConfigElements(e, modifiableConfigElements); + } + } + } + } + + /** + * Removes an unknown element, by tag name. One might use this to remove the + * configuration for a feature which is not part of the product, for example one + * that is built and installed by a FAT bucket. + * + * @param tagName The tag name that should be removed. + * + * @returns A list of the items that were removed. + */ + public List removeUnknownElement(String tagName) { + List removedElements = new LinkedList(); + Iterator i = unknownElements.iterator(); + while ((i != null) && (i.hasNext())) { + Element e = i.next(); + if ((e != null) && (e.getTagName().equals(tagName))) { + removedElements.add(e); + i.remove(); + } + } + return removedElements; + } + + /** + * Adds elements previously removed from the unknown elements list. This was intended + * to be used to add anything back to the configuration that was removed by the + * removeUnknownElements() method. + * + * @param unknownElements The elements to add back to the configuration. + */ + public void addUnknownElements(List unknownElements) { + for (Element e : unknownElements) { + this.unknownElements.add(e); + } + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ServerConfigurationFactory.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ServerConfigurationFactory.java new file mode 100755 index 000000000000..1a9df1ad5902 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/ServerConfigurationFactory.java @@ -0,0 +1,198 @@ +package com.ibm.websphere.simplicity.config; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; + +import com.ibm.websphere.simplicity.config.dsprops.Properties_derby_embedded; + +/** + * Reads server.xml into memory, writes changes back to server.xml + * + * @author Tim Burns + * + */ +public class ServerConfigurationFactory { + + private static ServerConfigurationFactory INSTANCE; + + public static ServerConfigurationFactory getInstance() throws Exception { + if (INSTANCE == null) { + INSTANCE = new ServerConfigurationFactory(); + } + return INSTANCE; + } + + private final Marshaller marshaller; + private final Unmarshaller unmarshaller; + + private ServerConfigurationFactory() throws Exception { + JAXBContext context = JAXBContext.newInstance(ServerConfiguration.class); + this.marshaller = context.createMarshaller(); + this.marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + this.unmarshaller = context.createUnmarshaller(); + } + + /** + * Expresses a server configuration in an XML document. + * + * @param sourceConfig + * the configuration you want to marshal + * @param targetFile + * the location where you want to marshal state information. + * parent directories will be created automatically + * @throws Exception + * if generation fails + */ + public void marshal(ServerConfiguration sourceConfig, File targetFile) throws Exception { + if (targetFile == null) { + return; // if the target location is null, there's nothing to do + } + targetFile.getParentFile().mkdirs(); + this.marshal(sourceConfig, new FileOutputStream(targetFile)); + } + + /** + * Expresses a server configuration in an XML document. + * + * @param sourceConfig + * the configuration you want to marshal + * @param outputStream + * the stream where you want to marshal state information. the + * stream will be closed before this method returns. + * @throws Exception + * if generation fails + */ + public void marshal(ServerConfiguration sourceConfig, OutputStream outputStream) throws Exception { + if (outputStream == null) { + return; // if the outputStream is null, there's nothing to do + } + try { + this.marshaller.marshal(sourceConfig, outputStream); + } finally { + outputStream.close(); + } + } + + /** + * Converts a server configuration XML file into a series of Java objects. + * + * @param inputStream + * a server configuration XML file as a stream + * @return a Java object representation of the server configuration, or null + * if the input stream is null + * @throws Exception + * if the XML can't be parsed + */ + public ServerConfiguration unmarshal(InputStream inputStream) throws Exception { + if (inputStream == null) { + return null; // nothing to unmarshall + } + try { + return (ServerConfiguration) this.unmarshaller.unmarshal(inputStream); + } finally { + inputStream.close(); + } + } + + /** + * Tests server configuration factory; prints server.xml for easy debug + * + * @param args + * nothing + * @throws Exception + * if any test fails + */ + public static void main(String[] args) throws Exception { + File serverConfig = File.createTempFile("server", ".xml"); + System.out.println("Created temporary file: " + serverConfig); + if (!serverConfig.exists()) { + throw new Exception("Failed to create tmp file"); + } + + Integer expectedInvalidationTimeout = Integer.valueOf(120); + String expectedCreateDatabase = "create"; + + ServerConfiguration server = new ServerConfiguration(); + server.getFeatureManager().getFeatures().add(FeatureManager.FEATURE_SERVLET_3_0); + server.getFeatureManager().getFeatures().add(FeatureManager.FEATURE_JSP_2_2); + server.getFeatureManager().getFeatures().add(FeatureManager.FEATURE_SESSION_DATABASE_1_0); + server.getFeatureManager().getFeatures().add(FeatureManager.FEATURE_APP_SECURITY_1_0); + HttpEndpoint httpEndpoint = new HttpEndpoint(); + httpEndpoint.setId("defaultHttpEndpoint"); + httpEndpoint.setHost("*"); + httpEndpoint.setHttpPort(Integer.valueOf(9080)); + httpEndpoint.setHttpsPort(Integer.valueOf(9443)); + httpEndpoint.getTcpOptions().setSoReuseAddr(Boolean.TRUE); + server.getHttpEndpoints().add(httpEndpoint); + Fileset fileset = server.getFilesets().getOrCreateById("DerbyFileset", Fileset.class); + fileset.setDir("${shared.resource.dir}/derby"); + fileset.setIncludes("derby.jar"); + Library library = server.getLibraries().getOrCreateById("DerbyLib", Library.class); + library.setFileset(fileset); + JdbcDriver jdbcDriver = server.getJdbcDrivers().getOrCreateById("DerbyEmbedded", JdbcDriver.class); + jdbcDriver.setLibrary(library); + DataSource dataSource = server.getDataSources().getOrCreateById("SessionDS", DataSource.class); + dataSource.setJndiName("jdbc/Sessions"); + dataSource.setJdbcDriverRef(jdbcDriver.getId()); + Properties_derby_embedded dataSourceProperties = new Properties_derby_embedded(); + dataSourceProperties.setDatabaseName("${shared.resource.dir}/data/sessionDB"); + dataSourceProperties.setUser("user1"); + dataSourceProperties.setPassword("password"); + dataSourceProperties.setCreateDatabase(expectedCreateDatabase); + dataSource.getProperties_derby_embedded().add(dataSourceProperties); + HttpSessionDatabase sessionDB = server.getHttpSessionDatabase(); + sessionDB.setId("SessionDB"); + sessionDB.setDataSource(dataSource); + sessionDB.setUseMultiRowSchema(Boolean.TRUE); + HttpSession smgr = server.getHttpSession(); + smgr.setInvalidationTimeout(expectedInvalidationTimeout); + smgr.setCookieDomain("\"\""); + smgr.setStorage(sessionDB); + server.getLogging().setTraceSpecification("*=info=enabled:com.ibm.ws.session*=all=enabled"); + BasicRegistry registry = server.getBasicRegistries().getOrCreateById("BasicRealm", BasicRegistry.class); + registry.setRealm(registry.getId()); + BasicRegistry.User user1 = registry.getUsers().getOrCreateById("user1", BasicRegistry.User.class); + user1.setName(user1.getId()); + user1.setPassword("security"); + Application application = new Application(); + application.setId("appName"); + application.setName(application.getId()); + application.setType("ear"); + application.setLocation("C:/some/path/on/my/machine/app.ear"); + SecurityRole role = application.getApplicationBnd().getSecurityRoles().getOrCreateById("securityRole", SecurityRole.class); + role.setName(role.getId()); + SpecialSubject specialSubject = role.getSpecialSubjects().getOrCreateById("specialSubject", SpecialSubject.class); + specialSubject.set(SpecialSubject.Type.ALL_AUTHENTICATED_USERS); + server.getApplications().add(application); + + ServerConfigurationFactory scf = ServerConfigurationFactory.getInstance(); + scf.marshal(server, serverConfig); + scf.marshaller.marshal(server, System.out); // call private variable to avoid calling System.out! + + ServerConfiguration unmarshalled = scf.unmarshal(new FileInputStream(serverConfig)); + scf.marshaller.marshal(unmarshalled, System.out); // call private variable to avoid calling System.out! + Integer actualInvalidationTimeout = unmarshalled.getHttpSession().getInvalidationTimeout(); + String actualCreateDatabase = unmarshalled.getDataSources().get(0).getProperties_derby_embedded().get(0).getCreateDatabase(); + if (!expectedInvalidationTimeout.equals(actualInvalidationTimeout)) { + throw new Exception("Expected invalidation timeout does not match actual invalidation timeout. Expected: " + expectedInvalidationTimeout + " Actual: " + + actualInvalidationTimeout); + } + if (!expectedCreateDatabase.equals(actualCreateDatabase)) { + throw new Exception("Expected data source property does not match actual invalidation timeout. Expected: " + expectedCreateDatabase + " Actual: " + + actualCreateDatabase); + } + if (!serverConfig.delete()) { + throw new Exception("Failed to delete tmp file"); + } + System.out.println("Deleted " + serverConfig); + System.out.println("All tests passed"); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/SpecialSubject.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/SpecialSubject.java new file mode 100755 index 000000000000..c70caf228bcc --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/SpecialSubject.java @@ -0,0 +1,68 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * Represents special-subject configuration. See /com.ibm.ws.javaee.dd/resources/OSGI-INF/metatype/metatype.xml + * + */ +public class SpecialSubject extends ConfigElement { + + /** + * Enumerates all allowed values for type attribute + */ + public static enum Type { + ALL_AUTHENTICATED_USERS, + EVERYONE + } + + private String type; + + /** + * @param type the subject type + */ + public void set(Type type) { + this.setType(type == null ? null : type.toString()); + } + + /** + * @return One of the following special subject types: ALL_AUTHENTICATED_USERS, EVERYONE. + */ + public String getType() { + return this.type; + } + + /** + * @param name One of the following special subject types: ALL_AUTHENTICATED_USERS, EVERYONE. + */ + @XmlAttribute + public void setType(String type) { + this.type = type; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("SpecialSubject{"); + if (type != null) + buf.append("type=\"" + type + "\" "); + buf.append("}"); + return buf.toString(); + } + + @Override + public SpecialSubject clone() throws CloneNotSupportedException { + return (SpecialSubject) super.clone(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/TcpOptions.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/TcpOptions.java new file mode 100755 index 000000000000..c0bdaec382d8 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/TcpOptions.java @@ -0,0 +1,34 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * Defines TCP options for channel framework + * + * @author Tim Burns + * + */ +public class TcpOptions extends ConfigElement { + + private Boolean soReuseAddr; + + public Boolean isSoReuseAddr() { + return this.soReuseAddr; + } + + @XmlAttribute + public void setSoReuseAddr(Boolean soReuseAddr) { + this.soReuseAddr = soReuseAddr; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("TcpOptions{"); + buf.append("id=\"" + this.getId() + "\" "); + if (soReuseAddr != null) + buf.append("soReuseAddr=\"" + soReuseAddr + "\" "); + + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Transaction.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Transaction.java new file mode 100755 index 000000000000..f7219afd7e81 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Transaction.java @@ -0,0 +1,188 @@ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * Lists data source properties. Some properties are generic, others are driver specifc. + */ +public class Transaction extends ConfigElement { + private Boolean acceptHeuristicHazard; + private Integer clientInactivityTimeout; + private Integer defaultMaxShutdownDelay; + private Boolean enableLoggingForHeuristicReporting; + private Integer heuristicRetryInterval; + private Integer heuristicRetryWait; + private String lpsHeuristicCompletion; + private Integer propogatedOrBMTTranLifetimeTimeout; + private Boolean recoverOnStartup; + private Boolean timeoutGracePeriodEnabled; + private Integer totalTranLifetimeTimeout; + private String transactionLogDirectory; + private Integer transactionLogSize; + private Boolean waitForRecovery; + + @XmlAttribute(name = "acceptHeuristicHazard") + public void setAcceptHeuristicHazard(Boolean acceptHeuristicHazard) { + this.acceptHeuristicHazard = acceptHeuristicHazard; + } + + public Boolean getAcceptHeuristicHazard() { + return this.acceptHeuristicHazard; + } + + @XmlAttribute(name = "clientInactivityTimeout") + public void setClientInactivityTimeout(Integer clientInactivityTimeout) { + this.clientInactivityTimeout = clientInactivityTimeout; + } + + public Integer getClientInactivityTimeout() { + return this.clientInactivityTimeout; + } + + @XmlAttribute(name = "defaultMaxShutdownDelay") + public void setDefaultMaxShutdownDelay(Integer defaultMaxShutdownDelay) { + this.defaultMaxShutdownDelay = defaultMaxShutdownDelay; + } + + public Integer getDefaultMaxShutdownDelay() { + return this.defaultMaxShutdownDelay; + } + + @XmlAttribute(name = "enableLoggingForHeuristicReporting") + public void setEnableLoggingForHeuristicReporting(Boolean enableLoggingForHeuristicReporting) { + this.enableLoggingForHeuristicReporting = enableLoggingForHeuristicReporting; + } + + public Boolean getEnableLoggingForHeuristicReporting() { + return this.enableLoggingForHeuristicReporting; + } + + @XmlAttribute(name = "heuristicRetryInterval") + public void setHeuristicRetryInterval(Integer heuristicRetryInterval) { + this.heuristicRetryInterval = heuristicRetryInterval; + } + + public Integer getHeuristicRetryInterval() { + return this.heuristicRetryInterval; + } + + @XmlAttribute(name = "heuristicRetryWait") + public void setHeuristicRetryWait(Integer heuristicRetryWait) { + this.heuristicRetryWait = heuristicRetryWait; + } + + public Integer getHeuristicRetryWait() { + return this.heuristicRetryWait; + } + + @XmlAttribute(name = "lpsHeuristicCompletion") + public void setLpsHeuristicCompletion(String lpsHeuristicCompletion) { + this.lpsHeuristicCompletion = lpsHeuristicCompletion; + } + + public String getLpsHeuristicCompletion() { + return this.lpsHeuristicCompletion; + } + + @XmlAttribute(name = "propogatedOrBMTTranLifetimeTimeout") + public void setPropogatedOrBMTTranLifetimeTimeout(Integer propogatedOrBMTTranLifetimeTimeout) { + this.propogatedOrBMTTranLifetimeTimeout = propogatedOrBMTTranLifetimeTimeout; + } + + public Integer getPropogatedOrBMTTranLifetimeTimeout() { + return this.propogatedOrBMTTranLifetimeTimeout; + } + + @XmlAttribute(name = "recoverOnStartup") + public void setRecoverOnStartup(Boolean recoverOnStartup) { + this.recoverOnStartup = recoverOnStartup; + } + + public Boolean getRecoverOnStartup() { + return this.recoverOnStartup; + } + + @XmlAttribute(name = "timeoutGracePeriodEnabled") + public void setTimeoutGracePeriodEnabled(Boolean timeoutGracePeriodEnabled) { + this.timeoutGracePeriodEnabled = timeoutGracePeriodEnabled; + } + + public Boolean getTimeoutGracePeriodEnabled() { + return this.timeoutGracePeriodEnabled; + } + + @XmlAttribute(name = "totalTranLifetimeTimeout") + public void setTotalTranLifetimeTimeout(Integer totalTranLifetimeTimeout) { + this.totalTranLifetimeTimeout = totalTranLifetimeTimeout; + } + + public Integer getTotalTranLifetimeTimeout() { + return this.totalTranLifetimeTimeout; + } + + @XmlAttribute(name = "transactionLogDirectory") + public void setTransactionLogDirectory(String transactionLogDirectory) { + this.transactionLogDirectory = transactionLogDirectory; + } + + public String getTransactionLogDirectory() { + return this.transactionLogDirectory; + } + + @XmlAttribute(name = "transactionLogSize") + public void setTransactionLogSize(Integer transactionLogSize) { + this.transactionLogSize = transactionLogSize; + } + + public Integer getTransactionLogSize() { + return this.transactionLogSize; + } + + @XmlAttribute(name = "waitForRecovery") + public void setWaitForRecovery(Boolean waitForRecovery) { + this.waitForRecovery = waitForRecovery; + } + + public Boolean getWaitForRecovery() { + return this.waitForRecovery; + } + + /** + * Returns a String listing the properties and their values used on this + * transaction element. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("Transaction{"); + if (acceptHeuristicHazard != null) + buf.append("acceptHeuristicHazard=\"" + acceptHeuristicHazard + "\" "); + if (clientInactivityTimeout != null) + buf.append("clientInactivityTimeout=\"" + clientInactivityTimeout + "\" "); + if (defaultMaxShutdownDelay != null) + buf.append("defaultMaxShutdownDelay=\"" + defaultMaxShutdownDelay + "\" "); + if (enableLoggingForHeuristicReporting != null) + buf.append("enableLoggingForHeuristicReporting=\"" + enableLoggingForHeuristicReporting + "\" "); + if (heuristicRetryInterval != null) + buf.append("heuristicRetryInterval=\"" + heuristicRetryInterval + "\" "); + if (heuristicRetryWait != null) + buf.append("heuristicRetryWait=\"" + heuristicRetryWait + "\" "); + if (lpsHeuristicCompletion != null) + buf.append("lpsHeuristicCompletion=\"" + lpsHeuristicCompletion + "\" "); + if (propogatedOrBMTTranLifetimeTimeout != null) + buf.append("propogatedOrBMTTranLifetimeTimeout=\"" + propogatedOrBMTTranLifetimeTimeout + "\" "); + if (recoverOnStartup != null) + buf.append("recoverOnStartup=\"" + recoverOnStartup + "\" "); + if (timeoutGracePeriodEnabled != null) + buf.append("timeoutGracePeriodEnabled=\"" + timeoutGracePeriodEnabled + "\" "); + if (totalTranLifetimeTimeout != null) + buf.append("totalTranLifetimeTimeout=\"" + totalTranLifetimeTimeout + "\" "); + if (transactionLogDirectory != null) + buf.append("transactionLogDirectory=\"" + transactionLogDirectory + "\" "); + if (transactionLogSize != null) + buf.append("transactionLogSize=\"" + transactionLogSize + "\" "); + if (waitForRecovery != null) + buf.append("waitForRecovery=\"" + waitForRecovery + "\" "); + buf.append("}"); + return buf.toString(); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Variable.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Variable.java new file mode 100755 index 000000000000..70bb16c31848 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/Variable.java @@ -0,0 +1,65 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * element in server.xml + */ +public class Variable extends ConfigElement { + private String name; + private String value; + + public Variable() {} + + public Variable(String name, String value) { + setName(name); + setValue(value); + } + + public String getName() { + return name; + } + + @XmlAttribute + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + @XmlAttribute + public void setValue(String value) { + this.value = value; + } + + /** + * Returns a string representing this element + * + * @return String representing this element + */ + @Override + public String toString() { + StringBuilder buf = new StringBuilder("Variable{"); + if (getId() != null) + buf.append("id=\"").append(getId()).append("\" "); + if (name != null) + buf.append("name=\"").append(name).append("\" "); + if (value != null) + buf.append("value=\"").append(value).append("\" "); + buf.append("}"); + return buf.toString(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/WasJmsProperties.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/WasJmsProperties.java new file mode 100755 index 000000000000..c33d910062ad --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/WasJmsProperties.java @@ -0,0 +1,276 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import java.lang.reflect.Field; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * This class holds all of the properties that can go in a nested properties.wasJms object. Note that these are often different PIDs but this class holds all of the properties for + * all of the PIDs for convenience. + */ +// final as the toString impl will only work for this class +public final class WasJmsProperties extends ConfigElement { + + private String queueName; + private String destinationRef; + private String userName; + private String clientID; + private String nonPersistentMapping; + private String persistentMapping; + private String topicName; + private String topicSpace; + private String deliveryMode; + private String timeToLive; + private String priority; + private String readAhead; + private String temporaryQueueNamePrefix; + private String remoteServerAddress; + + /** + * @return the queueName + */ + public String getQueueName() { + return queueName; + } + + /** + * @return the destinationRef + */ + public String getDestinationRef() { + return destinationRef; + } + + /** + * @return the userName + */ + public String getUserName() { + return userName; + } + + /** + * @return the clientID + */ + public String getClientID() { + return clientID; + } + + /** + * @return the nonPersistentMapping + */ + public String getNonPersistentMapping() { + return nonPersistentMapping; + } + + /** + * @return the persistentMapping + */ + public String getPersistentMapping() { + return persistentMapping; + } + + /** + * @return the topicName + */ + public String getTopicName() { + return topicName; + } + + /** + * @return the topicSpace + */ + public String getTopicSpace() { + return topicSpace; + } + + /** + * @return the deliveryMode + */ + public String getDeliveryMode() { + return deliveryMode; + } + + /** + * @return the timeToLive + */ + public String getTimeToLive() { + return timeToLive; + } + + /** + * @return the priority + */ + public String getPriority() { + return priority; + } + + /** + * @return the readAhead + */ + public String getReadAhead() { + return readAhead; + } + + /** + * @return the temporaryQueueNamePrefix + */ + public String getTemporaryQueueNamePrefix() { + return temporaryQueueNamePrefix; + } + + /** + * @return the remoteServerAddress + */ + public String getRemoteServerAddress() { + return remoteServerAddress; + } + + /** + * @param queueName the queueName to set + */ + @XmlAttribute + public void setQueueName(String queueName) { + this.queueName = queueName; + } + + /** + * @param destinationRef the destinationRef to set + */ + @XmlAttribute + public void setDestinationRef(String destinationRef) { + this.destinationRef = destinationRef; + } + + /** + * @param userName the userName to set + */ + @XmlAttribute + public void setUserName(String userName) { + this.userName = userName; + } + + /** + * @param clientID the clientID to set + */ + @XmlAttribute + public void setClientID(String clientID) { + this.clientID = clientID; + } + + /** + * @param nonPersistentMapping the nonPersistentMapping to set + */ + @XmlAttribute + public void setNonPersistentMapping(String nonPersistentMapping) { + this.nonPersistentMapping = nonPersistentMapping; + } + + /** + * @param persistentMapping the persistentMapping to set + */ + @XmlAttribute + public void setPersistentMapping(String persistentMapping) { + this.persistentMapping = persistentMapping; + } + + /** + * @param topicName the topicName to set + */ + @XmlAttribute + public void setTopicName(String topicName) { + this.topicName = topicName; + } + + /** + * @param topicSpace the topicSpace to set + */ + @XmlAttribute + public void setTopicSpace(String topicSpace) { + this.topicSpace = topicSpace; + } + + /** + * @param deliveryMode the deliveryMode to set + */ + @XmlAttribute + public void setDeliveryMode(String deliveryMode) { + this.deliveryMode = deliveryMode; + } + + /** + * @param timeToLive the timeToLive to set + */ + @XmlAttribute + public void setTimeToLive(String timeToLive) { + this.timeToLive = timeToLive; + } + + /** + * @param priority the priority to set + */ + @XmlAttribute + public void setPriority(String priority) { + this.priority = priority; + } + + /** + * @param readAhead the readAhead to set + */ + @XmlAttribute + public void setReadAhead(String readAhead) { + this.readAhead = readAhead; + } + + /** + * @param temporaryQueueNamePrefix the temporaryQueueNamePrefix to set + */ + @XmlAttribute + public void setTemporaryQueueNamePrefix(String temporaryQueueNamePrefix) { + this.temporaryQueueNamePrefix = temporaryQueueNamePrefix; + } + + /** + * @param remoteServerAddress the remoteServerAddress to set + */ + @XmlAttribute + public void setRemoteServerAddress(String remoteServerAddress) { + this.remoteServerAddress = remoteServerAddress; + } + + @Override + public String toString() { + Class clazz = this.getClass(); + StringBuilder buf = new StringBuilder(clazz.getSimpleName()) + .append('{'); + buf.append("id=\"" + (getId() == null ? "" : getId()) + "\" "); + + // Life is too short to type in all those fields! + Field[] fields = clazz.getDeclaredFields(); + for (int i = 0; i < fields.length; i++) { + Field field = fields[i]; + Object value; + try { + value = field.get(this); + if (value != null) + buf.append(field.getName() + "=\"" + value + "\" "); + } catch (IllegalArgumentException e) { + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + buf.append("}"); + return buf.toString(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/WebApplication.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/WebApplication.java new file mode 100755 index 000000000000..db90524e8e09 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/WebApplication.java @@ -0,0 +1,54 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * Represents a <webApplication> configuration element + */ +public class WebApplication extends Application { + + private String contextRoot; + + /** + * @return the contextRoot + */ + public String getContextRoot() { + return contextRoot; + } + + /** + * @param contextRoot the contextRoot to set + */ + @XmlAttribute + public void setContextRoot(String contextRoot) { + this.contextRoot = contextRoot; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("WebApplication{"); + buf.append(super.toString()); + if (contextRoot != null) + buf.append("contextRoot=\"" + contextRoot + "\" "); + buf.append("}"); + + return buf.toString(); + } + + @Override + public WebApplication clone() throws CloneNotSupportedException { + return (WebApplication) super.clone(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/WebContainerElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/WebContainerElement.java new file mode 100755 index 000000000000..d1ae1d1bed24 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/WebContainerElement.java @@ -0,0 +1,1339 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * + */ +public class WebContainerElement extends ConfigElement { + + private String listeners; + private Boolean decodeurlasutf8; + private Boolean fileservingenabled; + private Boolean disallowAllFileServing; + private Boolean directorybrowsingenabled; + private Boolean serveServletsByClassnameEnabled; + private Boolean disallowserveservletsbyclassname; + private String donotservebyclassname; + private Boolean trusthostheaderport; + private Boolean trusted; + private Boolean extracthostheaderport; + private String httpsindicatorheader; + private Boolean ExposeWebInfOnDispatch; + private Boolean decodeurlplussign; + private String channelwritetype; + private Boolean suppressHtmlRecursiveErrorOutput; + private Boolean fileWrapperEvents; + private String webgroupvhostnotfound; + private Boolean invokeFiltersCompatibility; + private Boolean defaultTraceRequestBehavior; + private Boolean defaultHeadRequestBehavior; + private Boolean tolerateSymbolicLinks; + private Integer symbolicLinksCacheSize; + private Boolean enableErrorExceptionTypeFirst; + private Boolean enablemultireadofpostdata; + private Boolean skipInputStreamRead; + private String httpOnlyCookies; + private Boolean invokeFilterInitAtStartup; + private Boolean enablejspmappingoverride; + //private Boolean com.ibm.ws.jsp.enabledefaultiselignoredintag; + private Boolean enabledefaultiselignoredintag; + private Boolean parseutf8postdata; + private Boolean logservletcontainerinitializerclassloadingerrors; + private Boolean allowincludesenderror; + private Boolean skipmetainfresourcesprocessing; + private Integer metainfresourcescachesize; + + private Boolean deferServletLoad; + + private Integer asyncmaxsizetaskpool; + private Integer asyncpurgeinterval; + private Integer asynctimeoutdefault; + private Integer asynctimerthreads; + + private String xpoweredby; + private Boolean disablexpoweredby; + private Boolean enableDefaultServletRequestPathElements; + private Boolean copyattributeskeyset; + private String contentType; + private Boolean mapFiltersToAsterisk; + private Boolean DisableSetCharacterEncodingAfterParametersRead; //PM03928 + private Boolean provideqStringToWelcomeFile; + private Boolean tolerateLocaleMismatchForServingFiles; + private Boolean serveWelcomeFileFromExtendedDocumentRoot; + private Boolean discernUnavailableServlet; + private Boolean setUnencodedHTMLinSendError; + private Boolean sendResponseToClientWhenResponseIsComplete; + private Boolean sendResponseToClientAsPartOfSendRedirect; + private Boolean keepUnReadPostDataAfterResponseSentToClient; + private Boolean finishResponseOnClose; + private Boolean globalListener; + private Boolean checkForceWorkRejected; // only for testing purposes + private Boolean enablePartialURLtoExtendedDocumentRoot; + private Boolean checkedRingetRealPath; + private Boolean disableServletContainerInitializersOnPreV8Apps; + private Boolean ignoreInvalidQueryString; + + private Boolean reInitServletOnInitUnavailableException; + private Boolean setContentLengthOnClose; //PM71666 + private Boolean allowdotsinname; // PM83452 + private Boolean useoriginalrequeststate; //PM88028 + private Boolean destroyservletonserviceunavailableexception; //PM98245 + private Boolean normalizerequesturi; //PI05525 + private String displaytextwhennoerrorpagedefined; //PI09474 + private Boolean throwExceptionForAddELResolver; //PM05903 + private Boolean evalExpressionFollowingTwoBackslashes; //PM81674 + private Boolean limitBuffer; //PK95332 + private Boolean allowdefaulterrorpage; //PI05845 + private Boolean preserveRequestParameterValues; //PI20210 + private Boolean writerOnEmptyBuffer; // PK90190 + private Boolean emptyServletMappings; //PI23529 + private Boolean parameterReturnEmptyString; //PK56156 + private Boolean redirectWithPathInfo; // PK23779 + private Boolean deferServletRequestListenerDestroyOnError; //PI26908 + private Boolean allowExpressionFactoryPerApp; // PI31922 + private Boolean useMaxRequestsizeforMultipart; //PI75528 + + /** + * @return the listeners + */ + public String getListeners() { + return listeners; + } + + /** + * @return the decodeurlasutf8 + */ + public Boolean getDecodeurlasutf8() { + return decodeurlasutf8; + } + + /** + * @return the fileservingenabled + */ + public Boolean getFileservingenabled() { + return fileservingenabled; + } + + /** + * @return the disallowAllFileServing + */ + public Boolean getDisallowAllFileServing() { + return disallowAllFileServing; + } + + /** + * @return the directorybrowsingenabled + */ + public Boolean getDirectorybrowsingenabled() { + return directorybrowsingenabled; + } + + /** + * @return the serveServletsByClassnameEnabled + */ + public Boolean getServeServletsByClassnameEnabled() { + return serveServletsByClassnameEnabled; + } + + /** + * @return the disallowserveservletsbyclassname + */ + public Boolean getDisallowserveservletsbyclassname() { + return disallowserveservletsbyclassname; + } + + /** + * @return the donotservebyclassname + */ + public String getDonotservebyclassname() { + return donotservebyclassname; + } + + /** + * @return the trusthostheaderport + */ + public Boolean getTrusthostheaderport() { + return trusthostheaderport; + } + + /** + * @return the trusted + */ + public Boolean getTrusted() { + return trusted; + } + + /** + * @return the extracthostheaderport + */ + public Boolean getExtracthostheaderport() { + return extracthostheaderport; + } + + /** + * @return the httpsindicatorheader + */ + public String getHttpsindicatorheader() { + return httpsindicatorheader; + } + + /** + * @return the exposeWebInfOnDispatch + */ + public Boolean getExposeWebInfOnDispatch() { + return ExposeWebInfOnDispatch; + } + + /** + * @return the decodeurlplussign + */ + public Boolean getDecodeurlplussign() { + return decodeurlplussign; + } + + /** + * @return the channelwritetype + */ + public String getChannelwritetype() { + return channelwritetype; + } + + /** + * @return the suppressHtmlRecursiveErrorOutput + */ + public Boolean getSuppressHtmlRecursiveErrorOutput() { + return suppressHtmlRecursiveErrorOutput; + } + + /** + * @return the fileWrapperEvents + */ + public Boolean getFilewrapperevents() { + return fileWrapperEvents; + } + + /** + * @return the webgroupvhostnotfound + */ + public String getWebgroupvhostnotfound() { + return webgroupvhostnotfound; + } + + /** + * @return the defaultTraceRequestBehavior + */ + public Boolean getDefaultTraceRequestBehavior() { + return defaultTraceRequestBehavior; + } + + /** + * @return the defaultHeadRequestBehavior + */ + public Boolean getDefaultHeadRequestBehavior() { + return defaultHeadRequestBehavior; + } + + /** + * @return the tolerateSymbolicLinks + */ + public Boolean getTolerateSymbolicLinks() { + return tolerateSymbolicLinks; + } + + /** + * @return the symbolicLinksCacheSize + */ + public Integer getSymbolicLinksCacheSize() { + return symbolicLinksCacheSize; + } + + /** + * @return the enableErrorExceptionTypeFirst + */ + public Boolean getEnableErrorExceptionTypeFirst() { + return enableErrorExceptionTypeFirst; + } + + /** + * @return the enablemultireadofpostdata + */ + public Boolean getEnablemultireadofpostdata() { + return enablemultireadofpostdata; + } + + /** + * @return the skipInputStreamRead + */ + public Boolean getSkipinputstreamread() { + return skipInputStreamRead; + } + + /** + * @return the httpOnlyCookies + */ + public String getHttponlycookies() { + return httpOnlyCookies; + } + + /** + * @return the invokeFilterInitAtStartup + */ + public Boolean getInvokeFilterInitAtStartup() { + return invokeFilterInitAtStartup; + } + + /** + * @return the enablejspmappingoverride + */ + public Boolean getEnablejspmappingoverride() { + return enablejspmappingoverride; + } + + /** + * @return the enabledefaultiselignoredintag + */ + public Boolean getEnabledefaultiselignoredintag() { + return enabledefaultiselignoredintag; + } + + /** + * @return the parseutf8postdata + */ + public Boolean getParseutf8postdata() { + return parseutf8postdata; + } + + /** + * @return the logservletcontainerinitializerclassloadingerrors + */ + public Boolean getLogservletcontainerinitializerclassloadingerrors() { + return logservletcontainerinitializerclassloadingerrors; + } + + /** + * @return the allowincludesenderror + */ + public Boolean getAllowincludesenderror() { + return allowincludesenderror; + } + + /** + * @return the skipmetainfresourcesprocessing + */ + public Boolean getSkipmetainfresourcesprocessing() { + return skipmetainfresourcesprocessing; + } + + /** + * @return the metainfresourcescachesize + */ + public Integer getMetainfresourcescachesize() { + return metainfresourcescachesize; + } + + public Boolean getDeferServletLoad() { + return deferServletLoad; + } + + /** + * @return the asyncmaxsizetaskpool + */ + public Integer getAsyncmaxsizetaskpool() { + return asyncmaxsizetaskpool; + } + + /** + * @return the asyncpurgeinterval + */ + public Integer getAsyncpurgeinterval() { + return asyncpurgeinterval; + } + + /** + * @return the asynctimeoutdefault + */ + public Integer getAsynctimeoutdefault() { + return asynctimeoutdefault; + } + + /** + * @return the asynctimerthreads + */ + public Integer getAsynctimerthreads() { + return asynctimerthreads; + } + + /** + * @return the xpoweredby + */ + public String getXpoweredby() { + return xpoweredby; + } + + /** + * @return the disablexpoweredby + */ + public Boolean getDisablexpoweredby() { + return disablexpoweredby; + } + + /** + * @return the enableDefaultServletRequestPathElements + */ + public Boolean getEnableDefaultServletRequestPathElements() { + return enableDefaultServletRequestPathElements; + } + + /** + * @return the copyattributeskeyset + */ + public Boolean getCopyattributeskeyset() { + return copyattributeskeyset; + } + + /** + * @return the contentType + */ + public String getContenttype() { + return contentType; + } + + /** + * @return the mapfilterstoasterisk + */ + public Boolean getMapfilterstoasterisk() { + return mapFiltersToAsterisk; + } + + /** + * @return the invokeFiltersCompatibility + */ + public Boolean getInvokefilterscompatibility() { + return invokeFiltersCompatibility; + } + + /** + * @return the DisableSetCharacterEncodingAfterParametersRead + */ + public Boolean getDisablesetcharacterencodingafterparametersread() { + return DisableSetCharacterEncodingAfterParametersRead; + } + + /** + * @return the provideqStringToWelcomeFile + */ + public Boolean getProvideqstringtowelcomefile() { + return provideqStringToWelcomeFile; + } + + /** + * @return the tolerateLocaleMismatchForServingFiles + */ + public Boolean getToleratelocalemismatchforservingfiles() { + return tolerateLocaleMismatchForServingFiles; + } + + /** + * @return the tolerateLocaleMismatchForServingFiles + */ + public Boolean getServewelcomefilefromextendeddocumentroot() { + return serveWelcomeFileFromExtendedDocumentRoot; + } + + /** + * @return the discernUnavailableServlet + */ + public Boolean getDiscernunavailableservlet() { + return discernUnavailableServlet; + } + + /** + * @return the reInitServletOnInitUnavailableException + */ + public Boolean getReInitServletOnInitUnavailableException() { + return reInitServletOnInitUnavailableException; + } + + /** + * @return the setUnencodedHTMLinSendError + */ + public Boolean getSetUnencodedhtmlinsenderror() { + return setUnencodedHTMLinSendError; + } + + /** + * @return the sendResponseToClientWhenResponseIsComplete + */ + public Boolean getSendresponsetoclientwhenresponseiscomplete() { + return sendResponseToClientWhenResponseIsComplete; + } + + /** + * @return the sendResponseToClientAsPartOfSendRedirect + */ + public Boolean getSendresponsetoclientaspartofsendredirect() { + return sendResponseToClientAsPartOfSendRedirect; + } + + /** + * @return the keepUnReadPostDataAfterResponseSentToClient + */ + public Boolean getKeepunreadpostdataafterresponsesenttoclient() { + return keepUnReadPostDataAfterResponseSentToClient; + } + + /** + * @return the finishResponseOnClose + */ + public Boolean getFinishresponseonclose() { + return finishResponseOnClose; + } + + /** + * @return the globalListener + */ + public Boolean getGloballistener() { + return globalListener; + } + + /** + * @return the checkForceWorkRejected + */ + public Boolean getCheckforceworkrejected() { + return checkForceWorkRejected; + } + + /** + * @return the enablePartialURLtoExtendedDocumentRoot + */ + public Boolean getEnablepartialurltoextendeddocumentroot() { + return enablePartialURLtoExtendedDocumentRoot; + } + + /** + * @return the checkedRingetRealPath + */ + public Boolean getCheckedringetrealpath() { + return checkedRingetRealPath; + } + + /** + * @return the disableServletContainerInitializersOnPreV8Apps + */ + public Boolean getdisableServletContainerInitializersOnPreV8Apps() { + return disableServletContainerInitializersOnPreV8Apps; + } + + public Boolean getIgnoreInvalidQueryString() { + return ignoreInvalidQueryString; + } + + //PM71666 + public Boolean getSetContentLengthOnClose() { + return setContentLengthOnClose; + } + + //PM83452 // PM82876 + /** + * @return the allowdotsinname + */ + public Boolean getAllowdotsinname() { + return allowdotsinname; + } + + /** + * @return the destroyservletonserviceunavailableexception + */ + public Boolean getDestroyservletonserviceunavailableexception() { + return destroyservletonserviceunavailableexception; + } //PM98245 + + /** + * @return the normalizerequesturi + */ + public Boolean getNormalizerequesturi() { + return normalizerequesturi; + } //PI05525 + + /** + * @return the displaytextwhennoerrorpagedefined + */ + public String getDisplaytextwhennoerrorpagedefined() { + return displaytextwhennoerrorpagedefined; + } //PI09474 + + /** + * @return the throwExceptionForAddELResolver + */ + public Boolean getThrowExceptionForAddELResolver() { + return throwExceptionForAddELResolver; + } //PM05903 + + public Boolean getEvalExpressionFollowingTwoBackslashes() { + return evalExpressionFollowingTwoBackslashes; + } //PM81674 + + public Boolean getLimitBuffer() { + return limitBuffer; + } //PM81674 + + /** + * @return the allowdefaulterrorpage + */ + public Boolean getAllowdefaulterrorpage() { + return allowdefaulterrorpage; + } //PI05845 + + public Boolean getPreserveRequestParameterValues() { + return preserveRequestParameterValues; + } //PI20210 + + public Boolean getWriterOnEmptyBuffer() { + return writerOnEmptyBuffer; + } // PK90190 + + public Boolean getEmptyServletMappings() { + return emptyServletMappings; + } // PI23529 + + public Boolean getParameterReturnEmptyString() { + return parameterReturnEmptyString; + } // PK56156 + + public Boolean getRedirectWithPathInfo() { + return redirectWithPathInfo; + } // PK23779 + + /** + * @return the deferservletrequestlistenerdestroyonerror + */ + public Boolean getDeferServletRequestListenerDestroyOnError() { + return deferServletRequestListenerDestroyOnError; + } // PI26908 + + public Boolean getAllowExpressionFactoryPerApp() { + return allowExpressionFactoryPerApp; + } // PI31922 + + /** + * @return the useMaxRequestsizeforMultipart + */ + public Boolean getUseMaxRequestsizeforMultipart() { + return useMaxRequestsizeforMultipart; + } + + @XmlAttribute(name = "listeners") + public void setListeners(String s) { + this.listeners = s; + } + + @XmlAttribute(name = "decodeurlasutf8") + public void setDecodeurlasutf8(Boolean b) { + this.decodeurlasutf8 = b; + } + + @XmlAttribute(name = "fileservingenabled") + public void setFileservingenabled(Boolean b) { + this.fileservingenabled = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.disallowAllFileServing") + public void setDisallowAllFileServing(Boolean b) { + this.disallowAllFileServing = b; + } + + @XmlAttribute(name = "directorybrowsingenabled") + public void setDirectorybrowsingenabled(Boolean b) { + this.directorybrowsingenabled = b; + } + + @XmlAttribute(name = "serveServletsByClassnameEnabled") + public void setServeServletsByClassnameEnabled(Boolean b) { + this.serveServletsByClassnameEnabled = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.disallowserveservletsbyclassname") + public void setDisallowserveservletsbyclassname(Boolean b) { + this.disallowserveservletsbyclassname = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.donotservebyclassname") + public void setDonotservebyclassname(String s) { + this.donotservebyclassname = s; + } + + @XmlAttribute(name = "trusthostheaderport") + public void setTrusthostheaderport(Boolean b) { + this.trusthostheaderport = b; + } + + @XmlAttribute(name = "trusted") + public void setTrusted(Boolean b) { + this.trusted = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.extracthostheaderport") + public void setExtracthostheaderport(Boolean b) { + this.extracthostheaderport = b; + } + + @XmlAttribute(name = "httpsindicatorheader") + public void setHttpsindicatorheader(String s) { + this.httpsindicatorheader = s; + } + + @XmlAttribute(name = "ExposeWebInfOnDispatch") + public void setExposeWebInfOnDispatch(Boolean b) { + this.ExposeWebInfOnDispatch = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.decodeurlplussign") + public void setDecodeurlplussign(Boolean b) { + this.decodeurlplussign = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.channelwritetype") + public void setChannelwritetype(String s) { + this.channelwritetype = s; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.suppressHtmlRecursiveErrorOutput") + public void setSuppressHtmlRecursiveErrorOutput(Boolean b) { + this.suppressHtmlRecursiveErrorOutput = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.fileWrapperEvents") + public void setFilewrapperevents(Boolean b) { + this.fileWrapperEvents = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.webgroupvhostnotfound") + public void setWebgroupvhostnotfound(String s) { + this.webgroupvhostnotfound = s; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.invokefilterscompatibility") + public void setInvokefilterscompatibility(Boolean b) { + this.invokeFiltersCompatibility = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.DefaultTraceRequestBehavior") + public void setDefaultTraceRequestBehavior(Boolean b) { + this.defaultTraceRequestBehavior = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.DefaultHeadRequestBehavior") + public void setDefaultHeadRequestBehavior(Boolean b) { + this.defaultHeadRequestBehavior = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.TolerateSymbolicLinks") + public void setTolerateSymbolicLinks(Boolean b) { + this.tolerateSymbolicLinks = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.SymbolicLinksCacheSize") + public void setSymbolicLinksCacheSize(Integer i) { + this.symbolicLinksCacheSize = i; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.enableErrorExceptionTypeFirst") + public void setEnableErrorExceptionTypeFirst(Boolean b) { + this.enableErrorExceptionTypeFirst = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.enablemultireadofpostdata") + public void setEnablemultireadofpostdata(Boolean b) { + this.enablemultireadofpostdata = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.skipinputstreamread") + public void setSkipinputstreamread(Boolean b) { + this.skipInputStreamRead = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.httponlycookies") + public void setHttponlycookies(String b) { + this.httpOnlyCookies = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.invokeFilterInitAtStartup") + public void setInvokeFilterInitAtStartup(Boolean b) { + this.invokeFilterInitAtStartup = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.enablejspmappingoverride") + public void setEnablejspmappingoverride(Boolean b) { + this.enablejspmappingoverride = b; + } + + @XmlAttribute(name = "com.ibm.ws.jsp.enabledefaultiselignoredintag") + public void setEnabledefaultiselignoredintag(Boolean b) { + this.enabledefaultiselignoredintag = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.parseutf8postdata") + public void setParseutf8postdata(Boolean b) { + this.parseutf8postdata = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.logservletcontainerinitializerclassloadingerrors") + public void setLogservletcontainerinitializerclassloadingerrors(Boolean b) { + this.logservletcontainerinitializerclassloadingerrors = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.allowincludesenderror") + public void setAllowincludesenderror(Boolean b) { + this.allowincludesenderror = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.skipmetainfresourcesprocessing") + public void setSkipmetainfresourcesprocessing(Boolean b) { + this.skipmetainfresourcesprocessing = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.metainfresourcescachesize") + public void setMetainfresourcescachesize(Integer i) { + this.metainfresourcescachesize = i; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.asyncmaxsizetaskpool") + public void setAsyncmaxsizetaskpool(Integer i) { + this.asyncmaxsizetaskpool = i; + } + + @XmlAttribute(name = "deferServletLoad") + public void setDeferServletLoad(Boolean deferServletLoad) { + this.deferServletLoad = deferServletLoad; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.asyncpurgeinterval") + public void setAsyncpurgeinterval(Integer i) { + this.asyncpurgeinterval = i; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.asynctimeoutdefault") + public void setAsynctimeoutdefault(Integer i) { + this.asynctimeoutdefault = i; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.asynctimerthreads") + public void setAsynctimerthreads(Integer i) { + this.asynctimerthreads = i; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.xpoweredby") + public void setXpoweredby(String s) { + this.xpoweredby = s; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.disablexpoweredby") + public void setDisablexpoweredby(Boolean b) { + this.disablexpoweredby = b; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.enabledefaultservletrequestpathelements") + public void setEnableDefaultServletRequestPathElements(Boolean e) { + this.enableDefaultServletRequestPathElements = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.copyattributeskeyset") + public void setCopyattributeskeyset(Boolean e) { + this.copyattributeskeyset = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.contenttypecompatibility") + public void setContenttype(String v) { + this.contentType = v; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.mapfilterstoasterisk") + public void setMapfilterstoasterisk(Boolean e) { + this.mapFiltersToAsterisk = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.disablesetcharacterencodingafterparametersread") + public void setDisablesetcharacterencodingafterparametersread(Boolean e) { + this.DisableSetCharacterEncodingAfterParametersRead = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.provideqstringtowelcomefile") + public void setProvideqstringtowelcomefile(Boolean e) { + this.provideqStringToWelcomeFile = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.toleratelocalemismatchforservingfiles") + public void setToleratelocalemismatchforservingfiles(Boolean e) { + this.tolerateLocaleMismatchForServingFiles = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.servewelcomefilefromextendeddocumentroot") + public void setServewelcomefilefromextendeddocumentroot(Boolean e) { + this.serveWelcomeFileFromExtendedDocumentRoot = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.discernunavailableservlet") + public void setDiscernunavailableservlet(Boolean e) { + this.discernUnavailableServlet = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.reinitservletoninitunavailableexception") + public void setReInitServletOnInitUnavailableException(Boolean e) { + this.reInitServletOnInitUnavailableException = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.setunencodedhtmlinsenderror") + public void setSetUnencodedhtmlinsenderror(Boolean e) { + this.setUnencodedHTMLinSendError = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.sendresponsetoclientwhenresponseiscomplete") + public void setSendresponsetoclientwhenresponseiscomplete(Boolean e) { + this.sendResponseToClientWhenResponseIsComplete = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.sendresponsetoclientaspartofsendredirect") + public void setSendresponsetoclientaspartofsendredirect(Boolean e) { + this.sendResponseToClientAsPartOfSendRedirect = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.keepunreadpostdataafterresponsesenttoclient") + public void setKeepunreadpostdataafterresponsesenttoclient(Boolean e) { + this.keepUnReadPostDataAfterResponseSentToClient = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.finishresponseonclose") + public void setFinishresponseonclose(Boolean e) { + this.finishResponseOnClose = e; + } + + @XmlAttribute(name = "com.ibm.webcontainer.fvt.listeners.globallistener") + public void setGloballistener(Boolean e) { + this.globalListener = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.checkforceworkrejected") + public void setCheckforceworkrejected(Boolean e) { + this.checkForceWorkRejected = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.enablepartialurltoextendeddocumentroot") + public void setEnablepartialurltoextendeddocumentroot(Boolean e) { + this.enablePartialURLtoExtendedDocumentRoot = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.checkedringetrealpath") + public void setCheckedringetrealpath(Boolean e) { + this.checkedRingetRealPath = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.disableServletContainerInitializersOnPreV8Apps") + public void setdisableServletContainerInitializersOnPreV8Apps(Boolean e) { + this.disableServletContainerInitializersOnPreV8Apps = e; + } + + @XmlAttribute(name = "com.ibm.ws.webcontainer.ignoreInvalidQueryString") + public void setIgnoreInvalidQueryString(Boolean e) { + this.ignoreInvalidQueryString = e; + } + + //PM71666 + @XmlAttribute(name = "setcontentlengthonclose") + public void setSetContentLengthOnClose(Boolean setContentLengthOnClose) { + this.setContentLengthOnClose = setContentLengthOnClose; + } + + /** + * @param allowdotsinname the allowdotsinname to set + */ + @XmlAttribute(name = "com.ibm.ws.webcontainer.allowdotsinname") + public void setAllowdotsinname(Boolean allowdotsinname) { + this.allowdotsinname = allowdotsinname; + } + + //PM88028 Start + /** + * @return the useoriginalrequeststate + */ + public Boolean getUseoriginalrequeststate() { + return useoriginalrequeststate; + } + + /** + * @param useoriginalrequeststate the useoriginalrequeststate to set + */ + @XmlAttribute(name = "com.ibm.ws.webcontainer.useoriginalrequeststate") + public void setUseoriginalrequeststate(Boolean useoriginalrequeststate) { + this.useoriginalrequeststate = useoriginalrequeststate; + } + + //PM88028 End + + /** + * @param destroyservletonserviceunavailableexception the destroyservletonserviceunavailableexception to set + */ + @XmlAttribute(name = "com.ibm.ws.webcontainer.destroyservletonserviceunavailableexception") + public void setDestroyservletonserviceunavailableexception(Boolean destroyservletonserviceunavailableexception) { + this.destroyservletonserviceunavailableexception = destroyservletonserviceunavailableexception; + }//PM98245 + + /** + * @param normalizerequesturi the normalizerequesturi to set + */ + @XmlAttribute(name = "com.ibm.ws.webcontainer.normalizerequesturi") + public void setNormalizerequesturi(Boolean normalizerequesturi) { + this.normalizerequesturi = normalizerequesturi; + } + + /** + * @param displaytextwhennoerrorpagedefined the displaytextwhennoerrorpagedefined to set + */ + @XmlAttribute(name = "com.ibm.ws.webcontainer.displaytextwhennoerrorpagedefined") + public void setDisplaytextwhennoerrorpagedefined(String displaytextwhennoerrorpagedefined) { + this.displaytextwhennoerrorpagedefined = displaytextwhennoerrorpagedefined; + } //PI09474 + + @XmlAttribute(name = "com.ibm.ws.jsp.throwExceptionForAddELResolver") + public void setThrowExceptionForAddELResolver(Boolean throwExceptionForAddELResolver) { + this.throwExceptionForAddELResolver = throwExceptionForAddELResolver; + } //PM05903 + + /** + * @param evalExpressionFollowingTwoBackslashes the evalExpressionFollowingTwoBackslashes to set + */ + @XmlAttribute(name = "com.ibm.ws.jsp.evalexpressionfollowingtwobackslashes") + public void setEvalExpressionFollowingTwoBackslashes(Boolean evalExpressionFollowingTwoBackslashes) { + this.evalExpressionFollowingTwoBackslashes = evalExpressionFollowingTwoBackslashes; + }//PM81674 + + /** + * @param limitBuffer the limitBuffer to set + */ + @XmlAttribute(name = "com.ibm.ws.jsp.limitBuffer") + public void setLimitBuffer(Boolean limitBuffer) { + this.limitBuffer = limitBuffer; + }//PK95332 + + /** + * @param allowdefaulterrorpage the allowdefaulterrorpage to set + */ + @XmlAttribute(name = "com.ibm.ws.webcontainer.allowdefaulterrorpage") + public void setAllowdefaulterrorpage(Boolean allowdefaulterrorpage) { + this.allowdefaulterrorpage = allowdefaulterrorpage; + }//PI05845 + + /** + * @param preserveRequestParameterValues to return a clone of the original request param values + */ + @XmlAttribute(name = "com.ibm.ws.webcontainer.preserverequestparametervalues") + public void setPreserveRequestParameterValues(Boolean preserveRequestParameterValues) { + this.preserveRequestParameterValues = preserveRequestParameterValues; + } //PI20210 + + /** + * @param writerOnEmptyBuffer the writerOnEmptyBuffer to set + */ + @XmlAttribute(name = "com.ibm.ws.jsp.getwriteronemptybuffer") + public void setWriterOnEmptyBuffer(Boolean writerOnEmptyBuffer) { + this.writerOnEmptyBuffer = writerOnEmptyBuffer; + } //PK90190 + + /** + * @param emptyServletMappings - true to return an empty list when mappings are empty, false to return null + */ + @XmlAttribute(name = "com.ibm.ws.webcontainer.emptyservletmappings") + public void setEmptyServletMappings(Boolean emptyServletMappings) { + this.emptyServletMappings = emptyServletMappings; + } //PI23529 + + /** + * @param parameterReturnEmptyString - true to return an empty string when calling jsp:getProperty on a property that has + * not been set , false to return null + */ + @XmlAttribute(name = "com.ibm.ws.jsp.getparameterreturnemptystring") + public void setParameterReturnEmptyString(Boolean parameterReturnEmptyString) { + this.parameterReturnEmptyString = parameterReturnEmptyString; + } //PK56156 + + /** + * @param redirectWithPathInfo - true to allow redirect with the request URI's path info, false to redirect using + * only the request URI + */ + @XmlAttribute(name = "com.ibm.ws.webcontainer.redirectwithpathinfo") + public void setRedirectWithPathInfo(Boolean redirectWithPathInfo) { + this.redirectWithPathInfo = redirectWithPathInfo; + } // PK23779 + + /** + * @param deferServletRequestListenerDestroyOnError the deferServletRequestListenerDestroyOnError to set + */ + @XmlAttribute(name = "com.ibm.ws.webcontainer.deferservletrequestlistenerdestroyonerror") + public void setDeferServletRequestListenerDestroyOnError(Boolean deferServletRequestListenerDestroyOnError) { + this.deferServletRequestListenerDestroyOnError = deferServletRequestListenerDestroyOnError; + } //PI26908 + + /** + * @param allowExpressionFactoryPerApp - true to allow multiple ExpressionFactory implementations, false to only use + * ExpressionFactory of first loaded application + */ + @XmlAttribute(name = "com.ibm.ws.jsp.allowexpressionfactoryperapp") + public void setAllowExpressionFactoryPerApp(Boolean allowExpressionFactoryPerApp) { + this.allowExpressionFactoryPerApp = allowExpressionFactoryPerApp; + } // PI31922 + + /** + * @param useMaxRequestsizeforMultipart the useMaxRequestsizeforMultipart to set + */ + @XmlAttribute(name = "com.ibm.ws.webcontainer.usemaxrequestsizeformultipart") + public void setUseMaxRequestsizeforMultipart(Boolean useMaxRequestsizeforMultipart) { + this.useMaxRequestsizeforMultipart = useMaxRequestsizeforMultipart; + }//PI75528 + + /* + * listeners + * decodeurlasutf8 + * fileservingenabled + * directorybrowsingenabled + * serveServletsByClassnameEnabled + * com.ibm.ws.webcontainer.disallowserveservletsbyclassname + * com.ibm.ws.webcontainer.donotservebyclassname + * trusthostheaderport + * trusted + * com.ibm.ws.webcontainer.extracthostheaderport + * httpsindicatorheader + * ExposeWebInfOnDispatch + * com.ibm.ws.webcontainer.decodeurlplussign + * com.ibm.ws.webcontainer.channelwritetype + * com.ibm.ws.webcontainer.suppressHtmlRecursiveErrorOutput + * com.ibm.ws.webcontainer.fileWrapperEvents + * com.ibm.ws.webcontainer.webgroupvhostnotfound + * com.ibm.ws.webcontainer.DefaultTraceRequestBehavior + * com.ibm.ws.webcontainer.DefaultHeadRequestBehavior + * com.ibm.ws.webcontainer.TolerateSymbolicLinks + * com.ibm.ws.webcontainer.SymbolicLinksCacheSize + * com.ibm.ws.webcontainer.enableErrorExceptionTypeFirst + * com.ibm.ws.webcontainer.enablemultireadofpostdata + * com.ibm.ws.webcontainer.invokeFilterInitAtStartup + * com.ibm.ws.webcontainer.enablejspmappingoverride + * com.ibm.ws.jsp.enabledefaultiselignoredintag + * com.ibm.ws.webcontainer.parseutf8postdata + * com.ibm.ws.webcontainer.logservletcontainerinitializerclassloadingerrors + * com.ibm.ws.webcontainer.allowincludesenderror + * com.ibm.ws.webcontainer.skipmetainfresourcesprocessing + * com.ibm.ws.webcontainer.metainfresourcescachesize + * com.ibm.ws.webcontainer.xpoweredby + * com.ibm.ws.webcontainer.disablexpoweredby + */ + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("WebContainerElement{"); + if (listeners != null) + buf.append("listeners=\"" + listeners + "\" "); + if (decodeurlasutf8 != null) + buf.append("decodeurlasutf8=\"" + decodeurlasutf8 + "\" "); + if (fileservingenabled != null) + buf.append("fileservingenabled=\"" + fileservingenabled + "\" "); + if (disallowAllFileServing != null) + buf.append("disallowAllFileServing=\"" + disallowAllFileServing + "\" "); + if (directorybrowsingenabled != null) + buf.append("directorybrowsingenabled=\"" + directorybrowsingenabled + "\" "); + if (serveServletsByClassnameEnabled != null) + buf.append("serveServletsByClassnameEnabled=\"" + serveServletsByClassnameEnabled + "\" "); + if (disallowserveservletsbyclassname != null) + buf.append("disallowserveservletsbyclassname=\"" + disallowserveservletsbyclassname + "\" "); + if (donotservebyclassname != null) + buf.append("donotservebyclassname=\"" + donotservebyclassname + "\" "); + if (trusthostheaderport != null) + buf.append("trusthostheaderport=\"" + trusthostheaderport + "\" "); + if (trusted != null) + buf.append("trusted=\"" + trusted + "\" "); + if (extracthostheaderport != null) + buf.append("extracthostheaderport=\"" + extracthostheaderport + "\" "); + if (httpsindicatorheader != null) + buf.append("httpsindicatorheader=\"" + httpsindicatorheader + "\" "); + if (ExposeWebInfOnDispatch != null) + buf.append("ExposeWebInfOnDispatch=\"" + ExposeWebInfOnDispatch + "\" "); + if (decodeurlplussign != null) + buf.append("decodeurlplussign=\"" + decodeurlplussign + "\" "); + if (channelwritetype != null) + buf.append("channelwritetype=\"" + channelwritetype + "\" "); + if (suppressHtmlRecursiveErrorOutput != null) + buf.append("suppressHtmlRecursiveErrorOutput=\"" + suppressHtmlRecursiveErrorOutput + "\" "); + if (fileWrapperEvents != null) + buf.append("fileWrapperEvents=\"" + fileWrapperEvents + "\" "); + if (webgroupvhostnotfound != null) + buf.append("webgroupvhostnotfound=\"" + webgroupvhostnotfound + "\" "); + if (invokeFiltersCompatibility != null) + buf.append("invokeFiltersCompatibility=\"" + invokeFiltersCompatibility + "\" "); + if (defaultTraceRequestBehavior != null) + buf.append("defaultTraceRequestBehavior=\"" + defaultTraceRequestBehavior + "\" "); + if (defaultHeadRequestBehavior != null) + buf.append("defaultHeadRequestBehavior=\"" + defaultHeadRequestBehavior + "\" "); + if (tolerateSymbolicLinks != null) + buf.append("tolerateSymbolicLinks=\"" + tolerateSymbolicLinks + "\" "); + if (symbolicLinksCacheSize != null) + buf.append("symbolicLinksCacheSize=\"" + symbolicLinksCacheSize + "\" "); + if (enableErrorExceptionTypeFirst != null) + buf.append("enableErrorExceptionTypeFirst=\"" + enableErrorExceptionTypeFirst + "\" "); + if (enablemultireadofpostdata != null) + buf.append("enablemultireadofpostdata=\"" + enablemultireadofpostdata + "\" "); + if (skipInputStreamRead != null) + buf.append("skipInputStreamRead=\"" + skipInputStreamRead + "\" "); + if (httpOnlyCookies != null) + buf.append("httpOnlyCookies=\"" + httpOnlyCookies + "\" "); + if (invokeFilterInitAtStartup != null) + buf.append("invokeFilterInitAtStartup=\"" + invokeFilterInitAtStartup + "\" "); + if (enablejspmappingoverride != null) + buf.append("enablejspmappingoverride=\"" + enablejspmappingoverride + "\" "); + if (enabledefaultiselignoredintag != null) + buf.append("enabledefaultiselignoredintag=\"" + enabledefaultiselignoredintag + "\" "); + if (parseutf8postdata != null) + buf.append("parseutf8postdata=\"" + parseutf8postdata + "\" "); + if (logservletcontainerinitializerclassloadingerrors != null) + buf.append("logservletcontainerinitializerclassloadingerrors=\"" + logservletcontainerinitializerclassloadingerrors + "\" "); + if (allowincludesenderror != null) + buf.append("allowincludesenderror=\"" + allowincludesenderror + "\" "); + if (skipmetainfresourcesprocessing != null) + buf.append("skipmetainfresourcesprocessing=\"" + skipmetainfresourcesprocessing + "\" "); + if (metainfresourcescachesize != null) + buf.append("metainfresourcescachesize=\"" + metainfresourcescachesize + "\" "); + + if (deferServletLoad != null) + buf.append("deferServletLoad=\"" + deferServletLoad + "\" "); + + if (asyncmaxsizetaskpool != null) + buf.append("asyncmaxsizetaskpool=\"" + asyncmaxsizetaskpool + "\" "); + if (asyncpurgeinterval != null) + buf.append("asyncpurgeinterval=\"" + asyncpurgeinterval + "\" "); + if (asynctimeoutdefault != null) + buf.append("asynctimeoutdefault=\"" + asynctimeoutdefault + "\" "); + if (asynctimerthreads != null) + buf.append("asynctimerthreads=\"" + asynctimerthreads + "\" "); + + if (xpoweredby != null) + buf.append("xpoweredby=\"" + xpoweredby + "\" "); + if (disablexpoweredby != null) + buf.append("disablexpoweredby=\"" + disablexpoweredby + "\" "); + if (enableDefaultServletRequestPathElements != null) + buf.append("enableDefaultServletRequestPathElements=\"" + enableDefaultServletRequestPathElements + "\" "); + if (copyattributeskeyset != null) + buf.append("copyattributeskeyset=\"" + copyattributeskeyset + "\" "); + if (mapFiltersToAsterisk != null) + buf.append("mapFiltersToAsterisk=\"" + mapFiltersToAsterisk + "\" "); + if (DisableSetCharacterEncodingAfterParametersRead != null) + buf.append("DisableSetCharacterEncodingAfterParametersRead=\"" + DisableSetCharacterEncodingAfterParametersRead + "\" "); + if (provideqStringToWelcomeFile != null) + buf.append("provideqStringToWelcomeFile=\"" + provideqStringToWelcomeFile + "\" "); + if (tolerateLocaleMismatchForServingFiles != null) + buf.append("tolerateLocaleMismatchForServingFiles=\"" + tolerateLocaleMismatchForServingFiles + "\" "); + if (serveWelcomeFileFromExtendedDocumentRoot != null) + buf.append("serveWelcomeFileFromExtendedDocumentRoot=\"" + serveWelcomeFileFromExtendedDocumentRoot + "\" "); + if (discernUnavailableServlet != null) + buf.append("discernUnavailableServlet=\"" + discernUnavailableServlet + "\" "); + if (reInitServletOnInitUnavailableException != null) + buf.append("reInitServletOnInitUnavailableException=\"" + reInitServletOnInitUnavailableException + "\" "); + if (setUnencodedHTMLinSendError != null) + buf.append("setUnencodedHTMLinSendError=\"" + setUnencodedHTMLinSendError + "\" "); + if (sendResponseToClientWhenResponseIsComplete != null) + buf.append("sendResponseToClientWhenResponseIsComplete=\"" + sendResponseToClientWhenResponseIsComplete + "\" "); + if (sendResponseToClientAsPartOfSendRedirect != null) + buf.append("sendResponseToClientAsPartOfSendRedirect=\"" + sendResponseToClientAsPartOfSendRedirect + "\" "); + if (keepUnReadPostDataAfterResponseSentToClient != null) + buf.append("keepUnReadPostDataAfterResponseSentToClient=\"" + keepUnReadPostDataAfterResponseSentToClient + "\" "); + if (finishResponseOnClose != null) + buf.append("finishResponseOnClose=\"" + finishResponseOnClose + "\" "); + if (globalListener != null) + buf.append("globalListener=\"" + globalListener + "\" "); + if (checkForceWorkRejected != null) + buf.append("checkForceWorkRejected=\"" + checkForceWorkRejected + "\" "); + if (enablePartialURLtoExtendedDocumentRoot != null) + buf.append("enablePartialURLtoExtendedDocumentRoot=\"" + enablePartialURLtoExtendedDocumentRoot + "\" "); + if (checkedRingetRealPath != null) + buf.append("checkedRingetRealPath=\"" + checkedRingetRealPath + "\" "); + if (disableServletContainerInitializersOnPreV8Apps != null) + buf.append("disableServletContainerInitializersOnPreV8Apps=\"" + disableServletContainerInitializersOnPreV8Apps + "\" "); + if (ignoreInvalidQueryString != null) + buf.append("ignoreInvalidQueryString=\"" + ignoreInvalidQueryString + "\" "); + //PM71666 + if (setContentLengthOnClose != null) + buf.append("setContentLengthOnClose=\"" + setContentLengthOnClose + "\" "); + //PM83452 //PM82876 + if (allowdotsinname != null) + buf.append("allowDotsinName=\"" + allowdotsinname + "\" "); + //PM88028 + if (useoriginalrequeststate != null) + buf.append("useoriginalrequeststate=\"" + useoriginalrequeststate + "\" "); + //PM98245 + if (destroyservletonserviceunavailableexception != null) + buf.append("destroyservletonserviceunavailableexception=\"" + destroyservletonserviceunavailableexception + "\" "); + //PI05525 + if (normalizerequesturi != null) + buf.append("normalizerequesturi=\"" + normalizerequesturi + "\" "); + if (displaytextwhennoerrorpagedefined != null) + buf.append("displaytextwhennoerrorpagedefined=\"" + displaytextwhennoerrorpagedefined + "\" "); + //PI09474 + + //PM05903 + if (throwExceptionForAddELResolver != null) + buf.append("throwExceptionForAddELResolver=\"" + throwExceptionForAddELResolver + "\" "); + + //PM81674 + if (evalExpressionFollowingTwoBackslashes != null) + buf.append("evalExpressionFollowingTwoBackslashes=\"" + evalExpressionFollowingTwoBackslashes + "\" "); + + //PK95332 + if (limitBuffer != null) + buf.append("limitBuffer=\"" + limitBuffer + "\" "); + + //PI05845 + if (allowdefaulterrorpage != null) + buf.append("allowdefaulterrorpage=\"" + allowdefaulterrorpage + "\" "); + + //PI20210 + if (preserveRequestParameterValues != null) + buf.append("preserveRequestParameterValues=\"" + preserveRequestParameterValues + "\" "); + + if (writerOnEmptyBuffer != null) + buf.append("writerOnEmptyBuffer=\"" + writerOnEmptyBuffer + "\" "); + + //PI23529 + if (emptyServletMappings != null) + buf.append("emptyServletMappings=\"" + emptyServletMappings + "\" "); + + //PK56156 + if (parameterReturnEmptyString != null) + buf.append("parameterReturnEmptyString=\"" + parameterReturnEmptyString + "\" "); + + // PK23779 + if (redirectWithPathInfo != null) + buf.append("redirectWithPathInfo=\"" + redirectWithPathInfo + "\" "); + + //PI26908 + if (deferServletRequestListenerDestroyOnError != null) + buf.append("deferServletRequestListenerDestroyOnError=\"" + deferServletRequestListenerDestroyOnError + "\" "); + + // PI31922 + if (allowExpressionFactoryPerApp != null) + buf.append("allowExpressionFactoryPerApp=\"" + allowExpressionFactoryPerApp + "\" "); + + //PI75528 + if (useMaxRequestsizeforMultipart != null) + buf.append("useMaxRequestsizeforMultipart=\"" + useMaxRequestsizeforMultipart + "\" "); + + buf.append("}"); + return buf.toString(); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/ClassloaderContext.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/ClassloaderContext.java new file mode 100755 index 000000000000..05b97840d446 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/ClassloaderContext.java @@ -0,0 +1,33 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config.context; + +import com.ibm.websphere.simplicity.config.ConfigElement; + +/** + * Represents the element which can be nested under + */ +public class ClassloaderContext extends ConfigElement { + /** + * Returns a string containing a list of the properties and their values. + * + * @return String representing the data + */ + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + buf.append("}"); + return buf.toString(); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/JEEMetadataContext.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/JEEMetadataContext.java new file mode 100755 index 000000000000..93e76e331329 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/JEEMetadataContext.java @@ -0,0 +1,33 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config.context; + +import com.ibm.websphere.simplicity.config.ConfigElement; + +/** + * Represents the element which can be nested under + */ +public class JEEMetadataContext extends ConfigElement { + /** + * Returns a string containing a list of the properties and their values. + * + * @return String representing the data + */ + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + buf.append("}"); + return buf.toString(); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/SecurityContext.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/SecurityContext.java new file mode 100755 index 000000000000..43190b76ef14 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/SecurityContext.java @@ -0,0 +1,60 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config.context; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.ConfigElement; + +/** + * Represents the element which can be nested under + */ +public class SecurityContext extends ConfigElement { + private String callerSubject; + private String invocationSubject; + + public String getCallerSubject() { + return callerSubject; + } + + public String getInvocationSubject() { + return invocationSubject; + } + + @XmlAttribute(name = "callerSubject") + public void setCallerSubject(String subject) { + callerSubject = subject; + } + + @XmlAttribute(name = "invocationSubject") + public void setInvocationSubject(String subject) { + invocationSubject = subject; + } + + /** + * Returns a string containing a list of the properties and their values. + * + * @return String representing the data + */ + @Override + public String toString() { + StringBuilder buf = new StringBuilder("securityContext{"); + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + if (callerSubject != null) + buf.append("callerSubject=").append(callerSubject).append(' '); + if (invocationSubject != null) + buf.append("invocationSubject=").append(invocationSubject).append(' '); + buf.append("}"); + return buf.toString(); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/SyncToOSThreadContext.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/SyncToOSThreadContext.java new file mode 100755 index 000000000000..69ec0fc5cf21 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/SyncToOSThreadContext.java @@ -0,0 +1,33 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config.context; + +import com.ibm.websphere.simplicity.config.ConfigElement; + +/** + * Represents the element which can be nested under + */ +public class SyncToOSThreadContext extends ConfigElement { + /** + * Returns a string containing a list of the properties and their values. + * + * @return String representing the data + */ + @Override + public String toString() { + StringBuilder buf = new StringBuilder(getClass().getSimpleName()).append('{'); + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + buf.append("}"); + return buf.toString(); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/ZOSWLMContext.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/ZOSWLMContext.java new file mode 100755 index 000000000000..a1c9cddbd99b --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/context/ZOSWLMContext.java @@ -0,0 +1,72 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.simplicity.config.context; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.ConfigElement; + +/** + * Represents the element which can be nested under + */ +public class ZOSWLMContext extends ConfigElement { + private String daemonTransactionClass; + private String defaultTransactionClass; + private String wlm; + + public String getDaemonTransactionClass() { + return daemonTransactionClass; + } + + public String getDefaultTransactionClass() { + return defaultTransactionClass; + } + + public String getWLM() { + return wlm; + } + + @XmlAttribute(name = "daemonTransactionClass") + public void setDaemonTransactionClass(String value) { + daemonTransactionClass = value; + } + + @XmlAttribute(name = "defaultTransactionClass") + public void setDefaultTransactionClass(String value) { + defaultTransactionClass = value; + } + + @XmlAttribute(name = "wlm") + public void setWLM(String value) { + wlm = value; + } + + /** + * Returns a string containing a list of the properties and their values. + * + * @return String representing the data + */ + @Override + public String toString() { + StringBuilder buf = new StringBuilder("zosWLMContext{"); + if (getId() != null) + buf.append("id=").append(getId()).append(' '); + if (wlm != null) + buf.append("wlm=").append(wlm).append(' '); + if (daemonTransactionClass != null) + buf.append("daemonTransactionClass=").append(daemonTransactionClass).append(' '); + if (defaultTransactionClass != null) + buf.append("defaultTransactionClass=").append(defaultTransactionClass).append(' '); + buf.append("}"); + return buf.toString(); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties.java new file mode 100755 index 000000000000..697c1341cd37 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties.java @@ -0,0 +1,51 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties extends DataSourceProperties { + + @Override + public String getElementName() { + return GENERIC; + } + + private String URL; + + @XmlAttribute(name = "URL") + public void setURL(String URL) { + this.URL = URL; + } + + public String getURL() { + return this.URL; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (URL != null) + buf.append("URL=\"" + URL + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (super.getPortNumber() != null) + buf.append("portNumber=\"" + super.getPortNumber() + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_datadirect_sqlserver.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_datadirect_sqlserver.java new file mode 100755 index 000000000000..8f617e62336a --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_datadirect_sqlserver.java @@ -0,0 +1,616 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_datadirect_sqlserver extends DataSourceProperties { + private String JDBCBehavior; + private String XATransactionGroup; + private String XMLDescribeType; + private String accountingInfo; + private String alternateServers; + private String alwaysReportTriggerResults; + private String applicationName; + private String authenticationMethod; + private String bulkLoadBatchSize; + private String bulkLoadOptions; + private String clientHostName; + private String clientUser; + private String codePageOverride; + private String connectionRetryCount; + private String connectionRetryDelay; + private String convertNull; + private String dateTimeInputParameterType; + private String dateTimeOutputParameterType; + private String describeInputParameters; + private String describeOutputParameters; + private String enableBulkLoad; + private String enableCancelTimeout; + private String encryptionMethod; + private String failoverGranularity; + private String failoverMode; + private String failoverPreconnect; + private String hostNameInCertificate; + private String initializationString; + private String insensitiveResultSetBufferSize; + private String javaDoubleToString; + private String loadBalancing; + private String longDataCacheSize; + private String netAddress; + private String packetSize; + private String queryTimeout; + private String resultsetMetaDataOptions; + private String selectMethod; + private String snapshotSerializable; + private String spyAttributes; + private String stringInputParameterType; + private String stringOutputParameterType; + private String suppressConnectionWarnings; + private String transactionMode; + private String truncateFractionalSeconds; + private String trustStore; + private String trustStorePassword; + private String useServerSideUpdatableCursors; + private String validateServerCertificate; + + @Override + public String getElementName() { + return DATADIRECT_SQLSERVER; + } + + @XmlAttribute(name = "JDBCBehavior") + public void setJDBCBehavior(String JDBCBehavior) { + this.JDBCBehavior = JDBCBehavior; + } + + public String getJDBCBehavior() { + return this.JDBCBehavior; + } + + @XmlAttribute(name = "XATransactionGroup") + public void setXATransactionGroup(String XATransactionGroup) { + this.XATransactionGroup = XATransactionGroup; + } + + public String getXATransactionGroup() { + return this.XATransactionGroup; + } + + @XmlAttribute(name = "XMLDescribeType") + public void setXMLDescribeType(String XMLDescribeType) { + this.XMLDescribeType = XMLDescribeType; + } + + public String getXMLDescribeType() { + return this.XMLDescribeType; + } + + @XmlAttribute(name = "accountingInfo") + public void setAccountingInfo(String accountingInfo) { + this.accountingInfo = accountingInfo; + } + + public String getAccountingInfo() { + return this.accountingInfo; + } + + @XmlAttribute(name = "alternateServers") + public void setAlternateServers(String alternateServers) { + this.alternateServers = alternateServers; + } + + public String getAlternateServers() { + return this.alternateServers; + } + + @XmlAttribute(name = "alwaysReportTriggerResults") + public void setAlwaysReportTriggerResults(String alwaysReportTriggerResults) { + this.alwaysReportTriggerResults = alwaysReportTriggerResults; + } + + public String getAlwaysReportTriggerResults() { + return this.alwaysReportTriggerResults; + } + + @XmlAttribute(name = "applicationName") + public void setApplicationName(String applicationName) { + this.applicationName = applicationName; + } + + public String getApplicationName() { + return this.applicationName; + } + + @XmlAttribute(name = "authenticationMethod") + public void setAuthenticationMethod(String authenticationMethod) { + this.authenticationMethod = authenticationMethod; + } + + public String getAuthenticationMethod() { + return this.authenticationMethod; + } + + @XmlAttribute(name = "bulkLoadBatchSize") + public void setBulkLoadBatchSize(String bulkLoadBatchSize) { + this.bulkLoadBatchSize = bulkLoadBatchSize; + } + + public String getBulkLoadBatchSize() { + return this.bulkLoadBatchSize; + } + + @XmlAttribute(name = "bulkLoadOptions") + public void setBulkLoadOptions(String bulkLoadOptions) { + this.bulkLoadOptions = bulkLoadOptions; + } + + public String getBulkLoadOptions() { + return this.bulkLoadOptions; + } + + @XmlAttribute(name = "clientHostName") + public void setClientHostName(String clientHostName) { + this.clientHostName = clientHostName; + } + + public String getClientHostName() { + return this.clientHostName; + } + + @XmlAttribute(name = "clientUser") + public void setClientUser(String clientUser) { + this.clientUser = clientUser; + } + + public String getClientUser() { + return this.clientUser; + } + + @XmlAttribute(name = "codePageOverride") + public void setCodePageOverride(String codePageOverride) { + this.codePageOverride = codePageOverride; + } + + public String getCodePageOverride() { + return this.codePageOverride; + } + + @XmlAttribute(name = "connectionRetryCount") + public void setConnectionRetryCount(String connectionRetryCount) { + this.connectionRetryCount = connectionRetryCount; + } + + public String getConnectionRetryCount() { + return this.connectionRetryCount; + } + + @XmlAttribute(name = "connectionRetryDelay") + public void setConnectionRetryDelay(String connectionRetryDelay) { + this.connectionRetryDelay = connectionRetryDelay; + } + + public String getConnectionRetryDelay() { + return this.connectionRetryDelay; + } + + @XmlAttribute(name = "convertNull") + public void setConvertNull(String convertNull) { + this.convertNull = convertNull; + } + + public String getConvertNull() { + return this.convertNull; + } + + @XmlAttribute(name = "dateTimeInputParameterType") + public void setDateTimeInputParameterType(String dateTimeInputParameterType) { + this.dateTimeInputParameterType = dateTimeInputParameterType; + } + + public String getDateTimeInputParameterType() { + return this.dateTimeInputParameterType; + } + + @XmlAttribute(name = "dateTimeOutputParameterType") + public void setDateTimeOutputParameterType(String dateTimeOutputParameterType) { + this.dateTimeOutputParameterType = dateTimeOutputParameterType; + } + + public String getDateTimeOutputParameterType() { + return this.dateTimeOutputParameterType; + } + + @XmlAttribute(name = "describeInputParameters") + public void setDescribeInputParameters(String describeInputParameters) { + this.describeInputParameters = describeInputParameters; + } + + public String getDescribeInputParameters() { + return this.describeInputParameters; + } + + @XmlAttribute(name = "describeOutputParameters") + public void setDescribeOutputParameters(String describeOutputParameters) { + this.describeOutputParameters = describeOutputParameters; + } + + public String getDescribeOutputParameters() { + return this.describeOutputParameters; + } + + @XmlAttribute(name = "enableBulkLoad") + public void setEnableBulkLoad(String enableBulkLoad) { + this.enableBulkLoad = enableBulkLoad; + } + + public String getEnableBulkLoad() { + return this.enableBulkLoad; + } + + @XmlAttribute(name = "enableCancelTimeout") + public void setEnableCancelTimeout(String enableCancelTimeout) { + this.enableCancelTimeout = enableCancelTimeout; + } + + public String getEnableCancelTimeout() { + return this.enableCancelTimeout; + } + + @XmlAttribute(name = "encryptionMethod") + public void setEncryptionMethod(String encryptionMethod) { + this.encryptionMethod = encryptionMethod; + } + + public String getEncryptionMethod() { + return this.encryptionMethod; + } + + @XmlAttribute(name = "failoverGranularity") + public void setFailoverGranularity(String failoverGranularity) { + this.failoverGranularity = failoverGranularity; + } + + public String getFailoverGranularity() { + return this.failoverGranularity; + } + + @XmlAttribute(name = "failoverMode") + public void setFailoverMode(String failoverMode) { + this.failoverMode = failoverMode; + } + + public String getFailoverMode() { + return this.failoverMode; + } + + @XmlAttribute(name = "failoverPreconnect") + public void setFailoverPreconnect(String failoverPreconnect) { + this.failoverPreconnect = failoverPreconnect; + } + + public String getFailoverPreconnect() { + return this.failoverPreconnect; + } + + @XmlAttribute(name = "hostNameInCertificate") + public void setHostNameInCertificate(String hostNameInCertificate) { + this.hostNameInCertificate = hostNameInCertificate; + } + + public String getHostNameInCertificate() { + return this.hostNameInCertificate; + } + + @XmlAttribute(name = "initializationString") + public void setInitializationString(String initializationString) { + this.initializationString = initializationString; + } + + public String getInitializationString() { + return this.initializationString; + } + + @XmlAttribute(name = "insensitiveResultSetBufferSize") + public void setInsensitiveResultSetBufferSize(String insensitiveResultSetBufferSize) { + this.insensitiveResultSetBufferSize = insensitiveResultSetBufferSize; + } + + public String getInsensitiveResultSetBufferSize() { + return this.insensitiveResultSetBufferSize; + } + + @XmlAttribute(name = "javaDoubleToString") + public void setJavaDoubleToString(String javaDoubleToString) { + this.javaDoubleToString = javaDoubleToString; + } + + public String getJavaDoubleToString() { + return this.javaDoubleToString; + } + + @XmlAttribute(name = "loadBalancing") + public void setLoadBalancing(String loadBalancing) { + this.loadBalancing = loadBalancing; + } + + public String getLoadBalancing() { + return this.loadBalancing; + } + + @XmlAttribute(name = "longDataCacheSize") + public void setStringDataCacheSize(String longDataCacheSize) { + this.longDataCacheSize = longDataCacheSize; + } + + public String getStringDataCacheSize() { + return this.longDataCacheSize; + } + + @XmlAttribute(name = "netAddress") + public void setNetAddress(String netAddress) { + this.netAddress = netAddress; + } + + public String getNetAddress() { + return this.netAddress; + } + + @XmlAttribute(name = "packetSize") + public void setPacketSize(String packetSize) { + this.packetSize = packetSize; + } + + public String getPacketSize() { + return this.packetSize; + } + + @XmlAttribute(name = "queryTimeout") + public void setQueryTimeout(String queryTimeout) { + this.queryTimeout = queryTimeout; + } + + public String getQueryTimeout() { + return this.queryTimeout; + } + + @XmlAttribute(name = "resultsetMetaDataOptions") + public void setResultsetMetaDataOptions(String resultsetMetaDataOptions) { + this.resultsetMetaDataOptions = resultsetMetaDataOptions; + } + + public String getResultsetMetaDataOptions() { + return this.resultsetMetaDataOptions; + } + + @XmlAttribute(name = "selectMethod") + public void setSelectMethod(String selectMethod) { + this.selectMethod = selectMethod; + } + + public String getSelectMethod() { + return this.selectMethod; + } + + @XmlAttribute(name = "snapshotSerializable") + public void setSnapshotSerializable(String snapshotSerializable) { + this.snapshotSerializable = snapshotSerializable; + } + + public String getSnapshotSerializable() { + return this.snapshotSerializable; + } + + @XmlAttribute(name = "spyAttributes") + public void setSpyAttributes(String spyAttributes) { + this.spyAttributes = spyAttributes; + } + + public String getSpyAttributes() { + return this.spyAttributes; + } + + @XmlAttribute(name = "stringInputParameterType") + public void setStringInputParameterType(String stringInputParameterType) { + this.stringInputParameterType = stringInputParameterType; + } + + public String getStringInputParameterType() { + return this.stringInputParameterType; + } + + @XmlAttribute(name = "stringOutputParameterType") + public void setStringOutputParameterType(String stringOutputParameterType) { + this.stringOutputParameterType = stringOutputParameterType; + } + + public String getStringOutputParameterType() { + return this.stringOutputParameterType; + } + + @XmlAttribute(name = "suppressConnectionWarnings") + public void setSuppressConnectionWarnings(String suppressConnectionWarnings) { + this.suppressConnectionWarnings = suppressConnectionWarnings; + } + + public String getSuppressConnectionWarnings() { + return this.suppressConnectionWarnings; + } + + @XmlAttribute(name = "transactionMode") + public void setTransactionMode(String transactionMode) { + this.transactionMode = transactionMode; + } + + public String getTransactionMode() { + return this.transactionMode; + } + + @XmlAttribute(name = "truncateFractionalSeconds") + public void setTruncateFractionalSeconds(String truncateFractionalSeconds) { + this.truncateFractionalSeconds = truncateFractionalSeconds; + } + + public String getTruncateFractionalSeconds() { + return this.truncateFractionalSeconds; + } + + @XmlAttribute(name = "trustStore") + public void setTrustStore(String trustStore) { + this.trustStore = trustStore; + } + + public String getTrustStore() { + return this.trustStore; + } + + @XmlAttribute(name = "trustStorePassword") + public void setTrustStorePassword(String trustStorePassword) { + this.trustStorePassword = trustStorePassword; + } + + public String getTrustStorePassword() { + return this.trustStorePassword; + } + + @XmlAttribute(name = "useServerSideUpdatableCursors") + public void setUseServerSideUpdatableCursors(String useServerSideUpdatableCursors) { + this.useServerSideUpdatableCursors = useServerSideUpdatableCursors; + } + + public String getUseServerSideUpdatableCursors() { + return this.useServerSideUpdatableCursors; + } + + @XmlAttribute(name = "validateServerCertificate") + public void setValidateServerCertificate(String validateServerCertificate) { + this.validateServerCertificate = validateServerCertificate; + } + + public String getValidateServerCertificate() { + return this.validateServerCertificate; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (JDBCBehavior != null) + buf.append("JDBCBehavior=\"" + JDBCBehavior + "\" "); + if (XATransactionGroup != null) + buf.append("XATransactionGroup=\"" + XATransactionGroup + "\" "); + if (XMLDescribeType != null) + buf.append("XMLDescribeType=\"" + XMLDescribeType + "\" "); + if (accountingInfo != null) + buf.append("accountingInfo=\"" + accountingInfo + "\" "); + if (alternateServers != null) + buf.append("alternateServers=\"" + alternateServers + "\" "); + if (alwaysReportTriggerResults != null) + buf.append("alwaysReportTriggerResults=\"" + alwaysReportTriggerResults + "\" "); + if (applicationName != null) + buf.append("applicationName=\"" + applicationName + "\" "); + if (authenticationMethod != null) + buf.append("authenticationMethod=\"" + authenticationMethod + "\" "); + if (bulkLoadBatchSize != null) + buf.append("bulkLoadBatchSize=\"" + bulkLoadBatchSize + "\" "); + if (bulkLoadOptions != null) + buf.append("bulkLoadOptions=\"" + bulkLoadOptions + "\" "); + if (clientHostName != null) + buf.append("clientHostName=\"" + clientHostName + "\" "); + if (clientUser != null) + buf.append("clientUser=\"" + clientUser + "\" "); + if (codePageOverride != null) + buf.append("codePageOverride=\"" + codePageOverride + "\" "); + if (connectionRetryCount != null) + buf.append("connectionRetryCount=\"" + connectionRetryCount + "\" "); + if (connectionRetryDelay != null) + buf.append("connectionRetryDelay=\"" + connectionRetryDelay + "\" "); + if (convertNull != null) + buf.append("convertNull=\"" + convertNull + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (dateTimeInputParameterType != null) + buf.append("dateTimeInputParameterType=\"" + dateTimeInputParameterType + "\" "); + if (dateTimeOutputParameterType != null) + buf.append("dateTimeOutputParameterType=\"" + dateTimeOutputParameterType + "\" "); + if (describeInputParameters != null) + buf.append("describeInputParameters=\"" + describeInputParameters + "\" "); + if (describeOutputParameters != null) + buf.append("describeOutputParameters=\"" + describeOutputParameters + "\" "); + if (enableBulkLoad != null) + buf.append("enableBulkLoad=\"" + enableBulkLoad + "\" "); + if (enableCancelTimeout != null) + buf.append("enableCancelTimeout=\"" + enableCancelTimeout + "\" "); + if (encryptionMethod != null) + buf.append("encryptionMethod=\"" + encryptionMethod + "\" "); + if (failoverGranularity != null) + buf.append("failoverGranularity=\"" + failoverGranularity + "\" "); + if (failoverMode != null) + buf.append("failoverMode=\"" + failoverMode + "\" "); + if (failoverPreconnect != null) + buf.append("failoverPreconnect=\"" + failoverPreconnect + "\" "); + if (hostNameInCertificate != null) + buf.append("hostNameInCertificate=\"" + hostNameInCertificate + "\" "); + if (initializationString != null) + buf.append("initializationString=\"" + initializationString + "\" "); + if (insensitiveResultSetBufferSize != null) + buf.append("insensitiveResultSetBufferSize=\"" + insensitiveResultSetBufferSize + "\" "); + if (javaDoubleToString != null) + buf.append("javaDoubleToString=\"" + javaDoubleToString + "\" "); + if (loadBalancing != null) + buf.append("loadBalancing=\"" + loadBalancing + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (longDataCacheSize != null) + buf.append("longDataCacheSize=\"" + longDataCacheSize + "\" "); + if (netAddress != null) + buf.append("netAddress=\"" + netAddress + "\" "); + if (packetSize != null) + buf.append("packetSize=\"" + packetSize + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (super.getPortNumber() != null) + buf.append("portNumber=\"" + super.getPortNumber() + "\" "); + if (queryTimeout != null) + buf.append("queryTimeout=\"" + queryTimeout + "\" "); + if (resultsetMetaDataOptions != null) + buf.append("resultsetMetaDataOptions=\"" + resultsetMetaDataOptions + "\" "); + if (selectMethod != null) + buf.append("selectMethod=\"" + selectMethod + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (snapshotSerializable != null) + buf.append("snapshotSerializable=\"" + snapshotSerializable + "\" "); + if (spyAttributes != null) + buf.append("spyAttributes=\"" + spyAttributes + "\" "); + if (stringInputParameterType != null) + buf.append("stringInputParameterType=\"" + stringInputParameterType + "\" "); + if (stringOutputParameterType != null) + buf.append("stringOutputParameterType=\"" + stringOutputParameterType + "\" "); + if (suppressConnectionWarnings != null) + buf.append("suppressConnectionWarnings=\"" + suppressConnectionWarnings + "\" "); + if (transactionMode != null) + buf.append("transactionMode=\"" + transactionMode + "\" "); + if (truncateFractionalSeconds != null) + buf.append("truncateFractionalSeconds=\"" + truncateFractionalSeconds + "\" "); + if (trustStore != null) + buf.append("trustStore=\"" + trustStore + "\" "); + if (trustStorePassword != null) + buf.append("trustStorePassword=\"" + trustStorePassword + "\" "); + if (useServerSideUpdatableCursors != null) + buf.append("useServerSideUpdatableCursors=\"" + useServerSideUpdatableCursors + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + if (validateServerCertificate != null) + buf.append("validateServerCertificate=\"" + validateServerCertificate + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_db2_i_native.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_db2_i_native.java new file mode 100755 index 000000000000..f8780b5e5fd8 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_db2_i_native.java @@ -0,0 +1,436 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_db2_i_native extends DataSourceProperties { + private String access; + private String autoCommit; + private String batchStyle; + private String behaviorOverride; + private String blockSize; + private String cursorHold; + private String cursorSensitivity; + private String dataTruncation; + private String dateFormat; + private String dateSeparator; + private String decimalSeparator; + private String directMap; + private String doEscapeProcessing; + private String fullErrors; + private String libraries; + private String lobThreshold; + private String lockTimeout; + private String maximumPrecision; + private String maximumScale; + private String minimumDivideScale; + private String networkProtocol; + private String prefetch; + private String queryOptimizeGoal; + private String reuseObjects; + private String serverTraceCategories; + private String systemNaming; + private String timeFormat; + private String timeSeparator; + private String trace; + private String transactionTimeout; + private String translateBinary; + private String translateHex; + private String useBlockInsert; + + @Override + public String getElementName() { + return DB2_I_NATIVE; + } + + @XmlAttribute(name = "access") + public void setAccess(String access) { + this.access = access; + } + + public String getAccess() { + return this.access; + } + + @XmlAttribute(name = "autoCommit") + public void setAutoCommit(String autoCommit) { + this.autoCommit = autoCommit; + } + + public String getAutoCommit() { + return this.autoCommit; + } + + @XmlAttribute(name = "batchStyle") + public void setBatchStyle(String batchStyle) { + this.batchStyle = batchStyle; + } + + public String getBatchStyle() { + return this.batchStyle; + } + + @XmlAttribute(name = "behaviorOverride") + public void setBehaviorOverride(String behaviorOverride) { + this.behaviorOverride = behaviorOverride; + } + + public String getBehaviorOverride() { + return this.behaviorOverride; + } + + @XmlAttribute(name = "blockSize") + public void setBlockSize(String blockSize) { + this.blockSize = blockSize; + } + + public String getBlockSize() { + return this.blockSize; + } + + @XmlAttribute(name = "cursorHold") + public void setCursorHold(String cursorHold) { + this.cursorHold = cursorHold; + } + + public String getCursorHold() { + return this.cursorHold; + } + + @XmlAttribute(name = "cursorSensitivity") + public void setCursorSensitivity(String cursorSensitivity) { + this.cursorSensitivity = cursorSensitivity; + } + + public String getCursorSensitivity() { + return this.cursorSensitivity; + } + + @XmlAttribute(name = "dataTruncation") + public void setDataTruncation(String dataTruncation) { + this.dataTruncation = dataTruncation; + } + + public String getDataTruncation() { + return this.dataTruncation; + } + + @XmlAttribute(name = "dateFormat") + public void setDateFormat(String dateFormat) { + this.dateFormat = dateFormat; + } + + public String getDateFormat() { + return this.dateFormat; + } + + @XmlAttribute(name = "dateSeparator") + public void setDateSeparator(String dateSeparator) { + this.dateSeparator = dateSeparator; + } + + public String getDateSeparator() { + return this.dateSeparator; + } + + @XmlAttribute(name = "decimalSeparator") + public void setDecimalSeparator(String decimalSeparator) { + this.decimalSeparator = decimalSeparator; + } + + public String getDecimalSeparator() { + return this.decimalSeparator; + } + + @XmlAttribute(name = "directMap") + public void setDirectMap(String directMap) { + this.directMap = directMap; + } + + public String getDirectMap() { + return this.directMap; + } + + @XmlAttribute(name = "doEscapeProcessing") + public void setDoEscapeProcessing(String doEscapeProcessing) { + this.doEscapeProcessing = doEscapeProcessing; + } + + public String getDoEscapeProcessing() { + return this.doEscapeProcessing; + } + + @XmlAttribute(name = "fullErrors") + public void setFullErrors(String fullErrors) { + this.fullErrors = fullErrors; + } + + public String getFullErrors() { + return this.fullErrors; + } + + @XmlAttribute(name = "libraries") + public void setLibraries(String libraries) { + this.libraries = libraries; + } + + public String getLibraries() { + return this.libraries; + } + + @XmlAttribute(name = "lobThreshold") + public void setLobThreshold(String lobThreshold) { + this.lobThreshold = lobThreshold; + } + + public String getLobThreshold() { + return this.lobThreshold; + } + + @XmlAttribute(name = "lockTimeout") + public void setLockTimeout(String lockTimeout) { + this.lockTimeout = lockTimeout; + } + + public String getLockTimeout() { + return this.lockTimeout; + } + + @XmlAttribute(name = "maximumPrecision") + public void setMaximumPrecision(String maximumPrecision) { + this.maximumPrecision = maximumPrecision; + } + + public String getMaximumPrecision() { + return this.maximumPrecision; + } + + @XmlAttribute(name = "maximumScale") + public void setMaximumScale(String maximumScale) { + this.maximumScale = maximumScale; + } + + public String getMaximumScale() { + return this.maximumScale; + } + + @XmlAttribute(name = "minimumDivideScale") + public void setMinimumDivideScale(String minimumDivideScale) { + this.minimumDivideScale = minimumDivideScale; + } + + public String getMinimumDivideScale() { + return this.minimumDivideScale; + } + + @XmlAttribute(name = "networkProtocol") + public void setNetworkProtocol(String networkProtocol) { + this.networkProtocol = networkProtocol; + } + + public String getNetworkProtocol() { + return this.networkProtocol; + } + + @XmlAttribute(name = "prefetch") + public void setPrefetch(String prefetch) { + this.prefetch = prefetch; + } + + public String getPrefetch() { + return this.prefetch; + } + + @XmlAttribute(name = "queryOptimizeGoal") + public void setQueryOptimizeGoal(String queryOptimizeGoal) { + this.queryOptimizeGoal = queryOptimizeGoal; + } + + public String getQueryOptimizeGoal() { + return this.queryOptimizeGoal; + } + + @XmlAttribute(name = "reuseObjects") + public void setReuseObjects(String reuseObjects) { + this.reuseObjects = reuseObjects; + } + + public String getReuseObjects() { + return this.reuseObjects; + } + + @XmlAttribute(name = "serverTraceCategories") + public void setServerTraceCategories(String serverTraceCategories) { + this.serverTraceCategories = serverTraceCategories; + } + + public String getServerTraceCategories() { + return this.serverTraceCategories; + } + + @XmlAttribute(name = "systemNaming") + public void setSystemNaming(String systemNaming) { + this.systemNaming = systemNaming; + } + + public String getSystemNaming() { + return this.systemNaming; + } + + @XmlAttribute(name = "timeFormat") + public void setTimeFormat(String timeFormat) { + this.timeFormat = timeFormat; + } + + public String getTimeFormat() { + return this.timeFormat; + } + + @XmlAttribute(name = "timeSeparator") + public void setTimeSeparator(String timeSeparator) { + this.timeSeparator = timeSeparator; + } + + public String getTimeSeparator() { + return this.timeSeparator; + } + + @XmlAttribute(name = "trace") + public void setTrace(String trace) { + this.trace = trace; + } + + public String getTrace() { + return this.trace; + } + + @XmlAttribute(name = "transactionTimeout") + public void setTransactionTimeout(String transactionTimeout) { + this.transactionTimeout = transactionTimeout; + } + + public String getTransactionTimeout() { + return this.transactionTimeout; + } + + @XmlAttribute(name = "translateBinary") + public void setTranslateBinary(String translateBinary) { + this.translateBinary = translateBinary; + } + + public String getTranslateBinary() { + return this.translateBinary; + } + + @XmlAttribute(name = "translateHex") + public void setTranslateHex(String translateHex) { + this.translateHex = translateHex; + } + + public String getTranslateHex() { + return this.translateHex; + } + + @XmlAttribute(name = "useBlockInsert") + public void setUseBlockInsert(String useBlockInsert) { + this.useBlockInsert = useBlockInsert; + } + + public String getUseBlockInsert() { + return this.useBlockInsert; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (access != null) + buf.append("access=\"" + access + "\" "); + if (autoCommit != null) + buf.append("autoCommit=\"" + autoCommit + "\" "); + if (batchStyle != null) + buf.append("batchStyle=\"" + batchStyle + "\" "); + if (behaviorOverride != null) + buf.append("behaviorOverride=\"" + behaviorOverride + "\" "); + if (blockSize != null) + buf.append("blockSize=\"" + blockSize + "\" "); + if (cursorHold != null) + buf.append("cursorHold=\"" + cursorHold + "\" "); + if (cursorSensitivity != null) + buf.append("cursorSensitivity=\"" + cursorSensitivity + "\" "); + if (dataTruncation != null) + buf.append("dataTruncation=\"" + dataTruncation + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (dateFormat != null) + buf.append("dateFormat=\"" + dateFormat + "\" "); + if (dateSeparator != null) + buf.append("dateSeparator=\"" + dateSeparator + "\" "); + if (decimalSeparator != null) + buf.append("decimalSeparator=\"" + decimalSeparator + "\" "); + if (directMap != null) + buf.append("directMap=\"" + directMap + "\" "); + if (doEscapeProcessing != null) + buf.append("doEscapeProcessing=\"" + doEscapeProcessing + "\" "); + if (fullErrors != null) + buf.append("fullErrors=\"" + fullErrors + "\" "); + if (libraries != null) + buf.append("libraries=\"" + libraries + "\" "); + if (lobThreshold != null) + buf.append("lobThreshold=\"" + lobThreshold + "\" "); + if (lockTimeout != null) + buf.append("lockTimeout=\"" + lockTimeout + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (maximumPrecision != null) + buf.append("maximumPrecision=\"" + maximumPrecision + "\" "); + if (maximumScale != null) + buf.append("maximumScale=\"" + maximumScale + "\" "); + if (minimumDivideScale != null) + buf.append("minimumDivideScale=\"" + minimumDivideScale + "\" "); + if (networkProtocol != null) + buf.append("networkProtocol=\"" + networkProtocol + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (super.getPortNumber() != null) + buf.append("portNumber=\"" + super.getPortNumber() + "\" "); + if (prefetch != null) + buf.append("prefetch=\"" + prefetch + "\" "); + if (queryOptimizeGoal != null) + buf.append("queryOptimizeGoal=\"" + queryOptimizeGoal + "\" "); + if (reuseObjects != null) + buf.append("reuseObjects=\"" + reuseObjects + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (serverTraceCategories != null) + buf.append("serverTraceCategories=\"" + serverTraceCategories + "\" "); + if (systemNaming != null) + buf.append("systemNaming=\"" + systemNaming + "\" "); + if (timeFormat != null) + buf.append("timeFormat=\"" + timeFormat + "\" "); + if (timeSeparator != null) + buf.append("timeSeparator=\"" + timeSeparator + "\" "); + if (trace != null) + buf.append("trace=\"" + trace + "\" "); + if (transactionTimeout != null) + buf.append("transactionTimeout=\"" + transactionTimeout + "\" "); + if (translateBinary != null) + buf.append("translateBinary=\"" + translateBinary + "\" "); + if (translateHex != null) + buf.append("translateHex=\"" + translateHex + "\" "); + if (useBlockInsert != null) + buf.append("useBlockInsert=\"" + useBlockInsert + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_db2_i_toolbox.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_db2_i_toolbox.java new file mode 100755 index 000000000000..f35e302a36c6 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_db2_i_toolbox.java @@ -0,0 +1,866 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_db2_i_toolbox extends DataSourceProperties { + private String access; + private String behaviorOverride; + private String bidiImplicitReordering; + private String bidiNumericOrdering; + private String bidiStringType; + private String bigDecimal; + private String blockCriteria; + private String blockSize; + private String cursorHold; + private String cursorSensitivity; + private String dataCompression; + private String dataTruncation; + private String dateFormat; + private String dateSeparator; + private String decimalSeparator; + private String driver; + private String dsPackage; + private String errors; + private String extendedDynamic; + private String extendedMetaData; + private String fullOpen; + private String holdInputLocators; + private String holdStatements; + private String isolationLevelSwitchingSupport; + private String keepAlive; + private String lazyClose; + private String libraries; + private String lobThreshold; + private String maximumPrecision; + private String maximumScale; + private String metaDataSource; + private String minimumDivideScale; + private String naming; + private String packageAdd; + private String packageCCSID; + private String packageCache; + private String packageCriteria; + private String packageError; + private String packageLibrary; + private String prefetch; + private String prompt; + private String proxyServer; + private String qaqqiniLibrary; + private String queryOptimizeGoal; + private String receiveBufferSize; + private String remarks; + private String rollbackCursorHold; + private String savePasswordWhenSerialized; + private String secondaryUrl; + private String secure; + private String sendBufferSize; + private String serverTraceCategories; + private String soLinger; + private String soTimeout; + private String sort; + private String sortLanguage; + private String sortTable; + private String sortWeight; + private String tcpNoDelay; + private String threadUsed; + private String timeFormat; + private String timeSeparator; + private String toolboxTrace; + private String trace; + private String translateBinary; + private String translateBoolean; + private String translateHex; + private String trueAutoCommit; + private String xaLooselyCoupledSupport; + + @Override + public String getElementName() { + return DB2_I_TOOLBOX; + } + + @XmlAttribute(name = "access") + public void setAccess(String access) { + this.access = access; + } + + public String getAccess() { + return this.access; + } + + @XmlAttribute(name = "behaviorOverride") + public void setBehaviorOverride(String behaviorOverride) { + this.behaviorOverride = behaviorOverride; + } + + public String getBehaviorOverride() { + return this.behaviorOverride; + } + + @XmlAttribute(name = "bidiImplicitReordering") + public void setBidiImplicitReordering(String bidiImplicitReordering) { + this.bidiImplicitReordering = bidiImplicitReordering; + } + + public String getBidiImplicitReordering() { + return this.bidiImplicitReordering; + } + + @XmlAttribute(name = "bidiNumericOrdering") + public void setBidiNumericOrdering(String bidiNumericOrdering) { + this.bidiNumericOrdering = bidiNumericOrdering; + } + + public String getBidiNumericOrdering() { + return this.bidiNumericOrdering; + } + + @XmlAttribute(name = "bidiStringType") + public void setBidiStringType(String bidiStringType) { + this.bidiStringType = bidiStringType; + } + + public String getBidiStringType() { + return this.bidiStringType; + } + + @XmlAttribute(name = "bigDecimal") + public void setBigDecimal(String bigDecimal) { + this.bigDecimal = bigDecimal; + } + + public String getBigDecimal() { + return this.bigDecimal; + } + + @XmlAttribute(name = "blockCriteria") + public void setBlockCriteria(String blockCriteria) { + this.blockCriteria = blockCriteria; + } + + public String getBlockCriteria() { + return this.blockCriteria; + } + + @XmlAttribute(name = "blockSize") + public void setBlockSize(String blockSize) { + this.blockSize = blockSize; + } + + public String getBlockSize() { + return this.blockSize; + } + + @XmlAttribute(name = "cursorHold") + public void setCursorHold(String cursorHold) { + this.cursorHold = cursorHold; + } + + public String getCursorHold() { + return this.cursorHold; + } + + @XmlAttribute(name = "cursorSensitivity") + public void setCursorSensitivity(String cursorSensitivity) { + this.cursorSensitivity = cursorSensitivity; + } + + public String getCursorSensitivity() { + return this.cursorSensitivity; + } + + @XmlAttribute(name = "dataCompression") + public void setDataCompression(String dataCompression) { + this.dataCompression = dataCompression; + } + + public String getDataCompression() { + return this.dataCompression; + } + + @XmlAttribute(name = "dataTruncation") + public void setDataTruncation(String dataTruncation) { + this.dataTruncation = dataTruncation; + } + + public String getDataTruncation() { + return this.dataTruncation; + } + + @XmlAttribute(name = "dateFormat") + public void setDateFormat(String dateFormat) { + this.dateFormat = dateFormat; + } + + public String getDateFormat() { + return this.dateFormat; + } + + @XmlAttribute(name = "dateSeparator") + public void setDateSeparator(String dateSeparator) { + this.dateSeparator = dateSeparator; + } + + public String getDateSeparator() { + return this.dateSeparator; + } + + @XmlAttribute(name = "decimalSeparator") + public void setDecimalSeparator(String decimalSeparator) { + this.decimalSeparator = decimalSeparator; + } + + public String getDecimalSeparator() { + return this.decimalSeparator; + } + + @XmlAttribute(name = "driver") + public void setDriver(String driver) { + this.driver = driver; + } + + public String getDriver() { + return this.driver; + } + + @XmlAttribute(name = "dsPackage") + public void setDsPackage(String dsPackage) { + this.dsPackage = dsPackage; + } + + public String getDsPackage() { + return this.dsPackage; + } + + @XmlAttribute(name = "errors") + public void setErrors(String errors) { + this.errors = errors; + } + + public String getErrors() { + return this.errors; + } + + @XmlAttribute(name = "extendedDynamic") + public void setExtendedDynamic(String extendedDynamic) { + this.extendedDynamic = extendedDynamic; + } + + public String getExtendedDynamic() { + return this.extendedDynamic; + } + + @XmlAttribute(name = "extendedMetaData") + public void setExtendedMetaData(String extendedMetaData) { + this.extendedMetaData = extendedMetaData; + } + + public String getExtendedMetaData() { + return this.extendedMetaData; + } + + @XmlAttribute(name = "fullOpen") + public void setFullOpen(String fullOpen) { + this.fullOpen = fullOpen; + } + + public String getFullOpen() { + return this.fullOpen; + } + + @XmlAttribute(name = "holdInputLocators") + public void setHoldInputLocators(String holdInputLocators) { + this.holdInputLocators = holdInputLocators; + } + + public String getHoldInputLocators() { + return this.holdInputLocators; + } + + @XmlAttribute(name = "holdStatements") + public void setHoldStatements(String holdStatements) { + this.holdStatements = holdStatements; + } + + public String getHoldStatements() { + return this.holdStatements; + } + + @XmlAttribute(name = "isolationLevelSwitchingSupport") + public void setIsolationLevelSwitchingSupport(String isolationLevelSwitchingSupport) { + this.isolationLevelSwitchingSupport = isolationLevelSwitchingSupport; + } + + public String getIsolationLevelSwitchingSupport() { + return this.isolationLevelSwitchingSupport; + } + + @XmlAttribute(name = "keepAlive") + public void setKeepAlive(String keepAlive) { + this.keepAlive = keepAlive; + } + + public String getKeepAlive() { + return this.keepAlive; + } + + @XmlAttribute(name = "lazyClose") + public void setLazyClose(String lazyClose) { + this.lazyClose = lazyClose; + } + + public String getLazyClose() { + return this.lazyClose; + } + + @XmlAttribute(name = "libraries") + public void setLibraries(String libraries) { + this.libraries = libraries; + } + + public String getLibraries() { + return this.libraries; + } + + @XmlAttribute(name = "lobThreshold") + public void setLobThreshold(String lobThreshold) { + this.lobThreshold = lobThreshold; + } + + public String getLobThreshold() { + return this.lobThreshold; + } + + @XmlAttribute(name = "maximumPrecision") + public void setMaximumPrecision(String maximumPrecision) { + this.maximumPrecision = maximumPrecision; + } + + public String getMaximumPrecision() { + return this.maximumPrecision; + } + + @XmlAttribute(name = "maximumScale") + public void setMaximumScale(String maximumScale) { + this.maximumScale = maximumScale; + } + + public String getMaximumScale() { + return this.maximumScale; + } + + @XmlAttribute(name = "metaDataSource") + public void setMetaDataSource(String metaDataSource) { + this.metaDataSource = metaDataSource; + } + + public String getMetaDataSource() { + return this.metaDataSource; + } + + @XmlAttribute(name = "minimumDivideScale") + public void setMinimumDivideScale(String minimumDivideScale) { + this.minimumDivideScale = minimumDivideScale; + } + + public String getMinimumDivideScale() { + return this.minimumDivideScale; + } + + @XmlAttribute(name = "naming") + public void setNaming(String naming) { + this.naming = naming; + } + + public String getNaming() { + return this.naming; + } + + @XmlAttribute(name = "packageAdd") + public void setPackageAdd(String packageAdd) { + this.packageAdd = packageAdd; + } + + public String getPackageAdd() { + return this.packageAdd; + } + + @XmlAttribute(name = "packageCCSID") + public void setPackageCCSID(String packageCCSID) { + this.packageCCSID = packageCCSID; + } + + public String getPackageCCSID() { + return this.packageCCSID; + } + + @XmlAttribute(name = "packageCache") + public void setPackageCache(String packageCache) { + this.packageCache = packageCache; + } + + public String getPackageCache() { + return this.packageCache; + } + + @XmlAttribute(name = "packageCriteria") + public void setPackageCriteria(String packageCriteria) { + this.packageCriteria = packageCriteria; + } + + public String getPackageCriteria() { + return this.packageCriteria; + } + + @XmlAttribute(name = "packageError") + public void setPackageError(String packageError) { + this.packageError = packageError; + } + + public String getPackageError() { + return this.packageError; + } + + @XmlAttribute(name = "packageLibrary") + public void setPackageLibrary(String packageLibrary) { + this.packageLibrary = packageLibrary; + } + + public String getPackageLibrary() { + return this.packageLibrary; + } + + @XmlAttribute(name = "prefetch") + public void setPrefetch(String prefetch) { + this.prefetch = prefetch; + } + + public String getPrefetch() { + return this.prefetch; + } + + @XmlAttribute(name = "prompt") + public void setPrompt(String prompt) { + this.prompt = prompt; + } + + public String getPrompt() { + return this.prompt; + } + + @XmlAttribute(name = "proxyServer") + public void setProxyServer(String proxyServer) { + this.proxyServer = proxyServer; + } + + public String getProxyServer() { + return this.proxyServer; + } + + @XmlAttribute(name = "qaqqiniLibrary") + public void setQaqqiniLibrary(String qaqqiniLibrary) { + this.qaqqiniLibrary = qaqqiniLibrary; + } + + public String getQaqqiniLibrary() { + return this.qaqqiniLibrary; + } + + @XmlAttribute(name = "queryOptimizeGoal") + public void setQueryOptimizeGoal(String queryOptimizeGoal) { + this.queryOptimizeGoal = queryOptimizeGoal; + } + + public String getQueryOptimizeGoal() { + return this.queryOptimizeGoal; + } + + @XmlAttribute(name = "receiveBufferSize") + public void setReceiveBufferSize(String receiveBufferSize) { + this.receiveBufferSize = receiveBufferSize; + } + + public String getReceiveBufferSize() { + return this.receiveBufferSize; + } + + @XmlAttribute(name = "remarks") + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getRemarks() { + return this.remarks; + } + + @XmlAttribute(name = "rollbackCursorHold") + public void setRollbackCursorHold(String rollbackCursorHold) { + this.rollbackCursorHold = rollbackCursorHold; + } + + public String getRollbackCursorHold() { + return this.rollbackCursorHold; + } + + @XmlAttribute(name = "savePasswordWhenSerialized") + public void setSavePasswordWhenSerialized(String savePasswordWhenSerialized) { + this.savePasswordWhenSerialized = savePasswordWhenSerialized; + } + + public String getSavePasswordWhenSerialized() { + return this.savePasswordWhenSerialized; + } + + @XmlAttribute(name = "secondaryUrl") + public void setSecondaryUrl(String secondaryUrl) { + this.secondaryUrl = secondaryUrl; + } + + public String getSecondaryUrl() { + return this.secondaryUrl; + } + + @XmlAttribute(name = "secure") + public void setSecure(String secure) { + this.secure = secure; + } + + public String getSecure() { + return this.secure; + } + + @XmlAttribute(name = "sendBufferSize") + public void setSendBufferSize(String sendBufferSize) { + this.sendBufferSize = sendBufferSize; + } + + public String getSendBufferSize() { + return this.sendBufferSize; + } + + @XmlAttribute(name = "serverTraceCategories") + public void setServerTraceCategories(String serverTraceCategories) { + this.serverTraceCategories = serverTraceCategories; + } + + public String getServerTraceCategories() { + return this.serverTraceCategories; + } + + @XmlAttribute(name = "soLinger") + public void setSoLinger(String soLinger) { + this.soLinger = soLinger; + } + + public String getSoLinger() { + return this.soLinger; + } + + @XmlAttribute(name = "soTimeout") + public void setSoTimeout(String soTimeout) { + this.soTimeout = soTimeout; + } + + public String getSoTimeout() { + return this.soTimeout; + } + + @XmlAttribute(name = "sort") + public void setSort(String sort) { + this.sort = sort; + } + + public String getSort() { + return this.sort; + } + + @XmlAttribute(name = "sortLanguage") + public void setSortLanguage(String sortLanguage) { + this.sortLanguage = sortLanguage; + } + + public String getSortLanguage() { + return this.sortLanguage; + } + + @XmlAttribute(name = "sortTable") + public void setSortTable(String sortTable) { + this.sortTable = sortTable; + } + + public String getSortTable() { + return this.sortTable; + } + + @XmlAttribute(name = "sortWeight") + public void setSortWeight(String sortWeight) { + this.sortWeight = sortWeight; + } + + public String getSortWeight() { + return this.sortWeight; + } + + @XmlAttribute(name = "tcpNoDelay") + public void setTcpNoDelay(String tcpNoDelay) { + this.tcpNoDelay = tcpNoDelay; + } + + public String getTcpNoDelay() { + return this.tcpNoDelay; + } + + @XmlAttribute(name = "threadUsed") + public void setThreadUsed(String threadUsed) { + this.threadUsed = threadUsed; + } + + public String getThreadUsed() { + return this.threadUsed; + } + + @XmlAttribute(name = "timeFormat") + public void setTimeFormat(String timeFormat) { + this.timeFormat = timeFormat; + } + + public String getTimeFormat() { + return this.timeFormat; + } + + @XmlAttribute(name = "timeSeparator") + public void setTimeSeparator(String timeSeparator) { + this.timeSeparator = timeSeparator; + } + + public String getTimeSeparator() { + return this.timeSeparator; + } + + @XmlAttribute(name = "toolboxTrace") + public void setToolboxTrace(String toolboxTrace) { + this.toolboxTrace = toolboxTrace; + } + + public String getToolboxTrace() { + return this.toolboxTrace; + } + + @XmlAttribute(name = "trace") + public void setTrace(String trace) { + this.trace = trace; + } + + public String getTrace() { + return this.trace; + } + + @XmlAttribute(name = "translateBinary") + public void setTranslateBinary(String translateBinary) { + this.translateBinary = translateBinary; + } + + public String getTranslateBinary() { + return this.translateBinary; + } + + @XmlAttribute(name = "translateBoolean") + public void setTranslateBoolean(String translateBoolean) { + this.translateBoolean = translateBoolean; + } + + public String getTranslateBoolean() { + return this.translateBoolean; + } + + @XmlAttribute(name = "translateHex") + public void setTranslateHex(String translateHex) { + this.translateHex = translateHex; + } + + public String getTranslateHex() { + return this.translateHex; + } + + @XmlAttribute(name = "trueAutoCommit") + public void setTrueAutoCommit(String trueAutoCommit) { + this.trueAutoCommit = trueAutoCommit; + } + + public String getTrueAutoCommit() { + return this.trueAutoCommit; + } + + @XmlAttribute(name = "xaLooselyCoupledSupport") + public void setXaLooselyCoupledSupport(String xaLooselyCoupledSupport) { + this.xaLooselyCoupledSupport = xaLooselyCoupledSupport; + } + + public String getXaLooselyCoupledSupport() { + return this.xaLooselyCoupledSupport; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (access != null) + buf.append("access=\"" + access + "\" "); + if (behaviorOverride != null) + buf.append("behaviorOverride=\"" + behaviorOverride + "\" "); + if (bidiImplicitReordering != null) + buf.append("bidiImplicitReordering=\"" + bidiImplicitReordering + "\" "); + if (bidiNumericOrdering != null) + buf.append("bidiNumericOrdering=\"" + bidiNumericOrdering + "\" "); + if (bidiStringType != null) + buf.append("bidiStringType=\"" + bidiStringType + "\" "); + if (bigDecimal != null) + buf.append("bigDecimal=\"" + bigDecimal + "\" "); + if (blockCriteria != null) + buf.append("blockCriteria=\"" + blockCriteria + "\" "); + if (blockSize != null) + buf.append("blockSize=\"" + blockSize + "\" "); + if (cursorHold != null) + buf.append("cursorHold=\"" + cursorHold + "\" "); + if (cursorSensitivity != null) + buf.append("cursorSensitivity=\"" + cursorSensitivity + "\" "); + if (dataCompression != null) + buf.append("dataCompression=\"" + dataCompression + "\" "); + if (dataTruncation != null) + buf.append("dataTruncation=\"" + dataTruncation + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (dateFormat != null) + buf.append("dateFormat=\"" + dateFormat + "\" "); + if (dateSeparator != null) + buf.append("dateSeparator=\"" + dateSeparator + "\" "); + if (decimalSeparator != null) + buf.append("decimalSeparator=\"" + decimalSeparator + "\" "); + if (driver != null) + buf.append("driver=\"" + driver + "\" "); + if (dsPackage != null) + buf.append("dsPackage=\"" + dsPackage + "\" "); + if (errors != null) + buf.append("errors=\"" + errors + "\" "); + if (extendedDynamic != null) + buf.append("extendedDynamic=\"" + extendedDynamic + "\" "); + if (extendedMetaData != null) + buf.append("extendedMetaData=\"" + extendedMetaData + "\" "); + if (fullOpen != null) + buf.append("fullOpen=\"" + fullOpen + "\" "); + if (holdInputLocators != null) + buf.append("holdInputLocators=\"" + holdInputLocators + "\" "); + if (holdStatements != null) + buf.append("holdStatements=\"" + holdStatements + "\" "); + if (isolationLevelSwitchingSupport != null) + buf.append("isolationLevelSwitchingSupport=\"" + isolationLevelSwitchingSupport + "\" "); + if (keepAlive != null) + buf.append("keepAlive=\"" + keepAlive + "\" "); + if (lazyClose != null) + buf.append("lazyClose=\"" + lazyClose + "\" "); + if (libraries != null) + buf.append("libraries=\"" + libraries + "\" "); + if (lobThreshold != null) + buf.append("lobThreshold=\"" + lobThreshold + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (maximumPrecision != null) + buf.append("maximumPrecision=\"" + maximumPrecision + "\" "); + if (maximumScale != null) + buf.append("maximumScale=\"" + maximumScale + "\" "); + if (metaDataSource != null) + buf.append("metaDataSource=\"" + metaDataSource + "\" "); + if (minimumDivideScale != null) + buf.append("minimumDivideScale=\"" + minimumDivideScale + "\" "); + if (naming != null) + buf.append("naming=\"" + naming + "\" "); + if (packageAdd != null) + buf.append("packageAdd=\"" + packageAdd + "\" "); + if (packageCCSID != null) + buf.append("packageCCSID=\"" + packageCCSID + "\" "); + if (packageCache != null) + buf.append("packageCache=\"" + packageCache + "\" "); + if (packageCriteria != null) + buf.append("packageCriteria=\"" + packageCriteria + "\" "); + if (packageError != null) + buf.append("packageError=\"" + packageError + "\" "); + if (packageLibrary != null) + buf.append("packageLibrary=\"" + packageLibrary + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (prefetch != null) + buf.append("prefetch=\"" + prefetch + "\" "); + if (prompt != null) + buf.append("prompt=\"" + prompt + "\" "); + if (proxyServer != null) + buf.append("proxyServer=\"" + proxyServer + "\" "); + if (qaqqiniLibrary != null) + buf.append("qaqqiniLibrary=\"" + qaqqiniLibrary + "\" "); + if (queryOptimizeGoal != null) + buf.append("queryOptimizeGoal=\"" + queryOptimizeGoal + "\" "); + if (receiveBufferSize != null) + buf.append("receiveBufferSize=\"" + receiveBufferSize + "\" "); + if (remarks != null) + buf.append("remarks=\"" + remarks + "\" "); + if (rollbackCursorHold != null) + buf.append("rollbackCursorHold=\"" + rollbackCursorHold + "\" "); + if (savePasswordWhenSerialized != null) + buf.append("savePasswordWhenSerialized=\"" + savePasswordWhenSerialized + "\" "); + if (secondaryUrl != null) + buf.append("secondaryUrl=\"" + secondaryUrl + "\" "); + if (secure != null) + buf.append("secure=\"" + secure + "\" "); + if (sendBufferSize != null) + buf.append("sendBufferSize=\"" + sendBufferSize + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (serverTraceCategories != null) + buf.append("serverTraceCategories=\"" + serverTraceCategories + "\" "); + if (soLinger != null) + buf.append("soLinger=\"" + soLinger + "\" "); + if (soTimeout != null) + buf.append("soTimeout=\"" + soTimeout + "\" "); + if (sort != null) + buf.append("sort=\"" + sort + "\" "); + if (sortLanguage != null) + buf.append("sortLanguage=\"" + sortLanguage + "\" "); + if (sortTable != null) + buf.append("sortTable=\"" + sortTable + "\" "); + if (sortWeight != null) + buf.append("sortWeight=\"" + sortWeight + "\" "); + if (tcpNoDelay != null) + buf.append("tcpNoDelay=\"" + tcpNoDelay + "\" "); + if (threadUsed != null) + buf.append("threadUsed=\"" + threadUsed + "\" "); + if (timeFormat != null) + buf.append("timeFormat=\"" + timeFormat + "\" "); + if (timeSeparator != null) + buf.append("timeSeparator=\"" + timeSeparator + "\" "); + if (toolboxTrace != null) + buf.append("toolboxTrace=\"" + toolboxTrace + "\" "); + if (trace != null) + buf.append("trace=\"" + trace + "\" "); + if (translateBinary != null) + buf.append("translateBinary=\"" + translateBinary + "\" "); + if (translateBoolean != null) + buf.append("translateBoolean=\"" + translateBoolean + "\" "); + if (translateHex != null) + buf.append("translateHex=\"" + translateHex + "\" "); + if (trueAutoCommit != null) + buf.append("trueAutoCommit=\"" + trueAutoCommit + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + if (xaLooselyCoupledSupport != null) + buf.append("xaLooselyCoupledSupport=\"" + xaLooselyCoupledSupport + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_db2_jcc.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_db2_jcc.java new file mode 100755 index 000000000000..4983d48ae8f6 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_db2_jcc.java @@ -0,0 +1,628 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_db2_jcc extends DataSourceProperties { + private String blockingReadConnectionTimeout; + private String clientAccountingInformation; + private String clientApplicationInformation; + private String clientRerouteAlternatePortNumber; + private String clientRerouteAlternateServerName; + private String clientRerouteServerListJNDIName; + private String clientUser; + private String clientWorkstation; + private String currentFunctionPath; + private String currentLockTimeout; + private String currentPackagePath; + private String currentPackageSet; + private String currentSQLID; + private String currentSchema; + private String cursorSensitivity; + private String deferPrepares; + private String driverType; + private String enableClientAffinitiesList; + private String enableNamedParameterMarkers; + private String enableSeamlessFailover; + private String enableSysplexWLB; + private String fetchSize; + private String fullyMaterializeInputStreams; + private String fullyMaterializeLobData; + private String keepAliveTimeout; + private String keepDynamic; + private String kerberosServerPrincipal; + private String maxRetriesForClientReroute; + private String queryCloseImplicit; + private String queryDataSize; + private String readOnly; + private String resultSetHoldability; + private String resultSetHoldabilityForCatalogQueries; + private String retrieveMessagesFromServerOnGetMessage; + private String retryIntervalForClientReroute; + private String securityMechanism; + private String sendDataAsIs; + private String sqljEnableClassLoaderSpecificProfiles; + private String sslConnection; + private String streamBufferSize; + private String sysSchema; + private String traceDirectory; + private String traceFile; + private String traceFileAppend; + private String traceLevel; + private String useCachedCursor; + private String useJDBC4ColumnNameAndLabelSemantics; + private String useTransactionRedirect; + private String xaNetworkOptimization; + + @Override + public String getElementName() { + return DB2_JCC; + } + + @XmlAttribute(name = "blockingReadConnectionTimeout") + public void setBlockingReadConnectionTimeout(String blockingReadConnectionTimeout) { + this.blockingReadConnectionTimeout = blockingReadConnectionTimeout; + } + + public String getBlockingReadConnectionTimeout() { + return this.blockingReadConnectionTimeout; + } + + @XmlAttribute(name = "clientAccountingInformation") + public void setClientAccountingInformation(String clientAccountingInformation) { + this.clientAccountingInformation = clientAccountingInformation; + } + + public String getClientAccountingInformation() { + return this.clientAccountingInformation; + } + + @XmlAttribute(name = "clientApplicationInformation") + public void setClientApplicationInformation(String clientApplicationInformation) { + this.clientApplicationInformation = clientApplicationInformation; + } + + public String getClientApplicationInformation() { + return this.clientApplicationInformation; + } + + @XmlAttribute(name = "clientRerouteAlternatePortNumber") + public void setClientRerouteAlternatePortNumber(String clientRerouteAlternatePortNumber) { + this.clientRerouteAlternatePortNumber = clientRerouteAlternatePortNumber; + } + + public String getClientRerouteAlternatePortNumber() { + return this.clientRerouteAlternatePortNumber; + } + + @XmlAttribute(name = "clientRerouteAlternateServerName") + public void setClientRerouteAlternateServerName(String clientRerouteAlternateServerName) { + this.clientRerouteAlternateServerName = clientRerouteAlternateServerName; + } + + public String getClientRerouteAlternateServerName() { + return this.clientRerouteAlternateServerName; + } + + @XmlAttribute(name = "clientRerouteServerListJNDIName") + public void setClientRerouteServerListJNDIName(String clientRerouteServerListJNDIName) { + this.clientRerouteServerListJNDIName = clientRerouteServerListJNDIName; + } + + public String getClientRerouteServerListJNDIName() { + return this.clientRerouteServerListJNDIName; + } + + @XmlAttribute(name = "clientUser") + public void setClientUser(String clientUser) { + this.clientUser = clientUser; + } + + public String getClientUser() { + return this.clientUser; + } + + @XmlAttribute(name = "clientWorkstation") + public void setClientWorkstation(String clientWorkstation) { + this.clientWorkstation = clientWorkstation; + } + + public String getClientWorkstation() { + return this.clientWorkstation; + } + + @XmlAttribute(name = "currentFunctionPath") + public void setCurrentFunctionPath(String currentFunctionPath) { + this.currentFunctionPath = currentFunctionPath; + } + + public String getCurrentFunctionPath() { + return this.currentFunctionPath; + } + + @XmlAttribute(name = "currentLockTimeout") + public void setCurrentLockTimeout(String currentLockTimeout) { + this.currentLockTimeout = currentLockTimeout; + } + + public String getCurrentLockTimeout() { + return this.currentLockTimeout; + } + + @XmlAttribute(name = "currentPackagePath") + public void setCurrentPackagePath(String currentPackagePath) { + this.currentPackagePath = currentPackagePath; + } + + public String getCurrentPackagePath() { + return this.currentPackagePath; + } + + @XmlAttribute(name = "currentPackageSet") + public void setCurrentPackageSet(String currentPackageSet) { + this.currentPackageSet = currentPackageSet; + } + + public String getCurrentPackageSet() { + return this.currentPackageSet; + } + + @XmlAttribute(name = "currentSQLID") + public void setCurrentSQLID(String currentSQLID) { + this.currentSQLID = currentSQLID; + } + + public String getCurrentSQLID() { + return this.currentSQLID; + } + + @XmlAttribute(name = "currentSchema") + public void setCurrentSchema(String currentSchema) { + this.currentSchema = currentSchema; + } + + public String getCurrentSchema() { + return this.currentSchema; + } + + @XmlAttribute(name = "cursorSensitivity") + public void setCursorSensitivity(String cursorSensitivity) { + this.cursorSensitivity = cursorSensitivity; + } + + public String getCursorSensitivity() { + return this.cursorSensitivity; + } + + @XmlAttribute(name = "deferPrepares") + public void setDeferPrepares(String deferPrepares) { + this.deferPrepares = deferPrepares; + } + + public String getDeferPrepares() { + return this.deferPrepares; + } + + @XmlAttribute(name = "driverType") + public void setDriverType(String driverType) { + this.driverType = driverType; + } + + public String getDriverType() { + return this.driverType; + } + + @XmlAttribute(name = "enableClientAffinitiesList") + public void setEnableClientAffinitiesList(String enableClientAffinitiesList) { + this.enableClientAffinitiesList = enableClientAffinitiesList; + } + + public String getEnableClientAffinitiesList() { + return this.enableClientAffinitiesList; + } + + @XmlAttribute(name = "enableNamedParameterMarkers") + public void setEnableNamedParameterMarkers(String enableNamedParameterMarkers) { + this.enableNamedParameterMarkers = enableNamedParameterMarkers; + } + + public String getEnableNamedParameterMarkers() { + return this.enableNamedParameterMarkers; + } + + @XmlAttribute(name = "enableSeamlessFailover") + public void setEnableSeamlessFailover(String enableSeamlessFailover) { + this.enableSeamlessFailover = enableSeamlessFailover; + } + + public String getEnableSeamlessFailover() { + return this.enableSeamlessFailover; + } + + @XmlAttribute(name = "enableSysplexWLB") + public void setEnableSysplexWLB(String enableSysplexWLB) { + this.enableSysplexWLB = enableSysplexWLB; + } + + public String getEnableSysplexWLB() { + return this.enableSysplexWLB; + } + + @XmlAttribute(name = "fetchSize") + public void setFetchSize(String fetchSize) { + this.fetchSize = fetchSize; + } + + public String getFetchSize() { + return this.fetchSize; + } + + @XmlAttribute(name = "fullyMaterializeInputStreams") + public void setFullyMaterializeInputStreams(String fullyMaterializeInputStreams) { + this.fullyMaterializeInputStreams = fullyMaterializeInputStreams; + } + + public String getFullyMaterializeInputStreams() { + return this.fullyMaterializeInputStreams; + } + + @XmlAttribute(name = "fullyMaterializeLobData") + public void setFullyMaterializeLobData(String fullyMaterializeLobData) { + this.fullyMaterializeLobData = fullyMaterializeLobData; + } + + public String getFullyMaterializeLobData() { + return this.fullyMaterializeLobData; + } + + @XmlAttribute(name = "keepAliveTimeout") + public void setKeepAliveTimeout(String keepAliveTimeout) { + this.keepAliveTimeout = keepAliveTimeout; + } + + public String getKeepAliveTimeout() { + return keepAliveTimeout; + } + + @XmlAttribute(name = "keepDynamic") + public void setKeepDynamic(String keepDynamic) { + this.keepDynamic = keepDynamic; + } + + public String getKeepDynamic() { + return this.keepDynamic; + } + + @XmlAttribute(name = "kerberosServerPrincipal") + public void setKerberosServerPrincipal(String kerberosServerPrincipal) { + this.kerberosServerPrincipal = kerberosServerPrincipal; + } + + public String getKerberosServerPrincipal() { + return this.kerberosServerPrincipal; + } + + @XmlAttribute(name = "maxRetriesForClientReroute") + public void setMaxRetriesForClientReroute(String maxRetriesForClientReroute) { + this.maxRetriesForClientReroute = maxRetriesForClientReroute; + } + + public String getMaxRetriesForClientReroute() { + return this.maxRetriesForClientReroute; + } + + @XmlAttribute(name = "queryCloseImplicit") + public void setQueryCloseImplicit(String queryCloseImplicit) { + this.queryCloseImplicit = queryCloseImplicit; + } + + public String getQueryCloseImplicit() { + return this.queryCloseImplicit; + } + + @XmlAttribute(name = "queryDataSize") + public void setQueryDataSize(String queryDataSize) { + this.queryDataSize = queryDataSize; + } + + public String getQueryDataSize() { + return this.queryDataSize; + } + + @XmlAttribute(name = "readOnly") + public void setReadOnly(String readOnly) { + this.readOnly = readOnly; + } + + public String getReadOnly() { + return this.readOnly; + } + + @XmlAttribute(name = "resultSetHoldability") + public void setResultSetHoldability(String resultSetHoldability) { + this.resultSetHoldability = resultSetHoldability; + } + + public String getResultSetHoldability() { + return this.resultSetHoldability; + } + + @XmlAttribute(name = "resultSetHoldabilityForCatalogQueries") + public void setResultSetHoldabilityForCatalogQueries(String resultSetHoldabilityForCatalogQueries) { + this.resultSetHoldabilityForCatalogQueries = resultSetHoldabilityForCatalogQueries; + } + + public String getResultSetHoldabilityForCatalogQueries() { + return this.resultSetHoldabilityForCatalogQueries; + } + + @XmlAttribute(name = "retrieveMessagesFromServerOnGetMessage") + public void setRetrieveMessagesFromServerOnGetMessage(String retrieveMessagesFromServerOnGetMessage) { + this.retrieveMessagesFromServerOnGetMessage = retrieveMessagesFromServerOnGetMessage; + } + + public String getRetrieveMessagesFromServerOnGetMessage() { + return this.retrieveMessagesFromServerOnGetMessage; + } + + @XmlAttribute(name = "retryIntervalForClientReroute") + public void setRetryIntervalForClientReroute(String retryIntervalForClientReroute) { + this.retryIntervalForClientReroute = retryIntervalForClientReroute; + } + + public String getRetryIntervalForClientReroute() { + return this.retryIntervalForClientReroute; + } + + @XmlAttribute(name = "securityMechanism") + public void setSecurityMechanism(String securityMechanism) { + this.securityMechanism = securityMechanism; + } + + public String getSecurityMechanism() { + return this.securityMechanism; + } + + @XmlAttribute(name = "sendDataAsIs") + public void setSendDataAsIs(String sendDataAsIs) { + this.sendDataAsIs = sendDataAsIs; + } + + public String getSendDataAsIs() { + return this.sendDataAsIs; + } + + @XmlAttribute(name = "sqljEnableClassLoaderSpecificProfiles") + public void setSqljEnableClassLoaderSpecificProfiles(String sqljEnableClassLoaderSpecificProfiles) { + this.sqljEnableClassLoaderSpecificProfiles = sqljEnableClassLoaderSpecificProfiles; + } + + public String getSqljEnableClassLoaderSpecificProfiles() { + return this.sqljEnableClassLoaderSpecificProfiles; + } + + @XmlAttribute(name = "sslConnection") + public void setSslConnection(String sslConnection) { + this.sslConnection = sslConnection; + } + + public String getSslConnection() { + return this.sslConnection; + } + + @XmlAttribute(name = "streamBufferSize") + public void setStreamBufferSize(String streamBufferSize) { + this.streamBufferSize = streamBufferSize; + } + + public String getStreamBufferSize() { + return this.streamBufferSize; + } + + @XmlAttribute(name = "sysSchema") + public void setSysSchema(String sysSchema) { + this.sysSchema = sysSchema; + } + + public String getSysSchema() { + return this.sysSchema; + } + + @XmlAttribute(name = "traceDirectory") + public void setTraceDirectory(String traceDirectory) { + this.traceDirectory = traceDirectory; + } + + public String getTraceDirectory() { + return this.traceDirectory; + } + + @XmlAttribute(name = "traceFile") + public void setTraceFile(String traceFile) { + this.traceFile = traceFile; + } + + public String getTraceFile() { + return this.traceFile; + } + + @XmlAttribute(name = "traceFileAppend") + public void setTraceFileAppend(String traceFileAppend) { + this.traceFileAppend = traceFileAppend; + } + + public String getTraceFileAppend() { + return this.traceFileAppend; + } + + @XmlAttribute(name = "traceLevel") + public void setTraceLevel(String traceLevel) { + this.traceLevel = traceLevel; + } + + public String getTraceLevel() { + return this.traceLevel; + } + + @XmlAttribute(name = "useCachedCursor") + public void setUseCachedCursor(String useCachedCursor) { + this.useCachedCursor = useCachedCursor; + } + + public String getUseCachedCursor() { + return this.useCachedCursor; + } + + @XmlAttribute(name = "useJDBC4ColumnNameAndLabelSemantics") + public void setUseJDBC4ColumnNameAndLabelSemantics(String useJDBC4ColumnNameAndLabelSemantics) { + this.useJDBC4ColumnNameAndLabelSemantics = useJDBC4ColumnNameAndLabelSemantics; + } + + public String getUseJDBC4ColumnNameAndLabelSemantics() { + return this.useJDBC4ColumnNameAndLabelSemantics; + } + + @XmlAttribute(name = "useTransactionRedirect") + public void setUseTransactionRedirect(String useTransactionRedirect) { + this.useTransactionRedirect = useTransactionRedirect; + } + + public String getUseTransactionRedirect() { + return this.useTransactionRedirect; + } + + @XmlAttribute(name = "xaNetworkOptimization") + public void setXaNetworkOptimization(String xaNetworkOptimization) { + this.xaNetworkOptimization = xaNetworkOptimization; + } + + public String getXaNetworkOptimization() { + return this.xaNetworkOptimization; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (blockingReadConnectionTimeout != null) + buf.append("blockingReadConnectionTimeout=\"" + blockingReadConnectionTimeout + "\" "); + if (clientAccountingInformation != null) + buf.append("clientAccountingInformation=\"" + clientAccountingInformation + "\" "); + if (clientApplicationInformation != null) + buf.append("clientApplicationInformation=\"" + clientApplicationInformation + "\" "); + if (clientRerouteAlternatePortNumber != null) + buf.append("clientRerouteAlternatePortNumber=\"" + clientRerouteAlternatePortNumber + "\" "); + if (clientRerouteAlternateServerName != null) + buf.append("clientRerouteAlternateServerName=\"" + clientRerouteAlternateServerName + "\" "); + if (clientRerouteServerListJNDIName != null) + buf.append("clientRerouteServerListJNDIName=\"" + clientRerouteServerListJNDIName + "\" "); + if (clientUser != null) + buf.append("clientUser=\"" + clientUser + "\" "); + if (clientWorkstation != null) + buf.append("clientWorkstation=\"" + clientWorkstation + "\" "); + if (currentFunctionPath != null) + buf.append("currentFunctionPath=\"" + currentFunctionPath + "\" "); + if (currentLockTimeout != null) + buf.append("currentLockTimeout=\"" + currentLockTimeout + "\" "); + if (currentPackagePath != null) + buf.append("currentPackagePath=\"" + currentPackagePath + "\" "); + if (currentPackageSet != null) + buf.append("currentPackageSet=\"" + currentPackageSet + "\" "); + if (currentSQLID != null) + buf.append("currentSQLID=\"" + currentSQLID + "\" "); + if (currentSchema != null) + buf.append("currentSchema=\"" + currentSchema + "\" "); + if (cursorSensitivity != null) + buf.append("cursorSensitivity=\"" + cursorSensitivity + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (deferPrepares != null) + buf.append("deferPrepares=\"" + deferPrepares + "\" "); + if (driverType != null) + buf.append("driverType=\"" + driverType + "\" "); + if (enableClientAffinitiesList != null) + buf.append("enableClientAffinitiesList=\"" + enableClientAffinitiesList + "\" "); + if (enableNamedParameterMarkers != null) + buf.append("enableNamedParameterMarkers=\"" + enableNamedParameterMarkers + "\" "); + if (enableSeamlessFailover != null) + buf.append("enableSeamlessFailover=\"" + enableSeamlessFailover + "\" "); + if (enableSysplexWLB != null) + buf.append("enableSysplexWLB=\"" + enableSysplexWLB + "\" "); + if (fetchSize != null) + buf.append("fetchSize=\"" + fetchSize + "\" "); + if (fullyMaterializeInputStreams != null) + buf.append("fullyMaterializeInputStreams=\"" + fullyMaterializeInputStreams + "\" "); + if (fullyMaterializeLobData != null) + buf.append("fullyMaterializeLobData=\"" + fullyMaterializeLobData + "\" "); + if (keepAliveTimeout != null) + buf.append("keepAliveTimeout=\"" + keepAliveTimeout + "\" "); + if (keepDynamic != null) + buf.append("keepDynamic=\"" + keepDynamic + "\" "); + if (kerberosServerPrincipal != null) + buf.append("kerberosServerPrincipal=\"" + kerberosServerPrincipal + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (maxRetriesForClientReroute != null) + buf.append("maxRetriesForClientReroute=\"" + maxRetriesForClientReroute + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (super.getPortNumber() != null) + buf.append("portNumber=\"" + super.getPortNumber() + "\" "); + if (queryCloseImplicit != null) + buf.append("queryCloseImplicit=\"" + queryCloseImplicit + "\" "); + if (queryDataSize != null) + buf.append("queryDataSize=\"" + queryDataSize + "\" "); + if (readOnly != null) + buf.append("readOnly=\"" + readOnly + "\" "); + if (resultSetHoldability != null) + buf.append("resultSetHoldability=\"" + resultSetHoldability + "\" "); + if (resultSetHoldabilityForCatalogQueries != null) + buf.append("resultSetHoldabilityForCatalogQueries=\"" + resultSetHoldabilityForCatalogQueries + "\" "); + if (retrieveMessagesFromServerOnGetMessage != null) + buf.append("retrieveMessagesFromServerOnGetMessage=\"" + retrieveMessagesFromServerOnGetMessage + "\" "); + if (retryIntervalForClientReroute != null) + buf.append("retryIntervalForClientReroute=\"" + retryIntervalForClientReroute + "\" "); + if (securityMechanism != null) + buf.append("securityMechanism=\"" + securityMechanism + "\" "); + if (sendDataAsIs != null) + buf.append("sendDataAsIs=\"" + sendDataAsIs + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (sqljEnableClassLoaderSpecificProfiles != null) + buf.append("sqljEnableClassLoaderSpecificProfiles=\"" + sqljEnableClassLoaderSpecificProfiles + "\" "); + if (sslConnection != null) + buf.append("sslConnection=\"" + sslConnection + "\" "); + if (streamBufferSize != null) + buf.append("streamBufferSize=\"" + streamBufferSize + "\" "); + if (sysSchema != null) + buf.append("sysSchema=\"" + sysSchema + "\" "); + if (traceDirectory != null) + buf.append("traceDirectory=\"" + traceDirectory + "\" "); + if (traceFile != null) + buf.append("traceFile=\"" + traceFile + "\" "); + if (traceFileAppend != null) + buf.append("traceFileAppend=\"" + traceFileAppend + "\" "); + if (traceLevel != null) + buf.append("traceLevel=\"" + traceLevel + "\" "); + if (useCachedCursor != null) + buf.append("useCachedCursor=\"" + useCachedCursor + "\" "); + if (useJDBC4ColumnNameAndLabelSemantics != null) + buf.append("useJDBC4ColumnNameAndLabelSemantics=\"" + useJDBC4ColumnNameAndLabelSemantics + "\" "); + if (useTransactionRedirect != null) + buf.append("useTransactionRedirect=\"" + useTransactionRedirect + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + if (xaNetworkOptimization != null) + buf.append("xaNetworkOptimization=\"" + xaNetworkOptimization + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_derby_client.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_derby_client.java new file mode 100755 index 000000000000..048281408adf --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_derby_client.java @@ -0,0 +1,160 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_derby_client extends DataSourceProperties { + private String connectionAttributes; + private String createDatabase; + private String retrieveMessageText; + private String securityMechanism; + private String shutdownDatabase; + private String ssl; + private String traceDirectory; + private String traceFile; + private String traceFileAppend; + private String traceLevel; + + @Override + public String getElementName() { + return DERBY_CLIENT; + } + + @XmlAttribute(name = "connectionAttributes") + public void setConnectionAttributes(String connectionAttributes) { + this.connectionAttributes = connectionAttributes; + } + + public String getConnectionAttributes() { + return this.connectionAttributes; + } + + @XmlAttribute(name = "createDatabase") + public void setCreateDatabase(String createDatabase) { + this.createDatabase = createDatabase; + } + + public String getCreateDatabase() { + return this.createDatabase; + } + + @XmlAttribute(name = "retrieveMessageText") + public void setRetrieveMessageText(String retrieveMessageText) { + this.retrieveMessageText = retrieveMessageText; + } + + public String getRetrieveMessageText() { + return this.retrieveMessageText; + } + + @XmlAttribute(name = "securityMechanism") + public void setSecurityMechanism(String securityMechanism) { + this.securityMechanism = securityMechanism; + } + + public String getSecurityMechanism() { + return this.securityMechanism; + } + + @XmlAttribute(name = "shutdownDatabase") + public void setShutdownDatabase(String shutdownDatabase) { + this.shutdownDatabase = shutdownDatabase; + } + + public String getShutdownDatabase() { + return this.shutdownDatabase; + } + + @XmlAttribute(name = "ssl") + public void setSsl(String ssl) { + this.ssl = ssl; + } + + public String getSsl() { + return this.ssl; + } + + @XmlAttribute(name = "traceDirectory") + public void setTraceDirectory(String traceDirectory) { + this.traceDirectory = traceDirectory; + } + + public String getTraceDirectory() { + return this.traceDirectory; + } + + @XmlAttribute(name = "traceFile") + public void setTraceFile(String traceFile) { + this.traceFile = traceFile; + } + + public String getTraceFile() { + return this.traceFile; + } + + @XmlAttribute(name = "traceFileAppend") + public void setTraceFileAppend(String traceFileAppend) { + this.traceFileAppend = traceFileAppend; + } + + public String getTraceFileAppend() { + return this.traceFileAppend; + } + + @XmlAttribute(name = "traceLevel") + public void setTraceLevel(String traceLevel) { + this.traceLevel = traceLevel; + } + + public String getTraceLevel() { + return this.traceLevel; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (connectionAttributes != null) + buf.append("connectionAttributes=\"" + connectionAttributes + "\" "); + if (createDatabase != null) + buf.append("createDatabase=\"" + createDatabase + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (super.getPortNumber() != null) + buf.append("portNumber=\"" + super.getPortNumber() + "\" "); + if (retrieveMessageText != null) + buf.append("retrieveMessageText=\"" + retrieveMessageText + "\" "); + if (securityMechanism != null) + buf.append("securityMechanism=\"" + securityMechanism + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (shutdownDatabase != null) + buf.append("shutdownDatabase=\"" + shutdownDatabase + "\" "); + if (ssl != null) + buf.append("ssl=\"" + ssl + "\" "); + if (traceDirectory != null) + buf.append("traceDirectory=\"" + traceDirectory + "\" "); + if (traceFile != null) + buf.append("traceFile=\"" + traceFile + "\" "); + if (traceFileAppend != null) + buf.append("traceFileAppend=\"" + traceFileAppend + "\" "); + if (traceLevel != null) + buf.append("traceLevel=\"" + traceLevel + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_derby_embedded.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_derby_embedded.java new file mode 100755 index 000000000000..899039d37b18 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_derby_embedded.java @@ -0,0 +1,71 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_derby_embedded extends DataSourceProperties { + private String connectionAttributes; + private String createDatabase; + private String shutdownDatabase; + + @Override + public String getElementName() { + return DERBY_EMBEDDED; + } + + @XmlAttribute(name = "connectionAttributes") + public void setConnectionAttributes(String connectionAttributes) { + this.connectionAttributes = connectionAttributes; + } + + public String getConnectionAttributes() { + return this.connectionAttributes; + } + + @XmlAttribute(name = "createDatabase") + public void setCreateDatabase(String createDatabase) { + this.createDatabase = createDatabase; + } + + public String getCreateDatabase() { + return this.createDatabase; + } + + @XmlAttribute(name = "shutdownDatabase") + public void setShutdownDatabase(String shutdownDatabase) { + this.shutdownDatabase = shutdownDatabase; + } + + public String getShutdownDatabase() { + return this.shutdownDatabase; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (connectionAttributes != null) + buf.append("connectionAttributes=\"" + connectionAttributes + "\" "); + if (createDatabase != null) + buf.append("createDatabase=\"" + createDatabase + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (shutdownDatabase != null) + buf.append("shutdownDatabase=\"" + shutdownDatabase + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + buf.append("}"); + return buf.toString(); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_informix.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_informix.java new file mode 100755 index 000000000000..5a4a167feb73 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_informix.java @@ -0,0 +1,832 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_informix extends DataSourceProperties { + private String ifxCLIENT_LOCALE; + private String ifxCPMAgeLimit; + private String ifxCPMInitPoolSize; + private String ifxCPMMaxConnections; + private String ifxCPMMaxPoolSize; + private String ifxCPMMinAgeLimit; + private String ifxCPMMinPoolSize; + private String ifxCPMServiceInterval; + private String ifxDBANSIWARN; + private String ifxDBCENTURY; + private String ifxDBDATE; + private String ifxDBSPACETEMP; + private String ifxDBTEMP; + private String ifxDBTIME; + private String ifxDBUPSPACE; + private String ifxDB_LOCALE; + private String ifxDELIMIDENT; + private String ifxENABLE_TYPE_CACHE; + private String ifxFET_BUF_SIZE; + private String ifxGL_DATE; + private String ifxGL_DATETIME; + private String ifxIFXHOST; + private String ifxIFX_AUTOFREE; + private String ifxIFX_DIRECTIVES; + private String ifxIFX_LOCK_MODE_WAIT; + private String ifxIFX_SOC_TIMEOUT; + private String ifxIFX_USEPUT; + private String ifxIFX_USE_STRENC; + private String ifxIFX_XASPEC; + private String ifxINFORMIXCONRETRY; + private String ifxINFORMIXCONTIME; + private String ifxINFORMIXOPCACHE; + private String ifxINFORMIXSTACKSIZE; + private String ifxJDBCTEMP; + private String ifxLDAP_IFXBASE; + private String ifxLDAP_PASSWD; + private String ifxLDAP_URL; + private String ifxLDAP_USER; + private String ifxLOBCACHE; + private String ifxNEWCODESET; + private String ifxNEWLOCALE; + private String ifxNODEFDAC; + private String ifxOPTCOMPIND; + private String ifxOPTOFC; + private String ifxOPT_GOAL; + private String ifxPATH; + private String ifxPDQPRIORITY; + private String ifxPLCONFIG; + private String ifxPLOAD_LO_PATH; + private String ifxPROTOCOLTRACE; + private String ifxPROTOCOLTRACEFILE; + private String ifxPROXY; + private String ifxPSORT_DBTEMP; + private String ifxPSORT_NPROCS; + private String ifxSECURITY; + private String ifxSQLH_FILE; + private String ifxSQLH_LOC; + private String ifxSQLH_TYPE; + private String ifxSSLCONNECTION; + private String ifxSTMT_CACHE; + private String ifxTRACE; + private String ifxTRACEFILE; + private String ifxTRUSTED_CONTEXT; + private String ifxUSEV5SERVER; + private String ifxUSE_DTENV; + private String roleName; + + @Override + public String getElementName() { + return INFORMIX_JDBC; + } + + @XmlAttribute(name = "ifxCLIENT_LOCALE") + public void setIfxCLIENT_LOCALE(String ifxCLIENT_LOCALE) { + this.ifxCLIENT_LOCALE = ifxCLIENT_LOCALE; + } + + public String getIfxCLIENT_LOCALE() { + return this.ifxCLIENT_LOCALE; + } + + @XmlAttribute(name = "ifxCPMAgeLimit") + public void setIfxCPMAgeLimit(String ifxCPMAgeLimit) { + this.ifxCPMAgeLimit = ifxCPMAgeLimit; + } + + public String getIfxCPMAgeLimit() { + return this.ifxCPMAgeLimit; + } + + @XmlAttribute(name = "ifxCPMInitPoolSize") + public void setIfxCPMInitPoolSize(String ifxCPMInitPoolSize) { + this.ifxCPMInitPoolSize = ifxCPMInitPoolSize; + } + + public String getIfxCPMInitPoolSize() { + return this.ifxCPMInitPoolSize; + } + + @XmlAttribute(name = "ifxCPMMaxConnections") + public void setIfxCPMMaxConnections(String ifxCPMMaxConnections) { + this.ifxCPMMaxConnections = ifxCPMMaxConnections; + } + + public String getIfxCPMMaxConnections() { + return this.ifxCPMMaxConnections; + } + + @XmlAttribute(name = "ifxCPMMaxPoolSize") + public void setIfxCPMMaxPoolSize(String ifxCPMMaxPoolSize) { + this.ifxCPMMaxPoolSize = ifxCPMMaxPoolSize; + } + + public String getIfxCPMMaxPoolSize() { + return this.ifxCPMMaxPoolSize; + } + + @XmlAttribute(name = "ifxCPMMinAgeLimit") + public void setIfxCPMMinAgeLimit(String ifxCPMMinAgeLimit) { + this.ifxCPMMinAgeLimit = ifxCPMMinAgeLimit; + } + + public String getIfxCPMMinAgeLimit() { + return this.ifxCPMMinAgeLimit; + } + + @XmlAttribute(name = "ifxCPMMinPoolSize") + public void setIfxCPMMinPoolSize(String ifxCPMMinPoolSize) { + this.ifxCPMMinPoolSize = ifxCPMMinPoolSize; + } + + public String getIfxCPMMinPoolSize() { + return this.ifxCPMMinPoolSize; + } + + @XmlAttribute(name = "ifxCPMServiceInterval") + public void setIfxCPMServiceInterval(String ifxCPMServiceInterval) { + this.ifxCPMServiceInterval = ifxCPMServiceInterval; + } + + public String getIfxCPMServiceInterval() { + return this.ifxCPMServiceInterval; + } + + @XmlAttribute(name = "ifxDBANSIWARN") + public void setIfxDBANSIWARN(String ifxDBANSIWARN) { + this.ifxDBANSIWARN = ifxDBANSIWARN; + } + + public String getIfxDBANSIWARN() { + return this.ifxDBANSIWARN; + } + + @XmlAttribute(name = "ifxDBCENTURY") + public void setIfxDBCENTURY(String ifxDBCENTURY) { + this.ifxDBCENTURY = ifxDBCENTURY; + } + + public String getIfxDBCENTURY() { + return this.ifxDBCENTURY; + } + + @XmlAttribute(name = "ifxDBDATE") + public void setIfxDBDATE(String ifxDBDATE) { + this.ifxDBDATE = ifxDBDATE; + } + + public String getIfxDBDATE() { + return this.ifxDBDATE; + } + + @XmlAttribute(name = "ifxDBSPACETEMP") + public void setIfxDBSPACETEMP(String ifxDBSPACETEMP) { + this.ifxDBSPACETEMP = ifxDBSPACETEMP; + } + + public String getIfxDBSPACETEMP() { + return this.ifxDBSPACETEMP; + } + + @XmlAttribute(name = "ifxDBTEMP") + public void setIfxDBTEMP(String ifxDBTEMP) { + this.ifxDBTEMP = ifxDBTEMP; + } + + public String getIfxDBTEMP() { + return this.ifxDBTEMP; + } + + @XmlAttribute(name = "ifxDBTIME") + public void setIfxDBTIME(String ifxDBTIME) { + this.ifxDBTIME = ifxDBTIME; + } + + public String getIfxDBTIME() { + return this.ifxDBTIME; + } + + @XmlAttribute(name = "ifxDBUPSPACE") + public void setIfxDBUPSPACE(String ifxDBUPSPACE) { + this.ifxDBUPSPACE = ifxDBUPSPACE; + } + + public String getIfxDBUPSPACE() { + return this.ifxDBUPSPACE; + } + + @XmlAttribute(name = "ifxDB_LOCALE") + public void setIfxDB_LOCALE(String ifxDB_LOCALE) { + this.ifxDB_LOCALE = ifxDB_LOCALE; + } + + public String getIfxDB_LOCALE() { + return this.ifxDB_LOCALE; + } + + @XmlAttribute(name = "ifxDELIMIDENT") + public void setIfxDELIMIDENT(String ifxDELIMIDENT) { + this.ifxDELIMIDENT = ifxDELIMIDENT; + } + + public String getIfxDELIMIDENT() { + return this.ifxDELIMIDENT; + } + + @XmlAttribute(name = "ifxENABLE_TYPE_CACHE") + public void setIfxENABLE_TYPE_CACHE(String ifxENABLE_TYPE_CACHE) { + this.ifxENABLE_TYPE_CACHE = ifxENABLE_TYPE_CACHE; + } + + public String getIfxENABLE_TYPE_CACHE() { + return this.ifxENABLE_TYPE_CACHE; + } + + @XmlAttribute(name = "ifxFET_BUF_SIZE") + public void setIfxFET_BUF_SIZE(String ifxFET_BUF_SIZE) { + this.ifxFET_BUF_SIZE = ifxFET_BUF_SIZE; + } + + public String getIfxFET_BUF_SIZE() { + return this.ifxFET_BUF_SIZE; + } + + @XmlAttribute(name = "ifxGL_DATE") + public void setIfxGL_DATE(String ifxGL_DATE) { + this.ifxGL_DATE = ifxGL_DATE; + } + + public String getIfxGL_DATE() { + return this.ifxGL_DATE; + } + + @XmlAttribute(name = "ifxGL_DATETIME") + public void setIfxGL_DATETIME(String ifxGL_DATETIME) { + this.ifxGL_DATETIME = ifxGL_DATETIME; + } + + public String getIfxGL_DATETIME() { + return this.ifxGL_DATETIME; + } + + @XmlAttribute(name = "ifxIFXHOST") + public void setIfxIFXHOST(String ifxIFXHOST) { + this.ifxIFXHOST = ifxIFXHOST; + } + + public String getIfxIFXHOST() { + return this.ifxIFXHOST; + } + + @XmlAttribute(name = "ifxIFX_AUTOFREE") + public void setIfxIFX_AUTOFREE(String ifxIFX_AUTOFREE) { + this.ifxIFX_AUTOFREE = ifxIFX_AUTOFREE; + } + + public String getIfxIFX_AUTOFREE() { + return this.ifxIFX_AUTOFREE; + } + + @XmlAttribute(name = "ifxIFX_DIRECTIVES") + public void setIfxIFX_DIRECTIVES(String ifxIFX_DIRECTIVES) { + this.ifxIFX_DIRECTIVES = ifxIFX_DIRECTIVES; + } + + public String getIfxIFX_DIRECTIVES() { + return this.ifxIFX_DIRECTIVES; + } + + @XmlAttribute(name = "ifxIFX_LOCK_MODE_WAIT") + public void setIfxIFX_LOCK_MODE_WAIT(String ifxIFX_LOCK_MODE_WAIT) { + this.ifxIFX_LOCK_MODE_WAIT = ifxIFX_LOCK_MODE_WAIT; + } + + public String getIfxIFX_LOCK_MODE_WAIT() { + return this.ifxIFX_LOCK_MODE_WAIT; + } + + @XmlAttribute(name = "ifxIFX_SOC_TIMEOUT") + public void setIfxIFX_SOC_TIMEOUT(String ifxIFX_SOC_TIMEOUT) { + this.ifxIFX_SOC_TIMEOUT = ifxIFX_SOC_TIMEOUT; + } + + public String getIfxIFX_SOC_TIMEOUT() { + return this.ifxIFX_SOC_TIMEOUT; + } + + @XmlAttribute(name = "ifxIFX_USEPUT") + public void setIfxIFX_USEPUT(String ifxIFX_USEPUT) { + this.ifxIFX_USEPUT = ifxIFX_USEPUT; + } + + public String getIfxIFX_USEPUT() { + return this.ifxIFX_USEPUT; + } + + @XmlAttribute(name = "ifxIFX_USE_STRENC") + public void setIfxIFX_USE_STRENC(String ifxIFX_USE_STRENC) { + this.ifxIFX_USE_STRENC = ifxIFX_USE_STRENC; + } + + public String getIfxIFX_USE_STRENC() { + return this.ifxIFX_USE_STRENC; + } + + @XmlAttribute(name = "ifxIFX_XASPEC") + public void setIfxIFX_XASPEC(String ifxIFX_XASPEC) { + this.ifxIFX_XASPEC = ifxIFX_XASPEC; + } + + public String getIfxIFX_XASPEC() { + return this.ifxIFX_XASPEC; + } + + @XmlAttribute(name = "ifxINFORMIXCONRETRY") + public void setIfxINFORMIXCONRETRY(String ifxINFORMIXCONRETRY) { + this.ifxINFORMIXCONRETRY = ifxINFORMIXCONRETRY; + } + + public String getIfxINFORMIXCONRETRY() { + return this.ifxINFORMIXCONRETRY; + } + + @XmlAttribute(name = "ifxINFORMIXCONTIME") + public void setIfxINFORMIXCONTIME(String ifxINFORMIXCONTIME) { + this.ifxINFORMIXCONTIME = ifxINFORMIXCONTIME; + } + + public String getIfxINFORMIXCONTIME() { + return this.ifxINFORMIXCONTIME; + } + + @XmlAttribute(name = "ifxINFORMIXOPCACHE") + public void setIfxINFORMIXOPCACHE(String ifxINFORMIXOPCACHE) { + this.ifxINFORMIXOPCACHE = ifxINFORMIXOPCACHE; + } + + public String getIfxINFORMIXOPCACHE() { + return this.ifxINFORMIXOPCACHE; + } + + @XmlAttribute(name = "ifxINFORMIXSTACKSIZE") + public void setIfxINFORMIXSTACKSIZE(String ifxINFORMIXSTACKSIZE) { + this.ifxINFORMIXSTACKSIZE = ifxINFORMIXSTACKSIZE; + } + + public String getIfxINFORMIXSTACKSIZE() { + return this.ifxINFORMIXSTACKSIZE; + } + + @XmlAttribute(name = "ifxJDBCTEMP") + public void setIfxJDBCTEMP(String ifxJDBCTEMP) { + this.ifxJDBCTEMP = ifxJDBCTEMP; + } + + public String getIfxJDBCTEMP() { + return this.ifxJDBCTEMP; + } + + @XmlAttribute(name = "ifxLDAP_IFXBASE") + public void setIfxLDAP_IFXBASE(String ifxLDAP_IFXBASE) { + this.ifxLDAP_IFXBASE = ifxLDAP_IFXBASE; + } + + public String getIfxLDAP_IFXBASE() { + return this.ifxLDAP_IFXBASE; + } + + @XmlAttribute(name = "ifxLDAP_PASSWD") + public void setIfxLDAP_PASSWD(String ifxLDAP_PASSWD) { + this.ifxLDAP_PASSWD = ifxLDAP_PASSWD; + } + + public String getIfxLDAP_PASSWD() { + return this.ifxLDAP_PASSWD; + } + + @XmlAttribute(name = "ifxLDAP_URL") + public void setIfxLDAP_URL(String ifxLDAP_URL) { + this.ifxLDAP_URL = ifxLDAP_URL; + } + + public String getIfxLDAP_URL() { + return this.ifxLDAP_URL; + } + + @XmlAttribute(name = "ifxLDAP_USER") + public void setIfxLDAP_USER(String ifxLDAP_USER) { + this.ifxLDAP_USER = ifxLDAP_USER; + } + + public String getIfxLDAP_USER() { + return this.ifxLDAP_USER; + } + + @XmlAttribute(name = "ifxLOBCACHE") + public void setIfxLOBCACHE(String ifxLOBCACHE) { + this.ifxLOBCACHE = ifxLOBCACHE; + } + + public String getIfxLOBCACHE() { + return this.ifxLOBCACHE; + } + + @XmlAttribute(name = "ifxNEWCODESET") + public void setIfxNEWCODESET(String ifxNEWCODESET) { + this.ifxNEWCODESET = ifxNEWCODESET; + } + + public String getIfxNEWCODESET() { + return this.ifxNEWCODESET; + } + + @XmlAttribute(name = "ifxNEWLOCALE") + public void setIfxNEWLOCALE(String ifxNEWLOCALE) { + this.ifxNEWLOCALE = ifxNEWLOCALE; + } + + public String getIfxNEWLOCALE() { + return this.ifxNEWLOCALE; + } + + @XmlAttribute(name = "ifxNODEFDAC") + public void setIfxNODEFDAC(String ifxNODEFDAC) { + this.ifxNODEFDAC = ifxNODEFDAC; + } + + public String getIfxNODEFDAC() { + return this.ifxNODEFDAC; + } + + @XmlAttribute(name = "ifxOPTCOMPIND") + public void setIfxOPTCOMPIND(String ifxOPTCOMPIND) { + this.ifxOPTCOMPIND = ifxOPTCOMPIND; + } + + public String getIfxOPTCOMPIND() { + return this.ifxOPTCOMPIND; + } + + @XmlAttribute(name = "ifxOPTOFC") + public void setIfxOPTOFC(String ifxOPTOFC) { + this.ifxOPTOFC = ifxOPTOFC; + } + + public String getIfxOPTOFC() { + return this.ifxOPTOFC; + } + + @XmlAttribute(name = "ifxOPT_GOAL") + public void setIfxOPT_GOAL(String ifxOPT_GOAL) { + this.ifxOPT_GOAL = ifxOPT_GOAL; + } + + public String getIfxOPT_GOAL() { + return this.ifxOPT_GOAL; + } + + @XmlAttribute(name = "ifxPATH") + public void setIfxPATH(String ifxPATH) { + this.ifxPATH = ifxPATH; + } + + public String getIfxPATH() { + return this.ifxPATH; + } + + @XmlAttribute(name = "ifxPDQPRIORITY") + public void setIfxPDQPRIORITY(String ifxPDQPRIORITY) { + this.ifxPDQPRIORITY = ifxPDQPRIORITY; + } + + public String getIfxPDQPRIORITY() { + return this.ifxPDQPRIORITY; + } + + @XmlAttribute(name = "ifxPLCONFIG") + public void setIfxPLCONFIG(String ifxPLCONFIG) { + this.ifxPLCONFIG = ifxPLCONFIG; + } + + public String getIfxPLCONFIG() { + return this.ifxPLCONFIG; + } + + @XmlAttribute(name = "ifxPLOAD_LO_PATH") + public void setIfxPLOAD_LO_PATH(String ifxPLOAD_LO_PATH) { + this.ifxPLOAD_LO_PATH = ifxPLOAD_LO_PATH; + } + + public String getIfxPLOAD_LO_PATH() { + return this.ifxPLOAD_LO_PATH; + } + + @XmlAttribute(name = "ifxPROTOCOLTRACE") + public void setIfxPROTOCOLTRACE(String ifxPROTOCOLTRACE) { + this.ifxPROTOCOLTRACE = ifxPROTOCOLTRACE; + } + + public String getIfxPROTOCOLTRACE() { + return this.ifxPROTOCOLTRACE; + } + + @XmlAttribute(name = "ifxPROTOCOLTRACEFILE") + public void setIfxPROTOCOLTRACEFILE(String ifxPROTOCOLTRACEFILE) { + this.ifxPROTOCOLTRACEFILE = ifxPROTOCOLTRACEFILE; + } + + public String getIfxPROTOCOLTRACEFILE() { + return this.ifxPROTOCOLTRACEFILE; + } + + @XmlAttribute(name = "ifxPROXY") + public void setIfxPROXY(String ifxPROXY) { + this.ifxPROXY = ifxPROXY; + } + + public String getIfxPROXY() { + return this.ifxPROXY; + } + + @XmlAttribute(name = "ifxPSORT_DBTEMP") + public void setIfxPSORT_DBTEMP(String ifxPSORT_DBTEMP) { + this.ifxPSORT_DBTEMP = ifxPSORT_DBTEMP; + } + + public String getIfxPSORT_DBTEMP() { + return this.ifxPSORT_DBTEMP; + } + + @XmlAttribute(name = "ifxPSORT_NPROCS") + public void setIfxPSORT_NPROCS(String ifxPSORT_NPROCS) { + this.ifxPSORT_NPROCS = ifxPSORT_NPROCS; + } + + public String getIfxPSORT_NPROCS() { + return this.ifxPSORT_NPROCS; + } + + @XmlAttribute(name = "ifxSECURITY") + public void setIfxSECURITY(String ifxSECURITY) { + this.ifxSECURITY = ifxSECURITY; + } + + public String getIfxSECURITY() { + return this.ifxSECURITY; + } + + @XmlAttribute(name = "ifxSQLH_FILE") + public void setIfxSQLH_FILE(String ifxSQLH_FILE) { + this.ifxSQLH_FILE = ifxSQLH_FILE; + } + + public String getIfxSQLH_FILE() { + return this.ifxSQLH_FILE; + } + + @XmlAttribute(name = "ifxSQLH_LOC") + public void setIfxSQLH_LOC(String ifxSQLH_LOC) { + this.ifxSQLH_LOC = ifxSQLH_LOC; + } + + public String getIfxSQLH_LOC() { + return this.ifxSQLH_LOC; + } + + @XmlAttribute(name = "ifxSQLH_TYPE") + public void setIfxSQLH_TYPE(String ifxSQLH_TYPE) { + this.ifxSQLH_TYPE = ifxSQLH_TYPE; + } + + public String getIfxSQLH_TYPE() { + return this.ifxSQLH_TYPE; + } + + @XmlAttribute(name = "ifxSSLCONNECTION") + public void setIfxSSLCONNECTION(String ifxSSLCONNECTION) { + this.ifxSSLCONNECTION = ifxSSLCONNECTION; + } + + public String getIfxSSLCONNECTION() { + return this.ifxSSLCONNECTION; + } + + @XmlAttribute(name = "ifxSTMT_CACHE") + public void setIfxSTMT_CACHE(String ifxSTMT_CACHE) { + this.ifxSTMT_CACHE = ifxSTMT_CACHE; + } + + public String getIfxSTMT_CACHE() { + return this.ifxSTMT_CACHE; + } + + @XmlAttribute(name = "ifxTRACE") + public void setIfxTRACE(String ifxTRACE) { + this.ifxTRACE = ifxTRACE; + } + + public String getIfxTRACE() { + return this.ifxTRACE; + } + + @XmlAttribute(name = "ifxTRACEFILE") + public void setIfxTRACEFILE(String ifxTRACEFILE) { + this.ifxTRACEFILE = ifxTRACEFILE; + } + + public String getIfxTRACEFILE() { + return this.ifxTRACEFILE; + } + + @XmlAttribute(name = "ifxTRUSTED_CONTEXT") + public void setIfxTRUSTED_CONTEXT(String ifxTRUSTED_CONTEXT) { + this.ifxTRUSTED_CONTEXT = ifxTRUSTED_CONTEXT; + } + + public String getIfxTRUSTED_CONTEXT() { + return this.ifxTRUSTED_CONTEXT; + } + + @XmlAttribute(name = "ifxUSEV5SERVER") + public void setIfxUSEV5SERVER(String ifxUSEV5SERVER) { + this.ifxUSEV5SERVER = ifxUSEV5SERVER; + } + + public String getIfxUSEV5SERVER() { + return this.ifxUSEV5SERVER; + } + + @XmlAttribute(name = "ifxUSE_DTENV") + public void setIfxUSE_DTENV(String ifxUSE_DTENV) { + this.ifxUSE_DTENV = ifxUSE_DTENV; + } + + public String getIfxUSE_DTENV() { + return this.ifxUSE_DTENV; + } + + @XmlAttribute(name = "roleName") + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public String getRoleName() { + return this.roleName; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (ifxCLIENT_LOCALE != null) + buf.append("ifxCLIENT_LOCALE=\"" + ifxCLIENT_LOCALE + "\" "); + if (ifxCPMAgeLimit != null) + buf.append("ifxCPMAgeLimit=\"" + ifxCPMAgeLimit + "\" "); + if (ifxCPMInitPoolSize != null) + buf.append("ifxCPMInitPoolSize=\"" + ifxCPMInitPoolSize + "\" "); + if (ifxCPMMaxConnections != null) + buf.append("ifxCPMMaxConnections=\"" + ifxCPMMaxConnections + "\" "); + if (ifxCPMMaxPoolSize != null) + buf.append("ifxCPMMaxPoolSize=\"" + ifxCPMMaxPoolSize + "\" "); + if (ifxCPMMinAgeLimit != null) + buf.append("ifxCPMMinAgeLimit=\"" + ifxCPMMinAgeLimit + "\" "); + if (ifxCPMMinPoolSize != null) + buf.append("ifxCPMMinPoolSize=\"" + ifxCPMMinPoolSize + "\" "); + if (ifxCPMServiceInterval != null) + buf.append("ifxCPMServiceInterval=\"" + ifxCPMServiceInterval + "\" "); + if (ifxDBANSIWARN != null) + buf.append("ifxDBANSIWARN=\"" + ifxDBANSIWARN + "\" "); + if (ifxDBCENTURY != null) + buf.append("ifxDBCENTURY=\"" + ifxDBCENTURY + "\" "); + if (ifxDBDATE != null) + buf.append("ifxDBDATE=\"" + ifxDBDATE + "\" "); + if (ifxDBSPACETEMP != null) + buf.append("ifxDBSPACETEMP=\"" + ifxDBSPACETEMP + "\" "); + if (ifxDBTEMP != null) + buf.append("ifxDBTEMP=\"" + ifxDBTEMP + "\" "); + if (ifxDBTIME != null) + buf.append("ifxDBTIME=\"" + ifxDBTIME + "\" "); + if (ifxDBUPSPACE != null) + buf.append("ifxDBUPSPACE=\"" + ifxDBUPSPACE + "\" "); + if (ifxDB_LOCALE != null) + buf.append("ifxDB_LOCALE=\"" + ifxDB_LOCALE + "\" "); + if (ifxDELIMIDENT != null) + buf.append("ifxDELIMIDENT=\"" + ifxDELIMIDENT + "\" "); + if (ifxENABLE_TYPE_CACHE != null) + buf.append("ifxENABLE_TYPE_CACHE=\"" + ifxENABLE_TYPE_CACHE + "\" "); + if (ifxFET_BUF_SIZE != null) + buf.append("ifxFET_BUF_SIZE=\"" + ifxFET_BUF_SIZE + "\" "); + if (ifxGL_DATE != null) + buf.append("ifxGL_DATE=\"" + ifxGL_DATE + "\" "); + if (ifxGL_DATETIME != null) + buf.append("ifxGL_DATETIME=\"" + ifxGL_DATETIME + "\" "); + if (ifxIFXHOST != null) + buf.append("ifxIFXHOST=\"" + ifxIFXHOST + "\" "); + if (ifxIFX_AUTOFREE != null) + buf.append("ifxIFX_AUTOFREE=\"" + ifxIFX_AUTOFREE + "\" "); + if (ifxIFX_DIRECTIVES != null) + buf.append("ifxIFX_DIRECTIVES=\"" + ifxIFX_DIRECTIVES + "\" "); + if (ifxIFX_LOCK_MODE_WAIT != null) + buf.append("ifxIFX_LOCK_MODE_WAIT=\"" + ifxIFX_LOCK_MODE_WAIT + "\" "); + if (ifxIFX_SOC_TIMEOUT != null) + buf.append("ifxIFX_SOC_TIMEOUT=\"" + ifxIFX_SOC_TIMEOUT + "\" "); + if (ifxIFX_USEPUT != null) + buf.append("ifxIFX_USEPUT=\"" + ifxIFX_USEPUT + "\" "); + if (ifxIFX_USE_STRENC != null) + buf.append("ifxIFX_USE_STRENC=\"" + ifxIFX_USE_STRENC + "\" "); + if (ifxIFX_XASPEC != null) + buf.append("ifxIFX_XASPEC=\"" + ifxIFX_XASPEC + "\" "); + if (ifxINFORMIXCONRETRY != null) + buf.append("ifxINFORMIXCONRETRY=\"" + ifxINFORMIXCONRETRY + "\" "); + if (ifxINFORMIXCONTIME != null) + buf.append("ifxINFORMIXCONTIME=\"" + ifxINFORMIXCONTIME + "\" "); + if (ifxINFORMIXOPCACHE != null) + buf.append("ifxINFORMIXOPCACHE=\"" + ifxINFORMIXOPCACHE + "\" "); + if (ifxINFORMIXSTACKSIZE != null) + buf.append("ifxINFORMIXSTACKSIZE=\"" + ifxINFORMIXSTACKSIZE + "\" "); + if (ifxJDBCTEMP != null) + buf.append("ifxJDBCTEMP=\"" + ifxJDBCTEMP + "\" "); + if (ifxLDAP_IFXBASE != null) + buf.append("ifxLDAP_IFXBASE=\"" + ifxLDAP_IFXBASE + "\" "); + if (ifxLDAP_PASSWD != null) + buf.append("ifxLDAP_PASSWD=\"" + ifxLDAP_PASSWD + "\" "); + if (ifxLDAP_URL != null) + buf.append("ifxLDAP_URL=\"" + ifxLDAP_URL + "\" "); + if (ifxLDAP_USER != null) + buf.append("ifxLDAP_USER=\"" + ifxLDAP_USER + "\" "); + if (ifxLOBCACHE != null) + buf.append("ifxLOBCACHE=\"" + ifxLOBCACHE + "\" "); + if (ifxNEWCODESET != null) + buf.append("ifxNEWCODESET=\"" + ifxNEWCODESET + "\" "); + if (ifxNEWLOCALE != null) + buf.append("ifxNEWLOCALE=\"" + ifxNEWLOCALE + "\" "); + if (ifxNODEFDAC != null) + buf.append("ifxNODEFDAC=\"" + ifxNODEFDAC + "\" "); + if (ifxOPTCOMPIND != null) + buf.append("ifxOPTCOMPIND=\"" + ifxOPTCOMPIND + "\" "); + if (ifxOPTOFC != null) + buf.append("ifxOPTOFC=\"" + ifxOPTOFC + "\" "); + if (ifxOPT_GOAL != null) + buf.append("ifxOPT_GOAL=\"" + ifxOPT_GOAL + "\" "); + if (ifxPATH != null) + buf.append("ifxPATH=\"" + ifxPATH + "\" "); + if (ifxPDQPRIORITY != null) + buf.append("ifxPDQPRIORITY=\"" + ifxPDQPRIORITY + "\" "); + if (ifxPLCONFIG != null) + buf.append("ifxPLCONFIG=\"" + ifxPLCONFIG + "\" "); + if (ifxPLOAD_LO_PATH != null) + buf.append("ifxPLOAD_LO_PATH=\"" + ifxPLOAD_LO_PATH + "\" "); + if (ifxPROTOCOLTRACE != null) + buf.append("ifxPROTOCOLTRACE=\"" + ifxPROTOCOLTRACE + "\" "); + if (ifxPROTOCOLTRACEFILE != null) + buf.append("ifxPROTOCOLTRACEFILE=\"" + ifxPROTOCOLTRACEFILE + "\" "); + if (ifxPROXY != null) + buf.append("ifxPROXY=\"" + ifxPROXY + "\" "); + if (ifxPSORT_DBTEMP != null) + buf.append("ifxPSORT_DBTEMP=\"" + ifxPSORT_DBTEMP + "\" "); + if (ifxPSORT_NPROCS != null) + buf.append("ifxPSORT_NPROCS=\"" + ifxPSORT_NPROCS + "\" "); + if (ifxSECURITY != null) + buf.append("ifxSECURITY=\"" + ifxSECURITY + "\" "); + if (ifxSQLH_FILE != null) + buf.append("ifxSQLH_FILE=\"" + ifxSQLH_FILE + "\" "); + if (ifxSQLH_LOC != null) + buf.append("ifxSQLH_LOC=\"" + ifxSQLH_LOC + "\" "); + if (ifxSQLH_TYPE != null) + buf.append("ifxSQLH_TYPE=\"" + ifxSQLH_TYPE + "\" "); + if (ifxSSLCONNECTION != null) + buf.append("ifxSSLCONNECTION=\"" + ifxSSLCONNECTION + "\" "); + if (ifxSTMT_CACHE != null) + buf.append("ifxSTMT_CACHE=\"" + ifxSTMT_CACHE + "\" "); + if (ifxTRACE != null) + buf.append("ifxTRACE=\"" + ifxTRACE + "\" "); + if (ifxTRACEFILE != null) + buf.append("ifxTRACEFILE=\"" + ifxTRACEFILE + "\" "); + if (ifxTRUSTED_CONTEXT != null) + buf.append("ifxTRUSTED_CONTEXT=\"" + ifxTRUSTED_CONTEXT + "\" "); + if (ifxUSEV5SERVER != null) + buf.append("ifxUSEV5SERVER=\"" + ifxUSEV5SERVER + "\" "); + if (ifxUSE_DTENV != null) + buf.append("ifxUSE_DTENV=\"" + ifxUSE_DTENV + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (super.getPortNumber() != null) + buf.append("portNumber=\"" + super.getPortNumber() + "\" "); + if (roleName != null) + buf.append("roleName=\"" + roleName + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_informix_jcc.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_informix_jcc.java new file mode 100755 index 000000000000..f790fe0e0568 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_informix_jcc.java @@ -0,0 +1,520 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_informix_jcc extends DataSourceProperties { + private String DBANSIWARN; + private String DBDATE; + private String DBPATH; + private String DBSPACETEMP; + private String DBTEMP; + private String DBUPSPACE; + private String DELIMIDENT; + private String IFX_DIRECTIVES; + private String IFX_EXTDIRECTIVES; + private String IFX_UPDDESC; + private String IFX_XASTDCOMPLIANCE_XAEND; + private String INFORMIXOPCACHE; + private String INFORMIXSTACKSIZE; + private String NODEFDAC; + private String OPTCOMPIND; + private String OPTOFC; + private String PDQPRIORITY; + private String PSORT_DBTEMP; + private String PSORT_NPROCS; + private String STMT_CACHE; + private String currentLockTimeout; + private String deferPrepares; + private String driverType; + private String enableNamedParameterMarkers; + private String enableSeamlessFailover; + private String enableSysplexWLB; + private String fetchSize; + private String fullyMaterializeLobData; + private String keepDynamic; + private String progressiveStreaming; + private String queryDataSize; + private String resultSetHoldability; + private String resultSetHoldabilityForCatalogQueries; + private String retrieveMessagesFromServerOnGetMessage; + private String securityMechanism; + private String traceDirectory; + private String traceFile; + private String traceFileAppend; + private String traceLevel; + private String useJDBC4ColumnNameAndLabelSemantics; + + @Override + public String getElementName() { + return INFORMIX_JCC; + } + + @XmlAttribute(name = "DBANSIWARN") + public void setDBANSIWARN(String DBANSIWARN) { + this.DBANSIWARN = DBANSIWARN; + } + + public String getDBANSIWARN() { + return this.DBANSIWARN; + } + + @XmlAttribute(name = "DBDATE") + public void setDBDATE(String DBDATE) { + this.DBDATE = DBDATE; + } + + public String getDBDATE() { + return this.DBDATE; + } + + @XmlAttribute(name = "DBPATH") + public void setDBPATH(String DBPATH) { + this.DBPATH = DBPATH; + } + + public String getDBPATH() { + return this.DBPATH; + } + + @XmlAttribute(name = "DBSPACETEMP") + public void setDBSPACETEMP(String DBSPACETEMP) { + this.DBSPACETEMP = DBSPACETEMP; + } + + public String getDBSPACETEMP() { + return this.DBSPACETEMP; + } + + @XmlAttribute(name = "DBTEMP") + public void setDBTEMP(String DBTEMP) { + this.DBTEMP = DBTEMP; + } + + public String getDBTEMP() { + return this.DBTEMP; + } + + @XmlAttribute(name = "DBUPSPACE") + public void setDBUPSPACE(String DBUPSPACE) { + this.DBUPSPACE = DBUPSPACE; + } + + public String getDBUPSPACE() { + return this.DBUPSPACE; + } + + @XmlAttribute(name = "DELIMIDENT") + public void setDELIMIDENT(String DELIMIDENT) { + this.DELIMIDENT = DELIMIDENT; + } + + public String getDELIMIDENT() { + return this.DELIMIDENT; + } + + @XmlAttribute(name = "IFX_DIRECTIVES") + public void setIFX_DIRECTIVES(String IFX_DIRECTIVES) { + this.IFX_DIRECTIVES = IFX_DIRECTIVES; + } + + public String getIFX_DIRECTIVES() { + return this.IFX_DIRECTIVES; + } + + @XmlAttribute(name = "IFX_EXTDIRECTIVES") + public void setIFX_EXTDIRECTIVES(String IFX_EXTDIRECTIVES) { + this.IFX_EXTDIRECTIVES = IFX_EXTDIRECTIVES; + } + + public String getIFX_EXTDIRECTIVES() { + return this.IFX_EXTDIRECTIVES; + } + + @XmlAttribute(name = "IFX_UPDDESC") + public void setIFX_UPDDESC(String IFX_UPDDESC) { + this.IFX_UPDDESC = IFX_UPDDESC; + } + + public String getIFX_UPDDESC() { + return this.IFX_UPDDESC; + } + + @XmlAttribute(name = "IFX_XASTDCOMPLIANCE_XAEND") + public void setIFX_XASTDCOMPLIANCE_XAEND(String IFX_XASTDCOMPLIANCE_XAEND) { + this.IFX_XASTDCOMPLIANCE_XAEND = IFX_XASTDCOMPLIANCE_XAEND; + } + + public String getIFX_XASTDCOMPLIANCE_XAEND() { + return this.IFX_XASTDCOMPLIANCE_XAEND; + } + + @XmlAttribute(name = "INFORMIXOPCACHE") + public void setINFORMIXOPCACHE(String INFORMIXOPCACHE) { + this.INFORMIXOPCACHE = INFORMIXOPCACHE; + } + + public String getINFORMIXOPCACHE() { + return this.INFORMIXOPCACHE; + } + + @XmlAttribute(name = "INFORMIXSTACKSIZE") + public void setINFORMIXSTACKSIZE(String INFORMIXSTACKSIZE) { + this.INFORMIXSTACKSIZE = INFORMIXSTACKSIZE; + } + + public String getINFORMIXSTACKSIZE() { + return this.INFORMIXSTACKSIZE; + } + + @XmlAttribute(name = "NODEFDAC") + public void setNODEFDAC(String NODEFDAC) { + this.NODEFDAC = NODEFDAC; + } + + public String getNODEFDAC() { + return this.NODEFDAC; + } + + @XmlAttribute(name = "OPTCOMPIND") + public void setOPTCOMPIND(String OPTCOMPIND) { + this.OPTCOMPIND = OPTCOMPIND; + } + + public String getOPTCOMPIND() { + return this.OPTCOMPIND; + } + + @XmlAttribute(name = "OPTOFC") + public void setOPTOFC(String OPTOFC) { + this.OPTOFC = OPTOFC; + } + + public String getOPTOFC() { + return this.OPTOFC; + } + + @XmlAttribute(name = "PDQPRIORITY") + public void setPDQPRIORITY(String PDQPRIORITY) { + this.PDQPRIORITY = PDQPRIORITY; + } + + public String getPDQPRIORITY() { + return this.PDQPRIORITY; + } + + @XmlAttribute(name = "PSORT_DBTEMP") + public void setPSORT_DBTEMP(String PSORT_DBTEMP) { + this.PSORT_DBTEMP = PSORT_DBTEMP; + } + + public String getPSORT_DBTEMP() { + return this.PSORT_DBTEMP; + } + + @XmlAttribute(name = "PSORT_NPROCS") + public void setPSORT_NPROCS(String PSORT_NPROCS) { + this.PSORT_NPROCS = PSORT_NPROCS; + } + + public String getPSORT_NPROCS() { + return this.PSORT_NPROCS; + } + + @XmlAttribute(name = "STMT_CACHE") + public void setSTMT_CACHE(String STMT_CACHE) { + this.STMT_CACHE = STMT_CACHE; + } + + public String getSTMT_CACHE() { + return this.STMT_CACHE; + } + + @XmlAttribute(name = "currentLockTimeout") + public void setCurrentLockTimeout(String currentLockTimeout) { + this.currentLockTimeout = currentLockTimeout; + } + + public String getCurrentLockTimeout() { + return this.currentLockTimeout; + } + + @XmlAttribute(name = "deferPrepares") + public void setDeferPrepares(String deferPrepares) { + this.deferPrepares = deferPrepares; + } + + public String getDeferPrepares() { + return this.deferPrepares; + } + + @XmlAttribute(name = "driverType") + public void setDriverType(String driverType) { + this.driverType = driverType; + } + + public String getDriverType() { + return this.driverType; + } + + @XmlAttribute(name = "enableNamedParameterMarkers") + public void setEnableNamedParameterMarkers(String enableNamedParameterMarkers) { + this.enableNamedParameterMarkers = enableNamedParameterMarkers; + } + + public String getEnableNamedParameterMarkers() { + return this.enableNamedParameterMarkers; + } + + @XmlAttribute(name = "enableSeamlessFailover") + public void setEnableSeamlessFailover(String enableSeamlessFailover) { + this.enableSeamlessFailover = enableSeamlessFailover; + } + + public String getEnableSeamlessFailover() { + return this.enableSeamlessFailover; + } + + @XmlAttribute(name = "enableSysplexWLB") + public void setEnableSysplexWLB(String enableSysplexWLB) { + this.enableSysplexWLB = enableSysplexWLB; + } + + public String getEnableSysplexWLB() { + return this.enableSysplexWLB; + } + + @XmlAttribute(name = "fetchSize") + public void setFetchSize(String fetchSize) { + this.fetchSize = fetchSize; + } + + public String getFetchSize() { + return this.fetchSize; + } + + @XmlAttribute(name = "fullyMaterializeLobData") + public void setFullyMaterializeLobData(String fullyMaterializeLobData) { + this.fullyMaterializeLobData = fullyMaterializeLobData; + } + + public String getFullyMaterializeLobData() { + return this.fullyMaterializeLobData; + } + + @XmlAttribute(name = "keepDynamic") + public void setKeepDynamic(String keepDynamic) { + this.keepDynamic = keepDynamic; + } + + public String getKeepDynamic() { + return this.keepDynamic; + } + + @XmlAttribute(name = "progressiveStreaming") + public void setProgressiveStreaming(String progressiveStreaming) { + this.progressiveStreaming = progressiveStreaming; + } + + public String getProgressiveStreaming() { + return this.progressiveStreaming; + } + + @XmlAttribute(name = "queryDataSize") + public void setQueryDataSize(String queryDataSize) { + this.queryDataSize = queryDataSize; + } + + public String getQueryDataSize() { + return this.queryDataSize; + } + + @XmlAttribute(name = "resultSetHoldability") + public void setResultSetHoldability(String resultSetHoldability) { + this.resultSetHoldability = resultSetHoldability; + } + + public String getResultSetHoldability() { + return this.resultSetHoldability; + } + + @XmlAttribute(name = "resultSetHoldabilityForCatalogQueries") + public void setResultSetHoldabilityForCatalogQueries(String resultSetHoldabilityForCatalogQueries) { + this.resultSetHoldabilityForCatalogQueries = resultSetHoldabilityForCatalogQueries; + } + + public String getResultSetHoldabilityForCatalogQueries() { + return this.resultSetHoldabilityForCatalogQueries; + } + + @XmlAttribute(name = "retrieveMessagesFromServerOnGetMessage") + public void setRetrieveMessagesFromServerOnGetMessage(String retrieveMessagesFromServerOnGetMessage) { + this.retrieveMessagesFromServerOnGetMessage = retrieveMessagesFromServerOnGetMessage; + } + + public String getRetrieveMessagesFromServerOnGetMessage() { + return this.retrieveMessagesFromServerOnGetMessage; + } + + @XmlAttribute(name = "securityMechanism") + public void setSecurityMechanism(String securityMechanism) { + this.securityMechanism = securityMechanism; + } + + public String getSecurityMechanism() { + return this.securityMechanism; + } + + @XmlAttribute(name = "traceDirectory") + public void setTraceDirectory(String traceDirectory) { + this.traceDirectory = traceDirectory; + } + + public String getTraceDirectory() { + return this.traceDirectory; + } + + @XmlAttribute(name = "traceFile") + public void setTraceFile(String traceFile) { + this.traceFile = traceFile; + } + + public String getTraceFile() { + return this.traceFile; + } + + @XmlAttribute(name = "traceFileAppend") + public void setTraceFileAppend(String traceFileAppend) { + this.traceFileAppend = traceFileAppend; + } + + public String getTraceFileAppend() { + return this.traceFileAppend; + } + + @XmlAttribute(name = "traceLevel") + public void setTraceLevel(String traceLevel) { + this.traceLevel = traceLevel; + } + + public String getTraceLevel() { + return this.traceLevel; + } + + @XmlAttribute(name = "useJDBC4ColumnNameAndLabelSemantics") + public void setUseJDBC4ColumnNameAndLabelSemantics(String useJDBC4ColumnNameAndLabelSemantics) { + this.useJDBC4ColumnNameAndLabelSemantics = useJDBC4ColumnNameAndLabelSemantics; + } + + public String getUseJDBC4ColumnNameAndLabelSemantics() { + return this.useJDBC4ColumnNameAndLabelSemantics; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (DBANSIWARN != null) + buf.append("DBANSIWARN=\"" + DBANSIWARN + "\" "); + if (DBDATE != null) + buf.append("DBDATE=\"" + DBDATE + "\" "); + if (DBPATH != null) + buf.append("DBPATH=\"" + DBPATH + "\" "); + if (DBSPACETEMP != null) + buf.append("DBSPACETEMP=\"" + DBSPACETEMP + "\" "); + if (DBTEMP != null) + buf.append("DBTEMP=\"" + DBTEMP + "\" "); + if (DBUPSPACE != null) + buf.append("DBUPSPACE=\"" + DBUPSPACE + "\" "); + if (DELIMIDENT != null) + buf.append("DELIMIDENT=\"" + DELIMIDENT + "\" "); + if (IFX_DIRECTIVES != null) + buf.append("IFX_DIRECTIVES=\"" + IFX_DIRECTIVES + "\" "); + if (IFX_EXTDIRECTIVES != null) + buf.append("IFX_EXTDIRECTIVES=\"" + IFX_EXTDIRECTIVES + "\" "); + if (IFX_UPDDESC != null) + buf.append("IFX_UPDDESC=\"" + IFX_UPDDESC + "\" "); + if (IFX_XASTDCOMPLIANCE_XAEND != null) + buf.append("IFX_XASTDCOMPLIANCE_XAEND=\"" + IFX_XASTDCOMPLIANCE_XAEND + "\" "); + if (INFORMIXOPCACHE != null) + buf.append("INFORMIXOPCACHE=\"" + INFORMIXOPCACHE + "\" "); + if (INFORMIXSTACKSIZE != null) + buf.append("INFORMIXSTACKSIZE=\"" + INFORMIXSTACKSIZE + "\" "); + if (NODEFDAC != null) + buf.append("NODEFDAC=\"" + NODEFDAC + "\" "); + if (OPTCOMPIND != null) + buf.append("OPTCOMPIND=\"" + OPTCOMPIND + "\" "); + if (OPTOFC != null) + buf.append("OPTOFC=\"" + OPTOFC + "\" "); + if (PDQPRIORITY != null) + buf.append("PDQPRIORITY=\"" + PDQPRIORITY + "\" "); + if (PSORT_DBTEMP != null) + buf.append("PSORT_DBTEMP=\"" + PSORT_DBTEMP + "\" "); + if (PSORT_NPROCS != null) + buf.append("PSORT_NPROCS=\"" + PSORT_NPROCS + "\" "); + if (STMT_CACHE != null) + buf.append("STMT_CACHE=\"" + STMT_CACHE + "\" "); + if (currentLockTimeout != null) + buf.append("currentLockTimeout=\"" + currentLockTimeout + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (deferPrepares != null) + buf.append("deferPrepares=\"" + deferPrepares + "\" "); + if (driverType != null) + buf.append("driverType=\"" + driverType + "\" "); + if (enableNamedParameterMarkers != null) + buf.append("enableNamedParameterMarkers=\"" + enableNamedParameterMarkers + "\" "); + if (enableSeamlessFailover != null) + buf.append("enableSeamlessFailover=\"" + enableSeamlessFailover + "\" "); + if (enableSysplexWLB != null) + buf.append("enableSysplexWLB=\"" + enableSysplexWLB + "\" "); + if (fetchSize != null) + buf.append("fetchSize=\"" + fetchSize + "\" "); + if (fullyMaterializeLobData != null) + buf.append("fullyMaterializeLobData=\"" + fullyMaterializeLobData + "\" "); + if (keepDynamic != null) + buf.append("keepDynamic=\"" + keepDynamic + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (super.getPortNumber() != null) + buf.append("portNumber=\"" + super.getPortNumber() + "\" "); + if (progressiveStreaming != null) + buf.append("progressiveStreaming=\"" + progressiveStreaming + "\" "); + if (queryDataSize != null) + buf.append("queryDataSize=\"" + queryDataSize + "\" "); + if (resultSetHoldability != null) + buf.append("resultSetHoldability=\"" + resultSetHoldability + "\" "); + if (resultSetHoldabilityForCatalogQueries != null) + buf.append("resultSetHoldabilityForCatalogQueries=\"" + resultSetHoldabilityForCatalogQueries + "\" "); + if (retrieveMessagesFromServerOnGetMessage != null) + buf.append("retrieveMessagesFromServerOnGetMessage=\"" + retrieveMessagesFromServerOnGetMessage + "\" "); + if (securityMechanism != null) + buf.append("securityMechanism=\"" + securityMechanism + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (traceDirectory != null) + buf.append("traceDirectory=\"" + traceDirectory + "\" "); + if (traceFile != null) + buf.append("traceFile=\"" + traceFile + "\" "); + if (traceFileAppend != null) + buf.append("traceFileAppend=\"" + traceFileAppend + "\" "); + if (traceLevel != null) + buf.append("traceLevel=\"" + traceLevel + "\" "); + if (useJDBC4ColumnNameAndLabelSemantics != null) + buf.append("useJDBC4ColumnNameAndLabelSemantics=\"" + useJDBC4ColumnNameAndLabelSemantics + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_microsoft_sqlserver.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_microsoft_sqlserver.java new file mode 100755 index 000000000000..9ac188370e91 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_microsoft_sqlserver.java @@ -0,0 +1,304 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_microsoft_sqlserver extends DataSourceProperties { + private String URL; + private String applicationIntent; + private String applicationName; + private String authenticationScheme; + private String encrypt; + private String failoverPartner; + private String hostNameInCertificate; + private String instanceName; + private String integratedSecurity; + private String lastUpdateCount; + private String lockTimeout; + private String multiSubnetFailover; + private String packetSize; + private String responseBuffering; + private String selectMethod; + private String sendStringParametersAsUnicode; + private String sendTimeAsDatetime; + private String trustServerCertificate; + private String trustStore; + private String trustStorePassword; + private String workstationID; + private String xopenStates; + + @Override + public String getElementName() { + return MICROSOFT_SQLSERVER; + } + + @XmlAttribute(name = "URL") + public void setURL(String URL) { + this.URL = URL; + } + + public String getURL() { + return this.URL; + } + + @XmlAttribute(name = "applicationIntent") + public void setApplicationIntent(String applicationIntent) { + this.applicationIntent = applicationIntent; + } + + public String getApplicationIntent() { + return this.applicationIntent; + } + + @XmlAttribute(name = "applicationName") + public void setApplicationName(String applicationName) { + this.applicationName = applicationName; + } + + public String getApplicationName() { + return this.applicationName; + } + + @XmlAttribute(name = "authenticationScheme") + public void setAuthenticationScheme(String authenticationScheme) { + this.authenticationScheme = authenticationScheme; + } + + public String getAuthenticationScheme() { + return this.authenticationScheme; + } + + @XmlAttribute(name = "encrypt") + public void setEncrypt(String encrypt) { + this.encrypt = encrypt; + } + + public String getEncrypt() { + return this.encrypt; + } + + @XmlAttribute(name = "failoverPartner") + public void setFailoverPartner(String failoverPartner) { + this.failoverPartner = failoverPartner; + } + + public String getFailoverPartner() { + return this.failoverPartner; + } + + @XmlAttribute(name = "hostNameInCertificate") + public void setHostNameInCertificate(String hostNameInCertificate) { + this.hostNameInCertificate = hostNameInCertificate; + } + + public String getHostNameInCertificate() { + return this.hostNameInCertificate; + } + + @XmlAttribute(name = "instanceName") + public void setInstanceName(String instanceName) { + this.instanceName = instanceName; + } + + public String getInstanceName() { + return this.instanceName; + } + + @XmlAttribute(name = "integratedSecurity") + public void setIntegratedSecurity(String integratedSecurity) { + this.integratedSecurity = integratedSecurity; + } + + public String getIntegratedSecurity() { + return this.integratedSecurity; + } + + @XmlAttribute(name = "lastUpdateCount") + public void setLastUpdateCount(String lastUpdateCount) { + this.lastUpdateCount = lastUpdateCount; + } + + public String getLastUpdateCount() { + return this.lastUpdateCount; + } + + @XmlAttribute(name = "lockTimeout") + public void setLockTimeout(String lockTimeout) { + this.lockTimeout = lockTimeout; + } + + public String getLockTimeout() { + return this.lockTimeout; + } + + @XmlAttribute(name = "multiSubnetFailover") + public void setMultiSubnetFailover(String multiSubnetFailover) { + this.multiSubnetFailover = multiSubnetFailover; + } + + public String getMultiSubnetFailover() { + return this.multiSubnetFailover; + } + + @XmlAttribute(name = "packetSize") + public void setPacketSize(String packetSize) { + this.packetSize = packetSize; + } + + public String getPacketSize() { + return this.packetSize; + } + + @XmlAttribute(name = "responseBuffering") + public void setResponseBuffering(String responseBuffering) { + this.responseBuffering = responseBuffering; + } + + public String getResponseBuffering() { + return this.responseBuffering; + } + + @XmlAttribute(name = "selectMethod") + public void setSelectMethod(String selectMethod) { + this.selectMethod = selectMethod; + } + + public String getSelectMethod() { + return this.selectMethod; + } + + @XmlAttribute(name = "sendStringParametersAsUnicode") + public void setSendStringParametersAsUnicode(String sendStringParametersAsUnicode) { + this.sendStringParametersAsUnicode = sendStringParametersAsUnicode; + } + + public String getSendStringParametersAsUnicode() { + return this.sendStringParametersAsUnicode; + } + + @XmlAttribute(name = "sendTimeAsDatetime") + public void setSendTimeAsDatetime(String sendTimeAsDatetime) { + this.sendTimeAsDatetime = sendTimeAsDatetime; + } + + public String getSendTimeAsDatetime() { + return this.sendTimeAsDatetime; + } + + @XmlAttribute(name = "trustServerCertificate") + public void setTrustServerCertificate(String trustServerCertificate) { + this.trustServerCertificate = trustServerCertificate; + } + + public String getTrustServerCertificate() { + return this.trustServerCertificate; + } + + @XmlAttribute(name = "trustStore") + public void setTrustStore(String trustStore) { + this.trustStore = trustStore; + } + + public String getTrustStore() { + return this.trustStore; + } + + @XmlAttribute(name = "trustStorePassword") + public void setTrustStorePassword(String trustStorePassword) { + this.trustStorePassword = trustStorePassword; + } + + public String getTrustStorePassword() { + return this.trustStorePassword; + } + + @XmlAttribute(name = "workstationID") + public void setWorkstationID(String workstationID) { + this.workstationID = workstationID; + } + + public String getWorkstationID() { + return this.workstationID; + } + + @XmlAttribute(name = "xopenStates") + public void setXopenStates(String xopenStates) { + this.xopenStates = xopenStates; + } + + public String getXopenStates() { + return this.xopenStates; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (URL != null) + buf.append("URL=\"" + URL + "\" "); + if (applicationIntent != null) + buf.append("applicationIntent=\"" + applicationIntent + "\" "); + if (applicationName != null) + buf.append("applicationName=\"" + applicationName + "\" "); + if (authenticationScheme != null) + buf.append("authenticationScheme=\"" + authenticationScheme + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (encrypt != null) + buf.append("encrypt=\"" + encrypt + "\" "); + if (failoverPartner != null) + buf.append("failoverPartner=\"" + failoverPartner + "\" "); + if (hostNameInCertificate != null) + buf.append("hostNameInCertificate=\"" + hostNameInCertificate + "\" "); + if (instanceName != null) + buf.append("instanceName=\"" + instanceName + "\" "); + if (integratedSecurity != null) + buf.append("integratedSecurity=\"" + integratedSecurity + "\" "); + if (lastUpdateCount != null) + buf.append("lastUpdateCount=\"" + lastUpdateCount + "\" "); + if (lockTimeout != null) + buf.append("lockTimeout=\"" + lockTimeout + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (multiSubnetFailover != null) + buf.append("multiSubnetFailover=\"" + multiSubnetFailover + "\" "); + if (packetSize != null) + buf.append("packetSize=\"" + packetSize + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (super.getPortNumber() != null) + buf.append("portNumber=\"" + super.getPortNumber() + "\" "); + if (responseBuffering != null) + buf.append("responseBuffering=\"" + responseBuffering + "\" "); + if (selectMethod != null) + buf.append("selectMethod=\"" + selectMethod + "\" "); + if (sendStringParametersAsUnicode != null) + buf.append("sendStringParametersAsUnicode=\"" + sendStringParametersAsUnicode + "\" "); + if (sendTimeAsDatetime != null) + buf.append("sendTimeAsDatetime=\"" + sendTimeAsDatetime + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (trustServerCertificate != null) + buf.append("trustServerCertificate=\"" + trustServerCertificate + "\" "); + if (trustStore != null) + buf.append("trustStore=\"" + trustStore + "\" "); + if (trustStorePassword != null) + buf.append("trustStorePassword=\"" + trustStorePassword + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + if (workstationID != null) + buf.append("workstationID=\"" + workstationID + "\" "); + if (xopenStates != null) + buf.append("xopenStates=\"" + xopenStates + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_oracle.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_oracle.java new file mode 100755 index 000000000000..35600193ba00 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_oracle.java @@ -0,0 +1,124 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_oracle extends DataSourceProperties { + private String ONSConfiguration; + private String TNSEntryName; + private String URL; + private String connectionProperties; + private String driverType; + private String networkProtocol; + private String serviceName; + + @Override + public String getElementName() { + return ORACLE_JDBC; + } + + @XmlAttribute(name = "ONSConfiguration") + public void setONSConfiguration(String ONSConfiguration) { + this.ONSConfiguration = ONSConfiguration; + } + + public String getONSConfiguration() { + return this.ONSConfiguration; + } + + @XmlAttribute(name = "TNSEntryName") + public void setTNSEntryName(String TNSEntryName) { + this.TNSEntryName = TNSEntryName; + } + + public String getTNSEntryName() { + return this.TNSEntryName; + } + + @XmlAttribute(name = "URL") + public void setURL(String URL) { + this.URL = URL; + } + + public String getURL() { + return this.URL; + } + + @XmlAttribute(name = "connectionProperties") + public void setConnectionProperties(String connectionProperties) { + this.connectionProperties = connectionProperties; + } + + public String getConnectionProperties() { + return this.connectionProperties; + } + + @XmlAttribute(name = "driverType") + public void setDriverType(String driverType) { + this.driverType = driverType; + } + + public String getDriverType() { + return this.driverType; + } + + @XmlAttribute(name = "networkProtocol") + public void setNetworkProtocol(String networkProtocol) { + this.networkProtocol = networkProtocol; + } + + public String getNetworkProtocol() { + return this.networkProtocol; + } + + @XmlAttribute(name = "serviceName") + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public String getServiceName() { + return this.serviceName; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (ONSConfiguration != null) + buf.append("ONSConfiguration=\"" + ONSConfiguration + "\" "); + if (TNSEntryName != null) + buf.append("TNSEntryName=\"" + TNSEntryName + "\" "); + if (URL != null) + buf.append("URL=\"" + URL + "\" "); + if (connectionProperties != null) + buf.append("connectionProperties=\"" + connectionProperties + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (driverType != null) + buf.append("driverType=\"" + driverType + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (networkProtocol != null) + buf.append("networkProtocol=\"" + networkProtocol + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (super.getPortNumber() != null) + buf.append("portNumber=\"" + super.getPortNumber() + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (serviceName != null) + buf.append("serviceName=\"" + serviceName + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_oracle_ucp.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_oracle_ucp.java new file mode 100755 index 000000000000..da28b41812b7 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_oracle_ucp.java @@ -0,0 +1,352 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_oracle_ucp extends DataSourceProperties { + private String ONSConfiguration; + private String SQLForValidateConnection; + private String URL; + private String abandonedConnectionTimeout; + private String connectionFactoryClassName; + private String connectionFactoryProperties; + private String connectionHarvestMaxCount; + private String connectionHarvestTriggerCount; + private String connectionPoolName; + private String connectionProperties; + private String connectionWaitTimeout; + private String fastConnectionFailoverEnabled; + private String inactiveConnectionTimeout; + private String initialPoolSize; + private String maxConnectionReuseCount; + private String maxConnectionReuseTime; + private String maxIdleTime; + private String maxPoolSize; + private String maxStatements; + private String minPoolSize; + private String networkProtocol; + private String propertyCycle; + private String roleName; + private String timeToLiveConnectionTimeout; + private String timeoutCheckInterval; + private String validateConnectionOnBorrow; + + @Override + public String getElementName() { + return ORACLE_UCP; + } + + @XmlAttribute(name = "ONSConfiguration") + public void setONSConfiguration(String ONSConfiguration) { + this.ONSConfiguration = ONSConfiguration; + } + + public String getONSConfiguration() { + return this.ONSConfiguration; + } + + @XmlAttribute(name = "SQLForValidateConnection") + public void setSQLForValidateConnection(String SQLForValidateConnection) { + this.SQLForValidateConnection = SQLForValidateConnection; + } + + public String getSQLForValidateConnection() { + return this.SQLForValidateConnection; + } + + @XmlAttribute(name = "URL") + public void setURL(String URL) { + this.URL = URL; + } + + public String getURL() { + return this.URL; + } + + @XmlAttribute(name = "abandonedConnectionTimeout") + public void setAbandonedConnectionTimeout(String abandonedConnectionTimeout) { + this.abandonedConnectionTimeout = abandonedConnectionTimeout; + } + + public String getAbandonedConnectionTimeout() { + return this.abandonedConnectionTimeout; + } + + @XmlAttribute(name = "connectionFactoryClassName") + public void setConnectionFactoryClassName(String connectionFactoryClassName) { + this.connectionFactoryClassName = connectionFactoryClassName; + } + + public String getConnectionFactoryClassName() { + return this.connectionFactoryClassName; + } + + @XmlAttribute(name = "connectionFactoryProperties") + public void setConnectionFactoryProperties(String connectionFactoryProperties) { + this.connectionFactoryProperties = connectionFactoryProperties; + } + + public String getConnectionFactoryProperties() { + return this.connectionFactoryProperties; + } + + @XmlAttribute(name = "connectionHarvestMaxCount") + public void setConnectionHarvestMaxCount(String connectionHarvestMaxCount) { + this.connectionHarvestMaxCount = connectionHarvestMaxCount; + } + + public String getConnectionHarvestMaxCount() { + return this.connectionHarvestMaxCount; + } + + @XmlAttribute(name = "connectionHarvestTriggerCount") + public void setConnectionHarvestTriggerCount(String connectionHarvestTriggerCount) { + this.connectionHarvestTriggerCount = connectionHarvestTriggerCount; + } + + public String getConnectionHarvestTriggerCount() { + return this.connectionHarvestTriggerCount; + } + + @XmlAttribute(name = "connectionPoolName") + public void setConnectionPoolName(String connectionPoolName) { + this.connectionPoolName = connectionPoolName; + } + + public String getConnectionPoolName() { + return this.connectionPoolName; + } + + @XmlAttribute(name = "connectionProperties") + public void setConnectionProperties(String connectionProperties) { + this.connectionProperties = connectionProperties; + } + + public String getConnectionProperties() { + return this.connectionProperties; + } + + @XmlAttribute(name = "connectionWaitTimeout") + public void setConnectionWaitTimeout(String connectionWaitTimeout) { + this.connectionWaitTimeout = connectionWaitTimeout; + } + + public String getConnectionWaitTimeout() { + return this.connectionWaitTimeout; + } + + @XmlAttribute(name = "fastConnectionFailoverEnabled") + public void setFastConnectionFailoverEnabled(String fastConnectionFailoverEnabled) { + this.fastConnectionFailoverEnabled = fastConnectionFailoverEnabled; + } + + public String getFastConnectionFailoverEnabled() { + return this.fastConnectionFailoverEnabled; + } + + @XmlAttribute(name = "inactiveConnectionTimeout") + public void setInactiveConnectionTimeout(String inactiveConnectionTimeout) { + this.inactiveConnectionTimeout = inactiveConnectionTimeout; + } + + public String getInactiveConnectionTimeout() { + return this.inactiveConnectionTimeout; + } + + @XmlAttribute(name = "initialPoolSize") + public void setInitialPoolSize(String initialPoolSize) { + this.initialPoolSize = initialPoolSize; + } + + public String getInitialPoolSize() { + return this.initialPoolSize; + } + + @XmlAttribute(name = "maxConnectionReuseCount") + public void setMaxConnectionReuseCount(String maxConnectionReuseCount) { + this.maxConnectionReuseCount = maxConnectionReuseCount; + } + + public String getMaxConnectionReuseCount() { + return this.maxConnectionReuseCount; + } + + @XmlAttribute(name = "maxConnectionReuseTime") + public void setMaxConnectionReuseTime(String maxConnectionReuseTime) { + this.maxConnectionReuseTime = maxConnectionReuseTime; + } + + public String getMaxConnectionReuseTime() { + return this.maxConnectionReuseTime; + } + + @XmlAttribute(name = "maxIdleTime") + public void setMaxIdleTime(String maxIdleTime) { + this.maxIdleTime = maxIdleTime; + } + + public String getMaxIdleTime() { + return this.maxIdleTime; + } + + @XmlAttribute(name = "maxPoolSize") + public void setMaxPoolSize(String maxPoolSize) { + this.maxPoolSize = maxPoolSize; + } + + public String getMaxPoolSize() { + return this.maxPoolSize; + } + + @XmlAttribute(name = "maxStatements") + public void setMaxStatements(String maxStatements) { + this.maxStatements = maxStatements; + } + + public String getMaxStatements() { + return this.maxStatements; + } + + @XmlAttribute(name = "minPoolSize") + public void setMinPoolSize(String minPoolSize) { + this.minPoolSize = minPoolSize; + } + + public String getMinPoolSize() { + return this.minPoolSize; + } + + @XmlAttribute(name = "networkProtocol") + public void setNetworkProtocol(String networkProtocol) { + this.networkProtocol = networkProtocol; + } + + public String getNetworkProtocol() { + return this.networkProtocol; + } + + @XmlAttribute(name = "propertyCycle") + public void setPropertyCycle(String propertyCycle) { + this.propertyCycle = propertyCycle; + } + + public String getPropertyCycle() { + return this.propertyCycle; + } + + @XmlAttribute(name = "roleName") + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public String getRoleName() { + return this.roleName; + } + + @XmlAttribute(name = "timeToLiveConnectionTimeout") + public void setTimeToLiveConnectionTimeout(String timeToLiveConnectionTimeout) { + this.timeToLiveConnectionTimeout = timeToLiveConnectionTimeout; + } + + public String getTimeToLiveConnectionTimeout() { + return this.timeToLiveConnectionTimeout; + } + + @XmlAttribute(name = "timeoutCheckInterval") + public void setTimeoutCheckInterval(String timeoutCheckInterval) { + this.timeoutCheckInterval = timeoutCheckInterval; + } + + public String getTimeoutCheckInterval() { + return this.timeoutCheckInterval; + } + + @XmlAttribute(name = "validateConnectionOnBorrow") + public void setValidateConnectionOnBorrow(String validateConnectionOnBorrow) { + this.validateConnectionOnBorrow = validateConnectionOnBorrow; + } + + public String getValidateConnectionOnBorrow() { + return this.validateConnectionOnBorrow; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (ONSConfiguration != null) + buf.append("ONSConfiguration=\"" + ONSConfiguration + "\" "); + if (SQLForValidateConnection != null) + buf.append("SQLForValidateConnection=\"" + SQLForValidateConnection + "\" "); + if (URL != null) + buf.append("URL=\"" + URL + "\" "); + if (abandonedConnectionTimeout != null) + buf.append("abandonedConnectionTimeout=\"" + abandonedConnectionTimeout + "\" "); + if (connectionFactoryClassName != null) + buf.append("connectionFactoryClassName=\"" + connectionFactoryClassName + "\" "); + if (connectionFactoryProperties != null) + buf.append("connectionFactoryProperties=\"" + connectionFactoryProperties + "\" "); + if (connectionHarvestMaxCount != null) + buf.append("connectionHarvestMaxCount=\"" + connectionHarvestMaxCount + "\" "); + if (connectionHarvestTriggerCount != null) + buf.append("connectionHarvestTriggerCount=\"" + connectionHarvestTriggerCount + "\" "); + if (connectionPoolName != null) + buf.append("connectionPoolName=\"" + connectionPoolName + "\" "); + if (connectionProperties != null) + buf.append("connectionProperties=\"" + connectionProperties + "\" "); + if (connectionWaitTimeout != null) + buf.append("connectionWaitTimeout=\"" + connectionWaitTimeout + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (fastConnectionFailoverEnabled != null) + buf.append("fastConnectionFailoverEnabled=\"" + fastConnectionFailoverEnabled + "\" "); + if (inactiveConnectionTimeout != null) + buf.append("inactiveConnectionTimeout=\"" + inactiveConnectionTimeout + "\" "); + if (initialPoolSize != null) + buf.append("initialPoolSize=\"" + initialPoolSize + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (maxConnectionReuseCount != null) + buf.append("maxConnectionReuseCount=\"" + maxConnectionReuseCount + "\" "); + if (maxConnectionReuseTime != null) + buf.append("maxConnectionReuseTime=\"" + maxConnectionReuseTime + "\" "); + if (maxIdleTime != null) + buf.append("maxIdleTime=\"" + maxIdleTime + "\" "); + if (maxPoolSize != null) + buf.append("maxPoolSize=\"" + maxPoolSize + "\" "); + if (maxStatements != null) + buf.append("maxStatements=\"" + maxStatements + "\" "); + if (minPoolSize != null) + buf.append("minPoolSize=\"" + minPoolSize + "\" "); + if (networkProtocol != null) + buf.append("networkProtocol=\"" + networkProtocol + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (super.getPortNumber() != null) + buf.append("portNumber=\"" + super.getPortNumber() + "\" "); + if (propertyCycle != null) + buf.append("propertyCycle=\"" + propertyCycle + "\" "); + if (roleName != null) + buf.append("roleName=\"" + roleName + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (timeToLiveConnectionTimeout != null) + buf.append("timeToLiveConnectionTimeout=\"" + timeToLiveConnectionTimeout + "\" "); + if (timeoutCheckInterval != null) + buf.append("timeoutCheckInterval=\"" + timeoutCheckInterval + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + if (validateConnectionOnBorrow != null) + buf.append("validateConnectionOnBorrow=\"" + validateConnectionOnBorrow + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_sybase.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_sybase.java new file mode 100755 index 000000000000..811b4f18df32 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/Properties_sybase.java @@ -0,0 +1,100 @@ +package com.ibm.websphere.simplicity.config.dsprops; + +import javax.xml.bind.annotation.XmlAttribute; + +import com.ibm.websphere.simplicity.config.DataSourceProperties; + +/** + * Lists data source properties specific to this driver. + */ +public class Properties_sybase extends DataSourceProperties { + private String connectionProperties; + private String networkProtocol; + private String resourceManagerName; + private String SERVER_INITIATED_TRANSACTIONS; + private String version; + + @Override + public String getElementName() { + return SYBASE; + } + + @XmlAttribute(name = "connectionProperties") + public void setConnectionProperties(String connectionProperties) { + this.connectionProperties = connectionProperties; + } + + public String getConnectionProperties() { + return this.connectionProperties; + } + + @XmlAttribute(name = "networkProtocol") + public void setNetworkProtocol(String networkProtocol) { + this.networkProtocol = networkProtocol; + } + + public String getNetworkProtocol() { + return this.networkProtocol; + } + + @XmlAttribute(name = "resourceManagerName") + public void setResourceManagerName(String resourceManagerName) { + this.resourceManagerName = resourceManagerName; + } + + public String getResourceManagerName() { + return this.resourceManagerName; + } + + @XmlAttribute(name = "SERVER_INITIATED_TRANSACTIONS") + public void setSERVER_INITIATED_TRANSACTIONS(String SERVER_INITIATED_TRANSACTIONS) { + this.SERVER_INITIATED_TRANSACTIONS = SERVER_INITIATED_TRANSACTIONS; + } + + public String getSERVER_INITIATED_TRANSACTIONS() { + return this.SERVER_INITIATED_TRANSACTIONS; + } + + @XmlAttribute(name = "version") + public void setVersion(String version) { + this.version = version; + } + + public String getVersion() { + return this.version; + } + + /** + * Returns a String listing the properties and their values used on this + * data source. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("{"); + if (connectionProperties != null) + buf.append("connectionProperties=\"" + connectionProperties + "\" "); + if (super.getDatabaseName() != null) + buf.append("databaseName=\"" + super.getDatabaseName() + "\" "); + if (super.getLoginTimeout() != null) + buf.append("loginTimeout=\"" + super.getLoginTimeout() + "\" "); + if (networkProtocol != null) + buf.append("networkProtocol=\"" + networkProtocol + "\" "); + if (super.getPassword() != null) + buf.append("password=\"" + super.getPassword() + "\" "); + if (super.getPortNumber() != null) + buf.append("portNumber=\"" + super.getPortNumber() + "\" "); + if (resourceManagerName != null) + buf.append("resourceManagerName=\"" + resourceManagerName + "\" "); + if (SERVER_INITIATED_TRANSACTIONS != null) + buf.append("SERVER_INITIATED_TRANSACTIONS=\"" + SERVER_INITIATED_TRANSACTIONS + "\" "); + if (super.getServerName() != null) + buf.append("serverName=\"" + super.getServerName() + "\" "); + if (super.getUser() != null) + buf.append("user=\"" + super.getUser() + "\" "); + if (version != null) + buf.append("version=\"" + version + "\" "); + buf.append("}"); + return buf.toString(); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/DataSourcePropertiesOnlyRule.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/DataSourcePropertiesOnlyRule.java new file mode 100755 index 000000000000..a8da08be0219 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/DataSourcePropertiesOnlyRule.java @@ -0,0 +1,90 @@ +package com.ibm.websphere.simplicity.config.dsprops.testrules; + +import java.util.Arrays; +import java.util.List; +import java.util.Set; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.config.DataSource; +import com.ibm.websphere.simplicity.config.DataSourceProperties; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.utils.FATServletClient; + +/** + * This class can be used as a @Rule to process a @OnlyIfDataSourceProperties annotation + * specified on one or more @Test. + *

    + * Usage: The simplest way to use this rule, is to extend the {@link FATServletClient} class.
    + * If it is not possible to extend FATServletClient, it may be used manually -- see below. + *

    + * Before this rule is used, the setDataSource() + * method must be called on this class to indicate which DataSource + * should be examined for a nested type of DataSourceProperties. + * If the DataSource is not set on this rule, then a null pointer exception will + * occur when the first test that is annotated with @OnlyIfDataSourceProperties is executed. + *

    + * The @Test will be run only if the DataSourceProperties type nested under the + * DataSource matches one of the DataSourceProperties specified + * in the @OnlyIfDataSourceProperties annotation. + *

    + * For example this code would specify that the test should only be run with "DB2 with JCC" and + * "Derby embedded". + *

    + * import static com.ibm.websphere.simplicity.config.DataSourceProperties.*;
    + * public class MyTestClass extends FATServletClient {
    + * 
    + * {@literal @Test} {@literal @OnlyIfDataSourceProperties}({ DB2_JCC, DERBY_EMBEDDED })
    + * public void onlyTestIf_DB2JCC_DerbyEmbedded() throws Exception {
    + * // test code
    + * }
    + * }
    + * 
    + *

    + * A full listing of supported database types can be found in:
    {@link com.ibm.websphere.simplicity.config.DataSourceProperties} + */ +public class DataSourcePropertiesOnlyRule implements TestRule { + + private DataSource dataSource; + + public void setDataSource(DataSource dataSource) { + this.dataSource = dataSource; + } + + public DataSource getDataSource() { + return dataSource; + } + + @Override + public Statement apply(final Statement statement, final Description description) { + OnlyIfDataSourceProperties annotation = description.getAnnotation(OnlyIfDataSourceProperties.class); + if (annotation == null) { + return statement; + } + + List allowedDataSets = Arrays.asList(annotation.value()); + Set dsp = null; + try { + dsp = dataSource.getDataSourceProperties(); + } catch (NullPointerException e) { + NullPointerException eMessage = + new NullPointerException("Must set the DataSourcePropertiesOnlyRule DataSource, using .setDataSource()"); + eMessage.setStackTrace(e.getStackTrace()); + throw eMessage; + } + for (DataSourceProperties p : dsp) { + if (allowedDataSets.contains(p.getElementName())) { + return statement; + } + } + + return new Statement() { + @Override + public void evaluate() throws Throwable { + Log.info(description.getTestClass(), description.getMethodName(), "Test method is skipped due to DataSourcePropertiesOnlyRule"); + } + }; + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/DataSourcePropertiesSkipRule.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/DataSourcePropertiesSkipRule.java new file mode 100755 index 000000000000..c3516994c575 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/DataSourcePropertiesSkipRule.java @@ -0,0 +1,91 @@ +package com.ibm.websphere.simplicity.config.dsprops.testrules; + +import java.util.Arrays; +import java.util.List; +import java.util.Set; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.config.DataSource; +import com.ibm.websphere.simplicity.config.DataSourceProperties; +import com.ibm.websphere.simplicity.log.Log; + +/** + * This class can be used as a @Rule to process a @SkipIfDataSourceProperties annotation + * specified on one or more @Test. + *

    + * Before this rule is used, the setDataSource() + * method must be called on this class to indicate which DataSource + * should be examined for a nested type of DataSourceProperties. + * If the DataSource is not set on this rule, then a null pointer exception will + * occur when the first test that is annotated with @SkipIfDataSourceProperties is executed. + *

    + * The @Test will not be run if the DataSourceProperties type nested under the + * DataSource matches one of the DataSourceProperties specified + * in the @SkipIfDataSourceProperties annotation. + *

    + * For example this code would specify that the test should not be run with "DB2 with JCC" or + * "Derby embedded". + *

    
    + * import static com.ibm.websphere.simplicity.config.DataSourceProperties.*;
    + * ...
    + * private static DataSourcePropertiesSkipRule skipRule = new DataSourcePropertiesSkipRule();
    + * 
    + * {@literal @Rule} public TestRule dataSourcePropertiesSkipRule = skipRule;
    + * 
    + * {@literal @BeforeClass} public static void setUp() throws Exception {
    + * // Get DataSource from server.xml. This DataSource must have
    + * // a nested DataSourceProperties
    + * skipRule.setDataSource(testDataSource);
    + * }
    + * 
    + * {@literal @SkipIfDataSourceProperties}({DB2_JCC, DERBY_EMBEDDED}) {@literal @Test} public void skipTestIf_DB2JCC_DerbyEmbedded() throws InterruptedException {
    + * // test code
    + * }
    + * 
    + * + */ +public class DataSourcePropertiesSkipRule implements TestRule { + + private DataSource dataSource; + + public void setDataSource(DataSource dataSource) { + this.dataSource = dataSource; + } + + public DataSource getDataSource() { + return dataSource; + } + + @Override + public Statement apply(final Statement statement, final Description description) { + SkipIfDataSourceProperties annotation = description.getAnnotation(SkipIfDataSourceProperties.class); + if (annotation == null) { + return statement; + } + + List allowedDataSets = Arrays.asList(annotation.value()); + Set dsp = null; + try { + dsp = dataSource.getDataSourceProperties(); + } catch (NullPointerException e) { + NullPointerException eMessage = + new NullPointerException("Must set the DataSourcePropertiesSkipRule DataSource, using .setDataSource()"); + eMessage.setStackTrace(e.getStackTrace()); + throw eMessage; + } + for (DataSourceProperties p : dsp) { + if (allowedDataSets.contains(p.getElementName())) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + Log.info(description.getTestClass(), description.getMethodName(), "Test method is skipped due to DataSourcePropertiesSkipRule"); + } + }; + } + } + return statement; + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/OnlyIfDataSourceProperties.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/OnlyIfDataSourceProperties.java new file mode 100755 index 000000000000..086bdf6a2e09 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/OnlyIfDataSourceProperties.java @@ -0,0 +1,23 @@ +package com.ibm.websphere.simplicity.config.dsprops.testrules; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation can be used to indicate that a test should only be executed + * if one of the DataSourceProperties in the array + * was a nested properties for the DataSource that was set on + * the DataSourcePropertiesOnlyRule. + * + * @param value one or classes of type DataSourceProperties. + * + * @see {@link DataSourcePropertiesOnlyRule} for an example of how to use this annotation. + * + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface OnlyIfDataSourceProperties { + String[] value(); +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/SkipIfDataSourceProperties.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/SkipIfDataSourceProperties.java new file mode 100755 index 000000000000..db12ff428f72 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/dsprops/testrules/SkipIfDataSourceProperties.java @@ -0,0 +1,23 @@ +package com.ibm.websphere.simplicity.config.dsprops.testrules; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation can be used to indicate that a test should not be executed + * if one of the DataSourceProperties in the array + * was a nested properties for the DataSource that was set on + * the DataSourcePropertiesOnlyRule. + * + * @param dsprops one or classes of type DataSourceProperties. + * + * @see {@link DataSourcePropertiesSkipRule} for an example of how to use this annotation. + * + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface SkipIfDataSourceProperties { + String[] value(); +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/product/Installation.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/product/Installation.java new file mode 100755 index 000000000000..1caff7b4f491 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/product/Installation.java @@ -0,0 +1,123 @@ +package com.ibm.websphere.simplicity.product; + +import java.util.HashMap; +import java.util.Map; + +import com.ibm.websphere.simplicity.Machine; + +/** + * This class represents a generic software installation. It provides access to information common + * to all installations such as an install path and access to the {@link Machine} on which the + * installation exists. + */ +public abstract class Installation { + + static Map installs = new HashMap(); + + private Machine machine; + private String installRoot; + private InstallationType installType; + private String bootstrapFileKey; + + /** + * Constructor + * + * @param machine The machine of this install + * @param installRoot The installation root + * @param installType The type of install + */ + Installation(Machine machine, String installRoot, InstallationType installType) { + this.machine = machine; + this.installRoot = installRoot; + this.installType = installType; + } + + /** + * Get the installation root of this Install. The installation root is the file system + * location on the machine where the install exists. + * + * @return The installation root + */ + public String getInstallRoot() { + return this.installRoot; + } + + /** + * Set the installation root for this install + * + * @param path The install root path + */ + void setInstallRoot(String path) { + this.installRoot = path; + } + + /** + * This method returns the type of product that this Installation represents. An example product + * would be the WebSphere Application Server. + * + * @return The {@link InstallationType} which signifies what type of product this installation + * represents + */ + public InstallationType getInstallType() { + return this.installType; + } + + /** + * Set the {@link InstallationType} for this Installation + * + * @param installType The {@link InstallationType} to set + */ + void setInstallType(InstallationType installType) { + this.installType = installType; + } + + /** + * This method returns the {@link Machine} representation of the machine that this installation + * is installed on. + * + * @return The {@link Machine} of this Install. + */ + public Machine getMachine() { + return this.machine; + } + + /** + * Get the key used to cache this installation in the bootstrapping properties file. If not + * bootstrapping file is being used, this returns null. + * + * @return The key used to cache this installation + */ + public String getBootstrapFileKey() { + return bootstrapFileKey; + } + + /** + * Set the key used to cache this installation in the bootstrapping properties file. + * + * @param bootstrapFileKey The key used to cache the installation + */ + public void setBootstrapFileKey(String bootstrapFileKey) { + this.bootstrapFileKey = bootstrapFileKey; + } + + /** + * This factory method returns an Install based on the provided data. If the install is cached, + * the cached instance will be returned. Otherwise a new instance is created and cached. + * + * @param machine The {@link Machine} that the installation is on + * @param installRoot The path of the installation + * @param installType The type of installation + * @return An {@link Installation} instance + */ + public static Installation getInstall(Machine machine, String installRoot, InstallationType installType) { + String key = machine.getHostname() + installRoot + installType; + Installation install = installs.get(key); + if (install == null) { + if (installType == InstallationType.WAS_INSTALL) { + install = new WASInstallation(machine, installRoot, installType); + } + installs.put(key, install); + } + return install; + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/wsadmin/Wsadmin.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/wsadmin/Wsadmin.java new file mode 100755 index 000000000000..cd6e057c7202 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/wsadmin/Wsadmin.java @@ -0,0 +1,62 @@ +package com.ibm.websphere.simplicity.wsadmin; + +import java.io.File; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Cell; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.WsadminConnectionOptions; + +public class Wsadmin { + + public static Wsadmin getProviderInstance(Cell cell) throws Exception { + WsadminConnectionOptions wsadminOptions = new WsadminConnectionOptions(cell); + wsadminOptions.setLang("jython"); + return new Wsadmin(wsadminOptions, true); + } + + private Wsadmin(WsadminConnectionOptions options, boolean isProviderWsadmin) {} + + public void openSession() throws Exception {} + + public void closeSession() throws Exception {} + + public void reset() throws Exception { + closeSession(); + openSession(); + } + + public boolean isSessionOpen() throws Exception { + return false; + } + + public String executeCommand(String cmd) throws Exception { + System.out.println("Executing cmd: " + cmd); + if (cmd.contains("saveAndSyncAndPrintResult")) + return "save.result(0)"; + return null; + } + + public String executeScriptFile(File file) throws Exception { + System.out.println("Executing file: " + file.getAbsolutePath()); + return null; + } + + @Override + public boolean equals(Object o) { + return true; + } + + public Machine getLaunchMachine() throws Exception { + return null; + } + + public ApplicationServer getTargetServer() throws Exception { + return null; + } + + public static Wsadmin getInstance(WsadminConnectionOptions options) { + return new Wsadmin(options, false); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/soe_reporting/ResultCollectionConstants.java b/dev/fattest.simplicity/src/com/ibm/websphere/soe_reporting/ResultCollectionConstants.java new file mode 100755 index 000000000000..670a305c7df0 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/soe_reporting/ResultCollectionConstants.java @@ -0,0 +1,98 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.soe_reporting; + +/** + * Holds a set of constants which are shared by the result collection servlet and by the build process. + * + * This separate file is used to avoid introducing a dependency on the Ant "Task" class in the servlet. + */ +public abstract class ResultCollectionConstants { + + // Parameter names under which data is sent to the servlet to be persisted. + + // The servlet contains a mapping from these parameter names to the table/column where + // the data should be persisted to in the database. + + // TODO Where an identical named constant is below the in-use one, it means we really + // want to rename the variable to something actually meaningful or readable but can't + // as it's currently in use... + + public static final String PARAM_BUCKET_NAME = "BUCKETNAME"; + // public static final String PARAM_BUCKET_NAME = "BUCKET_NAME"; + + public static final String PARAM_TEST_PASSES = "TESTSPASSED"; + // public static final String PARAM_TEST_PASSES = "TEST_PASSES"; + + public static final String PARAM_TEST_FAILURES = "TESTSFAILED"; + // public static final String PARAM_TEST_FAILURES = "TEST_FAILURES"; + + public static final String PARAM_TEST_ERRORS = "TESTERRORS"; + // public static final String PARAM_TEST_ERRORS = "TEST_ERRORS"; + + public static final String PARAM_TOTAL_TESTS = "TOTALTESTS"; + // public static final String PARAM_TOTAL_TESTS = "TEST_TOTAL"; + + public static final String PARAM_BUILD_ENGINE_NAME = "ENGINENAME"; + // public static final String PARAM_BUILD_ENGINE_NAME = "BUILD_ENGINE_NAME"; + + public static final String PARAM_INSTALL_TYPE_NAME = "INSTALLTYPE"; + // public static final String PARAM_INSTALL_TYPE_NAME = "INSTALL_TYPE_NAME"; + + public static final String PARAM_INSTALL_TYPE_TOPOLOGY = "TOPOLOGY"; + // public static final String PARAM_INSTALL_TYPE_TOPOLOGY = "INSTALL_TYPE_TOPOLOGY"; + + public static final String PARAM_JVM_REPORTING_JVM = "JVMNAME"; + // public static final String PARAM_JVM_REPORTING_JVM = "JVM_NAME"; + + public static final String PARAM_RELEASE_BUILD_LABEL = "RELEASEBUILDLABEL"; + // public static final String PARAM_RELEASE_BUILD_LABEL = "RELEASE_BUILD_LABEL"; + + public static final String PARAM_TEST_BUILD_LABEL = "TESTBUILDLABEL"; + // public static final String PARAM_TEST_BUILD_LABEL = "TEST_BUILD_LABEL"; + + public static final String PARAM_TEST_DATABASE_NAME = "DBNAME"; + // public static final String PARAM_TEST_DATABASE_NAME = "TEST_DATABASE_NAME"; + + public static final String PARAM_OS_NAME = "OSNAME"; + // public static final String PARAM_OS_NAME = "OS_NAME"; + + public static final String PARAM_OS_ARCHITECTURE = "OSARCHITECTURE"; + // public static final String PARAM_OS_ARCHITECTURE = "OS_ARCHITECTURE"; + + public static final String PARAM_OS_REPORTING_OS = "SOEOS"; + // public static final String PARAM_OS_REPORTING_OS = "SOE_OS"; + + public static final String PARAM_RELEASE_BUILD_REPORTING_TYPE = "RELEASE_BUILD_REPORTING_TYPE"; + public static final String PARAM_RELEASE_BUILD_REPORTING_IGNORE = "RELEASE_BUILD_REPORTING_IGNORE"; + public static final String PARAM_RELEASE_BUILD_REPORTING_VERSION = "RELEASE_BUILD_REPORTING_VERSION"; + public static final String PARAM_RELEASE_BUILD_DATE = "RELEASE_BUILD_DATE"; + public static final String PARAM_START_TIME_AND_DATE = "START_TIME_AND_DATE"; + public static final String PARAM_DURATION = "DURATION"; + public static final String PARAM_BUILD_RUN_ID = "BUILD_RUN_ID"; + + public static final String VALUE_UNSPECIFIED = "Unspecified"; + + // Log-scrape timeout failure additions. + public static final String PARAM_FAILURE_TYPE = "FAILURE_TYPE"; + public static final String PARAM_WORKSPACE = "WORKSPACE"; + public static final String PARAM_TEST_CLASS = "TEST_CLASS"; + public static final String PARAM_TEST_METHOD = "TEST_METHOD"; + public static final String PARAM_TEST_LINE = "TEST_LINE"; + public static final String PARAM_IS_PERSONAL_BUILD = "IS_PERSONAL_BUILD"; + public static final String PARAM_TIME_OCCURRED = "TIME_OCCURRED"; + public static final String PARAM_TIME_WAITED_MILLIS = "TIME_WAITED_MILLIS"; + public static final String PARAM_SEARCH_REGEX = "SEARCH_REGEX"; + public static final String PARAM_JVM_VERSION = "JVM_VERSION"; + public static final String PARAM_JVM_VENDOR = "JVM_VENDOR"; + public static final String PARAM_JVM_ARCHITECTURE = "JVM_ARCHITECTURE"; +} diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/soe_reporting/SOEHttpPostUtil.java b/dev/fattest.simplicity/src/com/ibm/websphere/soe_reporting/SOEHttpPostUtil.java new file mode 100755 index 000000000000..16c699b5c974 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/websphere/soe_reporting/SOEHttpPostUtil.java @@ -0,0 +1,231 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2014 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ + +package com.ibm.websphere.soe_reporting; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.log.Log; + +/* The SOE team run several web servlets which are used to collect build data for analytics purposes. + * They/we have added a new kind of datum for reporting soft/transient failures, + * DB access for storing and retrieving those reports is provided via those servlets. + * + * This class acts as a reporting client for to that system. + * Its logic is adapted from that used by several custom Ant tasks in the build to send data + * to the SOE servlets via an HTTP POST request. + * + * At the time I'm writing this, the only reports Simplicity is submitting through this channel + * are "soft timeouts" from log scraping actions in LibertyServer. + * + * @see LibertyServer.waitForStringInLog(String regexp, long intendedTimeout, long extendedTimeout, RemoteFile outputFile) + */ +public class SOEHttpPostUtil { + private static final Class thisClass = SOEHttpPostUtil.class; + private static final String CLASS_NAME = thisClass.getName(); + private static Logger LOG = Logger.getLogger(CLASS_NAME); + + private static final int CONNECTION_TIMEOUT_MILLISECONDS = 10000; + private static final String UTF8 = "UTF-8"; + + // Test server: "http://ltestw40.hursley.ibm.com:9080/soe_LogScrapeTimeout/CollectLogScrapeTimeout" + // Production server: "http://howler.hursley.ibm.com:9080/LogScrapeTimeoutCollection/CollectLogScrapeTimeout" + // Note: bnd wants property names to be in lowercase. + private static final String SOE_SOFTFAILURE_REPORT_SERVER = + System.getProperty("soe.softfailure.report.server"); + private static final String LOGFAILURE_REPORT_SERVER = + (SOE_SOFTFAILURE_REPORT_SERVER == null) + ? null + : SOE_SOFTFAILURE_REPORT_SERVER + "/LogScrapeTimeoutCollection/CollectLogScrapeTimeout"; + + protected HttpPostResponse send(String urlString, Map parameters) { + + HttpPostResponse response = null; + try { + URL url = new URL(urlString); + String encodedParameterString = createParameterContentString(parameters); + response = null; + + HttpURLConnection connection = connect(url, encodedParameterString); + if (connection != null) { + writeParameters(connection, encodedParameterString); + response = readResponse(connection); + } + } catch (IOException e) { + Log.error(thisClass, "send", e); + e.printStackTrace(); + return null; + } + + return response; + } + + private HttpURLConnection connect(URL url, String encodedParameterString) throws IOException { + HttpURLConnection connection = createConnection(url, encodedParameterString); + return connection; + } + + private HttpURLConnection createConnection(URL url, String encodedParameterString) throws IOException { + HttpURLConnection connection = null; + connection = (HttpURLConnection) url.openConnection(); + connection.setDoOutput(true); + connection.setRequestMethod("POST"); + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + connection.setConnectTimeout(CONNECTION_TIMEOUT_MILLISECONDS); + connection.setRequestProperty("Content-Length", "" + encodedParameterString.length()); + return connection; + } + + private void writeParameters(HttpURLConnection connection, String encodedParameterString) throws IOException { + OutputStreamWriter writer = null; + try { + writer = new OutputStreamWriter(connection.getOutputStream()); + writer.write(encodedParameterString); + writer.flush(); + } finally { + if (writer != null) { + writer.close(); + } + } + } + + private HttpPostResponse readResponse(HttpURLConnection connection) throws IOException { + int responseCode = connection.getResponseCode(); + String responseMessage = connection.getResponseMessage(); + + StringBuilder responseContentBuilder = new StringBuilder(); + BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String line = null; + + while ((line = br.readLine()) != null) { + responseContentBuilder.append(line); + } + + return new HttpPostResponse(responseCode, responseMessage, responseContentBuilder.toString()); + } + + private String createParameterContentString(Map parameters) throws UnsupportedEncodingException { + StringBuilder stringBuilder = new StringBuilder(); + + for (Map.Entry entry : parameters.entrySet()) { + if (stringBuilder.length() != 0) { + stringBuilder.append('&'); + } + stringBuilder.append(encodeStringUTF8(entry.getKey())); + stringBuilder.append('='); + stringBuilder.append(encodeStringUTF8(entry.getValue())); + } + + Log.debug(thisClass, "Sending String: " + stringBuilder.toString()); + return stringBuilder.toString(); + } + + private String encodeStringUTF8(String string) throws UnsupportedEncodingException { + return URLEncoder.encode(string, UTF8); + } + + protected static final class HttpPostResponse { + + private final int responseCode; + private final String responseMessage; + private final String content; + + public HttpPostResponse(int responseCode, String returnMessage, String content) { + this.responseCode = responseCode; + this.responseMessage = returnMessage; + this.content = content; + } + + public int getResponseCode() { + return responseCode; + } + + public String getResponseMessage() { + return responseMessage; + } + + public String getContent() { + return content; + } + } + + /** + * This can be called to send reports of "soft failures" to the SOE server, for use in finer-grained analysis of builds. + * It's defined in conjunction with the infra.buildtasks folks; see RTC Work Items 116585 and 122141 + */ + + // Environmental "constants" for a given test run + // If any is absent (ie, if we are on a developer's personal machine), do not log the soft timeout. + static final String _buildEngineName = System.getProperty("build.engine.name"); + static final String _operatingSystem = System.getProperty("os.name"); + static final String _buildLabel = System.getProperty("buildServerLabel"); + static final String _workspaceName = System.getProperty("team.scm.workspace"); + static final String _personalBuild = (null != System.getProperty("personalBuild")) ? "1" : "0"; + static final String _osArch = System.getProperty("os.arch"); + static final String _jvmVersion = System.getProperty("java.version"); + static final String _jvmVendor = System.getProperty("java.vendor"); + static final boolean _enableReport = + null != _buildEngineName && null != _operatingSystem && null != _buildLabel && + null != _workspaceName && null != _osArch && null != _jvmVersion && null != _jvmVendor; + + public static void reportSoftLogTimeoutToSOE(String testClass, String testMethod, int testLine, long timeWaited_msec, String regEx) { + if (!_enableReport) + return; // No-op on developer machine. + + SOEHttpPostUtil post = new SOEHttpPostUtil(); + + Map params = new HashMap(); + + // @formatter:off // INTERNAL REPRESENTATIONS/CONSTRAINTS + // Environment constants + params.put(ResultCollectionConstants.PARAM_BUILD_ENGINE_NAME, _buildEngineName); // String; max length 100. + params.put(ResultCollectionConstants.PARAM_WORKSPACE, _workspaceName); // String; max length 50. + params.put(ResultCollectionConstants.PARAM_IS_PERSONAL_BUILD, _personalBuild); // short + params.put(ResultCollectionConstants.PARAM_JVM_ARCHITECTURE, _osArch); // String; max length 20. + params.put(ResultCollectionConstants.PARAM_JVM_VENDOR, _jvmVendor); // String; max length 50. + params.put(ResultCollectionConstants.PARAM_JVM_VERSION, _jvmVersion); // String; max length 50. + params.put(ResultCollectionConstants.PARAM_OS_ARCHITECTURE, _osArch); // String; max length 100. + params.put(ResultCollectionConstants.PARAM_OS_NAME, _operatingSystem); // String; max length 100. + params.put(ResultCollectionConstants.PARAM_TEST_BUILD_LABEL, _buildLabel); // String; max length 200. + + // Event type (fixed, in this utility function) + params.put(ResultCollectionConstants.PARAM_FAILURE_TYPE, "SoftLogScrapeTimeout"); // String; max length 50. + + // Event properties (params and runtime context) + params.put(ResultCollectionConstants.PARAM_TIME_OCCURRED, Long.toString(System.currentTimeMillis())); // long (converted to java.sql.Timestamp when stored). + params.put(ResultCollectionConstants.PARAM_TEST_CLASS, testClass); // String; max length 100. + params.put(ResultCollectionConstants.PARAM_TEST_LINE, Integer.toString(testLine)); // int + params.put(ResultCollectionConstants.PARAM_TEST_METHOD, testMethod); // String; max length 100. + params.put(ResultCollectionConstants.PARAM_SEARCH_REGEX, regEx); // String; max length 100. + params.put(ResultCollectionConstants.PARAM_TIME_WAITED_MILLIS, Long.toString(timeWaited_msec)); // int + // @formatter:on + + HttpPostResponse response = post.send(LOGFAILURE_REPORT_SERVER, params); + + Log.debug(thisClass, "Reported to " + LOGFAILURE_REPORT_SERVER + " that " + testClass + "." + testMethod + "[" + testLine + "]: exceeded " + timeWaited_msec + + " finding " + + regEx); + Log.debug(thisClass, "Got response code: " + response.getResponseCode()); + Log.debug(thisClass, "Got response message: " + response.getResponseMessage()); + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/AbstractParser.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/AbstractParser.java new file mode 100755 index 000000000000..a94ce483d0e4 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/AbstractParser.java @@ -0,0 +1,31 @@ +package com.ibm.ws.fat.jcdi.util.html; + +import java.nio.CharBuffer; +import java.util.List; + +/** + * This interface represent an abstract parser. + * + * @author yingwang + * + */ +public interface AbstractParser { + + /** + * reset the event handler. + * + * @param handler + */ + public void reset(Object handler); + + /** + * Parse and rewrite an array of input CharBuffer and output the result into a list of + * CharBuffer. + * + * @param inputBuffers input buffers. + * @param outputBuffers output buffers. + * @throws Exception the exception. + */ + public void parse(CharBuffer inputBuffers[], List outputBuffers) throws Exception ; + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/ConversationsHtmlParser.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/ConversationsHtmlParser.java new file mode 100755 index 000000000000..ca81040c6216 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/ConversationsHtmlParser.java @@ -0,0 +1,180 @@ +package com.ibm.ws.fat.jcdi.util.html; + +import java.nio.CharBuffer; +import java.util.HashMap; +import java.util.ArrayList; + +public class ConversationsHtmlParser extends HtmlDefaultParser { + + protected String body; + + protected ConversationsHtmlEventHandler conversationsHandler; + + protected HashMap PageInfo = new HashMap(); + protected ArrayList items = new ArrayList(); + + public void reset(String body) { + this.body = body; + this.reset(new ConversationsHtmlEventHandler()); + } + + public ConversationsHtmlParser(String body) + { + this.body = body; + this.reset(new ConversationsHtmlEventHandler()); + } + + public String getPageInfo(String attr) + { + return PageInfo.get(attr); + } + + public String getTagAttributeNameBasedOnValue(String value) + { + for(String key : PageInfo.keySet()) { + if (PageInfo.get(key).equals(value)) return key; + } + return null; + } + + public String getItem(int index) + { + if (index >= items.size()) + { + return null; + } + return items.get(index); + } + + public int getItemListSize() + { + return items.size(); + } + + public void parse() throws Exception + { ArrayList output = new ArrayList(); + CharBuffer cb = CharBuffer.wrap(body); + super.parse(new CharBuffer[] {cb}, output); + } + + public class ConversationsHtmlEventHandler implements HtmlDefaultEventHandler { + + public void reset() { + } + + public void startDoc() { + } + + /** + * handle a html tag. + */ + public CharBuffer handleTag(CharBuffer buffer) { + HtmlTag tag = new HtmlTag(buffer); + + tag.parseAttributes(); + + + // view id + if (tag.getAttributeValue("name") != null + && tag.getAttributeValue("name").equals("form")) + { + String value = tag.getAttributeValue("action"); + System.out.println("handleTag() finds action=" + value); + if (value != null) + PageInfo.put("action", value); + int index = value.indexOf("?cid="); + if (index > 0) { + PageInfo.put("cid", value.substring(index)); + System.out.println("handleTag() finds cid=" + value.substring(index)); + } + } + + // view id + if (tag.getAttributeValue("name") != null + && tag.getAttributeValue("name").equals("javax.faces.ViewState")) + { + String value = tag.getAttributeValue("value"); + if (value != null) + PageInfo.put("javax.faces.ViewState", value); + System.out.println("handleTag() finds javax.faces.ViewState=" + value); + } + + // submite form + if (tag.getAttributeValue("name") != null + && tag.getAttributeValue("name").equals("form_SUBMIT")) + { + String value = tag.getAttributeValue("value"); + if (value != null) { + PageInfo.put("form_SUBMIT", value); + System.out.println("handleTag() finds form_SUBMIT=" + value); + } + } + + // parse item id. + if (tag.getAttributeValue("href") != null + && tag.getAttributeValue("href").equals("#") + //&& tag.getAttributeValue("onclick").startsWith("return oamSubmitForm(")) + && tag.getAttributeValue("onclick").startsWith("return myfaces.oam.submitForm")) + { + String value = tag.getAttributeValue("onclick"); + int start = value.indexOf("form:"); + if (start > 0) { + int end = value.indexOf("\')", start); + if (end > start) { + PageInfo.put("", value); + items.add(value.substring(start, end)); + System.out.println("handleTag() finds item=" + value.substring(start, end)); + } + } + } + + // Login + if (tag.getAttributeValue("value") != null + && tag.getAttributeValue("value").equals("Login")) + { + String name = tag.getAttributeValue("name"); + String value = tag.getAttributeValue("value"); + System.out.println("handleTag() finds Login tag name=" + name); + if (value != null) + PageInfo.put(name, value); + } + + return buffer; + } + /** + * Handle DTD. + */ + public CharBuffer handleDTD(CharBuffer buffer) { + return buffer; + } + + + /** + * Handle contents. + */ + public CharBuffer handleContents(CharBuffer buffer) { + return buffer; + } + + /** + * Handle comments. + */ + public CharBuffer handleComments(CharBuffer buffer) { + return buffer; + } + + public CharBuffer[] flush() { + return null; + } + + public void endDoc() { + + } + + public boolean isFinished() { + return false; + } + + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/HtmlDefaultEventHandler.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/HtmlDefaultEventHandler.java new file mode 100755 index 000000000000..a32e471f83dc --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/HtmlDefaultEventHandler.java @@ -0,0 +1,79 @@ +package com.ibm.ws.fat.jcdi.util.html; + +import java.nio.CharBuffer; + +/** + * The Default html SAX-like event handler interface. + * + * @author yingwang + * + */ +public interface HtmlDefaultEventHandler { + + /** + * start of the html/xhtml document. + */ + public void startDoc(); + + /** + * handle the dtd. + * + * @param buffer + * @return + */ + public CharBuffer handleDTD(CharBuffer buffer); + + /** + * handle the tag. + * + * @param buffer + * @return + */ + public CharBuffer handleTag(CharBuffer buffer); + + /** + * handle the contents. + * + * @param buffer + * @return + */ + public CharBuffer handleContents(CharBuffer buffer); + + /** + * handle the comments. + * + * @param buffer + * @return + */ + public CharBuffer handleComments(CharBuffer buffer); + + /** + * end of the document. + * + * @param buffer + * @return + */ + public void endDoc(); + + /** + * flush the final result. + * + * @return + */ + public CharBuffer[] flush(); + + /** + * reset the event handler. + * + * @return + */ + public void reset(); + + /** + * Whether or not the handler already finish parsing. So the parser could skip + * the rest of the contents. + * + * @return + */ + public boolean isFinished(); +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/HtmlDefaultParser.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/HtmlDefaultParser.java new file mode 100755 index 000000000000..4a50f2ed4f14 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/HtmlDefaultParser.java @@ -0,0 +1,441 @@ +package com.ibm.ws.fat.jcdi.util.html; + +import java.nio.CharBuffer; +import java.util.List; + +/** + * Shared common code for html parsing and rewriting. + * + * @author yingwang + * + */ +public class HtmlDefaultParser implements AbstractParser { + + static boolean DEBUG = false; + /** + * The state of this parser. + */ + int state; + + /** + * Where we start to handle stored + new char buffers. it should be the length + * of stored char buffer; + */ + int savedIndex; + + /** + * This buffer is used to store the partial tag that may span 2 char buffers. + */ + CharBuffer savedCharBuffer; + + /** + * The callback to handle the html events. + */ + HtmlDefaultEventHandler handler; + + @Override + public void reset(Object handler) { + this.reset((HtmlDefaultEventHandler) handler); + } + + /** + * Reset the the parser and attach new handler to the parser. + * + * @param handler The html event handler. + */ + public void reset(HtmlDefaultEventHandler handler) { + if (DEBUG) + System.out.println("HTMLAP.reset() handler=" + handler); + this.handler = handler; + this.handler.reset(); + state = State.STATE_CONTENTS; + savedIndex = -1; + savedCharBuffer = null; + if (DEBUG) + System.out.println("HTMLAP.reset() exit."); + } + + /** + * The simple parser. Since html might have open tags, and xml SAX parser does not support nio, + * we need to implement ourselves. This simple html parser will fire following events: + * + * 1. Tags, the charbuffer between/include < and > + * 2. DTD style tags, the charbuffer between/include + * 3. Comments, the char buffer between/include + * 4. Normal text contents, note the parser might fire multiple events for a block of text contents. + * + * The parser is designed for junction rewriting features and could be extended for other rewriting + * purpose. + * + * @param inputBuffers the input char buffers. + * @param outputBuffers The output char buffers. + * + * @throws Exception any exceptions that fired from the html event handler. + * + */ + @Override + public void parse(CharBuffer inputBuffers[], List outputBuffers) throws Exception { + int index, start; + CharBuffer currentBuffer = null, valueBuffer, resultBuffer; + + if (DEBUG) + System.out.println("HTMLAP.parse() inputBuffers=" + inputBuffers + + " outputBuffers=" + outputBuffers + + " state=" + State.STATES[state] + + " savedIndex=" + savedIndex); + + for (CharBuffer inputBuffer : inputBuffers) { + + // If saved buffer is not null, we need to merge the saved and the first buffer in the input list. + if (savedCharBuffer != null) { + if (DEBUG) + System.out.println("HTMLAP.parse() savedCharBuffer.remaining=" + savedCharBuffer.remaining() + + " inputbuffer.remaining()=" + inputBuffer.remaining()); + currentBuffer = CharBuffer.allocate(savedCharBuffer.remaining() + inputBuffer.remaining() + 1); + savedCharBuffer.read(currentBuffer); + inputBuffer.read(currentBuffer); + currentBuffer.flip(); + savedCharBuffer = null; + } else { + currentBuffer = inputBuffer; + } + + int position = start = index = currentBuffer.position(); + if (DEBUG) + System.out.println("HTMLAP.parse() currentBuffer.remaining()=" + currentBuffer.remaining() + + " currentBuffer.limit()=" + currentBuffer.limit() + + " position=start=index=" + position + + " savedIndex=" + savedIndex); + while (index < currentBuffer.limit()) { + if (handler.isFinished()) { + if (DEBUG) + System.out.println("HTMLAP.parse() handler=" + handler + " is finished. outputBuffers.size()=" + + outputBuffers.size()); + return; + } + if (DEBUG) + System.out.println("HTMLAP.parse() state=" + State.STATES[state] + + " start=" + start + " index=" + index); + switch (state) { + case State.STATE_CONTENTS: + // handle the normal contents between tags. We do not buffer the whole + // contents between 2 tags because we do not rewrite the contents. + if (currentBuffer.get(start) == '<') { + state = State.STATE_LTAG; + start = index; + continue; + } + for (index = (savedIndex > 0 ? start + savedIndex : start); index < currentBuffer.limit(); index++) { + if (currentBuffer.get(index) == '<') + break; + } + if (index < currentBuffer.limit()) { + valueBuffer = CharBuffer.wrap(currentBuffer, start - position, index - position); + if (DEBUG) + System.out.println("HTMLAP.parse() firing handler.handleContents0 on valueBuffer=" + valueBuffer); + resultBuffer = handler.handleContents(valueBuffer); + if (DEBUG) + System.out.println("HTMLAP.parse() handler.handleContents0 resultBuffer=" + resultBuffer); + if (resultBuffer != null) { + outputBuffers.add(resultBuffer); + } + savedIndex = -1; + state = State.STATE_LTAG; + start = index; + continue; + } + valueBuffer = CharBuffer.wrap(currentBuffer, start - position, currentBuffer.limit() - position); + if (DEBUG) + System.out.println("HTMLAP.parse() firing handler.handleContents1 on valueBuffer=" + valueBuffer); + resultBuffer = handler.handleContents(valueBuffer); + if (DEBUG) + System.out.println("HTMLAP.parse() handler.handleContents1 resultBuffer=" + resultBuffer); + index = currentBuffer.limit(); + if (resultBuffer != null) { + outputBuffers.add(resultBuffer); + } + savedIndex = -1; + continue; + + case State.STATE_LTAG: + if (currentBuffer.limit() - start == 1) { + if (DEBUG) + System.out.println("HTMLAP.parse() STATE_LTAG saveRemaining0 start=" + start + + "currentBuffer.limit()=" + currentBuffer.limit()); + saveRemaining(currentBuffer, start); + index = currentBuffer.limit(); + continue; + } + if (currentBuffer.get(start + 1) == '!') { + state = State.STATE_LDTD; + savedIndex = -1; + continue; + } else { + for (index = (savedIndex > 0 ? start + savedIndex : start + 1); index < currentBuffer.limit(); index++) { + if (currentBuffer.get(index) == '>') { + break; + } + } + } + + if (index < currentBuffer.limit()) { + index++; + valueBuffer = CharBuffer.wrap(currentBuffer, start - position, index - position); + if (DEBUG) + System.out.println("HTMLAP.parse() firing handler.handleTag on valueBuffer=" + valueBuffer); + resultBuffer = handler.handleTag(valueBuffer); + if (DEBUG) + System.out.println("HTMLAP.parse() handler.handleTag resultBuffer=" + resultBuffer); + if (resultBuffer != null) { + outputBuffers.add(resultBuffer); + } + start = index; + state = State.STATE_CONTENTS; + savedIndex = -1; + continue; + } + if (DEBUG) + System.out.println("HTMLAP.parse() STATE_LTAG saveRemaining1 start=" + start + + "currentBuffer.limit()=" + currentBuffer.limit()); + saveRemaining(currentBuffer, start); + index = currentBuffer.limit(); + continue; + case State.STATE_LDTD: + if (currentBuffer.limit() - start <= 2) { + if (DEBUG) + System.out.println("HTMLAP.parse() STATE_LDTD saveRemaining0 start=" + start + + "currentBuffer.limit()=" + currentBuffer.limit()); + saveRemaining(currentBuffer, start); + index = currentBuffer.limit(); + continue; + } + if (currentBuffer.get(start + 2) == '-') { + if (currentBuffer.limit() - index <= 3) { + if (DEBUG) + System.out.println("HTMLAP.parse() STATE_LDTD saveRemaining1 start=" + start + + "currentBuffer.limit()=" + currentBuffer.limit()); + saveRemaining(currentBuffer, start); + index = currentBuffer.limit(); + continue; + } + if (currentBuffer.get(start + 3) == '-') { + state = State.STATE_LCOMMENTS; + savedIndex = -1; + continue; + } + for (index = (savedIndex > 0 ? start + savedIndex : start + 3); index < currentBuffer.limit(); index++) { + if (currentBuffer.get(index) == '>') { + break; + } + } + } else { + for (index = (savedIndex > 0 ? start + savedIndex : start + 2); index < currentBuffer.limit(); index++) { + if (currentBuffer.get(index) == '>') { + break; + } + } + } + if (index < currentBuffer.limit()) { + index++; + valueBuffer = CharBuffer.wrap(currentBuffer, start - position, index - position); + if (DEBUG) + System.out.println("HTMLAP.parse() firing handler.handleDTD on valueBuffer=" + valueBuffer); + resultBuffer = handler.handleDTD(valueBuffer); + if (DEBUG) + System.out.println("HTMLAP.parse() handler.handleDTD resultBuffer=" + resultBuffer); + if (resultBuffer != null) { + outputBuffers.add(resultBuffer); + } + start = index; + state = State.STATE_CONTENTS; + savedIndex = -1; + continue; + } + if (DEBUG) + System.out.println("HTMLAP.parse() STATE_LDTD saveRemaining2 start=" + start + + "currentBuffer.limit()=" + currentBuffer.limit()); + saveRemaining(currentBuffer, start); + index = currentBuffer.limit(); + continue; + case State.STATE_LCOMMENTS: + if (currentBuffer.limit() - start <= 4) { + if (DEBUG) + System.out.println("HTMLAP.parse() STATE_LCOMMENTS saveRemaining0 start=" + start + + "currentBuffer.limit()=" + currentBuffer.limit()); + saveRemaining(currentBuffer, start); + index = currentBuffer.limit(); + continue; + } + + for (index = (savedIndex > 0 ? start + savedIndex : start + 4); index < currentBuffer.limit(); index++) { + if (currentBuffer.get(index) == '>') { + if (currentBuffer.get(index - 1) == '-' && index - 1 > start + 5) { + if (currentBuffer.get(index - 2) == '-' && index - 2 > start + 4) { + break; + } + } + } + } + if (index < currentBuffer.limit()) { + index++; + valueBuffer = CharBuffer.wrap(currentBuffer, start - position, index - position); + if (DEBUG) + System.out.println("HTMLAP.parse() firing handler.handleComments on valueBuffer=" + valueBuffer); + resultBuffer = handler.handleComments(valueBuffer); + if (DEBUG) + System.out.println("HTMLAP.parse() handler.handleComments resultBuffer=" + resultBuffer); + if (resultBuffer != null) { + outputBuffers.add(resultBuffer); + } + start = index; + state = State.STATE_CONTENTS; + savedIndex = -1; + continue; + } + if (DEBUG) + System.out.println("HTMLAP.parse() STATE_LCOMMENTS saveRemaining1 start=" + start + + "currentBuffer.limit()=" + currentBuffer.limit()); + saveRemaining(currentBuffer, start); + index = currentBuffer.limit(); + continue; + } // swith + } // while + } // for + if (DEBUG) + System.out.println("HTMLAP.parse() outputBuffers.size()=" + outputBuffers.size()); + } + + /** + * Save remaining buffer from the absolute index 'from'. + * + * @param charBuffer the unfinished char buffer. + * @param from the absolute index from. + * + * @throws Exception index out of bound. + */ + protected void saveRemaining(CharBuffer charBuffer, int from) throws Exception { + savedCharBuffer = CharBuffer.wrap(charBuffer, from - charBuffer.position(), charBuffer.limit() - charBuffer.position()); + savedIndex = savedCharBuffer.remaining(); + } + + /** + * This simple parser's state. + * + * @author yingwang + * + */ + protected static class State { + + /** + * normal text block between tags. + */ + static final int STATE_CONTENTS = 1; + + /** + * For "<" + */ + static final int STATE_LTAG = 2; + + /** + * For "asReadOnlyBuffer<"), + CharBuffer.wrap("a code=\"333>');//-->") + }; + inputBuffers[0].position(2); + HtmlDefaultParser parser = new HtmlDefaultParser(); + parser.reset(new NullHtmlEventHandler()); + List outputBuffers = new java.util.ArrayList(); + try { + parser.parse(inputBuffers, outputBuffers); + if (DEBUG) + System.out.print(outputBuffers); + } catch (Exception ex) { + + } + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/HtmlTag.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/HtmlTag.java new file mode 100755 index 000000000000..bb78bd4c9be7 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/jcdi/util/html/HtmlTag.java @@ -0,0 +1,325 @@ +package com.ibm.ws.fat.jcdi.util.html; + +import java.nio.CharBuffer; +import java.util.HashMap; +import java.util.Map; + +/** + * The representation of a Html Tag. A Lazy evaluation is used. + * + * @author yingwang + * + */ +public class HtmlTag { + + /** + * The original CharBuffer that stores the html tag. + */ + protected CharBuffer buffer; + + /** + * abs start of the tag in the buffer. + */ + protected int start; + + /** + * abs end of the tag in the buffer. + */ + protected int end; + + /** + * The tag name. + */ + protected String name; + + /** + * The abs index of next char after the tag name. + */ + protected int tagNameEnd; + + /** + * Tag attribute pairs. + */ + protected Map attributes; + + /** + * The constructor. + * + * @param buffer0 input charbuffer that stores the tag. + */ + public HtmlTag(CharBuffer buffer0) { + this.buffer = buffer0; + this.start = buffer.position(); + this.end = buffer.limit(); + + int i = 0, ss = -1, ee = -1; + char ch; + name = null; + tagNameEnd = -1; + for (i = start; i < end; i++) { + ch = buffer.get(i); + switch (ch) { + case '<': + ss = 0; + break; + case ' ': + case '\r': + case '\n': + case '\t': + if (ss > 0) { + ee = i; + } + break; + case '>': + if (ss >= 0) { + ee = i; + } + break; + default: + if (ss == 0) { + ss = i; + } + } + if (ee > 0) + break; + } + tagNameEnd = ee; + if (ss > 0 && ee >= ss) { + name = CharBuffer.wrap(buffer, ss - start, ee - start).toString().toLowerCase(); + } + } + + /** + * get the tag name. + * + * @return the tag name. + */ + public String getName() { + return name; + } + + /** + * Whether or not the current index is at the end of a tag. + * + * @param input + * @param index + * @param end + * + * @return true of at the end of tag. + */ + protected boolean isEndOfTag(CharBuffer input, int index, int end) { + if (index >= end - 1) + return true; + if (index == end - 2) { + char ch = input.get(index); + if (ch == '/' || ch == '?') + return true; + } + return false; + } + + /** + * Skip the index until we see the char 'till' or at the end of a tag. + * + * @param input + * @param start + * @param end + * @param output + * @param till + * @return + */ + protected int skipTill(CharBuffer input, int start, int end, + StringBuffer output, char till) { + char ch; + int i; + for (i = start; i < end; i++) { + ch = input.get(i); + if (ch == till || isEndOfTag(input, i, end)) + return i; + output.append(ch); + } + return i; + } + + /** + * Skip the index until we see the char 'till' or at the end of a tag. + * + * @param input + * @param start + * @param end + * @param till + * @return + */ + protected int skipTill(CharBuffer input, int start, int end, + char till) { + char ch; + int i; + for (i = start; i < end; i++) { + ch = input.get(i); + if (ch == till || isEndOfTag(input, i, end)) + return i; + } + return i; + } + + /** + * Skip the index until we see the char 'till' or at the end of a tag. + * Then contents between quote pair are also skipped. + * + * @param input + * @param start + * @param end + * @param output + * @param till + * @return + */ + protected int skipTillAndQuote(CharBuffer input, int start, int end, + StringBuffer output, char till) { + char ch; + int i; + for (i = start; i < end; i++) { + ch = input.get(i); + if (ch == '"' || ch == '\'') { + output.append(ch); + i = skipTill(input, i + 1, end, output, ch); + if (i < end) { + output.append(ch); + } + continue; + } + if (ch == till || isEndOfTag(input, i, end)) + return i; + output.append(ch); + } + return i; + } + + /** + * Skip the index until we see the char 'till' or at the end of a tag. + * Then contents between quote pair are also skipped. + * + * @param input + * @param start + * @param end + * @param till + * @return + */ + protected int skipTillAndQuote(CharBuffer input, int start, int end, + char till) { + char ch; + int i; + for (i = start; i < end; i++) { + ch = input.get(i); + if (ch == '"' || ch == '\'') { + i = skipTill(input, i + 1, end, ch); + continue; + } + if (ch == till || isEndOfTag(input, i, end)) + return i; + } + return i; + } + + /** + * Parse the attribute of a tag. + * + */ + public void parseAttributes() { + char ch; + int index = tagNameEnd, attrNameStart, attrNameEnd, valueStart, valueEnd; + String attributeName, attributeValue; + attributes = new HashMap(); + + while (index < end) { + + // skip space between attribute. + ch = buffer.get(index); + if (Character.isWhitespace(ch)) { + index++; + continue; + } else if (isEndOfTag(buffer, index, end)) { + index = end; + continue; + } + + //We are here to start to handle new attribute + attrNameStart = index; + attrNameEnd = skipTill(buffer, attrNameStart, end, '='); + if (attrNameEnd <= attrNameStart) { + index = this.skipTillAndQuote(buffer, attrNameEnd, end, ' '); + continue; + } + attributeName = CharBuffer.wrap(buffer, attrNameStart - start, attrNameEnd - start).toString(); + + index = attrNameEnd; + ch = buffer.get(index); + if (ch != '=') { + index = this.skipTillAndQuote(buffer, attrNameEnd, end, ' '); + continue; + } + + index++; + ch = buffer.get(index); + if (ch == '"' || ch == '\'') { + valueStart = index + 1; + valueEnd = this.skipTill(buffer, valueStart, end, ch); + attributeValue = CharBuffer.wrap(buffer, valueStart - start, valueEnd - start).toString(); + attributes.put(attributeName.toLowerCase(), attributeValue); + index = valueEnd + 1; + continue; + } else { + valueStart = index; + valueEnd = this.skipTillAndQuote(buffer, valueStart, end, ' '); + attributeValue = CharBuffer.wrap(buffer, valueStart - start, valueEnd - start).toString(); + attributes.put(attributeName.toLowerCase(), attributeValue); + index = valueEnd; + continue; + } + } + } + + /** + * get the original char buffer. + * + * @return + */ + public CharBuffer getOriginalBuffer() { + return this.buffer; + } + + /** + * get the value of a attribute. + * + * @param attributeName + * @return + */ + public String getAttributeValue(String attributeName) { + return attributes.get(attributeName); + } + + // unit test cases. + public static void main(String[] args) { + CharBuffer[] testcases = { + CharBuffer.wrap(" <>"), + CharBuffer.wrap(" "), + CharBuffer.wrap(" "), + CharBuffer.wrap(" < abc>"), + CharBuffer.wrap(" < abc >"), + CharBuffer.wrap(" "), + CharBuffer.wrap(" ") + }; + HtmlTag tag; + for (int i = 0; i < testcases.length; i++) { + testcases[i].position(2); + tag = new HtmlTag(testcases[i]); + tag.parseAttributes(); + System.out.println("buffer=" + tag.buffer); + System.out.println("name=" + tag.getName()); + System.out.println("start=" + tag.start); + System.out.println("end=" + tag.end); + System.out.println("tagNameEnd=" + tag.tagNameEnd); + System.out.println("attributes=" + tag.attributes); + System.out.println("************"); + } + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/ACEScanner.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/ACEScanner.java new file mode 100644 index 000000000000..5f847e7a3a02 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/ACEScanner.java @@ -0,0 +1,152 @@ +package com.ibm.ws.fat.util; + +import java.io.BufferedReader; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; + +public class ACEScanner { + // Variables that you might want to configure + public String INPUT_FILE = "files/console.log"; + public String OUTPUT_FILE = "unique_j2sec_issues.log"; + public int WS_STACK_DEPTH = 0; // how many lines of stack to print after the first "com.ibm.ws" + + // Other variables + public static final Pattern JAVA_2_SEC_NORETHROW = Pattern.compile("^\\[WARNING \\] CWWKE09(21W|12W|13E|14W|15W|16W):.*"); + public static final Pattern JAVA_2_SEC_RETHROW = Pattern.compile("^ERROR: java\\.security\\.AccessControlException:.*"); + private static final Pattern IBM_STACK = Pattern.compile("^(\\s*at )?com\\.ibm\\.ws.*"); + private static final Class c = ACEScanner.class; + private static final boolean DEBUG = false; + private final Map exceptionMap = new HashMap(); + private int totalACECount = 0; + + public static void main(String[] args) throws Exception { + new ACEScanner().run(); + } + + public ACEScanner() {} + + public ACEScanner(LibertyServer server) throws Exception { + this.INPUT_FILE = server.getConsoleLogFile().getAbsolutePath(); + } + + public ACEScanner inputFile(String inputFile) { + this.INPUT_FILE = inputFile; + return this; + } + + public ACEScanner stackDepth(int stackDepth) { + this.WS_STACK_DEPTH = stackDepth; + return this; + } + + public void run() { + try { + Log.info(c, "run", "Processing server log: " + INPUT_FILE); + + // Find all the unique ACEs and store them in a map + BufferedReader infile = new BufferedReader(new FileReader(INPUT_FILE)); + String curLine; + while ((curLine = infile.readLine()) != null) + if (JAVA_2_SEC_RETHROW.matcher(curLine).matches() || JAVA_2_SEC_NORETHROW.matcher(curLine).matches()) { + if (DEBUG) + Log.info(c, "run", "starting to process: " + curLine); + processACEStack(infile); + } + infile.close(); + + if (exceptionMap.size() == 0) { + Log.info(c, "run", "No AccessControlExceptions found in logs, so no report will be generated."); + return; + } + + // Write the ACE report + String tstamp = new SimpleDateFormat("HH-mm-ss-SSS").format(new Date(System.currentTimeMillis())); + PrintWriter outfile = new PrintWriter(new FileOutputStream("ACE-report-" + tstamp + ".log")); + + outfile.write("Begin AccessControlException report for for log file:\n"); + outfile.write(INPUT_FILE + "\n\n"); + outfile.write("============================================================\n\n"); + outfile.write("Found " + totalACECount + " total AccessControlExceptions in logs.\n"); + outfile.write("Found " + exceptionMap.size() + " unique occurrances.\n\n"); + outfile.write("============================================================\n\n\n"); + + for (String stack : exceptionMap.values()) { + outfile.write(stack); + outfile.write("\n"); + } + + outfile.write("\n\nEnd of AccessControlException report."); + outfile.close(); + } catch (IOException e) { + Log.error(c, "run", e); + } + } + + /** + * Get a string of the relevant stack trace + */ + private void processACEStack(BufferedReader reader) throws IOException { + /* + * Example text to scan + * [begin] ("java.lang.RuntimePermission" "getClassLoader") + * Stack: + * java.security.AccessControlException: Access denied ("java.lang.RuntimePermission" "getClassLoader")java.security.AccessController.throwACE(AccessController.java:125) + * java.security.AccessController.checkPermission(AccessController.java:198) + * java.lang.SecurityManager.checkPermission(SecurityManager.java:563) + * com.ibm.ws.kernel.launch.internal.MissingDoPrivDetectionSecurityManager.checkPermission(MissingDoPrivDetectionSecurityManager.java:41) + * java.lang.Class.getClassLoader(Class.java:393) + * [end] com.ibm.wsspi.persistence.internal.PUInfoImpl.(PUInfoImpl.java:74) + * com.ibm.wsspi.persistence.internal.PersistenceServiceUnitImpl.(PersistenceServiceUnitImpl.java:65) + * com.ibm.wsspi.persistence.internal.PersistenceServiceImpl.createPersistenceServiceUnit(PersistenceServiceImpl.java:60) + * com.ibm.wsspi.persistence.internal.DatabaseStoreImpl.createPersistenceServiceUnit(DatabaseStoreImpl.java:290) + * com.ibm.ws.concurrent.persistent.db.DatabaseTaskStore.getPersistenceServiceUnit(DatabaseTaskStore.java:718) + * com.ibm.ws.concurrent.persistent.db.DatabaseTaskStore.findOrCreate(DatabaseTaskStore.java:465) + * com.ibm.ws.concurrent.persistent.internal.PersistentExecutorImpl.getPartitionId(PersistentExecutorImpl.java:774) + * com.ibm.ws.concurrent.persistent.internal.PersistentExecutorImpl.newTask(PersistentExecutorImpl.java:1064) + * com.ibm.ws.concurrent.persistent.internal.PersistentExecutorImpl.schedule(PersistentExecutorImpl.java:1419) + * web.PersistentDemoServlet.doGet(PersistentDemoServlet.java:63) + * javax.servlet.http.HttpServlet.service(HttpServlet.java:687) + * javax.servlet.http.HttpServlet.service(HttpServlet.java:790) + */ + // We want to capture from the [begin] to [end], and use the [end] line as the unique key + + final String m = "processACEStack"; + + StringBuffer sb = new StringBuffer(); + String line; + while ((line = reader.readLine()) != null && !line.isEmpty()) { + sb.append(line).append('\n'); + if (DEBUG) + Log.info(c, m, "Process line:" + line); + if (IBM_STACK.matcher(line).matches() && !line.startsWith("com.ibm.ws.kernel.launch.internal.MissingDoPrivDetectionSecurityManager")) { + if (DEBUG) + Log.info(c, m, "Found WebSphere stack: " + line); + // found the last relevant line in the stack + if (!exceptionMap.containsKey(line)) { + if (DEBUG) + Log.info(c, m, "Found new exception: " + line); + // we have not seen this exception before, so add it to the map + String exceptionKey = line; + for (int i = 0; i < WS_STACK_DEPTH && (line = reader.readLine()) != null; i++) + sb.append(line).append('\n'); + exceptionMap.put(exceptionKey, sb.toString()); + } + totalACECount++; + return; + } + } + if (DEBUG) + Log.info(c, m, "exit"); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/FatLogHandler.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/FatLogHandler.java new file mode 100755 index 000000000000..db549a47e76d --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/FatLogHandler.java @@ -0,0 +1,330 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util; + +import java.io.File; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Pattern; + +import org.junit.rules.ExternalResource; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +/** + *

    Encapsulates a {@link LogHandler} to handle logs for FATs.

    + *

    When a member variable is annotated {@link org.junit.Rule}, JUnit invokes {@link #before()} before any method annotated {@link org.junit.Before}, and {@link #after()} after + * any method annotated {@link org.junit.After}.

    + *

    Similarly, when a static variable is annotated {@link org.junit.ClassRule}, JUnit invokes {@link #before()} before any method annotated {@link org.junit.BeforeClass}, and + * {@link #after()} after any method annotated {@link org.junit.AfterClass}.

    + *

    Note that JUnit invokes {@link #apply(Statement, Description)} before {@link #before()}.

    + * + * @see #createLogDirectory(Description) + * @author Tim Burns + */ +public class FatLogHandler extends ExternalResource { + + private final static Logger LOG = Logger.getLogger(FatLogHandler.class.getName()); + + /** + * Most users expect FAT buckets to have an output.txt file in the results directory. + * This method generates an output.txt file that explains how to find the real test logs. + */ + public static void generateHelpFile() { + if (!LOG.isLoggable(Level.INFO)) { + return; + } + LogHandler handler = new LogHandler(); + Props props = Props.getInstance(); + handler.enable(props.getFileProperty(Props.DIR_LOG)); + String parent = props.getProperty(Props.LOGGING_DIRS_PARENT); + String delimiter = props.getProperty(Props.LOGGING_BREAK_LARGE); + LOG.info(delimiter); + LOG.info("Hi there! If you're debugging a test failure, you should check out the log files found in the '" + parent + "' directory."); + LOG.info(delimiter); + LOG.info("How do I find test logs?"); + LOG.info(" (1) Start by finding the results/" + parent + " directory"); + LOG.info(" (2) Each test class has its own directory; let's call that a \"test fixture.\""); + LOG.info(" (3) Test fixtures are ordered by the order they were executed."); + LOG.info(" (4) Each test fixture has two logs: output.txt and trace.txt."); + LOG.info(" (5) output.txt contains INFO and above log records from all encapsulated test cases, and trace.txt contains ALL log records."); + LOG.info(" (6) Inside each test fixture, you'll find one directory for each encapsulated test case."); + LOG.info(" (7) Test cases are ordered by the order they were executed."); + LOG.info(" (8) Each test case has its own output.txt and trace.txt file; they only contain log records from that specific test."); + LOG.info(" (9) You might find additional files inside each test directory, such as request/response information for HTTP requests."); + LOG.info(" (10) Have fun!"); + LOG.info("What else can you tell me?"); + props.collectVersionInformation().log(Level.INFO, " ", true); + LOG.info(delimiter); + handler.disable(); + } + + /** zero or more characters matching [a-zA-Z_0-9\\.]. The '-' character is not allowed! */ + protected final static Pattern WORD_CHARACTERS = Pattern.compile("[\\w\\.]*"); + + /** + *

    + * Searches a directory for file names matching a numeric prefix, and + * returns a new File instance representing a new (unique) file in that + * directory. Successive calls to this method for the same directory and + * prefix will produce an ordered list of child files. For example: + * prefix01_nameA, prefix02_nameB, prefix03_nameC, prefix04_nameC, etc. Note + * that the returned File will not yet exist on the file system. + *

    + *

    + * This method is not thread-safe. + *

    + * + * @param parent + * the directory where you want to create a new file + * @param prefix + * an optional String that proceeds ordering information. All + * characters must match: [a-zA-Z_0-9\\.] + * @param digits + * the number of digits to use for generated identifiers + * @param name + * the name of the desired file, without any numeric identifier. + * All characters must match: [a-zA-Z_0-9\\.] + * @return a new File representing a unique child of the parent + * @throws IllegalArgumentException + * if input arguments are invalid + */ + protected File createOrderedFileInDirectory(File parent, String prefix, int digits, String name) throws IllegalArgumentException { + if (parent == null) { + throw new IllegalArgumentException("Can't create a file in a directory that doesn't exist: " + parent); + } + String[] children = parent.list(); + if (children == null) { + // throw new IllegalArgumentException("The parent does not denote a directory: "+parent); + children = new String[0]; // instead of requiring the parent to exist, treat it as an empty directory + } + if (!WORD_CHARACTERS.matcher(name).matches()) { // if the file name contains a non-word character + throw new IllegalArgumentException("Invalid characters detected in proposed file name: " + name); + } + int prefixLength = 0; + if (prefix != null) { + if (!WORD_CHARACTERS.matcher(prefix).matches()) { // if the file name contains a non-word character + throw new IllegalArgumentException("Invalid characters detected in file prefix: " + prefix); + } + prefixLength = prefix.length(); + } + long highest = 0; + for (String child : children) { + if (child == null) { + continue; // ignore children with a null name + } + int dashIndex = child.indexOf("-"); + if (dashIndex < 0) { + continue; // ignore children without a dash in their name + } + if (prefixLength > 0 && !child.startsWith(prefix)) { + continue; // ignore children missing our prefix in their name + } + String numberString = child.substring(prefixLength, dashIndex); + long number = Long.parseLong(numberString); + if (number > highest) { + highest = number; + } + } + StringBuilder newName = new StringBuilder(); + if (prefixLength > 0) { + newName.append(prefix); + } + newName.append(this.zeroPad(highest + 1, digits)); + newName.append("-"); + newName.append(name); + return new File(parent, newName.toString()); + } + + /** + * Prepends zeros to the left of the input number to ensure that the input + * number is a total of width digits. Truncates the input + * number if it has more than width digits. + * + * @param number + * a positive integer (negative integers cause problems with odd + * widths) + * @param width + * the number of characters that you want in a String + * representation of number; must be a positive + * integer smaller than 18 (larger numbers cause an overflow + * issue) + * @return a zero-padded String representation of the input number + */ + protected String zeroPad(long number, int width) { + long n = Math.abs(number); + long w = width; + if (w < 0) { + w = 0; + } else if (w > 18) { + w = 18; + } + long wrapAt = (long) Math.pow(10, w); + return String.valueOf(n % wrapAt + wrapAt).substring(1); + } + + private File logDirectory; + private LogHandler logHandler; + private FatLogHandler parent; + private String description; + private StopWatch timer; + + /** + * @return the encapsulated {@link LogHandler} + */ + public LogHandler getLogHandler() { + return this.logHandler; + } + + /** + * @param logHandler the {@link LogHandler} to encapsulate; null indicates that no log files should be created. + * @return this instance + */ + public FatLogHandler setLogHandler(LogHandler logHandler) { + this.logHandler = logHandler; + return this; + } + + /** + * @return the parent FatLogHandler, or null if no parent exists + */ + public FatLogHandler getParent() { + return this.parent; + } + + /** + * @param parent the parent FatLogHandler, or null if no parent exists + * @return this instance + */ + public FatLogHandler setParent(FatLogHandler parent) { + this.parent = parent; + return this; + } + + /** + * @return the directory where this instance will log results, or null if results will not be logged + */ + public File getLogDirectory() { + return this.logDirectory; + } + + @Override + public Statement apply(Statement base, Description description) { + this.description = description == null ? null : description.toString(); + this.logDirectory = this.createLogDirectory(description); + if (this.logDirectory == null) { + LOG.warning("Failed to create a log directory for: " + this.description); + } else { + LOG.info("Created log directory: " + this.logDirectory + " for " + this.description); + } + return super.apply(base, description); + } + + /** + * Defines the directory where logs will be stored for the current test fixture / test case + * + * @param description the test fixture currently being applied + * @return the directory where results from this test fixture should be logged, or null if no valid directory could be found + */ + protected File createLogDirectory(Description description) { + if (description == null) { + LOG.warning("Cannot create log directory because test case description from JUnit is null"); + return null; + } + Props props = Props.getInstance(); + File parentLogDir = this.parent == null ? null : this.parent.getLogDirectory(); + if (parentLogDir == null) { + File fatLogDir = props.getFileProperty(Props.DIR_LOG); + parentLogDir = new File(fatLogDir, props.getProperty(Props.LOGGING_DIRS_PARENT)); + } + String suffix = null; + String testMethodName = description.getMethodName(); + if (testMethodName == null) { + testMethodName = ""; + } else { + testMethodName = testMethodName.trim(); + } + if (testMethodName.isEmpty()) { + this.timer = new StopWatch(); + suffix = description.getClassName(); + if (suffix == null) { + LOG.warning("Cannot create log directory because test class name is null"); + return null; + } + suffix = suffix.trim(); + if (suffix.isEmpty()) { + LOG.warning("Cannot create log directory because test class name is empty"); + return null; + } + if (!props.getBooleanProperty(Props.LOGGING_DIRS_FULLNAME)) { + // determine simple class name, and avoid ArrayIndexOutOfBoundsException + int afterLastDot = suffix.lastIndexOf(".") + 1; + if (afterLastDot > -1 && afterLastDot < suffix.length()) { + suffix = suffix.substring(afterLastDot); + } + } + } else { + this.timer = null; // reset state in case this handler is reused + suffix = testMethodName; + } + String prefix = props.getProperty(Props.LOGGING_DIRS_PREFIX); + int digits = props.getIntProperty(Props.LOGGING_DIRS_DIGITS); + parentLogDir.mkdirs(); // parent directory must exist in order to examine it + File directory; + try { + directory = this.createOrderedFileInDirectory(parentLogDir, prefix, digits, suffix); + } catch (IllegalArgumentException e) { + LOG.warning("Cannot create log directory: " + e.getMessage()); + return null; + } + if (directory.exists()) { + if (!directory.isDirectory()) { + LOG.warning("Cannot create log directory because a weird file is already there; can't use it as a directory: " + directory); + return null; + } + } else { + directory.mkdirs(); + } + return directory; + } + + @Override + protected void before() { + LogHandler handler = this.getLogHandler(); + File directory = this.getLogDirectory(); + if (handler != null && directory != null) { + LOG.info("Activating log handlers for: " + directory); + handler.enable(directory); // null directory is ignored + } else { + LOG.info("Log handlers for " + directory + " will NOT be created. Handler: " + handler); + } + if (this.timer != null) { + this.timer.start(); + } + } + + @Override + protected void after() { + if (this.timer != null) { + this.timer.stop(); + LOG.info("Completed " + this.description + " after " + this.timer.getTimeElapsedAsString()); + } + LogHandler handler = this.getLogHandler(); + if (handler != null) { + LOG.info("Deactivating log handlers for " + this.getLogDirectory()); + handler.disable(); + } else { + LOG.info("Log handlers for " + this.getLogDirectory() + " will NOT be deactivated. Handler: " + handler); + } + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/FatWatcher.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/FatWatcher.java new file mode 100755 index 000000000000..5bbb2ca75963 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/FatWatcher.java @@ -0,0 +1,102 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.junit.Rule; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; + +/** + *

    It watches your FAT. lol!

    + *

    But seriously, you need to annotate a public member variable of your test class with {@link Rule} to to use this watcher. It logs extra messages to distinguish test A from + * test B.

    + * + * @author Tim Burns + */ +public class FatWatcher extends TestWatcher { + + private static Logger LOG = Logger.getLogger(FatWatcher.class.getName()); + + private final StopWatch timer = new StopWatch(); + private Boolean passed; + + @Override + public void starting(Description description) { + String delimiter = Props.getInstance().getProperty(Props.LOGGING_BREAK_LARGE); + if (delimiter != null) { + LOG.info(delimiter); + } + LOG.info("Starting Test: " + description); + if (delimiter != null) { + LOG.info(delimiter); + } + this.passed = null; + this.timer.start(); + } + + @Override + public void failed(Throwable t, Description description) { + LOG.log(Level.WARNING, "Test Failure Details ...", t); + this.passed = Boolean.FALSE; + } + + @Override + public void succeeded(Description description) { + this.passed = Boolean.TRUE; + } + + /** + * Indicates whether the current test passed, failed, or did not finish. + * + * @return true if the test passed, false if it failed, or null if it didn't finish yet + */ + public Boolean passed() { + return this.passed; + } + + /** + * Describes the current test status as a human-readable string. + * + * @return "PASSED", "FAILED", or "DID NOT FINISH" + */ + public String getStatus() { + if (Boolean.TRUE.equals(this.passed)) { + return "PASSED"; + } + if (Boolean.FALSE.equals(this.passed)) { + return "FAILED"; + } + return "DID NOT FINISH"; + } + + @Override + public void finished(Description description) { + this.timer.stop(); + String delimiter = Props.getInstance().getProperty(Props.LOGGING_BREAK_LARGE); + if (delimiter != null) { + LOG.info(delimiter); + } + LOG.info("Finishing Test: " + description); + if (delimiter != null) { + LOG.info(delimiter); + } + LOG.info("Test Result : " + this.getStatus()); + LOG.info("Time Elapsed : " + this.timer.getTimeElapsedAsString()); + if (delimiter != null) { + LOG.info(delimiter); + } + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/LogHandler.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/LogHandler.java new file mode 100755 index 000000000000..13efb9e89959 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/LogHandler.java @@ -0,0 +1,182 @@ +package com.ibm.ws.fat.util; + +import java.io.File; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import java.util.logging.FileHandler; +import java.util.logging.Formatter; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ibm.tivoli.remoteaccess.BaseProtocol; +import com.ibm.tivoli.remoteaccess.log.JreLogAdapter; + +/** + *

    + * Helper class for tracking RXA, Simplicity, and FAT trace. Loading this + * class automatically configures RXA to start using the JRE Logger. + *

    + *

    + * By default, the enable() method enables two log files: one + * that publishes all messages at the INFO level, and another that publishes all + * messages at any level. The createHandlers() method can + * be overridden by subclasses to redefine the specific FileHandler instances + * constructed and cached by this instance. + *

    + *

    + * Errors encountered while handling log files are considered warnings, and no + * exceptions are thrown. Instead, messages are printed to + * System.out to warn the user about unexpected log behavior. + * (Failures of this nature are uncommon). + *

    + * + * @author Tim Burns + */ +public class LogHandler { + + /** + * Arbitrary package name used to define RXA logger. It happens to match the + * actual package name used in the Java implementation. This logger name + * should be used to control RXA log messages. + */ + public static final String RXA_LOGGER_NAME = "com.ibm.tivoli.remoteaccess"; + + static { + try { + // RXA does not use JRE Logger by default; it must be enabled like this + Logger.getLogger(RXA_LOGGER_NAME); // NOTE: this line needs to be here for some reason + JreLogAdapter logAdapter = JreLogAdapter.getLogger(RXA_LOGGER_NAME); + BaseProtocol.setLogger(logAdapter); + BaseProtocol.startLogging(); + // set these logging levels in logging.properties + // Logger.getLogger("com.ibm.websphere.simplicity").setLevel(Level.FINEST); + // Logger.getLogger("com.ibm.websphere.jiiws").setLevel(Level.FINE); + // Logger.getLogger(RXA_LOGGER_NAME).setLevel(Level.FINEST); + } catch (Throwable t) { + System.out.println("Failed to initialize RXA log handler!"); + t.printStackTrace(System.out); + } + } + + protected Set handlers; + + /** + * Creates a new set of log handlers. + * + * @param directory + * the directory where you want to store log files. + * @return a set of new Handler instances. never returns null. + * @throws IOException + * if any handler can't be constructed + */ + protected Set createHandlers(File directory) throws IOException { + HashSet handlers = new HashSet(); + Formatter formatter = this.createFormatter(); + + FileHandler outputHandler = new FileHandler(new File(directory, "output.txt").getAbsolutePath()); + outputHandler.setFormatter(formatter); + outputHandler.setLevel(Level.INFO); + handlers.add(outputHandler); + + FileHandler traceHandler = new FileHandler(new File(directory, "trace.txt").getAbsolutePath()); + traceHandler.setFormatter(formatter); + traceHandler.setLevel(Level.ALL); + handlers.add(traceHandler); + + return handlers; + } + + /** + * Creates a new log formatter. + * + * @return a new Formatter instance + */ + protected Formatter createFormatter() { + GenericFormatter formatter = new GenericFormatter(); + formatter.setLogClassName(true); + formatter.setLogFullClass(false); + formatter.setClassLength(30); + formatter.setLogLevel(true); + formatter.setLogMethodName(true); + formatter.setMethodLength(30); + formatter.setLogThreadId(true); + formatter.setThreadIdLength(3); + formatter.setLogTimeStamp(true); + return formatter; + } + + /** + * Creates the local logging directory, creates logging handlers, and adds + * all handlers to the parent logger. These handlers are cached until the + * next time disable() is called. If enable() is + * called again before disable(), then disable() + * will automatically be called. + * + * @param directory + * the directory where you want to store log files. If the + * directory does not currently exist, it will be created. null + * indicates that no log files should be created. + */ + public void enable(File directory) { + if (this.handlers != null) { + this.disable(); + } + if (directory == null) { + return; + } + try { + directory.mkdirs(); + Logger logger = Logger.getLogger(""); // get the parent logger + Set handlers = this.createHandlers(directory); + for (Handler handler : handlers) { + logger.addHandler(handler); + } + this.handlers = handlers; + } catch (Throwable e) { + System.out.println("Failed to enable log handlers!"); + e.printStackTrace(System.out); + } + } + + /** + * Removes all cached handlers from the parent logger, and closes all cached + * handlers. + */ + public void disable() { + if (this.handlers == null) { + return; // nothing to do + } + try { + Logger logger = Logger.getLogger(""); // get the parent logger + for (FileHandler handler : this.handlers) { + logger.removeHandler(handler); + this.closeHandler(handler); + } + } catch (Throwable e) { + System.out.println("Failed to disable log handlers!"); + e.printStackTrace(System.out); + } + this.handlers.clear(); + this.handlers = null; + } + + /** + * Flushes and closes a specific logging handler + * + * @param handler + * the handler to disable + * @throws NullPointerException + * if handler is null + */ + protected void closeHandler(FileHandler handler) throws NullPointerException { + try { + handler.close(); // JDK bug ID 4775533: despite calling close(), a .lck file is left behind on Java 1.4.x + } catch (Throwable e) { + System.out.println("Failed to close a log handler!"); + e.printStackTrace(System.out); + } + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/LoggingTest.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/LoggingTest.java new file mode 100755 index 000000000000..4a8a3b5d2c42 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/LoggingTest.java @@ -0,0 +1,131 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util; + +import java.io.File; + +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.rules.TestWatcher; + +import com.ibm.ws.fat.util.browser.WebBrowser; +import com.ibm.ws.fat.util.browser.WebBrowserFactory; +import com.ibm.ws.fat.util.browser.WebResponse; + +/** + *

    A test that stores messages logged during execution to special directories and files.

    + *

    Instances of this class should not be run in parallel. If they are, weird things will happen with log files.

    + * + * @author Tim Burns + */ +public abstract class LoggingTest { + + /** Prints extra messages to the log to distinguish test A from test B. JUnit requires this variable to be public. */ + @Rule + public final TestWatcher watchman = new FatWatcher(); + + /** JUnit requires this variable to be public. Generally, nothing but the declaring class should use it outside of JUnit. */ + @ClassRule + public static FatLogHandler TEST_FIXTURE_LOG_HANDLER = new FatLogHandler().setLogHandler(new LogHandler()); + + /** JUnit requires this variable to be public. Generally, nothing but the declaring class should use it outside of JUnit. */ + @Rule + public FatLogHandler testCaseLogHandler = new FatLogHandler().setLogHandler(new LogHandler()).setParent(TEST_FIXTURE_LOG_HANDLER); + + /** + *

    Retrieves the unique directory where log information will be stored for this test fixture.

    + *

    Use this method when you need to store debug information that's applicable to multiple tests. If you need to store debug information that's only applicable to the current + * test, use {@link #getTestCaseLogDirectory()} instead.

    + * + * @return the unique directory where log information will be stored for this test fixture + */ + protected File getTestFixtureLogDirectory() { + return TEST_FIXTURE_LOG_HANDLER.getLogDirectory(); + } + + /** + *

    Retrieves the unique directory where log information will be stored for this test case.

    + *

    Use this method when you need to store debug information that's only applicable to the current test. If you need to store debug information that's applicable to multiple + * tests, use {@link #getTestFixtureLogDirectory()} instead.

    + * + * @return the unique directory where log information will be stored for this test case + */ + protected File getTestCaseLogDirectory() { + return testCaseLogHandler.getLogDirectory(); + } + + /** + *

    Creates a new {@link WebBrowser} instance for this test case.

    + *

    The first request from this instance will establish a new HttpSession, and response information will be stored in the test case log directory.

    + *

    Use this method when you only need to access the same {@link WebBrowser} within a single test case. If you need to reuse the same {@link WebBrowser} with multiple tests, + * use {@link #createWebBrowserForTestFixture()} instead.

    + * + * @return a new {@link WebBrowser} instance for this test case + */ + protected WebBrowser createWebBrowserForTestCase() { + return WebBrowserFactory.getInstance().createWebBrowser(getTestCaseLogDirectory()); + } + + /** + *

    Creates a new WebBrowser instance for this test fixture.

    + *

    The first request from this instance will establish a new HttpSession, and response information will be stored in the test fixture log directory.

    + *

    Use this method when you need to reuse the same {@link WebBrowser} with multiple tests. If you only need to access the same {@link WebBrowser} within a single test + * case, use {@link #createWebBrowserForTestCase()} instead.

    + * + * @return a new WebBrowser instance for this test case + */ + protected WebBrowser createWebBrowserForTestFixture() { + return WebBrowserFactory.getInstance().createWebBrowser(this.getTestFixtureLogDirectory()); + } + + abstract protected SharedServer getSharedServer(); + + protected final WebResponse verifyResponse(String resource, String expectedResponse) throws Exception { + return verifyResponse(createWebBrowserForTestCase(), resource, expectedResponse); + } + + protected final WebResponse verifyResponse(String resource, String expectedResponse, int numberToMatch, String extraMatch) throws Exception { + return verifyResponse(createWebBrowserForTestCase(), resource, expectedResponse, numberToMatch, extraMatch); + } + + protected final WebResponse verifyResponse(String resource, String[] expectedResponses, String[] unexpectedResponses) throws Exception { + return verifyResponse(createWebBrowserForTestCase(), resource, expectedResponses, unexpectedResponses); + } + + protected final WebResponse verifyResponse(String resource, String... expectedResponses) throws Exception { + return verifyResponse(createWebBrowserForTestCase(), resource, expectedResponses); + } + + protected final WebResponse verifyResponse(WebBrowser wb, String resource, String expectedResponse) throws Exception { + return getSharedServer().verifyResponse(wb, resource, expectedResponse); + } + + protected final WebResponse verifyResponse(WebBrowser wb, String resource, String expectedResponse, int numberToMatch, String extraMatch) throws Exception { + return getSharedServer().verifyResponse(wb, resource, expectedResponse, numberToMatch, extraMatch); + } + + protected final WebResponse verifyResponse(WebBrowser wb, String resource, String[] expectedResponses, String[] unexpectedResponses) throws Exception { + return getSharedServer().verifyResponse(wb, resource, expectedResponses, unexpectedResponses); + } + + protected final WebResponse verifyResponse(WebBrowser wb, String resource, String[] expectedResponses) throws Exception { + return getSharedServer().verifyResponse(wb, resource, expectedResponses); + } + + protected final void verifyStatusCode(String resource, int expectedStatus) throws Exception { + verifyStatusCode(createWebBrowserForTestCase(), resource, expectedStatus); + } + + protected final void verifyStatusCode(WebBrowser wb, String resource, int expectedStatus) throws Exception { + getSharedServer().verifyStatusCode(wb, resource, expectedStatus); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/PropertyMap.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/PropertyMap.java new file mode 100755 index 000000000000..5921a76fe86b --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/PropertyMap.java @@ -0,0 +1,140 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util; + +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Pattern; + +/** + * Helps you log a map of properties. + * + * @author Tim Burns + */ +public class PropertyMap { + + private static final Pattern LINE_SEPS = Pattern.compile("[\n\r]"); + private static final Logger LOG = Logger.getLogger(PropertyMap.class.getName()); + + private final Map map = new LinkedHashMap(); + + /** + * Maps a property key to a value + * + * @param key property key, null is allowed + * @param value property value, null is allowed + */ + public void put(String key, T value) { + this.map.put(key, value); + } + + /** + * Maps a property key to an array of values; a unique number is used as a suffix on each individual key. + * + * @param key property key, null is allowed + * @param values property values, null array and null values are allowed + */ + public void put(String key, T[] values) { + if (values != null) { + for (int i = 0; i < values.length; i++) { + this.map.put(key + " " + (i + 1), values[i]); + } + } + } + + /** + * Maps a property key to an array of values; a unique number is used as a suffix on each individual key. + * + * @param key property key, null is allowed + * @param values property values, null array and null values are allowed + */ + public void put(String key, Collection values) { + if (values != null) { + int i = 0; + for (T value : values) { + this.map.put(key + " " + (++i), value); + } + } + } + + /** + * Prints the encapsulated map of key/value pairs at the INFO level. The + * log messages are formatted so that keys and values appear in distinct + * columns. Assumes that the log formatter prints each log entry to a single line. + * + * @param level + * the Logger level to use + * @param prefix + * a String that prefixes all messages logged by this method + * @param alphabetize + * true to alphabetize the list by key, false to use the input order + */ + public void log(Level level, String prefix, boolean alphabetize) { + if (!LOG.isLoggable(level)) { + return; + } + if (this.map == null) { + return; + } + TreeSet keys = new TreeSet(this.map.keySet()); // alphabetize keys + int length = maxLength(keys) + 2; // leave one character for a colon, and one character for some space between keys and values + String p = (prefix == null) ? "" : prefix; + String format = "%1$-" + length + "s %2$-1s"; + for (String key : keys) { + if (key == null) { + continue; + } + Object value = this.map.get(key); + String v = (value == null) ? "(null)" : value.toString().trim(); + String[] parts = LINE_SEPS.split(v); + String k = key.trim() + ":"; // having the colon on the end of the key looks better than having it in the middle + for (int i = 0; i < parts.length; i++) { + if (parts[i].length() > 0) { // ignore lines with no data + LOG.log(level, p + String.format(format, k, parts[i])); + k = ""; // only print the key once + } + } + } + } + + /** + * Calculates the length of the longest trimmed String in the input Set + * + * @param set + * the set of strings you want to inspect + * @return the length of the longest trimmed String in the input Set, or -1 + * if the input Set is null, or -2 if every item in the Set is null + */ + protected int maxLength(Set set) { + if (set == null) { + return -1; + } + int maxLength = -2; + for (String item : set) { + if (item == null) { + continue; + } + String k = item.trim(); + int length = k.length(); + if (length > maxLength) { + maxLength = length; + } + } + return maxLength; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/Props.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/Props.java new file mode 100755 index 000000000000..4886e82a0686 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/Props.java @@ -0,0 +1,463 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util; + +import java.io.File; +import java.io.FileInputStream; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ibm.tivoli.remoteaccess.BaseProtocol; +import com.ibm.websphere.simplicity.Topology; + +/** + *

    + * Use this class to access the values of properties defined in + * bootstrapping.properties, configuration.properties, properties.xml, and the + * command line. Additional properties can also be set dynamically. Reading + * properties through this object guarantees that the returned properties are + * non-null. + *

    + * The junit task from this Ant project should propagate system properties to the JVM through a local.properties file:
    + * /fattest.simplicity/autoFVT-defaults/src/ant/launch.xml + *

    + * If that file changes, then instances of this class might return bizarre results. + *

    + * This class also contains several statically defined property keys that can be + * used to reference all of the known properties. Referencing properties using + * the statically defined keys is good for three reasons: + *

      + *
    • makes it easy to locate all references to a specific property through Eclipse (good for debugging problems related to those properties).
    • + *
    • You avoid syntax errors related to specifying invalid property keys in various places in your code. You also don't need to worry about updating property keys.
    • + *
    • You only construct the String for each frequently-referenced property key once
    • + *
    + *

    + */ +public class Props { + + private static final Logger LOG = Logger.getLogger(Props.class.getName()); + + /*- Property keys defined by the command line -*/ + + /*- Property keys from properties.xml -*/ + /** + * The path to the root of this test component. Defined in properties.xml. + */ + public static final String DIR_COMPONENT_ROOT = "dir.component.root"; + /** + * The path to this test component's result directory, typically:
    + * ${component_Root_Directory}/results.
    + * Defined in properties.xml. + */ + public static final String DIR_LOG = "dir.log"; + + /*- Property keys from TestBuild.xml and launch.xml -*/ + /** + * The path to Moonstone's bootstrapping properties file. This file is + * provided by the user (in a sandbox test environment), or by the Moonstone + * infrastructure in an Aphid run or a Rapid Regression run. Defined in + * launch.xml. + */ + public static final String BOOTSTRAPPING_PROPERTIES = "bootstrapping.properties"; + /** + * The path to Simplicity's configuration file. This file is generated by + * launch.xml using configuration.properties. Defined in launch.xml. + */ + public static final String SIMPLICITY_PROPERTIES = "simplicity.properties"; + /** + * The path to this test bucket's configuration file. Defined in launch.xml. + */ + public static final String CONFIGURATION_PROPERTIES = "configuration.properties"; + /** + * The path to this test bucket's Java Logging properties file. This file is + * used to control the of trace levels printed by this component (and + * dependent APIs) during runtime. Defined and referenced in launch.xml. + */ + public static final String LOGGING_PROPERTIES = "logging.properties"; + /** + * The path to this test bucket's local properties file. This file is + * generated by launch.xml, and contains all the properties found in + * boostrapping.properties, configuration.properties, properties.xml, and + * launch.xml. Defined in launch.xml. + */ + public static final String LOCAL_PROPERTIES = "local.properties"; + + /*- Property keys from configuration.properties -*/ + /** + * Separator characters used to distinguish related blocks of output in test + * bucket trace files. Small logging breaks are typically encapsulated by + * larger logging breaks. Defined in configuration.properties. + */ + public static final String LOGGING_BREAK_LARGE = "logging.break.large"; + /** + * Separator characters used to distinguish related blocks of output in test + * bucket trace files. Small logging breaks are typically encapsulated by + * larger logging breaks. Defined in configuration.properties. + */ + public static final String LOGGING_BREAK_MEDIUM = "logging.break.medium"; + /** + * Separator characters used to distinguish related blocks of output in test + * bucket trace files. Small logging breaks are typically encapsulated by + * larger logging breaks. Defined in configuration.properties. + */ + public static final String LOGGING_BREAK_SMALL = "logging.break.small"; + /** + * The parent directory of all test case logs, relative to the dir.log directory specified by properties.xml + */ + public static final String LOGGING_DIRS_PARENT = "logging.dirs.parent"; + /** + * The prefix to use when creating directory names
    + * All characters must match: [a-zA-Z_0-9\\.]
    + * Specify the empty string to skip the prefix
    + * Recommended: Either "" or "Step"
    + * Only used if ${logging.dirs.enable}=true + */ + public static final String LOGGING_DIRS_PREFIX = "logging.dirs.prefix"; + /** + * The number of digits to use in the unique identifier for directory names
    + * Only used if ${logging.dirs.enable}=true + */ + public static final String LOGGING_DIRS_DIGITS = "logging.dirs.digits"; + /** + * true to include package information in each directory name;
    + * false to use simple class names only
    + * Only used if ${logging.dirs.enable}=true + */ + public static final String LOGGING_DIRS_FULLNAME = "logging.dirs.fullname"; + + /*- Property keys set in the local System (and redundantly Props.java) -*/ + /** + * Java System property for the local JVM's file separator character. + * Defined in the local System (and redundantly Props.java). + */ + public static final String LOCAL_FILE_SEPARATOR = "file.separator"; + /** + * Java System property for the local JVM's path separator character. + * Defined in the local System (and redundantly Props.java). + */ + public static final String LOCAL_PATH_SEPARATOR = "path.separator"; + /** + * Java System property for the local JVM's line separator character. + * Defined in the local System (and redundantly Props.java). + */ + public static final String LOCAL_LINE_SEPARATOR = "line.separator"; + + /*- Property keys set by Props.java -*/ + + public static Props INSTANCE; + + /** + * @return a global instance of this class that caches all properties from local.properties + */ + public static Props getInstance() { + if (INSTANCE == null) { + setInstance(new Props()); + } + return INSTANCE; + } + + /** + * Configures the global properties instance. Subclasses should call this method before any properties are read. + * + * @param props the global properties instance to use + */ + public static void setInstance(Props props) { + INSTANCE = props; + } + + /*- local variables -*/ + private final Properties properties = new Properties(); + private final String defaultValue = ""; + + /** + * Use the global instance exposed by {@link #getInstance()} + */ + protected Props() { + this.reloadProperties(); + this.printPropertyInformation(); + } + + /** + * Load properties from local.properties (generated by launch.xml). Probably + * only need to do this once during initialization. + */ + public void reloadProperties() { + if (LOG.isLoggable(Level.INFO)) { + LOG.log(Level.INFO, "Initializing FAT Bucket Properties ..."); + LOG.log(Level.INFO, "System property used to locate the local properties file: " + LOCAL_PROPERTIES); + } + String propsFileName = System.getProperty(LOCAL_PROPERTIES); + try { + this.properties.load(new FileInputStream(propsFileName.trim())); + } catch (Exception e) { + if (LOG.isLoggable(Level.WARNING)) { + LOG.log(Level.WARNING, "Unable to initialize properties", e); + } + } + } + + /** + * Log essential test bucket information regarding assumptions and input properties. + */ + public void printPropertyInformation() { + if (LOG.isLoggable(Level.INFO)) { + LOG.log(Level.INFO, "Common Directories: "); + LOG.log(Level.INFO, "Root Directory - " + this.getFileProperty(DIR_COMPONENT_ROOT).getAbsolutePath()); + LOG.log(Level.INFO, "Result Directory - " + this.getFileProperty(DIR_LOG).getAbsolutePath()); + LOG.log(Level.INFO, "User-input properties files: "); + LOG.log(Level.INFO, "Bootstrapping Properties - " + this.getFileProperty(BOOTSTRAPPING_PROPERTIES).getAbsolutePath()); + LOG.log(Level.INFO, "Configuration Properties - " + this.getFileProperty(CONFIGURATION_PROPERTIES).getAbsolutePath()); + LOG.log(Level.INFO, "Logging Properties - " + this.getFileProperty(LOGGING_PROPERTIES).getAbsolutePath()); + LOG.log(Level.INFO, "Generated properties files: "); + LOG.log(Level.INFO, "Local Properties - " + this.getFileProperty(LOCAL_PROPERTIES).getAbsolutePath()); + LOG.log(Level.INFO, "Simplicity Properties - " + this.getFileProperty(SIMPLICITY_PROPERTIES).getAbsolutePath()); + } + } + + /** + * Retrieves a list of useful system properties that describe a JRE + * + * @return a list of interesting Java property keys + */ + protected String[] getJavaPropertyKeys() { + return new String[] { + "os.name", + "os.version", + "os.arch", + "user.name", + "user.home", + "user.dir", + "java.home", + "java.version", + "java.fullversion", + "java.jcl.version", + "java.vendor", + "java.runtime.name", + "java.runtime.version", + "java.vm.name", + "java.vm.home", + "java.vm.version", + "java.vm.vendor", + "java.class.version", + "java.compiler", + "java.io.tmpdir" }; + } + + /** + * Collects information about the current version of Java and other + * dependencies. + * + * @return a map of key/value pairs that describe the current environment + */ + public PropertyMap collectVersionInformation() { + PropertyMap properties = new PropertyMap(); + for (String prop : this.getJavaPropertyKeys()) { + properties.put(prop, System.getProperty(prop)); + } + properties.put("simplicity.version", Topology.SIMPLICITY_VERSION); + // properties.put("jiiws.version", SessionManager.getVersion()); + properties.put("rxa.version", BaseProtocol.getRXAVersion()); + properties.put("rxa.build", BaseProtocol.getRXABuild()); + try { + properties.put("host.address", InetAddress.getLocalHost().getHostAddress()); + properties.put("host.name", InetAddress.getLocalHost().getHostName()); + properties.put("host.name.canonical", InetAddress.getLocalHost().getCanonicalHostName()); + } catch (UnknownHostException e) { + // it doesn't really matter; just don't print these properties + } + return properties; + } + + /** + * Determines whether or not a property is set. + * + * @param prop + * The key of the property you want to check for the existence of + * @return true if the input property is set + */ + public boolean isSet(String prop) { + if (prop == null) { + return false; + } + String value = this.properties.getProperty(prop); + return (value != null); + } + + /** + * Determines whether a property is set to a String composed of white-space + * characters. + * + * @param prop + * The key of the property you want to check + * @return true if the input property is set, but either contains spaces or + * is the empty String + */ + public boolean isSetToBlank(String prop) { + if (prop == null) { + return false; + } + String value = this.properties.getProperty(prop); + if (value == null) { + return false; + } + return (this.defaultValue.equals(value.trim())); + } + + /** + * Determines whether a property is set to a String composed of + * non-white-space characters. + * + * @param prop + * The key of the property you want to check + * @return true if the input property is set and is not blank + */ + public boolean isSetToText(String prop) { + if (prop == null) { + return false; + } + String value = this.properties.getProperty(prop); + if (value == null) { + return false; + } + return !(this.defaultValue.equals(value.trim())); + } + + /** + * Determine the value of a property as a String + * + * @param prop + * The key of the property you want to check + * @return The value of the input property + */ + public String getProperty(String prop) { + if (prop == null) { + return this.defaultValue; + } + return this.properties.getProperty(prop, this.defaultValue).trim(); + } + + /** + * Determine the value of a property as an int. + * + * @param prop + * The key of the property you want to check + * @return The value of the input property, or zero if the value of the + * property could not be parsed + */ + public int getIntProperty(String prop) { + String value = getProperty(prop); + try { + return Integer.parseInt(value); + } catch (Exception e) { + if (LOG.isLoggable(Level.FINE)) { + LOG.log(Level.FINE, "Encountered problems loading property: '" + prop + "'. Property found: '" + value + "'. Using default value of 0 instead", e); + } + return 0; + } + } + + /** + * Determine the value of a property as a boolean. The boolean + * returned represents the value true if the value of the + * property is not null and is equal, ignoring case, to the + * string "true".
    + *
    + * Example: Boolean.valueOf("True") returns true.
    + * Example: Boolean.valueOf("yes") returns false. + * + * @param prop + * The key of the property you want to check + * @return The value of the input property as a boolean + */ + public boolean getBooleanProperty(String prop) { + return Boolean.valueOf(getProperty(prop)).booleanValue(); + } + + /** + * Determine the value of a property as a File. Creates a new + * File instance by converting the value specified by the + * property key into an abstract pathname. If the given string is the empty + * string, then the result is the empty abstract pathname. + * + * @param prop + * The key of the property you want to check + * @return The value of the input property as a File + */ + public File getFileProperty(String prop) { + return new File(getProperty(prop)); + } + + /** + * Sets a property if the input key and value are not null. If either + * parameter is null, no property is set. + * + * @param prop + * The key of the property you want to set + * @param value + * The value of the property you want to set + */ + public void setProperty(String prop, String value) { + if (prop != null && value != null) { + this.properties.setProperty(prop, value); + } + } + + /** + * Sets an int property if the input key is not null. If the key is null, no + * property is set. + * + * @param prop + * The key of the property you want to set + * @param value + * The value of the property you want to set + */ + public void setIntProperty(String prop, int value) { + setProperty(prop, new Integer(value).toString()); + } + + /** + * Sets a boolean property if the input key is not null. If the key is null, + * no property is set. + * + * @param prop + * The key of the property you want to set + * @param value + * The value of the property you want to set + */ + public void setBooleanProperty(String prop, boolean value) { + setProperty(prop, new Boolean(value).toString()); + } + + /** + * Sets a File property if the input key and value are not null. If either + * parameter is null, no property is set. + * + * @param prop + * The key of the property you want to set + * @param file + * The value of the property you want to set + */ + public void setFileProperty(String prop, File file) { + if (file != null) { + try { + setProperty(prop, file.getCanonicalPath()); + } catch (Exception e) { + setProperty(prop, file.getAbsolutePath()); + } + } + // else, if the file is null, there's no property to set! + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/SharedServer.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/SharedServer.java new file mode 100755 index 000000000000..3c9a388beec9 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/SharedServer.java @@ -0,0 +1,376 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util; + +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.management.remote.JMXServiceURL; + +import junit.framework.Assert; + +import org.junit.rules.ExternalResource; + +import com.ibm.ws.fat.util.browser.WebBrowser; +import com.ibm.ws.fat.util.browser.WebBrowserException; +import com.ibm.ws.fat.util.browser.WebResponse; +import com.ibm.ws.fat.util.jmx.JmxException; +import com.ibm.ws.fat.util.jmx.JmxServiceUrlFactory; +import com.ibm.ws.fat.util.jmx.mbeans.ApplicationMBean; +import com.ibm.ws.fat.util.jmx.mbeans.PluginConfigMBean; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.impl.LibertyServerWrapper; + +/** + *

    Encapsulates a {@link LibertyServer} and provides helper methods. Automatically starts the server before the annotated test fixture starts.

    + *

    Consider migrating methods from this class to {@link LibertyServer}.

    + * + * @author Tim Burns + */ +@LibertyServerWrapper +public class SharedServer extends ExternalResource { + + private static final Logger LOG = Logger.getLogger(SharedServer.class.getName()); + + private final String serverName; + private final boolean waitForSecurity; + private LibertyServer server; + private String[] featuresToInstall = new String[] {}; + + /** + * Convenience constructor; assumes security is disabled + * + * @param serverName the name of the {@link LibertyServer} to encapsulate + */ + public SharedServer(String serverName) { + this(serverName, false); + } + + /** + * Convenience constructor; assumes security is disabled + * + * @param serverName the name of the {@link LibertyServer} to encapsulate + */ + public SharedServer(String serverName, String... featuresToInstall) { + this(serverName, false); + this.featuresToInstall = featuresToInstall; + + } + + /** + * Primary constructor + * + * @param serverName the name of the {@link LibertyServer} to encapsulate + * @param waitForSecurity true if the {@link #startIfNotStarted()} method should wait for security-related methods before proceeding + */ + public SharedServer(String serverName, boolean waitForSecurity) { + this.serverName = serverName; + this.waitForSecurity = waitForSecurity; + } + + @Override + protected void before() { + try { + this.startIfNotStarted(); + } catch (Exception e) { + LOG.log(Level.INFO, "Failed to start shared server", e); + } + } + + /** + * @return the name of the liberty server; see the publish/servers directory for options + */ + public String getServerName() { + return serverName; + } + + /** + * @see #getServerName() + * @return the liberty server used by this test + */ + public LibertyServer getLibertyServer() { + if (this.server == null) { + this.server = LibertyServerFactory.getLibertyServer(this.getServerName()); + } + return this.server; + } + + /** + * Get the JMX connection URL of this server + * + * @return a {@link JMXServiceURL} that allows you to invoke MBeans on the server + * @throws JmxException + * if the server can't be found, + * the localConnector-1.0 feature is not enabled, + * or the address file is not valid + */ + public JMXServiceURL getJmxServiceUrl() throws JmxException { + return JmxServiceUrlFactory.getInstance().getUrl(this.getLibertyServer()); + } + + /** + * Retrieves an {@link ApplicationMBean} for a particular application on this server + * + * @param applicationName the name of the application to operate on + * @return an {@link ApplicationMBean} + * @throws JmxException if the object name for the input application cannot be constructed + */ + public ApplicationMBean getApplicationMBean(String applicationName) throws JmxException { + return new ApplicationMBean(this.getJmxServiceUrl(), applicationName); + } + + /** + * Retrieves a {@link PluginConfigMBean} for this server + * + * @return a {@link PluginConfigMBean} for this server + * @throws JmxException if the object name for the PluginConfigMBean cannot be constructed + */ + public PluginConfigMBean getPluginConfigMBean() throws JmxException { + return new PluginConfigMBean(this.getJmxServiceUrl()); + } + + /** + * Get the WebResponse for the given resource using the given WebBrowser + * + * @param browser + * @param resource + * @return + */ + public WebResponse getResponse(WebBrowser browser, String resource) throws Exception { + String url = getServerUrl(true, resource); + WebResponse response = browser.request(url); + return response; + } + + /** + * Start the server if it is not running, or do nothing if it's already running + * + * @throws Exception if server start fails + */ + public void startIfNotStarted() throws Exception { + LibertyServer server = this.getLibertyServer(); + if (!server.isStarted()) { + String delimiter = Props.getInstance().getProperty(Props.LOGGING_BREAK_SMALL); + installRequiredFeatures(); + LOG.info(delimiter); + LOG.info("Starting server: " + server.getServerName()); + LOG.info(delimiter); + server.startServer(); // throws exception if start fails + if (this.waitForSecurity) { + server.waitForStringInLog(".*CWWKS4105I: LTPA configuration is ready.*"); + server.waitForStringInLog(".*CWWKS0008I: The security service is ready.*"); + } + LOG.info(delimiter); + LOG.info("Server is running: " + server.getServerName()); + LOG.info(delimiter); + } + } + + private void installRequiredFeatures() throws Exception { + if (featuresToInstall.length > 0) { + LibertyServer server = this.getLibertyServer(); + for (String feature : featuresToInstall) { + server.copyFileToLibertyInstallRoot("lib/features", feature); + } + } + } + + /** + * Builds the URL of the Liberty server. + * + * @param http true for HTTP, false for HTTPS + * @param path additional information to append to the returned URL + * @return the URL of the Liberty server + */ + public String getServerUrl(boolean http, String path) { + LibertyServer server = this.getLibertyServer(); + StringBuilder url = new StringBuilder(); + if (http) { + url.append("http://"); + } else { + url.append("https://"); + } + url.append(server.getHostname()); // trust Simplicity to provide host + url.append(":"); + if (http) { + url.append(server.getHttpDefaultPort()); // trust Simplicity to provide port + } else { + url.append(server.getHttpDefaultSecurePort()); // trust Simplicity to provide port + } + if (path != null) { + url.append(path); + } + return url.toString(); + } + + /** + * Submits an HTTP request at the path specified by resource, + * and verifies that the HTTP response body contains the text specified by + * expectedResponse. + * + * @param webBrowser the browser used to submit the request + * @param resource the resource on the shared server to request + * @param expectedResponse a subset of the text expected from the HTTP response + * @return the HTTP response (in case further validation is required) + * @throws Exception if the expectedResponse is not contained in the HTTP response body + */ + public WebResponse verifyResponse(WebBrowser webBrowser, String resource, String expectedResponse) throws Exception { + String url = this.getServerUrl(true, resource); + WebResponse response = webBrowser.request(url); + LOG.info("Response from webBrowser: " + response.getResponseBody()); + response.verifyResponseBodyContains(expectedResponse); + return response; + } + + /** + * + * @param regex regex to search for + * @param url URL to fetch + * @return the first capture, or null if no captures in the regex + * @throws Exception If the webBrowser throws and Exception + */ + public String assertRegexInresponse(WebBrowser wb, String url, String regex) throws Exception { + String returnString = null; + WebResponse wr = wb.request(url); + Pattern pat = Pattern.compile(regex); + String response = wr.getResponseBody(); + Matcher m = null; + boolean found = false; + for (String s : response.split("\n")) { + System.out.println("Line:" + s); + m = pat.matcher(s); + boolean matches = m.find(); + System.out.println("Does it match " + regex + "? " + matches); + if (matches) { + found = true; + break; + } + } + Assert.assertTrue("Didn't find match for regex " + regex + + " in response " + response, found); + System.out.println("Group count is " + m.groupCount()); + if (m != null && m.groupCount() > 0) { + System.out.println("First Hit i s " + m.group(1)); + returnString = m.group(1); + } + return returnString; + } + + /** + * Submits an HTTP request at the path specified by resource, + * and verifies that the HTTP response body contains the all of the supplied text + * specified by the array of * expectedResponses + * + * @param webBrowser the browser used to submit the request + * @param resource the resource on the shared server to request + * @param expectedResponses an array of the different subsets of the text expected from the HTTP response + * @return the HTTP response (in case further validation is required) + * @throws Exception if the expectedResponses is not contained in the HTTP response body + */ + public WebResponse verifyResponse(WebBrowser webBrowser, String resource, String[] expectedResponses) throws Exception { + String url = this.getServerUrl(true, resource); + WebResponse response = webBrowser.request(url); + LOG.info("Response from webBrowser: " + response.getResponseBody()); + for (String textToFind : expectedResponses) { + response.verifyResponseBodyContains(textToFind); + } + + return response; + } + + /** + * Submits an HTTP request at the path specified by resource, + * and verifies that the HTTP response body contains the all of the supplied text + * specified by the array of * expectedResponses and doesn't contain any + * unexpected responses. + * + * @param webBrowser the browser used to submit the request + * @param resource the resource on the shared server to request + * @param expectedResponses an array of the different subsets of the text expected from the HTTP response + * @param unexpectedResponses an array of the different subsets of the text that must not be found in the HTTP response + * @return the HTTP response (in case further validation is required) + * @throws Exception if the expectedResponse is not contained in the HTTP response body or the unexpected responses are + * found in the response body. + */ + public WebResponse verifyResponse(WebBrowser webBrowser, String resource, String[] expectedResponses, String[] unexpectedResponses) throws Exception { + WebResponse response = verifyResponse(webBrowser, resource, expectedResponses); + + // Now check that we don't have any unexpected responses + for (String textNotExpectedToFind : unexpectedResponses) { + response.verifyResponseBodyDoesNotContain(textNotExpectedToFind); + } + + return response; + } + + /** + * Submits an HTTP request at the path specified by resource, + * and verifies that the HTTP response status code equals the expected status code + * specified by statusCode. + * + * @param webBrowser the browser used to submit the request + * @param resource the resource on the shared server to request + * @param statusCode the expected HTTP response status code + * @throws Exception if the statusCode is not the actual status code returned in the HTTP response + */ + public void verifyStatusCode(WebBrowser webBrowser, String resource, int statusCode) throws WebBrowserException { + String url = this.getServerUrl(true, resource); + + int actualStatusCode = webBrowser.request(url, statusCode); + + if (actualStatusCode != statusCode) { + throw new WebBrowserException("The expected status code was not thrown. Expected " + statusCode + ", was " + actualStatusCode); + } else { + LOG.info("Expected status code retrieved: " + statusCode); + } + } + + /** + * Submits an HTTP request at the path specified by resource, + * and verifies that the HTTP response body contains the text specified by + * expectedResponse. + * + * @param webBrowser the browser used to submit the request + * @param resource the resource on the shared server to request + * @param expectedResponse a subset of the text expected from the HTTP response + * @return the HTTP response (in case further validation is required) + * @throws Exception if the expectedResponse is not contained in the HTTP response body + */ + public WebResponse verifyResponse(WebBrowser webBrowser, String resource, String expectedResponse, int numberToMatch, String extraMatch) throws Exception { + String url = this.getServerUrl(true, resource); + WebResponse response = webBrowser.request(url); + LOG.info("Response from webBrowser: " + response.getResponseBody()); + response.verifyResponseBodyWithRepeatMatchAndExtra(expectedResponse, numberToMatch, extraMatch); + return response; + } + + /** + * Looks for messages in the server log to indicate that an application has started. + * You only need to call this method if the application isn't in the dropins directory. + * + * @param applicationName the name of the application whose startup you want to verify + * @throws Exception if the application doesn't apear to be running + */ + public void verifyAppHasStarted(String applicationName) throws Exception { + String message = "CWWKZ0001I:.*" + applicationName; + LOG.info("Waiting for message to appear in log: " + message); + this.getLibertyServer().waitForStringInLog(message); + } + + public void logInfo(String s) { + LOG.info(s); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/TrackedInstances.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/TrackedInstances.java new file mode 100755 index 000000000000..f7efc3bbffd6 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/TrackedInstances.java @@ -0,0 +1,134 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * Caches the output of /com.ibm.ws.cdi_fat/test-applications/basicEjbInWar.war/resources/showInstances.jsp + */ +public class TrackedInstances { + + private final List constructed; + private final List destroyed; + private final List living; + private final List dead; + + /** + * Parses the output of /com.ibm.ws.cdi_fat/test-applications/basicEjbInWar.war/resources/showInstances.jsp + * + * @param document the HTML returned from a request to showInstances.jsp + */ + public TrackedInstances(Document document) { + List constructed = new ArrayList(); + List destroyed = new ArrayList(); + List living = new ArrayList(); + List dead = new ArrayList(); + if (document != null) { + NodeList orderedLists = document.getElementsByTagName("ol"); + if (orderedLists != null) { + int numOrderedLists = orderedLists.getLength(); + for (int olIndex = 0; olIndex < numOrderedLists; olIndex++) { + Element orderedList = (Element) orderedLists.item(olIndex); + if (orderedList == null) { + continue; + } + NodeList spans = orderedList.getElementsByTagName("span"); + if (spans != null && spans.getLength() > 0) { + Element span = (Element) spans.item(0); + if (span == null) { + continue; + } + String spanText = getText(span); + List activeList = null; + if ("Constructed Instances:".equals(spanText)) { + activeList = constructed; + } else if ("Destroyed Instances:".equals(spanText)) { + activeList = destroyed; + } else if ("Living Instances:".equals(spanText)) { + activeList = living; + } else if ("Dead Instances:".equals(spanText)) { + activeList = dead; + } + NodeList listItems = orderedList.getElementsByTagName("li"); + if (activeList == null || listItems == null) { + continue; + } + int numItems = listItems.getLength(); + for (int liIndex = 0; liIndex < numItems; liIndex++) { + Element listItem = (Element) listItems.item(liIndex); + if (listItem == null) { + continue; + } + String listItemText = getText(listItem); + if (listItemText == null) { + continue; + } + activeList.add(listItemText); + } + } + } + } + } + this.constructed = Collections.unmodifiableList(constructed); + this.destroyed = Collections.unmodifiableList(destroyed); + this.living = Collections.unmodifiableList(living); + this.dead = Collections.unmodifiableList(dead); + } + + private static String getText(Node node) { + NodeList children = node.getChildNodes(); + for (int k = 0; k < children.getLength(); k++) { + Node child = children.item(k); + if (child.getNodeType() == Node.TEXT_NODE) { + return child.getNodeValue(); + } + } + return null; + } + + /** + * @return the constructed + */ + public List getConstructed() { + return this.constructed; + } + + /** + * @return the destroyed + */ + public List getDestroyed() { + return this.destroyed; + } + + /** + * @return the living + */ + public List getLiving() { + return this.living; + } + + /** + * @return the dead + */ + public List getDead() { + return this.dead; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/Counter.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/Counter.java new file mode 100755 index 000000000000..2f33d55b0984 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/Counter.java @@ -0,0 +1,29 @@ +package com.ibm.ws.fat.util.browser; + +/** + * Thread-safe counter + * + * @author Tim Burns + * + */ +public class Counter { + + protected int count; + + /** + * Primary Constructor + */ + public Counter() { + this.count = 0; + } + + /** + * Increment this instance by one + * + * @return + */ + public synchronized int next() { + this.count++; + return this.count; + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/EasySSLProtocolSocketFactory.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/EasySSLProtocolSocketFactory.java new file mode 100755 index 000000000000..2199b7faef3d --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/EasySSLProtocolSocketFactory.java @@ -0,0 +1,237 @@ +package com.ibm.ws.fat.util.browser; + +/* + * $HeadURL$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + */ + +import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.UnknownHostException; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.net.SocketFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; + +import org.apache.commons.httpclient.ConnectTimeoutException; +import org.apache.commons.httpclient.HttpClientError; +import org.apache.commons.httpclient.params.HttpConnectionParams; +import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; + +/** + *

    + * EasySSLProtocolSocketFactory can be used to creats SSL {@link Socket}s + * that accept self-signed certificates. + *

    + *

    + * This socket factory SHOULD NOT be used for productive systems + * due to security reasons, unless it is a concious decision and + * you are perfectly aware of security implications of accepting + * self-signed certificates + *

    + * + *

    + * Example of using custom protocol socket factory for a specific host: + *

    + * Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
    + * 
    + * URI uri = new URI("https://localhost/", true);
    + * // use relative url only
    + * GetMethod httpget = new GetMethod(uri.getPathQuery());
    + * HostConfiguration hc = new HostConfiguration();
    + * hc.setHost(uri.getHost(), uri.getPort(), easyhttps);
    + * HttpClient client = new HttpClient();
    + * client.executeMethod(hc, httpget);
    + * 
    + *

    + *

    + * Example of using custom protocol socket factory per default instead of the standard one: + *

    + * Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
    + * Protocol.registerProtocol("https", easyhttps);
    + * 
    + * HttpClient client = new HttpClient();
    + * GetMethod httpget = new GetMethod("https://localhost/");
    + * client.executeMethod(httpget);
    + * 
    + *

    + * + * @author Oleg Kalnichevski + * + *

    + * DISCLAIMER: HttpClient developers DO NOT actively support this component. + * The component is provided as a reference material, which may be inappropriate + * for use without additional customization. + *

    + */ + +public class EasySSLProtocolSocketFactory implements SecureProtocolSocketFactory { + + /** Log object for this class. */ + private static final Logger LOG = Logger.getLogger(EasyX509TrustManager.class.getName()); + + private SSLContext sslcontext = null; + + /** + * Constructor for EasySSLProtocolSocketFactory. + */ + public EasySSLProtocolSocketFactory() { + super(); + } + + private static SSLContext createEasySSLContext() { + try { + SSLContext context = SSLContext.getInstance("SSL"); + context.init( + null, + new TrustManager[] { new EasyX509TrustManager(null) }, + null); + return context; + } catch (Exception e) { + LOG.log(Level.WARNING, e.getMessage(), e); + throw new HttpClientError(e.toString()); + } + } + + private SSLContext getSSLContext() { + if (this.sslcontext == null) { + this.sslcontext = createEasySSLContext(); + } + return this.sslcontext; + } + + /** + * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int,java.net.InetAddress,int) + */ + @Override + public Socket createSocket( + String host, + int port, + InetAddress clientHost, + int clientPort) + throws IOException, UnknownHostException { + + return getSSLContext().getSocketFactory().createSocket( + host, + port, + clientHost, + clientPort + ); + } + + /** + * Attempts to get a new socket connection to the given host within the given time limit. + *

    + * To circumvent the limitations of older JREs that do not support connect timeout a + * controller thread is executed. The controller thread attempts to create a new socket + * within the given limit of time. If socket constructor does not return until the + * timeout expires, the controller terminates and throws an {@link ConnectTimeoutException}

    + * + * @param host the host name/IP + * @param port the port on the host + * @param localAddress the local host name/IP to bind the socket to + * @param localPort the port on the local machine + * @param params {@link HttpConnectionParams Http connection parameters} + * + * @return Socket a new socket + * + * @throws IOException if an I/O error occurs while creating the socket + * @throws UnknownHostException if the IP address of the host cannot be + * determined + */ + @Override + public Socket createSocket( + final String host, + final int port, + final InetAddress localAddress, + final int localPort, + final HttpConnectionParams params + ) throws IOException, UnknownHostException, ConnectTimeoutException { + if (params == null) { + throw new IllegalArgumentException("Parameters may not be null"); + } + int timeout = params.getConnectionTimeout(); + SocketFactory socketfactory = getSSLContext().getSocketFactory(); + if (timeout == 0) { + return socketfactory.createSocket(host, port, localAddress, localPort); + } else { + Socket socket = socketfactory.createSocket(); + SocketAddress localaddr = new InetSocketAddress(localAddress, localPort); + SocketAddress remoteaddr = new InetSocketAddress(host, port); + socket.bind(localaddr); + socket.connect(remoteaddr, timeout); + return socket; + } + } + + /** + * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int) + */ + @Override + public Socket createSocket(String host, int port) + throws IOException, UnknownHostException { + return getSSLContext().getSocketFactory().createSocket( + host, + port + ); + } + + /** + * @see SecureProtocolSocketFactory#createSocket(java.net.Socket,java.lang.String,int,boolean) + */ + @Override + public Socket createSocket( + Socket socket, + String host, + int port, + boolean autoClose) + throws IOException, UnknownHostException { + return getSSLContext().getSocketFactory().createSocket( + socket, + host, + port, + autoClose + ); + } + + @Override + public boolean equals(Object obj) { + return ((obj != null) && obj.getClass().equals(EasySSLProtocolSocketFactory.class)); + } + + @Override + public int hashCode() { + return EasySSLProtocolSocketFactory.class.hashCode(); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/EasyX509TrustManager.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/EasyX509TrustManager.java new file mode 100755 index 000000000000..5e126465159c --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/EasyX509TrustManager.java @@ -0,0 +1,114 @@ +package com.ibm.ws.fat.util.browser; + +/* + * ==================================================================== + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + */ +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509TrustManager; + +/** + *

    + * EasyX509TrustManager unlike default {@link X509TrustManager} accepts + * self-signed certificates. + *

    + *

    + * This trust manager SHOULD NOT be used for productive systems + * due to security reasons, unless it is a concious decision and + * you are perfectly aware of security implications of accepting + * self-signed certificates + *

    + * + * @author Adrian Sutton + * @author Oleg Kalnichevski + * + *

    + * DISCLAIMER: HttpClient developers DO NOT actively support this component. + * The component is provided as a reference material, which may be inappropriate + * for use without additional customization. + *

    + */ +public class EasyX509TrustManager implements X509TrustManager { + private X509TrustManager standardTrustManager = null; + + /** Log object for this class. */ + private static final Logger LOG = Logger.getLogger(EasyX509TrustManager.class.getName()); + + /** + * Constructor for EasyX509TrustManager. + */ + public EasyX509TrustManager(KeyStore keystore) throws NoSuchAlgorithmException, KeyStoreException { + super(); + TrustManagerFactory factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + factory.init(keystore); + TrustManager[] trustmanagers = factory.getTrustManagers(); + if (trustmanagers.length == 0) { + throw new NoSuchAlgorithmException("no trust manager found"); + } + this.standardTrustManager = (X509TrustManager) trustmanagers[0]; + } + + /** + * @see javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[],String authType) + */ + @Override + public void checkClientTrusted(X509Certificate[] certificates, String authType) throws CertificateException { + standardTrustManager.checkClientTrusted(certificates, authType); + } + + /** + * @see javax.net.ssl.X509TrustManager#checkServerTrusted(X509Certificate[],String authType) + */ + @Override + public void checkServerTrusted(X509Certificate[] certificates, String authType) throws CertificateException { + if ((certificates != null) && LOG.isLoggable(Level.FINE)) { + LOG.fine("Server certificate chain:"); + for (int i = 0; i < certificates.length; i++) { + LOG.fine("X509Certificate[" + i + "]=" + certificates[i]); + } + } + if ((certificates != null) && (certificates.length == 1)) { + certificates[0].checkValidity(); + } else { + standardTrustManager.checkServerTrusted(certificates, authType); + } + } + + /** + * @see javax.net.ssl.X509TrustManager#getAcceptedIssuers() + */ + @Override + public X509Certificate[] getAcceptedIssuers() { + return this.standardTrustManager.getAcceptedIssuers(); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/HtmlParser.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/HtmlParser.java new file mode 100755 index 000000000000..11b236554d03 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/HtmlParser.java @@ -0,0 +1,90 @@ +package com.ibm.ws.fat.util.browser; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.PrintWriter; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.w3c.dom.Document; +import org.w3c.tidy.Tidy; + +/** + * Convenience class for parsing HTML that may not be well formatted. Since + * JTidy is required for HttpUnit, we might as well use it + * + * @author Tim Burns + */ +public class HtmlParser { + + private static Logger LOG = Logger.getLogger(HtmlParser.class.getName()); + + protected static HtmlParser INSTANCE; + + /** + * If you only intend to parse one HTML document at a time, you only need + * one instance. This method allows you to access a global instance. + * + * @return a global instance for this class + */ + public static HtmlParser getInstance() { + if (INSTANCE == null) { + INSTANCE = new HtmlParser(); + } + return INSTANCE; + } + + protected Tidy tidy; + protected ByteArrayOutputStream errorStream; + protected PrintWriter errorWriter; + + /** + * Initializes a new parser and configures default settings + */ + public HtmlParser() { + this.tidy = new Tidy(); // NOTE: makes all HTML tags and attributes lower case by default + this.tidy.setShowWarnings(false); + this.errorStream = new ByteArrayOutputStream(); + this.errorWriter = new PrintWriter(this.errorStream); + this.tidy.setErrout(this.errorWriter); + this.tidy.setQuiet(true); + this.tidy.setTidyMark(false); + this.tidy.setSmartIndent(true); + } + + /** + * Parses a input String as HTML. The HTML does not need to be well + * formatted. + * + * @param html + * the document you want to parse. Must not be null. + * @return a parsed version of the document + * @throws Throwable + * If the document can't be parsed. throws an NPE if the input + * String is null + */ + public synchronized Document parse(String html) throws Throwable { + ByteArrayOutputStream parsedHtmlStream = null; + if (LOG.isLoggable(Level.FINE)) { + parsedHtmlStream = new ByteArrayOutputStream(); + LOG.fine("Parsing HTML using JTidy ..."); + } + Document document = this.tidy.parseDOM(new ByteArrayInputStream(html.getBytes()), parsedHtmlStream); + this.errorWriter.flush(); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine("~~~ Beginning of parsed HTML document ~~~"); + LOG.fine(parsedHtmlStream.toString()); + LOG.fine("~~~ End of parsed HTML document ~~~~~~~~~"); + int numParseErrors = this.tidy.getParseErrors(); + if (numParseErrors > 0) { + LOG.fine("JTidy detected " + numParseErrors + " parser errors"); + LOG.fine("~~~ Beginning of parser errors ~~~"); + LOG.fine(this.errorStream.toString()); + LOG.fine("~~~ End of parser errors ~~~~~~~~~"); + } + } + this.errorStream.reset(); + return document; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/HttpClientBrowser.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/HttpClientBrowser.java new file mode 100755 index 000000000000..0dbb5886e836 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/HttpClientBrowser.java @@ -0,0 +1,271 @@ +package com.ibm.ws.fat.util.browser; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.httpclient.Credentials; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpConnectionManager; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpMethod; +import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; +import org.apache.commons.httpclient.NameValuePair; +import org.apache.commons.httpclient.UsernamePasswordCredentials; +import org.apache.commons.httpclient.auth.AuthScope; +import org.apache.commons.httpclient.cookie.CookiePolicy; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.params.HttpClientParams; +import org.apache.commons.httpclient.params.HttpConnectionManagerParams; +import org.apache.commons.httpclient.params.HttpMethodParams; +import org.apache.commons.httpclient.protocol.Protocol; +import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; + +/** + * WebBrowser implementation for Apache's HttpClient
    + * http://hc.apache.org/httpclient-3.x/
    + *
    + * Tested with Jakarta Commons-HttpClient/3.1 + * + * @author Tim Burns + */ +public class HttpClientBrowser extends WebBrowserCore { + + protected static String IMPL; + protected static HttpConnectionManager CONNECTION_MANAGER; + protected NameValuePair[] formValues = null; + + static { + // Tell the Jakarta Commons Logging (JCL) library which logging implementation to use + // (this line makes it possible to configure HttpClient logging with logging.properties from the JRE Logger) + System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger"); + // Make it possible for HttpClient to handle https requests + ProtocolSocketFactory psf = new EasySSLProtocolSocketFactory(); + Protocol.registerProtocol("https", new Protocol("https", psf, 443)); + } + + protected static HttpConnectionManager getHttpConnectionManager() { + if (CONNECTION_MANAGER == null) { // no need to acquire a lock if CONNECTION_MANAGER is already set (most likely case) + synchronized (HttpClientBrowser.class) { + if (CONNECTION_MANAGER == null) { // if CONNECTION_MANAGER is still null after acquiring the lock + CONNECTION_MANAGER = new MultiThreadedHttpConnectionManager(); + HttpConnectionManagerParams params = CONNECTION_MANAGER.getParams(); + // Set the maximum number of connections that will be created for any particular HostConfiguration. Defaults to 2. + params.setDefaultMaxConnectionsPerHost(5); + // Set the maximum number of active connections. Defaults to 20. + params.setMaxTotalConnections(20); + // So you can 5 active connections to up to 4 hosts at the same time (5*4=20 connections) + } + } + } + return CONNECTION_MANAGER; + } + + private final HttpClient client; + + protected HttpClientBrowser(File resultDirectory) { + super(resultDirectory); + this.client = new HttpClient(getHttpConnectionManager()); + // I don't want to offer up authentication credentials unless I'm asked for them + this.client.getParams().setAuthenticationPreemptive(false); + } + + @Override + protected String getImplementationDescription() { + if (IMPL == null) { // no need to acquire a lock if IMPL is already set (most likely case) + synchronized (HttpClientBrowser.class) { + if (IMPL == null) { // if IMPL is still null after acquiring the lock + HttpClientParams params = new HttpClient().getParams(); + IMPL = (String) params.getParameter("http.useragent"); + } + } + } + return IMPL; + } + + @Override + protected void performSetAuthorization(String userName, String password) throws Exception { + // The WebBrowser object does not allow the client to be null at this point (only called if this browser is open) + /* + * (from Http Client documentation ...) + * "Use default credentials with caution when developing applications + * that may need to communicate with untrusted web sites or web + * applications. When preemptive authentication is activated or + * credentials are not explicitly given for a specific authentication + * realm and host HttpClient will use default credentials to try to + * authenticate with the target site. If you want to avoid sending + * sensitive credentials to an untrusted site, narrow the credentials + * scope as much as possible: always specify the host and, when known, + * the realm the credentials are intended for. Setting credentials with + * AuthScope.ANY authentication scope (null value for host and/or realm) + * is highly discouraged in production applications. Doing this will + * result in the credentials being sent for all authentication attempts + * (all requests in the case of preemptive authentication). Use of this + * setting should be limited to debugging only." + * + * For the sake of this testing framework, I'm going to assume that all + * credentials passed into this framework are not sensative, so I'm going + * to "live dangerously" and always use default credentials. + */ + Credentials defaultcreds = new UsernamePasswordCredentials(userName, password); + this.client.getState().setCredentials(AuthScope.ANY, defaultcreds); + } + + @Override + protected void configureAcceptCookies() throws Exception { + /* nothing to do; must set cookie policy for each HttpMethod. See configureMethodSettings(method) */ + } + + @Override + protected void configureAutoRedirect() throws Exception { + /* nothing to do; must set auto redirect policy for each HttpMethod. See configureMethodSettings(method) */ + } + + protected void configureMethodSettings(HttpMethod method) throws Exception { + if (method != null) { + method.setFollowRedirects(this.autoRedirect); + HttpMethodParams params = method.getParams(); + params.setSoTimeout(10 * 60 * 1000); // Quit waiting if an HTTP request takes longer than 10 minutes. Required to prevent the test bucket from hanging when WebSphere hangs. I can't find a way to set an equivalent timeout in HttpUnit. + if (this.acceptCookies) { + params.setCookiePolicy(CookiePolicy.RFC_2109); + } else { + params.setCookiePolicy(CookiePolicy.IGNORE_COOKIES); + } + } + } + + protected void addAll(NameValuePair[] source, List dest) { + if (source != null && dest != null) { + for (int i = 0; i < source.length; i++) { + dest.add(new MyNameValuePair(source[i].getName(), source[i].getValue())); + } + } + } + + @Override + protected WebResponse submitRequest(String url, int requestNum) throws Exception { + WebResponse response = new WebResponse(this, requestNum); + response.setUrl(url); + response.setRequestedUrl(url); + this.populateResponse(response); + return response; + } + + @Override + public int request(String url, int expectedStatusCode) throws WebBrowserException { + HttpMethod method = getHTTPMethod(url); + //boolean rv = false; + int rv = -1; + try { + client.executeMethod(method); + //rv = (expectedStatusCode == method.getStatusCode()); + rv = method.getStatusCode(); + } catch (HttpException e) { + throw new WebBrowserException(e); + } catch (IOException ioe) { + throw new WebBrowserException(ioe); + } + return rv; + } + + /* + * @Override + * protected WebResponse submitExpectedFailedRequest(String url, int requestNum) throws Exception { + * WebResponse response = new WebResponse(this, requestNum); + * response.setUrl(url); + * response.setRequestedUrl(url); + * this.populateResponse(response); + * return response; + * } + */ + + protected void populateResponse(WebResponse response) throws Exception { + // Choose the HttpMethod request type + HttpMethod method = getHTTPMethod(response.url); + + //configure HttpMethod Settings + this.configureMethodSettings(method); + + int rc = -1; + try { + // start the timer + response.setStart(); + + // Invoke the HttpMethod + this.client.executeMethod(method); + + // Collect state information for later reference + rc = method.getStatusCode(); + response.setUrl(method.getURI().toString()); // must reset the URL in case any redirects occurred + response.setResponseCode(rc); + response.setResponseBody(method.getResponseBodyAsString()); + this.addAll(this.client.getState().getCookies(), response.cookies); + this.addAll(method.getRequestHeaders(), response.requestHeaders); + this.addAll(method.getResponseHeaders(), response.responseHeaders); + } finally { + /*- + * From the HttpClient JavaDoc: + * Releases the connection being used by this HTTP method. In + * particular the connection is used to read the response(if there + * is one) and will be held until the response has been read. If the + * connection can be reused by other HTTP methods it is NOT closed + * at this point. + */ + method.releaseConnection(); // be sure the connection is released back to the connection manager + } + + // Populate frames + response.parseFrames(); + for (WebResponse frame : response.frames) { + this.populateResponse(frame); + } + response.setStop(); + + // if necessary, throw a status code exception AFTER the connection has been released + // if possible, save response output to a file prior to throwing an exception + response.save(); + this.checkStatusCode(rc, response.url); // don't call getUrl() to reduce logging + } + + @Override + protected void performReset() throws Exception { + /*- + * From the HttpClient JavaDoc: + * Clears the state information (all cookies, credentials and proxy + * credentials). + */ + this.client.getState().clear(); + } + + @Override + protected void performClose() throws Exception { + // nothing to do + } + + private HttpMethod getHTTPMethod(String url) { + HttpMethod method; + if (formValues != null) { + method = new PostMethod(url); + ((PostMethod) method).addParameters(formValues); + } else { + method = new GetMethod(url); + } + return method; + } + + @Override + public void setFormValues(Properties values) { + List nameValuePairs = new ArrayList(); + if (values != null) { + for (Map.Entry entry : values.entrySet()) { + nameValuePairs.add(new NameValuePair((String) entry.getKey(), (String) entry.getValue())); + } + } + + this.formValues = nameValuePairs.toArray(new NameValuePair[] {}); + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/HttpUnitBrowser.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/HttpUnitBrowser.java new file mode 100755 index 000000000000..c8632f0d6382 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/HttpUnitBrowser.java @@ -0,0 +1,215 @@ +package com.ibm.ws.fat.util.browser; + +import java.io.File; +import java.net.URL; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.meterware.httpunit.ClientProperties; +import com.meterware.httpunit.HttpUnitOptions; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebWindow; + +/** + * WebBrowser implementation for HttpUnitt
    + * http://httpunit.sourceforge.net/
    + *
    + * Tested with httpunit/1.5
    + *
    + * Limitations: + *
      + *
    • There's no supported way to determine request headers; not sure how to determine request headers for some frames
    • + *
    • Frames are automatically loaded; can't control when the load, can't measure load time
    • + *
    • Can't enable trace (HttpUnit has no trace)
    • + *
    • There's no way to determine the originally requested URL for frames (sometimes)
    • + *
    + * + * @author Tim Burns + * + */ +public class HttpUnitBrowser extends WebBrowserCore { + + private static final String CLASS_NAME = HttpUnitBrowser.class.getName(); + private static Logger LOGGER = Logger.getLogger(CLASS_NAME); + + private static final String IMPL; + + static { + HttpUnitOptions.setExceptionsThrownOnErrorStatus(false); // mysteriously, an exception is still thrown on 401 + HttpUnitOptions.setExceptionsThrownOnScriptError(true); + + ClientProperties props = ClientProperties.getDefaultProperties(); + IMPL = props.getUserAgent(); + + String method = "(clinit)"; + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Initializing " + IMPL); + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Default Character Set : " + HttpUnitOptions.getDefaultCharacterSet()); + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Default Content Type : " + HttpUnitOptions.getDefaultContentType()); + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Exceptions thrown on Error Status (4xx or 5xx) : " + HttpUnitOptions.getExceptionsThrownOnErrorStatus()); + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Exceptions thrown on script error : " + HttpUnitOptions.getExceptionsThrownOnScriptError()); + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Redirect delay : " + HttpUnitOptions.getRedirectDelay()); + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Check Content Length (forbid partially received messages) : " + HttpUnitOptions.isCheckContentLength()); + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Default Application Code Name : " + props.getApplicationCodeName()); + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Default Application Name : " + props.getApplicationName()); + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Default Application Version : " + props.getApplicationVersion()); + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Accept Cookies by Default : " + WebBrowserCore.DEFAULT_ACCEPT_COOKIE_POLICY); + LOGGER.logp(Level.INFO, CLASS_NAME, method, "Auto Redirect by Default : " + WebBrowserCore.DEFAULT_AUTO_REDIRECT_POLICY); + } + + private final MyWebConversation wc; + + protected HttpUnitBrowser(File resultDirectory) { + super(resultDirectory); + this.wc = new MyWebConversation(); + this.configureClientProperties(); + } + + @Override + protected String getImplementationDescription() { + return IMPL; + } + + @Override + protected void performSetAuthorization(String userName, String password) throws Exception { + // The WebBrowser object does not allow the wc to be null at this point (only called if this browser is open) + this.wc.setAuthorization(userName, password); + } + + private void configureClientProperties() { + ClientProperties props = this.wc.getClientProperties(); + props.setAcceptCookies(this.acceptCookies); + props.setAutoRedirect(this.autoRedirect); + } + + @Override + protected void configureAcceptCookies() throws Exception { + this.configureClientProperties(); + } + + @Override + protected void configureAutoRedirect() throws Exception { + this.configureClientProperties(); + } + + @Override + protected WebResponse submitRequest(String url, int requestNum) throws Exception { + WebResponse result = new WebResponse(this, requestNum); // sets start time + /* + * (from HttpUnit javadoc ...) + * + * Submits a GET method request and returns a response. + */ + result.setUrl(url); + result.setRequestedUrl(url); + this.populateResponse(this.wc.getResponse(url), result); + return result; + } + + protected void populateResponse(com.meterware.httpunit.WebResponse source, WebResponse dest) throws Exception { + URL url = source.getURL(); + String urlString = null; + if (url != null) { + // source.getURL() sometimes returns null for WebResponse objects returned from wc.getFrameContents(frameName) + urlString = url.toString(); + dest.setUrl(urlString); // resolves frame URL, but no change on top level frames + + // not sure how to determine request headers without the URL + Dictionary headers = this.wc.getHeaderFields(url); + if (headers != null) { + Enumeration keys = headers.keys(); + while (keys.hasMoreElements()) { + String key = keys.nextElement(); + dest.addRequestHeader(key, headers.get(key)); + } + } + } + dest.setResponseBody(source.getText()); + int rc = source.getResponseCode(); + dest.setResponseCode(rc); + String[] cookieNames = this.wc.getCookieNames(); + for (int i = 0; i < cookieNames.length; i++) { + String cookieValue = this.wc.getCookieValue(cookieNames[i]); + dest.addCookie(cookieNames[i], cookieValue); + } + String[] headerNames = source.getHeaderFieldNames(); + for (int i = 0; i < headerNames.length; i++) { + String headerValue = source.getHeaderField(headerNames[i]); + dest.addResponseHeader(headerNames[i], headerValue); + } + String contentType = source.getContentType(); + if ("text/html".equals(contentType)) { + /*- + * For some reason, HttpUnit throws an exception when you try to + * parse frames in a content type other than HTML; for example: + * "com.meterware.httpunit.NotHTMLException: The content type of the + * response is 'text/xml': it must be 'text/html' in order to be + * recognized as HTML" + */ + String[] frameNames = source.getFrameNames(); + for (int i = 0; i < frameNames.length; i++) { + WebResponse frame = null; + // when frames have no name, HttpUnit names them by their object's toString method ... + if (frameNames[i] == null || frameNames[i].contains("com.meterware.httpunit.WebFrame")) { + frame = new WebResponse(this, dest.getNumber(), i); + } else { + frame = new WebResponse(this, dest.getNumber(), frameNames[i], i); + } + frame.setStart(dest.start); // HttpUnit auto-requests all child frames; there's no way to determine the actual start time + this.populateResponse(this.wc.getFrameContents(frameNames[i]), frame); + dest.addFrame(frame); + } + } + + dest.setStop(); + + // if possible, save response output to a file prior to throwing an exception + dest.save(); + this.checkStatusCode(rc, urlString); + } + + @Override + protected void performReset() throws Exception { + /*- + * From the HttpUnit JavaDoc: + * Resets the state of this client, removing all cookies, frames, and + * per-client headers. + */ + this.wc.clearContents(); + } + + @Override + protected void performClose() throws Exception { + WebWindow[] windows = this.wc.getOpenWindows(); + for (int i = 0; i < windows.length; i++) { + windows[i].close(); + } + } + + /** + * By default, HttpUnit forces you to guess the names of the request headers + * that it uses. In order to deduce the request header names, you need to + * increase the visibility of one of WebConversation's protected methods. + * + * @author Tim Burns + * + */ + static class MyWebConversation extends WebConversation { + @Override + public Dictionary getHeaderFields(URL targetURL) { + return super.getHeaderFields(targetURL); + } + } + + @Override + // Does not need to be implemented + public void setFormValues(Properties values) {} + + @Override + // Does not need to be implemented + public int request(String url, int expectedStatusCode) throws WebBrowserException { + return 0; + } +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/MyNameValuePair.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/MyNameValuePair.java new file mode 100755 index 000000000000..e1695f1cfa22 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/MyNameValuePair.java @@ -0,0 +1,29 @@ +package com.ibm.ws.fat.util.browser; + +public class MyNameValuePair { + + String name; + String value; + + public MyNameValuePair(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + + public void setName(String name) { + this.name = name; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowser.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowser.java new file mode 100755 index 000000000000..64bc6581e12b --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowser.java @@ -0,0 +1,132 @@ +package com.ibm.ws.fat.util.browser; + +import java.io.File; +import java.util.Properties; + +/** + *

    + * Simulates an Internet browser like Internet Explorer or Firefox, but uses one + * of a variety of implementations, including HttpUnit and Http Client. Both + * HttpUnit and Http Client can be used in some situations, but not others, so + * having a WebBrowser object makes it easier to switch between the two + * implementations. The WebBrowser object also prints messages that describe the + * browser's activity in a standard fashion. If the programmer desires a + * particular implementation (HttpUnit or Http Client), a WebBrowser of a + * particular type should be requested. Otherwise, a default implementation will + * be used. + *

    + * Multiple WebBrowser instances may be opened concurrently, and many threads + * can use a single instance at the same time. (While WebBrowser instances are + * thread-safe, there is a limit to the number of active connections allowed by + * the underlying implementation. For Http Client, that limit is 5 active + * connections to 4 different hosts). + *

    + * The user is responsible for verifying that the observed behavior of the web + * browser is appropriate for the given situation (based on the response code or + * page text returned by each page navigation). In other words, whenever you + * navigate to a page, you should always verify either that (A) the + * correct page text is returned or (B) the expected response code is returned. + * In cases where an error code is expected (4xx or 5xx), an exception will be + * thrown to explain the error code, so this exception should be checked if + * expected. + *

    + * Note that HtmlUnit was not used (instead of Http Client) because the only way + * to disable cookies in Html Unit is at a global level; in other words, all + * instances of all active WebBrowser objects would need to disable or enable + * cookies, and individual browsers could not choose whether to enable or + * disable cookies individually. (unverified) + *

    + * JavaScript and HTML Forms are not supported. Frames are supported, but nested + * frames are only partially supported. + *

    + * + * @author Tim Burns + */ +public interface WebBrowser { + + /** + * Sets authentication credentials for this instance on all hosts, ports, + * realms and authentication schemes. + * + * @param userName + * The user name + * @param password + * The password + * @throws WebBrowserException + * If credentials can not be set + */ + public void setAuthorization(String userName, String password) throws WebBrowserException; + + /** + * Configures this instance to accept cookies + * + * @param acceptCookies + * true to accept cookies, false to reject cookies + * @throws WebBrowserException + * if the cookie policy can not be set + */ + public void setAcceptCookies(boolean acceptCookies) throws WebBrowserException; + + /** + * Configures this instance to automatically follow redirects + * + * @param autoRedirect + * true to automatically follow redirects + * @throws WebBrowserException + * if the redirect policy can not be set + */ + public void setAutoRedirect(boolean autoRedirect) throws WebBrowserException; + + /** + * Retrieve the directory where web responses are automatically stored. Null + * indicates that responses will not be automatically stored. + * + * @return the directory where web responses are automatically stored. + */ + public File getResultDirectory(); + + /** + * Retrieve the unique identifier for this instance + * + * @return a unique identifier for this instance + */ + public int getNumber(); + + /** + * Submits an HTTP request to the given URL. The internal state of the + * browser will update based on the result of this operation. Note that a + * WebBrowser does not keep any record of previous pages where + * the user has navigated, so there is no "Back" or "Forward" button. + * Navigation to paths on the local file system is not supported. + * + * @param url + * The destination URL; normally starts with "http://..." or + * "https://..." + * @return the response from navigating to the specified url + * @throws WebBrowserException + * if navigation fails + */ + public WebResponse request(String url) throws WebBrowserException; + + public int request(String url, int expectedStatusCode) throws WebBrowserException; + + /** + * Resets the state of this client, removing all cookies etc + */ + public void reset() throws WebBrowserException; + + /** + * Attempts to "close" all windows associated with this browser instance. + * This operation is implementation-dependent, and not guaranteed to have + * any effect on the state of this instance. + */ + public void close() throws WebBrowserException; + + /** + * This method sets POSTMethod form values + * + * @param values - Parameters to set on Post method. + */ + public void setFormValues(Properties values); + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserCore.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserCore.java new file mode 100755 index 000000000000..8d525f01e4fe --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserCore.java @@ -0,0 +1,214 @@ +package com.ibm.ws.fat.util.browser; + +import java.io.File; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + *

    + * WebBrowserCore models the basic behavior of a + * WebBrowser. It logs standard information about the browser's + * activity, and produces a unique identifier for every WebBrowserCore + * instance that's constructed. + *

    + *

    + * All implementation-specific work is passed down to subclasses of + * WebBrowserCore, through a set of "perform" methods. + *

    + * + * @author Tim Burns + */ +public abstract class WebBrowserCore implements WebBrowser { + + private static final String CLASS_NAME = WebBrowserCore.class.getName(); + private static Logger LOG = Logger.getLogger(CLASS_NAME); + + private static final AtomicInteger BROWSER_COUNTER = new AtomicInteger(); + protected static final boolean DEFAULT_AUTO_REDIRECT_POLICY = true; + protected static final boolean DEFAULT_ACCEPT_COOKIE_POLICY = true; + + private final int number; + protected final AtomicInteger responseCounter; + protected boolean acceptCookies; + protected boolean autoRedirect; + protected final File resultDirectory; + protected String humanReadableString; + + protected abstract String getImplementationDescription(); + + protected WebBrowserCore(File resultDirectory) { + this.resultDirectory = resultDirectory; + this.number = BROWSER_COUNTER.incrementAndGet(); + this.responseCounter = new AtomicInteger(); + LOG.info("Opening " + this.toString() + " using " + this.getImplementationDescription()); + this.acceptCookies = DEFAULT_ACCEPT_COOKIE_POLICY; + this.autoRedirect = DEFAULT_AUTO_REDIRECT_POLICY; + this.humanReadableString = null; // initialize upon first invocation of toString() + } + + @Override + public String toString() { + if (this.humanReadableString == null) { + this.humanReadableString = this.getHumanReadableString(); + } + return this.humanReadableString; + } + + /** + * Produces a human-readable identifier for this instance; internally used + * for logging. + * + * @return a human-readable identifier for this instance. Must not return + * null! + */ + protected String getHumanReadableString() { + StringBuffer name = new StringBuffer(); + name.append("Web Browser "); + name.append(this.getNumber()); + return name.toString(); + } + + @Override + public int getNumber() { + return this.number; + } + + @Override + public File getResultDirectory() { + return this.resultDirectory; + } + + protected abstract void performSetAuthorization(String userName, String password) throws Throwable; + + @Override + public final void setAuthorization(String userName, String password) throws WebBrowserException { + String method = "setAuthorization"; + LOG.info(this.toString() + " will now authorize as user \"" + userName + "\" with password \"" + password + "\""); + try { + this.performSetAuthorization(userName, password); + } catch (Throwable e) { + String error = this.toString() + " was unable to configure its authorization settings."; + LOG.logp(Level.WARNING, CLASS_NAME, method, error, e); + throw new WebBrowserException(error, e); + } + } + + /** + * Submits an HTTP request and retrieves a response. + * + * @param url + * the location of the resource you want to request + * @return A response object populated with state information + * @throws Throwable + * if a problem occurs making the request or building the + * response + */ + protected abstract WebResponse submitRequest(String url, int number) throws Throwable; + + @Override + public WebResponse request(String url) throws WebBrowserException { + if (url == null) { + return null; + } + int requestNum = this.responseCounter.incrementAndGet(); + LOG.info("Submitting " + this.toString() + " Request " + requestNum + ": " + url); + try { + return this.submitRequest(url, requestNum); + } catch (Throwable e) { + throw new WebBrowserException(this.toString() + + " failed to complete request " + + requestNum + + "; the URL was " + + url + + ". This failure may have been caused by one or more underlying problems: please check test case output to confirm that the test was configured and started correctly. Possible causes: the server does not exist, the server failed to start, the application failed to install, the application failed to start, specific product features are not behaving correctly, etc.", e); + } + } + + /** + * Throws an exception if the status code indicates a client/server error. See + * Status Code Definitions.
    + *
    + *
      + *
    1. Informational 1xx
    2. + *
    3. Successful 2xx
    4. + *
    5. Redirection 3xx
    6. + *
    7. Client Error 4xx
    8. + *
    9. Server Error 5xx
    10. + *
    + * + * @param statusCode + * @param url + * @throws WebBrowserException + */ + protected void checkStatusCode(int statusCode, String url) throws WebBrowserException { + if (statusCode >= 400) { + throw new WebBrowserException("Server returned HTTP response code: " + statusCode + " for URL: " + url); + } + if (statusCode < 100) { // most likely indicates a WebBrowser implementation error + throw new WebBrowserException(this.getImplementationDescription() + " may have processed an HTTP request incorrectly. Encountered HTTP response code: " + statusCode + + " for URL: " + url); + } + } + + protected abstract void configureAcceptCookies() throws Throwable; + + @Override + public void setAcceptCookies(boolean acceptCookies) throws WebBrowserException { + LOG.info("Setting the cookie policy in " + this.toString()); + try { + this.acceptCookies = acceptCookies; + this.configureAcceptCookies(); + if (this.acceptCookies) { + LOG.info(this.toString() + " is now accepting cookies."); + } else { + LOG.info(this.toString() + " is now rejecting cookies."); + } + } catch (Throwable e) { + throw new WebBrowserException(this.toString() + " was unable to change its cookie policy.", e); + } + } + + protected abstract void configureAutoRedirect() throws Throwable; + + @Override + public void setAutoRedirect(boolean autoRedirect) throws WebBrowserException { + LOG.info("Setting the automatic redirect policy in " + this.toString()); + try { + this.autoRedirect = autoRedirect; + this.configureAutoRedirect(); + if (this.autoRedirect) { + LOG.info(this.toString() + " will now automatically follow HTTP redirects (status code 302, etc)."); + } else { + LOG.info(this.toString() + " will not automatically follow HTTP redirects."); + } + } catch (Throwable e) { + throw new WebBrowserException(this.toString() + " was unable to change its auto redirect policy.", e); + } + } + + protected abstract void performReset() throws Throwable; + + @Override + public void reset() throws WebBrowserException { + LOG.info("Clearing the state of " + this.toString()); + try { + this.performReset(); + } catch (Throwable cause) { + throw new WebBrowserException("Unable to clear the state of " + this.toString(), cause); + } + } + + protected abstract void performClose() throws Throwable; + + @Override + public void close() throws WebBrowserException { + LOG.info("Closing " + this.toString() + ". (This operation is not guaranteed to have any effect on the state of this instance)"); + try { + this.performClose(); + } catch (Throwable cause) { + throw new WebBrowserException("Unable to close " + this.toString(), cause); + } + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserException.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserException.java new file mode 100755 index 000000000000..f1f215be2082 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserException.java @@ -0,0 +1,47 @@ +package com.ibm.ws.fat.util.browser; + +/** + * Indicates that an operation performed on a WebBrowser instance failed. + * + * @author Tim Burns + */ +public class WebBrowserException extends Exception { + + private static final long serialVersionUID = 1L; + + /** + * Calls super() + */ + public WebBrowserException() { + super(); + } + + /** + * Calls super(message) + * + * @param message A message explaining the cause of the problem + */ + public WebBrowserException(String message) { + super(message); + } + + /** + * Calls super(cause) + * + * @param cause explains the cause of the problem + */ + public WebBrowserException(Throwable cause) { + super(cause); + } + + /** + * Calls super(message, cause) + * + * @param message explains the cause of the problem + * @param cause explains the cause of the problem + */ + public WebBrowserException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserFactory.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserFactory.java new file mode 100755 index 000000000000..bb727b993278 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserFactory.java @@ -0,0 +1,119 @@ +package com.ibm.ws.fat.util.browser; + +import java.io.File; + +/** + * Factory for WebBrowser instances. The default browser type is Http Client. + * + * @author Tim Burns + * + */ +public class WebBrowserFactory { + + protected static WebBrowserFactory INSTANCE; + + /** + * Convenience method for retrieving a globally shared factory + * + * @return a globally shared factory + */ + public static WebBrowserFactory getInstance() { + if (INSTANCE == null) { + INSTANCE = new WebBrowserFactory(); + } + return INSTANCE; + } + + protected WebBrowserType defaultType; + + /** + * Primary constructor. + */ + public WebBrowserFactory() { + this.defaultType = WebBrowserType.HttpClient; // default to HttpClient + } + + /** + * Creates a new WebBrowser instance. + * + * @param resultDirectory + * the directory where HTTP response bodies should be stored. + * null indicates that HTTP response bodies should not be stored. + * @param type + * the type of WebBrowser you want to create. null indicates that + * the default type should be used. + * @return a new WebBrowser instance. + */ + public WebBrowser createWebBrowser(File resultDirectory, WebBrowserType type) { + if (WebBrowserType.HttpClient.equals(type)) { + return new HttpClientBrowser(resultDirectory); + } else if (WebBrowserType.HttpUnit.equals(type)) { + return new HttpUnitBrowser(resultDirectory); + } else if (WebBrowserType.HttpUnit.equals(this.getDefaultType())) { + return new HttpUnitBrowser(resultDirectory); + } else { + return new HttpClientBrowser(resultDirectory); + } + } + + /** + * Creates a new WebBrowser instance. Convenience method for:
    + * factory.createWebBrowser(resultDirectory, factory.getDefaultType()); + * + * @param resultDirectory + * the directory where HTTP response bodies should be stored. + * null indicates that HTTP response bodies should not be stored. + * @return a new WebBrowser instance. + */ + public WebBrowser createWebBrowser(File resultDirectory) { + return this.createWebBrowser(resultDirectory, this.getDefaultType()); + } + + /** + * Creates a new WebBrowser instance. Convenience method for:
    + * factory.createWebBrowser(null, type); + * + * @param type + * the type of WebBrowser you want to create. null indicates that + * the default type should be used. + * @return a new WebBrowser instance. + */ + public WebBrowser createWebBrowser(WebBrowserType type) { + return this.createWebBrowser(null, type); + } + + /** + * Creates a new WebBrowser instance. Convenience method for:
    + * factory.createWebBrowser(null, factory.getDefaultType()); + * + * @return a new WebBrowser instance. + */ + public WebBrowser createWebBrowser() { + return this.createWebBrowser(null, this.getDefaultType()); + } + + /** + * Describes the default type of WebBrowser that this instance creates. + * + * @return the default type of WebBrowser that this instance creates. + */ + public WebBrowserType getDefaultType() { + return this.defaultType; + } + + /** + * Configures the default type of WebBrowser that this instance should + * create. + * + * @param type + * the default type of WebBrowser that this instance should + * create. null indicates that the current default type should be + * used. + */ + public void setDefaultType(WebBrowserType type) { + if (type != null) { + this.defaultType = type; + } + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserType.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserType.java new file mode 100755 index 000000000000..94f227ece668 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebBrowserType.java @@ -0,0 +1,12 @@ +package com.ibm.ws.fat.util.browser; + +/** + * Enumeration of all known WebBrowser implementations + * + * @author Tim Burns + * + */ +public enum WebBrowserType { + HttpUnit, + HttpClient; +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebLink.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebLink.java new file mode 100755 index 000000000000..d14bff6f4b17 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebLink.java @@ -0,0 +1,198 @@ +package com.ibm.ws.fat.util.browser; + +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * Convenience class for HTML anchor elements + * + * @author Tim Burns + */ +public class WebLink { + + protected final WebResponse response; + protected final int index; + protected final String name; + protected final String text; + protected final String id; + protected final String href; + protected final String url; + + /** + * Primary constructor + * + * @param response + * the WebResponse where this hyperlink is located. Must not be + * null. + * @param anchor + * The anchor element for this hyperlink found on the specified + * response + * @throws IllegalArgumentException + * if the specified WebResponse is null + * @throws WebBrowserException + * if a relative href can't be resolved + */ + protected WebLink(WebResponse response, Element anchor, int index) throws IllegalArgumentException, WebBrowserException { + if (response == null) { + throw new IllegalArgumentException("Unable to construct a " + this.getClass().getName() + " instance because the specified input argument is null: " + + WebResponse.class.getName()); + } + this.response = response; + this.index = index; + this.name = (anchor == null) ? null : anchor.getAttribute("name"); + this.href = (anchor == null) ? null : anchor.getAttribute("href"); + this.url = (this.href == null || this.href.trim().length() == 0) ? null : this.response.resolveRelativeUrl(this.href); + this.text = this.getText(anchor); + this.id = this.getId(anchor); + } + + @Override + public String toString() { + StringBuffer s = new StringBuffer(); + s.append(this.response.toString()); + s.append(" Anchor Index "); + s.append(this.index); + return s.toString(); + } + + /** + * Determines the ID of the specified anchor element by locating an + * attribute with the name "id".
    + *
    + * I wanted to use Attr.isId to determine if an attribute is of type ID; + * note that attributes with the name "ID" or "id" are not of type ID unless + * so defined (for compatibility with document.getElementById(id)).
    + * + * However, for some reason, calling attr.isId() result in + * "java.lang.AbstractMethodError: org/w3c/dom/Attr.isId()" when using an + * IBM JRE. That seems wrong to me, but whatever. + * + * @param element + * the element whose ID you want to determine + * @return the ID for the input element, or null if no ID can be found + */ + protected String getId(Element element) { + if (element == null) { + return null; + } + NamedNodeMap map = element.getAttributes(); + if (map == null) { + return null; + } + int numAttrs = map.getLength(); + for (int i = 0; i < numAttrs; i++) { + Attr attr = (Attr) map.item(i); + // if(attr.isId()) { // this doesn't appear to work, but I don't know why + if ("id".equals(attr.getNodeName())) { + return attr.getNodeValue(); + } + } + return null; + } + + /** + * Retrieve the text found inside the specified Element.
    + *
    + * For some reason, calling element.getTextContent() throws + * "java.lang.AbstractMethodError: org/w3c/dom/Node.getTextContent()" when + * using an IBM JRE. That seems wrong to me, but whatever. + * + * @param element + * The element whose text you want to examine + * @return the text inside the specified Element, or null if no text is + * found + */ + protected String getText(Element element) { + if (element == null) { + return null; + } + //return element.getTextContent(); // this doesn't appear to work, but I don't know why + NodeList children = element.getChildNodes(); + int numChildren = children.getLength(); + for (int i = 0; i < numChildren; i++) { + Node child = children.item(i); + if (Node.TEXT_NODE == child.getNodeType()) { + return child.getNodeValue(); + } + } + return null; + } + + /** + * Returns the value of the "name" attribute for this anchor element + * + * @return the name of this anchor, or null if no name is defined + */ + public String getName() { + return this.name; + } + + /** + * Returns the value of text found inside this anchor element + * + * @return the value of text found inside this anchor, or null if no text is + * defined + */ + public String getText() { + return this.text; + } + + /** + * Returns the ID of this anchor element (Attr.isId is used to determine if + * an attribute is of type ID; note that attributes with the name "ID" or + * "id" are not of type ID unless so defined) + * + * @return the ID of this anchor, or null if no ID is defined + */ + public String getId() { + return this.id; + } + + /** + * Returns the value of the "href" attribute for this anchor element. Note + * that this value may be path-relative + * + * @return the href of this anchor, or null if no href is defined + */ + public String getHref() { + return this.href; + } + + /** + * Gets the target of this anchor element by resolving the relative path + * defined by the "href" attribute. (If the "href" attribute does not define + * a relative path, then the value of the "href" attribute is returned). + * + * @return the target of this anchor element + */ + public String getUrl() { + return this.url; + } + + /** + * Gets the index of this anchor element on the page. + * + * @return the index of this anchor element on the page + */ + public int getIndex() { + return this.index; + } + + /** + * Makes an HTTP request for the resource defined by this anchor element. + * + * @return the response from the server from clicking on this hyperlink + * @throws WebBrowserException + * if any problem occurs + */ + public WebResponse click() throws WebBrowserException { + if (this.url == null) { + throw new WebBrowserException("Failed to click on " + this.toString() + " because the 'href' attribute is either null or empty."); + } + return this.response.getBrowser().request(this.url); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebResponse.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebResponse.java new file mode 100755 index 000000000000..b2f87065142f --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/browser/WebResponse.java @@ -0,0 +1,1501 @@ +package com.ibm.ws.fat.util.browser; + +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import com.ibm.ws.fat.util.StopWatch; +import com.ibm.ws.fat.util.browser.WebResponse.WebLinkFinder.FindLinkById; +import com.ibm.ws.fat.util.browser.WebResponse.WebLinkFinder.FindLinkByIndex; +import com.ibm.ws.fat.util.browser.WebResponse.WebLinkFinder.FindLinkByName; +import com.ibm.ws.fat.util.browser.WebResponse.WebLinkFinder.FindLinkByText; + +/** + * Encapsulates all the information returned from a server by submitting an HTTP + * request. Instances are pre-populated; in other words, all response + * information is cached in memory before the user is able to call any methods + * on a particular instance.
    + *
    + * WARNING: Request Headers are not fully supported (In some cases, HttpUnit + * does not allow you to view them). The requested URL of WebResponses from + * frames is not always supported (again, HttpUnit's support of this feature is + * limited). + * + * @author Tim Burns + * + */ +public class WebResponse { + + protected static final String TOP_LEVEL_FRAME_NAME = null; + protected static final String DEFAULT_FRAME_NAME = ""; + protected static final int TOP_LEVEL_FRAME_INDEX = -1; + private static final String CLASS_NAME = WebResponse.class.getName(); + private static Logger LOG = Logger.getLogger(CLASS_NAME); + + private final WebBrowser browser; + private final int number; + protected String url; + protected String requestedUrl; + protected String responseBody; + protected Document parsedResponseBody; + protected final List cookies = new ArrayList(); + protected final List requestHeaders = new ArrayList(); + protected final List responseHeaders = new ArrayList(); + protected final String frameName; + protected final int frameIndex; + protected List frames; + protected List anchors; + protected int responseCode; + protected String humanReadableString; + protected File lastFile; + protected Date start; + protected Date stop; + + /** + * Convenience constructor for top-level frames + * + * @param browser + * the parent web browser + * @param requestNum + * the number of this request (from the user) + */ + protected WebResponse(WebBrowser browser, int requestNum) { + this(browser, requestNum, TOP_LEVEL_FRAME_NAME, TOP_LEVEL_FRAME_INDEX); + } + + /** + * Convenience constructor for frames with no name + * + * @param browser + * the parent web browser + * @param requestNum + * the number of this request (from the user) + */ + protected WebResponse(WebBrowser browser, int requestNum, int frameIndex) { + this(browser, requestNum, DEFAULT_FRAME_NAME, frameIndex); + } + + /** + * Convenience constructor for frame with a name + * + * @param browser + * the parent web browser + * @param requestNum + * the number of this request (from the user) + * @param frameName + * the name of this frame + * @param frameIndex + * the index of this frame in the parent page + */ + protected WebResponse(WebBrowser browser, int requestNum, String frameName, int frameIndex) { + if (browser == null) { + throw new IllegalArgumentException("Unable to construct an instance of " + this.getClass().getName() + " becuase the parent WebBrowser is null."); + } + this.browser = browser; + this.number = requestNum; + this.url = null; + this.requestedUrl = null; + this.responseBody = null; + //this.cookies = null; + //this.requestHeaders = null; + //this.responseHeaders = null; + this.frames = new Vector(0, 1); + this.responseCode = -1; + this.humanReadableString = null; // initialize upon first invocation of toString() + this.frameName = frameName; + this.frameIndex = frameIndex; + this.anchors = null; + this.lastFile = null; + this.setStart(); + this.setStop(); + } + + @Override + public String toString() { + if (this.humanReadableString == null) { + this.humanReadableString = this.getHumanReadableString(); + } + return this.humanReadableString; + } + + /** + * Produces a human-readable identifier for this instance; internally used + * for logging. + * + * @return a human-readable identifier for this instance. Must not return + * null! + */ + protected String getHumanReadableString() { + StringBuffer name = new StringBuffer(); + name.append(this.getBrowser().toString()); + name.append(" Response "); + name.append(this.getNumber()); + if (this.frameIndex != TOP_LEVEL_FRAME_INDEX) { + name.append(" Frame "); + if (DEFAULT_FRAME_NAME.equals(this.frameName)) { + name.append("Index "); + name.append(this.frameIndex); + } else { + name.append("Name \""); + name.append(this.frameName); + name.append("\""); + } + } + return name.toString(); + } + + /** + * Retrieves the browser that submitted the request responsible for this + * instance + * + * @return the browser associated with this instance + */ + public WebBrowser getBrowser() { + return this.browser; + } + + /** + * Retrieve the unique identifier for this instance + * + * @return a unique identifier for this instance + */ + public int getNumber() { + return this.number; + } + + /** + * Convenience method for saving response information to the web browser's + * default result directory. Two files will be created in the specified + * directory, uniquely named for this instance. + * + * @throws WebBrowserException + * if response information cannot be saved + */ + public void save() throws WebBrowserException { + this.save(null); + } + + /** + * Convenience method for saving response information to a directory. Two + * files will be created in the specified directory, uniquely named for this + * instance. + * + * @param directory + * the directory where you want to store response information. + * null indicates that the browser's default result directory + * should be used (if the browser's default result directory is + * null, then no save will occur. + * + * @throws WebBrowserException + * if response information cannot be saved + */ + public void save(File directory) throws WebBrowserException { + File dir = directory; + if (dir == null) { + dir = this.getBrowser().getResultDirectory(); // may return null + } + if (dir == null) { + return; + } + // start with a human-readable String for this instance + String name = this.toString(); + + // replace the non-word characters with the empty String + name = name.replaceAll("\\W", ""); // "\W" is a regular expression for a non-word character; the opposite is "\w"=[a-zA-Z_0-9] + + // chose an extension that matches the content type (only supports XML and HTML) + List contentTypeList = this.getResponseHeader("Content-Type", true); + String contentType = (contentTypeList == null || contentTypeList.size() == 0) ? null : contentTypeList.get(0); + String ext = (contentType != null && contentType.contains("text/xml")) ? ".xml" : ".html"; // default to html + + // write the response body to the File + File body = new File(dir, name + "Body" + ext); + this.saveResponseBody(body); + + // write response information to the File + File info = new File(dir, name + "Info.txt"); + this.saveResponseInformation(info); + } + + /** + * Saves the body of this response to the specified File + * + * @param file + * the File where you want to store response information. + * null indicates that no save should be performed. + * @throws WebBrowserException + * if response information cannot be saved + */ + public void saveResponseBody(File file) throws WebBrowserException { + if (file == null) { + return; + } + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Saving the body of " + this.toString() + " to: " + file); + } + Vector body = new Vector(0, 1); + body.addElement(this.responseBody); + this.writeStringsToFile(file, body, false, false); // don't call getResponseBody(); that operation logs extra information + this.lastFile = file; + } + + /** + * Saves information about this response to the specified File (headers, + * cookies, etc) + * + * @param file + * the File where you want to store response information. null + * indicates that no save should be performed. + * @throws WebBrowserException + * if response information cannot be saved + */ + public void saveResponseInformation(File file) throws WebBrowserException { + if (file == null) { + return; + } + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Saving information about " + this.toString() + " to: " + file); + } + Vector info = new Vector(0, 1); + info.addElement(this.toString()); + info.addElement("Request URL: " + this.requestedUrl); // don't call getRequestedUrl(); that operation logs extra information (same logic applies for others below) + info.addElement("Response URL: " + this.url); + info.addElement("Response Code: " + this.responseCode); + info.addElement("Request Sent: " + StopWatch.formatTime(this.start)); + info.addElement("Response Parsed: " + StopWatch.formatTime(this.stop)); + info.addElement("Time Elapsed: " + StopWatch.convertMillisecondsToString(this.stop.getTime() - this.start.getTime())); + info.addElement("Request Headers:"); + for (String line : this.getSummary(this.requestHeaders)) { + info.addElement(line); + } + info.addElement("Response Headers:"); + for (String line : this.getSummary(this.responseHeaders)) { + info.addElement(line); + } + info.addElement("Cookies:"); + for (String line : this.getSummary(this.cookies)) { + info.addElement(line); + } + this.writeStringsToFile(file, info, false, true); + } + + /** + * Retrieves a File object that represents the last File containing the + * response body that was saved to the local file system using one of the + * save(...) methods. If no File was recently saved, returns null. + * + * @return the last File containing the response body that was saved to the + * local file system using one of the save(...) methods + */ + public File getResponseBodyAsFile() { + return this.lastFile; + } + + protected void writeStringsToFile(File file, List lines, boolean append, boolean appendEndLines) throws WebBrowserException { + if (file == null) { + return; + } + PrintWriter writer; + try { + File directory = file.getParentFile(); + if (!directory.exists()) { + directory.mkdirs(); + } + writer = new PrintWriter(new FileWriter(file, append), true); + } catch (Throwable cause) { + throw new WebBrowserException(this.toString() + " failed to open a " + FileWriter.class.getName() + " for the File " + file, cause); + } + try { + if (lines != null) { + for (String line : lines) { + if (appendEndLines) { + writer.println(line); + } else { + writer.print(line); + } + } + } + } catch (Throwable cause) { + throw new WebBrowserException(this.toString() + " failed to write to the File " + file, cause); + } finally { + try { + writer.close(); + } catch (Throwable cause) { + throw new WebBrowserException(this.toString() + " failed to close the " + FileWriter.class.getName() + " for the File " + file, cause); + } + } + } + + /** + * Retrieves the value of the specified response header, ignoring case if + * desired + * + * @param key + * the name of the response header to search for + * @param ignoreCase + * true indicates that the case of each character in the + * specified header should be ignored while searching for a match + * @return the value of the specified response header, or null if no such + * header is found + */ + public List getResponseHeader(String key, boolean ignoreCase) { + return this.getValue(this.responseHeaders, key, ignoreCase); + } + + /** + * Retrieves the value of the specified request header, ignoring case if + * desired + * + * @param key + * the name of the request header to search for + * @param ignoreCase + * true indicates that the case of each character in the + * specified header should be ignored while searching for a match + * @return the value of the specified request header, or null if no such + * header is found + */ + public List getRequestHeader(String key, boolean ignoreCase) { + return this.getValue(this.requestHeaders, key, ignoreCase); + } + + /** + * Retrieves the value of the specified cookie, ignoring case if desired + * + * @param key + * the name of the cookie to search for + * @param ignoreCase + * true indicates that the case of each character in the + * specified cookie key should be ignored while searching for a + * match + * @return the value of the specified cookie, or null if no such cookie is + * found + */ + public List getCookie(String key, boolean ignoreCase) { + return this.getValue(this.cookies, key, ignoreCase); + } + + protected List getValue(List map, String key, boolean ignoreCase) { + ArrayList returnedList = new ArrayList(); + if (map == null || key == null) { + return null; + } + for (MyNameValuePair p : map) { + String name = p.getName(); + if (ignoreCase) { + if (key.equalsIgnoreCase(name)) { + returnedList.add(p.getValue()); + } + } else { + if (key.equals(name)) { + returnedList.add(p.getValue()); + } + } + } + if (returnedList.size() > 0) { + return returnedList; + } + return null; + } + + protected void setStart() { + this.setStart(new Date(System.currentTimeMillis())); + } + + protected void setStart(Date time) { + this.start = time; + } + + protected void setStop() { + this.stop = new Date(System.currentTimeMillis()); + } + + protected void setUrl(String url) { + this.url = url; + } + + protected void setRequestedUrl(String url) { + this.requestedUrl = url; + } + + protected void setResponseBody(String responseBody) { + this.responseBody = responseBody; + } + + protected void addCookie(String name, String value) { + this.cookies.add(new MyNameValuePair(name, value)); + } + + protected void setResponseCode(int responseCode) { + this.responseCode = responseCode; + } + + /** + * Retrieves the request headers associated with the current page. + * + * @return the request headers associated with the current page. + */ + public List getRequestHeaders() { + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Request headers associated with " + this.toString() + ":"); + for (String line : this.getSummary(this.requestHeaders)) { + LOG.info(line); + } + } + return this.requestHeaders; + } + + protected void addRequestHeader(String name, String value) { + this.requestHeaders.add(new MyNameValuePair(name, value)); + } + + protected void addResponseHeader(String name, String value) { + this.responseHeaders.add(new MyNameValuePair(name, value)); + } + + /** + * Parses the response body as an HTML document, + * and caches the result for future reference. + * + * @return he response body as an HTML document + * @throws WebBrowserException if the response body does not contain valid HTML + */ + public Document getResponseBodyAsDocument() throws WebBrowserException { + if (this.parsedResponseBody == null) { + String method = "parseResponseBody"; + LOG.logp(Level.FINE, CLASS_NAME, method, "Parsing the body of " + this.toString()); + if (this.responseBody == null) { + throw new WebBrowserException("Unable to parse the body of " + this.toString() + " becuase the body is null"); + } + try { + return this.parsedResponseBody = HtmlParser.getInstance().parse(this.responseBody); + } catch (Throwable e) { + throw new WebBrowserException("Unable to parse the body of " + this.toString(), e); + } + } + return this.parsedResponseBody; + } + + /** + * Returns the name of the frame containing this page. If the frame has no + * name, then the empty String is returned. If this instance represents the + * top-level frame, null is returned. + * + * @return Returns the name of the frame containing this page. + */ + public String getFrameName() { + return this.frameName; + } + + /** + * Returns the index of the frame that contains this response, where frame + * indexes match the order that they appear in the parent frame. For + * example, if this response is contained by the first frame in the parent + * frame, then this method would return 0. If this response is the top-level + * frame, -1 is returned. + * + * @return the index of this frame on the parent page. + */ + public int getFrameIndex() { + return this.frameIndex; + } + + protected void addFrame(WebResponse frame) { + this.frames.add(frame); + } + + public List getFrames() { + if (LOG.isLoggable(Level.INFO)) { + LOG.info("The response body of " + this.toString() + " contains " + this.frames.size() + " frame(s)"); + } + return this.frames; + } + + /** + * Parses the response body to construct one WebResponse object for each + * HTML frame found in the body. The URL for each WebResponse has + * corresponds to the frame source of each frame, but no other response + * information is populated in the object. It is left to the caller to + * populate each WebResponse object, perhaps by making a request to the + * given URL. Each WebResponse is added to the cached List of frames for + * this instance. + * + * @throws WebBrowserException + * if a problem occurs while parsing the response body and + * constructing empty WebResponse objects + */ + protected void parseFrames() throws WebBrowserException { + String method = "parseFrames"; + try { + Document document = this.getResponseBodyAsDocument(); + LOG.logp(Level.FINE, CLASS_NAME, method, "Searching the body of " + this.toString() + " to locate all frame elements"); + NodeList elements = document.getElementsByTagName("frame"); + int numElements = elements.getLength(); + LOG.logp(Level.FINE, CLASS_NAME, method, "Found " + numElements + " frame(s)"); + for (int i = 0; i < numElements; i++) { + Element element = (Element) elements.item(i); + String src = element.getAttribute("src"); + if (src == null || src.trim().length() == 0) { + throw new IllegalArgumentException("Frame element " + i + " in " + this.toString() + " does not contain a 'src' attribute."); + } + String url = this.resolveRelativeUrl(src); + String name = element.getAttribute("name"); + WebResponse frame = null; + if (name == null || name.length() == 0) { + frame = new WebResponse(this.getBrowser(), this.getNumber(), i); + } else { + frame = new WebResponse(this.getBrowser(), this.getNumber(), name, i); + } + frame.setUrl(url); + frame.setRequestedUrl(url); + this.addFrame(frame); + } + } catch (Throwable e) { + throw new WebBrowserException("Failed to request frame elements in " + this.toString(), e); + } + } + + protected String resolveRelativeUrl(String relativeUrl) throws WebBrowserException { + URL url = null; + try { + url = new URL(relativeUrl); // see if the url isn't relative + } catch (MalformedURLException e) { + // usually, getting here indicates that theURL is relative + URL context = null; + try { + context = new URL(this.url); // don't call this.getUrl() to avoid unnecessary logging + } catch (MalformedURLException e1) { + throw new WebBrowserException("Failed to construct a URL object representing the url of " + this.toString() + ": " + this.url, e); + } + try { + url = new URL(context, relativeUrl); + } catch (MalformedURLException e1) { + throw new WebBrowserException("Failed to construct a URL object representing a relative url in " + this.toString() + ": " + relativeUrl, e); + } + } + return url.toString(); + } + + /** + * Parses the HTML of the current page to locate all anchor elements, and + * constructs one WebLink object to represent each anchor element. Caches + * the resulting list for future reference. If an error occurs while + * initializing one particular WebLink instance, a message will be logged, + * but an attempt will be made to initialize all other WebLink instances. + * + * @return a List of WebLink objects representing each anchor on this page. + * Never returns null, and each member of the list is not null. + * @throws WebBrowserException + * if the links can not be determined + */ + public List getLinks() throws WebBrowserException { + if (this.anchors == null) { + this.anchors = new Vector(0, 1); + Document document = this.getResponseBodyAsDocument(); + String method = "getAnchors"; + LOG.info("Searching the body of " + this.toString() + " to locate all anchor elements"); + NodeList anchors = document.getElementsByTagName("a"); + int numAnchors = anchors.getLength(); + for (int i = 0; i < numAnchors; i++) { + Element anchor = (Element) anchors.item(i); + try { + this.anchors.add(new WebLink(this, anchor, i)); + } catch (Exception e) { + // do not quit; try to initialize as many anchors as possible + LOG.log(Level.INFO, this.toString() + " failed to construct anchor element index " + i, e); + } + } + LOG.logp(Level.FINE, CLASS_NAME, method, "Found " + numAnchors + " anchor(s)"); + } + return this.anchors; + } + + /** + * Submits an HTTP request to the hyperlink indicated by the specified + * index. Hyperlinks are indexed by their relative position on the current + * response body. + * + * @param index + * the index of the desired hyperlink in the current response + * body + * @return the response received from submitting this request + * @throws WebBrowserException + * if a problem happens while submitting the HTTP request + */ + public WebResponse clickOnLinkByIndex(int index) throws WebBrowserException { + return new FindLinkByIndex(this, index).click(); + } + + /** + * Submits an HTTP request to the hyperlink indicated by the specified name. + * If multiple anchors share the same name, the first anchor found on the + * page will be clicked. + * + * @param name + * the name of the desired hyperlink in the current response body + * @return the response received from submitting this request + * @throws WebBrowserException + * if a problem happens while submitting the HTTP request + */ + public WebResponse clickOnLinkByName(String name) throws WebBrowserException { + return new FindLinkByName(this, name).click(); + } + + /** + * Submits an HTTP request to the hyperlink indicated by the specified ID. + * If multiple anchors share the same ID, the first anchor found on the + * page will be clicked. + * + * @param id + * the ID of the desired hyperlink in the current response body + * @return the response received from submitting this request + * @throws WebBrowserException + * if a problem happens while submitting the HTTP request + */ + public WebResponse clickOnLinkById(String id) throws WebBrowserException { + return new FindLinkById(this, id).click(); + } + + /** + * Submits an HTTP request to the hyperlink indicated by the specified text. + * If multiple anchors share the same text, the first anchor found on the + * page will be clicked. + * + * @param text + * the text of the desired hyperlink in the current response + * body; this is the text found within the anchor element. + * @return the response received from submitting this request + * @throws WebBrowserException + * if a problem happens while submitting the HTTP request + */ + public WebResponse clickOnLinkByText(String text) throws WebBrowserException { + return new FindLinkByText(this, text).click(); + } + + /** + * Retrieves the URL of the current page. Note that this URL may represent + * the redirected URL if the URL that was used to construct this object was + * itself a redirect page. To retrieve the original URL, use this.getRequestedUrl(). + * + * @return the URL of the current page + */ + public String getUrl() { + if (LOG.isLoggable(Level.INFO)) { + LOG.info("The URL associated with " + this.toString() + " is: " + this.url); + } + return this.url; + } + + /** + * Retrieves the URL that was used to submit the original request for this + * instance. To retrieve the redirected URL, use this.getUrl(). + * + * @return the URL of the original request + */ + public String getRequestedUrl() { + if (LOG.isLoggable(Level.INFO)) { + LOG.info("The request URL associated with " + this.toString() + " is: " + this.requestedUrl); + } + return this.requestedUrl; + } + + protected List getSummary(List pairs) { + Vector summary = new Vector(0, 1); + if (pairs == null || pairs.size() == 0) { + summary.addElement("(None)"); + } else { + int count = 1; + for (MyNameValuePair p : pairs) { + String name = p.getName(); + StringBuffer buffer = new StringBuffer(); + buffer.append(count); + buffer.append(": "); + buffer.append(name); + buffer.append("="); + buffer.append(p.getValue()); + summary.addElement(buffer.toString()); + count++; + } + } + return summary; + } + + /** + * Retrieves the cookies associated with the current page. + * + * @return the cookies associated with the current page. + */ + public List getCookies() { + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Cookies associated with " + this.toString() + ":"); + for (String line : this.getSummary(this.cookies)) { + LOG.info(line); + } + } + return this.cookies; + } + + /** + * Retrieves the response headers associated with the current page. + * + * @return the response headers associated with the current page. + */ + public List getResponseHeaders() { + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Response headers associated with " + this.toString() + ":"); + for (String line : this.getSummary(this.responseHeaders)) { + LOG.info(line); + } + } + return this.responseHeaders; + } + + /** + * This method filters the response headers to the header that we're looking for, and returns them in a String array. + * + * @param headerToFind - The header to find + * @return - A String array of any found headers. + */ + public String[] getResponseHeaders(String headerToFind) { + List selectedHeaders = new ArrayList(); + for (MyNameValuePair header : getResponseHeaders()) { + String headerName = header.getName(); + if (headerName.equalsIgnoreCase(headerToFind)) { + selectedHeaders.add(header.getValue()); + } + } + return selectedHeaders.toArray(new String[] {}); + } + + public int getStatusCode() { + return this.responseCode; + } + + /** + * Retrieves the status code of the response + * + * @return the status code of the response + */ + public int getResponseCode() { + if (LOG.isLoggable(Level.INFO)) { + LOG.info("The response code associated with " + this.toString() + " is " + this.responseCode + "."); + } + return this.responseCode; + } + + /** + * Retrieves the body of the response as a String + * + * @return the body of the response as a String + */ + public String getResponseBody() { + if (LOG.isLoggable(Level.INFO)) { + String method = "getResponseBody"; + LOG.info("Retrieving the response body from " + this.toString() + "."); + // it's usually not necessary to log this, since all responses can be saved anyway + if (LOG.isLoggable(Level.FINE)) { + LOG.logp(Level.FINE, CLASS_NAME, method, "The response body retrieved is:"); + LOG.logp(Level.FINE, CLASS_NAME, method, "~~~ Beginning of body ~~~"); + LOG.logp(Level.FINE, CLASS_NAME, method, this.responseBody); + LOG.logp(Level.FINE, CLASS_NAME, method, "~~~ End of body ~~~~~~~~~"); + } + } + return this.responseBody; + } + + /** + * Verifies that the response body contains the specified text + * + * @param text + * The text that should be found within the response body + * @return the response body + * @throws WebBrowserException + * if the response body does not contain the expected text + */ + public String verifyResponseBodyContains(String text) throws WebBrowserException { + return this.verifyResponseBody(text, true); + } + + /** + * Verifies that the response body does not contain the specified text + * + * @param text + * The text that shouldn't be found within the response body + * @return the response body + * @throws WebBrowserException + * if the validation fails + */ + public String verifyResponseBodyDoesNotContain(String text) throws WebBrowserException { + return this.verifyResponseBody(text, false); + } + + /** + * Verifies that the response body contains (or does not contain) the + * specified text + * + * @param text + * The text that should (or shouldn't) be found within the + * response body + * @param contained + * true indicates that the text should be found within the + * response body; false indicates that the text should not be + * found + * @return the response body + * @throws WebBrowserException + * if the validation fails + */ + public String verifyResponseBody(String text, boolean contained) throws WebBrowserException { + String msg = contained ? "contains" : "does not contain"; + LOG.info("Verifying that the body of " + this.toString() + " " + msg + ": " + text); + if (text == null) { + throw new IllegalArgumentException("Unable to verify the body of " + this.toString() + " because the search text is null."); + } + if (this.responseBody == null) { + throw new WebBrowserException("The body of " + this.toString() + " is null."); + } + boolean foundText = this.responseBody.indexOf(text) >= 0; + if (contained) { + if (!foundText) { + throw new WebBrowserException("The body of " + this.toString() + " does not contain: " + text + + " - Response body: " + this.responseBody); + } + } else { + if (foundText) { + throw new WebBrowserException("The body of " + this.toString() + " contains: " + text); + } + } + LOG.info("Yep!"); + return this.responseBody; + } + + /** + * Verifies that the response body contains (or does not contain) the + * specified text + * + * @param text + * The text that should be found within the response body + * @param desiredMatches + * The number of times the matching text should be found + * @param extraMatch + * (Optional) additional text to match, this can be null if + * there is no more text to match. + * @return the response body + * @throws WebBrowserException + * if the validation fails + */ + public String verifyResponseBodyWithRepeatMatchAndExtra(String match, int desiredMatches, String extraMatch) throws WebBrowserException { + LOG.info("Verifying that the body of " + this.toString() + " :Contains: " + match); + LOG.info(" :Exact Number of matches needed is: " + desiredMatches); + LOG.info(" :Extra matching string is: " + extraMatch); + + if (match == null) { + throw new IllegalArgumentException("Unable to verify the body of " + this.toString() + " because the search text is null."); + } + if (this.responseBody == null) { + throw new WebBrowserException("The body of " + this.toString() + " is null."); + } + + int fromIndex = 0; + int foundMatches = 0; + while (true) { + fromIndex = this.responseBody.indexOf(match, fromIndex); + if (fromIndex >= 0) { + foundMatches++; + fromIndex++; + } else { + break; + } + } + + // boolean foundText = this.responseBody.indexOf(text) >= 0; + if (foundMatches != desiredMatches) { + throw new WebBrowserException("The body of " + this.toString() + + " for search text of: " + match + + " number of matches found was: " + foundMatches + + " but desired number to find was: " + desiredMatches + + ". The full text of the response was: " + + System.getProperty("line.separator") + responseBody); + } + + if (extraMatch != null) { + boolean foundExtraText = this.responseBody.indexOf(extraMatch) >= 0; + + if (!foundExtraText) { + throw new WebBrowserException("The body of " + this.toString() + " does not contain: " + extraMatch); + } + } + + LOG.info("Yep!"); + return this.responseBody; + } + + /** + * Verifies that the response code matches the specified response code + * + * @param expectedResponseCode + * the value that should match the response code + * @return the response code + * @throws WebBrowserException + * if the response code does not match the expected code + */ + public int verifyResponseCodeEquals(int expectedResponseCode) throws WebBrowserException { + LOG.info("Verifying that the response code of " + this.toString() + " is: " + expectedResponseCode); + if (this.responseCode != expectedResponseCode) { + throw new WebBrowserException("The response code of " + this.toString() + " is " + this.responseCode + "; expected " + expectedResponseCode); + } + LOG.info("Yep!"); + return this.responseCode; + } + + /** + * Verifies that the URL matches the specified URL + * + * @param expectedUrl + * the value that should match the URL + * @return the URL + * @throws WebBrowserException + * if the URL does not match the expected URL + */ + public String verifyUrlEquals(String expectedUrl) throws WebBrowserException { + LOG.info("Verifying that the URL of " + this.toString() + " is: " + expectedUrl); + boolean notEqual = (this.url == null) ? (expectedUrl != null) : !this.url.equals(expectedUrl); + if (notEqual) { + throw new WebBrowserException("The URL of " + this.toString() + " is " + this.url + "; expected " + expectedUrl); + } + LOG.info("Yep!"); + return this.url; + } + + /** + * Verifies that a response header is formatted correctly. + * + * @param key + * The key of the response header to check + * @param ignoreKeyCase + * Ignore the case of the specified key (true indicates that + * capital letters don't matter) + * @param exists + * true indicates that the specified response header should + * exist; false indicates that the specified response header + * should not exist + * @throws WebBrowserException + * if the response header is not formatted correctly + * @return the value of the response header that was checked + */ + public List verifyResponseHeaderExists(String key, boolean ignoreKeyCase, boolean exists) throws WebBrowserException { + return this.verifyKeyExists(this.responseHeaders, "Response Header", key, ignoreKeyCase, exists); + } + + /** + * Verifies that a response header is formatted correctly. + * + * @param key + * The key of the response header to check + * @param ignoreKeyCase + * Ignore the case of the specified key (true indicates that + * capital letters don't matter) + * @param value + * The value that should (or should not) match the specified + * response header. null indicates that the header should not + * exist. + * @param equals + * true indicates that the specified response header should match + * the input value; false indicates that the specified response + * header should not match the input value + * @param ignoreValueCase + * Ignore the case of the specified value (true indicates that + * capital letters don't matter) + * @throws WebBrowserException + * if the response header is not formatted correctly + * @return the value of the response header that was checked + */ + public String verifyResponseHeaderEquals(String key, boolean ignoreKeyCase, String value, boolean equals, boolean ignoreValueCase) throws WebBrowserException { + return this.verifyKeyEquals(this.responseHeaders, "Response Header", key, ignoreKeyCase, value, equals, ignoreValueCase); + } + + /** + * Verifies that a response header is formatted correctly. + * + * @param key + * The key of the response header to check + * @param ignoreKeyCase + * Ignore the case of the specified key (true indicates that + * capital letters don't matter) + * @param value + * The value that should (or should not) be contained in the + * specified response header. null indicates that the header + * should not exist. + * @param contains + * true indicates that the specified response header should + * contain the input value; false indicates that the specified + * response header should not contain the input value + * @param ignoreValueCase + * Ignore the case of the specified value (true indicates that + * capital letters don't matter) + * @return the value of the response header that was checked + * @throws WebBrowserException + * if the response header is not formatted correctly + */ + public String verifyResponseHeaderContains(String key, boolean ignoreKeyCase, String value, boolean contains, boolean ignoreValueCase) throws WebBrowserException { + return this.verifyKeyContains(this.responseHeaders, "Response Header", key, ignoreKeyCase, value, contains, ignoreValueCase); + } + + /** + * Verifies that a request header is formatted correctly. + * + * @param key + * The key of the request header to check + * @param ignoreKeyCase + * Ignore the case of the specified key (true indicates that + * capital letters don't matter) + * @param exists + * true indicates that the specified request header should + * exist; false indicates that the specified request header + * should not exist + * @return the value of the request header that was checked + * @throws WebBrowserException + * if the request header is not formatted correctly + */ + public List verifyRequestHeaderExists(String key, boolean ignoreKeyCase, boolean exists) throws WebBrowserException { + return this.verifyKeyExists(this.requestHeaders, "Request Header", key, ignoreKeyCase, exists); + } + + /** + * Verifies that a request header is formatted correctly. + * + * @param key + * The key of the request header to check + * @param ignoreKeyCase + * Ignore the case of the specified key (true indicates that + * capital letters don't matter) + * @param value + * The value that should (or should not) be contained in the + * specified request header. null indicates that the header + * should not exist. + * @param contains + * true indicates that the specified request header should + * contain the input value; false indicates that the specified + * request header should not contain the input value + * @param ignoreValueCase + * Ignore the case of the specified value (true indicates that + * capital letters don't matter) + * @return the value of the request header that was checked + * @throws WebBrowserException + * if the request header is not formatted correctly + */ + public String verifyRequestHeaderContains(String key, boolean ignoreKeyCase, String value, boolean contains, boolean ignoreValueCase) throws WebBrowserException { + return this.verifyKeyContains(this.requestHeaders, "Request Header", key, ignoreKeyCase, value, contains, ignoreValueCase); + } + + /** + * Verifies that a request header is formatted correctly. + * + * @param key + * The key of the request header to check + * @param ignoreKeyCase + * Ignore the case of the specified key (true indicates that + * capital letters don't matter) + * @param value + * The value that should (or should not) match the specified + * request header. null indicates that the header should not + * exist. + * @param equals + * true indicates that the specified request header should match + * the input value; false indicates that the specified request + * header should not match the input value + * @param ignoreValueCase + * Ignore the case of the specified value (true indicates that + * capital letters don't matter) + * @return the value of the request header that was checked + * @throws WebBrowserException + * if the request header is not formatted correctly + */ + public String verifyRequestHeaderEquals(String key, boolean ignoreKeyCase, String value, boolean equals, boolean ignoreValueCase) throws WebBrowserException { + return this.verifyKeyEquals(this.requestHeaders, "Request Header", key, ignoreKeyCase, value, equals, ignoreValueCase); + } + + /** + * Verifies that a cookie is formatted correctly. + * + * @param key + * The key of the cookie to check + * @param ignoreKeyCase + * Ignore the case of the specified key (true indicates that + * capital letters don't matter) + * @param exists + * true indicates that the specified cookie should exist; false + * indicates that the specified cookie should not exist + * @return the value of the cookie that was checked + * @throws WebBrowserException + * if the cookie is not formatted correctly + */ + public List verifyCookieExists(String key, boolean ignoreKeyCase, boolean exists) throws WebBrowserException { + return this.verifyKeyExists(this.cookies, "Cookie", key, ignoreKeyCase, exists); + } + + /** + * Verifies that a cookie is formatted correctly. + * + * @param key + * The key of the cookie to check + * @param ignoreKeyCase + * Ignore the case of the specified key (true indicates that + * capital letters don't matter) + * @param value + * The value that should (or should not) be contained in the + * specified cookie. null indicates that the cookie should not + * exist. + * @param contains + * true indicates that the specified cookie should contain the + * input value; false indicates that the specified cookie should + * not contain the input value + * @param ignoreValueCase + * Ignore the case of the specified value (true indicates that + * capital letters don't matter) + * @return the value of the cookie that was checked + * @throws WebBrowserException + * if the cookie is not formatted correctly + */ + public String verifyCookieContains(String key, boolean ignoreKeyCase, String value, boolean contains, boolean ignoreValueCase) throws WebBrowserException { + return this.verifyKeyContains(this.cookies, "Cookie", key, ignoreKeyCase, value, contains, ignoreValueCase); + } + + /** + * Verifies that a cookie is formatted correctly. + * + * @param key + * The key of the cookie to check + * @param ignoreKeyCase + * Ignore the case of the specified key (true indicates that + * capital letters don't matter) + * @param value + * The value that should (or should not) match the specified + * cookie. null indicates that the cookie should not exist. + * @param equals + * true indicates that the specified cookie should match the + * input value; false indicates that the specified cookie should + * not match the input value + * @param ignoreValueCase + * Ignore the case of the specified value (true indicates that + * capital letters don't matter) + * @return the value of the cookie that was checked + * @throws WebBrowserException + * if the cookie is not formatted correctly + */ + public String verifyCookieEquals(String key, boolean ignoreKeyCase, String value, boolean equals, boolean ignoreValueCase) throws WebBrowserException { + return this.verifyKeyEquals(this.cookies, "Cookie", key, ignoreKeyCase, value, equals, ignoreValueCase); + } + + protected String getKeyName(String type, String key, boolean ignoreKeyCase) { + StringBuffer keyNameBuffer = new StringBuffer(); + keyNameBuffer.append(type); + keyNameBuffer.append(" with key="); + if (key == null) { + keyNameBuffer.append("(null)"); + } else { + keyNameBuffer.append("\""); + keyNameBuffer.append(key); + keyNameBuffer.append("\""); + if (ignoreKeyCase) { + keyNameBuffer.append(" (ignoring case)"); + } + } + return keyNameBuffer.toString(); + } + + protected String getValueDescription(String value, boolean ignoreValueCase) { + StringBuffer description = new StringBuffer(); + if (value == null) { + description.append("(null)"); + } else { + description.append("\""); + description.append(value); + description.append("\""); + if (ignoreValueCase) { + description.append(" (ignoring case)"); + } + } + return description.toString(); + } + + protected List verifyKeyExists(List map, String type, String key, boolean ignoreKeyCase, boolean exists) throws WebBrowserException { + String methodName = "verifyKeyExists"; + List actualValue = this.getValue(map, key, ignoreKeyCase); + String keyName = this.getKeyName(type, key, ignoreKeyCase); + if (exists) { + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Verifying that " + this.toString() + " has a " + keyName); + if (actualValue == null) { + throw new WebBrowserException(this.toString() + " should have a " + keyName); + } + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Yep!"); + } else { + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Verifying that " + this.toString() + " does not have a " + keyName); + if (actualValue == null) { + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Yep!"); + } else { + throw new WebBrowserException(this.toString() + " should not have a " + keyName); + } + } + return actualValue; + } + + protected String verifyKeyContains(List map, String type, String key, boolean ignoreKeyCase, String value, boolean contains, boolean ignoreValueCase) throws WebBrowserException { + List actualValues = this.verifyKeyExists(map, type, key, ignoreKeyCase, (value != null)); + //List actualValues = this.getValues(map, type, key, ignoreKeyCase, (value!=null)); + String keyName = this.getKeyName(type, key, ignoreKeyCase); + boolean passed = false; + String errorText = ""; + String resultActualValue = null; + if (actualValues != null) { + for (String actualValue : actualValues) { + if (actualValue != null) { // if actualValue==null when it shouldn't, this.verifyKeyExists(...) will throw an appropriate exception + String methodName = "verifyKeyContains"; + String actualValueUpper = ignoreValueCase ? actualValue.toUpperCase() : actualValue; + String valueUpper = (ignoreValueCase && value != null) ? value.toUpperCase() : value; + boolean isContained = actualValueUpper.contains(valueUpper); + String valueDescription = this.getValueDescription(value, ignoreValueCase); + if (contains) { + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Verifying that the " + keyName + " of " + this.toString() + " contains the text " + valueDescription + + " ..."); + if (isContained) { + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Yep!"); + resultActualValue = actualValue; + passed = true; + } else { + errorText = this.toString() + " has a " + keyName + ", but the value should contain the text " + valueDescription + ". Value=" + actualValue; + } + } else { + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Verifying that the " + keyName + " of " + this.toString() + " does not contain the text " + + valueDescription + " ..."); + if (isContained) { + errorText = this.toString() + " has a " + keyName + ", but the value should not contain the text " + valueDescription + ". Value=" + actualValue; + } else { + resultActualValue = actualValue; + passed = true; + } + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Yep!"); + } + } + } + } else { //actualValues was null. pass if the value is null + if (value == null) { + passed = true; + } + } + if (!passed) { + throw new WebBrowserException(errorText); + } else { + return resultActualValue; + } + } + + protected String verifyKeyEquals(List map, String type, String key, boolean ignoreKeyCase, String value, boolean equals, boolean ignoreValueCase) throws WebBrowserException { + List actualValues = this.verifyKeyExists(map, type, key, ignoreKeyCase, (value != null)); + String keyName = this.getKeyName(type, key, ignoreKeyCase); + boolean passed = false; + String errorText = ""; + String resultActualValue = null; + if (actualValues != null) { + for (String actualValue : actualValues) { + if (actualValue != null) { // if actualValue==null when it shouldn't, this.verifyKeyExists(...) will throw an appropriate exception + String methodName = "verifyKeyEquals"; + boolean equal = ignoreValueCase ? actualValue.equalsIgnoreCase(value) : actualValue.equals(value); + String valueDescription = this.getValueDescription(value, ignoreValueCase); + if (equals) { + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Verifying that the " + keyName + " of " + this.toString() + " equals " + valueDescription + " ..."); + if (equal) { + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Yep!"); + passed = true; + resultActualValue = actualValue; + } else { + errorText = this.toString() + " has a " + keyName + ", but the value should equal " + valueDescription + ". Value=" + actualValue; + } + } else { + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Verifying that the " + keyName + " of " + this.toString() + " does not equal " + valueDescription + " ..."); + if (equal) { + errorText = this.toString() + " has a " + keyName + ", but the value should not equal " + valueDescription + ". Value=" + actualValue; + } else { + passed = true; + resultActualValue = actualValue; + } + LOG.logp(Level.INFO, CLASS_NAME, methodName, "Yep!"); + } + } + } + } else {//actualValues was null. pass if the value is null + if (value == null) { + passed = true; + } + } + if (!passed) { + throw new WebBrowserException(errorText); + } else { + return resultActualValue; + } + } + + /** + * Convenience class for HTML anchor elements; provides assistance with + * finding a specific anchor element and clicking on it. + * + * @author Tim Burns + * + */ + static class WebLinkFinder { + + final WebResponse response; + final String identifier; + final String description; + + /** + * Primary constructor + * + * @param response + * the WebResponse where this hyperlink is located. Must not + * be null. + * @param identifier + * information that uniquely identifies this hyperlink on the + * page + * @param description + * a human-readable description of the information that + * uniquely identifies this hyperlink + * @throws IllegalArgumentException + * if the specified WebResponse is null + */ + WebLinkFinder(WebResponse response, String identifier, String description) throws IllegalArgumentException { + if (response == null) { + throw new IllegalArgumentException("Unable to construct a " + this.getClass().getName() + " instance because the specified input argument is null: " + + WebResponse.class.getName()); + } + this.response = response; + this.identifier = (identifier == null) ? new String() : identifier; + this.description = description + "=\"" + identifier + "\""; + } + + /** + * Locates this hyperlink inside the encapsulated WebResponse. Default + * implementation iterates over all anchor elements found in the + * WebResponse, and calls this.matches(element) to determine if the + * current anchor is the desired anchor. + * + * @return an anchor element representing this hyperlink + * @throws WebBrowserException if there is a problem + * detecting the requested hyperlink + */ + WebLink find() throws WebBrowserException { + List links = this.response.getLinks(); + for (WebLink link : links) { + if (this.matches(link)) { + return link; + } + } + return null; + } + + /** + * Determines if the specified anchor element matches the desired anchor + * element. The default implementation always returns true. + * + * @param link + * the WebLink to check + * @return true if the specified anchor matches the desired anchor + */ + boolean matches(WebLink link) { + return true; + } + + /** + * Locates the this hyperlink on the encapsulated WebResponse and makes + * an HTTP request for the resource defined by that hyperlink + * + * @return the response from the server from clicking on this hyperlink + * @throws IllegalArgumentException + * if the specified link cannot be found + * @throws IllegalStateException + * if any problem occurs while clicking the link + */ + WebResponse click() throws IllegalArgumentException, WebBrowserException { + try { + WebLink link = this.find(); + if (link == null) { + throw new IllegalArgumentException(this.response.toString() + " does not contain an anchor element with " + this.description); + } + return link.click(); + } catch (Exception e) { + throw new WebBrowserException(this.response.toString() + " failed to click on the link with " + this.description, e); + } + } + + static class FindLinkByText extends WebLinkFinder { + + FindLinkByText(WebResponse response, String text) throws IllegalArgumentException { + super(response, text, "text content"); + } + + @Override + boolean matches(WebLink link) { + return this.identifier.equals(link.getText()); + } + + } + + static class FindLinkByName extends WebLinkFinder { + + FindLinkByName(WebResponse response, String name) throws IllegalArgumentException { + super(response, name, "name"); + } + + @Override + boolean matches(WebLink link) { + return this.identifier.equals(link.getName()); + } + + } + + static class FindLinkById extends WebLinkFinder { + + FindLinkById(WebResponse response, String id) throws IllegalArgumentException { + super(response, id, "ID"); + } + + @Override + boolean matches(WebLink link) { + return this.identifier.equals(link.getId()); + } + + } + + static class FindLinkByIndex extends WebLinkFinder { + + FindLinkByIndex(WebResponse response, int index) throws IllegalArgumentException { + super(response, Integer.toString(index), "index"); + } + + @Override + WebLink find() throws WebBrowserException { + int index = Integer.parseInt(this.identifier); + List links = this.response.getLinks(); + int size = links.size(); + if (size <= index) { + throw new IllegalArgumentException(this.toString() + " failed to locate an anchor element with " + this.description + "; total anchor elements found on page: " + + size); + } + return links.get(index); + } + + } + + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/JmxConnection.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/JmxConnection.java new file mode 100755 index 000000000000..1bd188f95154 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/JmxConnection.java @@ -0,0 +1,299 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util.jmx; + +import java.io.IOException; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.MBeanAttributeInfo; +import javax.management.MBeanInfo; +import javax.management.MBeanNotificationInfo; +import javax.management.MBeanOperationInfo; +import javax.management.MBeanParameterInfo; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +import com.ibm.ws.fat.util.PropertyMap; +import com.ibm.ws.fat.util.Props; + +/** + * Convenience class to perform standard operations with a {@link JMXConnector} and {@link MBeanServerConnection}. + * + * @author Tim Burns + */ +public class JmxConnection { + + // static class ApplicationMBeanListener implements NotificationListener { + // private final DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); + // + // @Override + // public void handleNotification(Notification notification, Object handback) { + // if (notification == null) { + // LOG.info("Received notification, but it's null"); + // } else { + // LOG.info("Notification " + notification.getSequenceNumber()); + // LOG.info(" Message : " + notification.getMessage()); + // LOG.info(" Time Stamp : " + dateFormat.format(new Date(notification.getTimeStamp()))); + // LOG.info(" Type : " + notification.getType()); + // LOG.info(" Handback : " + handback); + // LOG.info(" Source : " + notification.getSource()); + // LOG.info(" User Data : " + notification.getUserData()); + // } + // } + // } + + private static final Logger LOG = Logger.getLogger(JmxConnection.class.getName()); + + private JMXConnector jmxConnector; + private String connectionId; + private MBeanServerConnection mbsc; + + /** + * Establishes a JMX connection. + * The {@link #close()} method must be called after you are done with the connection. + * If a connection is already open, it will be closed before a new connection is established. + * + * @param url the address to connect to + * @throws JmxException if the connection fails + * @see #close() + * @see {@link JmxServiceUrlFactory} + */ + public void open(JMXServiceURL url) throws JmxException { + this.close(); // in case a connection is already open + try { + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Establishing a JMX conection to URL: " + url); + } + this.jmxConnector = JMXConnectorFactory.connect(url); + this.connectionId = this.jmxConnector.getConnectionId(); + this.mbsc = this.jmxConnector.getMBeanServerConnection(); + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Connection established! ID: " + this.connectionId); + } + } catch (IOException e) { + // something's wrong with the connection, disconnect immediately and throw an exception + try { + this.close(); + } catch (Exception e1) { + // don't throw this exception, throw the original exception + if (LOG.isLoggable(Level.FINE)) { + LOG.log(Level.FINE, "Failed to close a JMX connection after a connection attempt failed", e1); + } + } + throw new JmxException("Failed to establish a JMX connection to URL: " + url.toString(), e); + } + } + + /** + * Closes a JMX connection. If no connection has been established, this method does nothing. + * + * @throws JmxException if the connection cannot be closed cleanly. + * If this exception is thrown, it is not known whether the server + * end of the connection has been cleanly closed. + */ + public void close() throws JmxException { + if (this.jmxConnector != null) { + try { + try { + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Closing JMX connection with ID: " + this.connectionId); + } + this.jmxConnector.close(); + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Connection closed."); + } + } catch (IOException e) { + throw new JmxException("Failed to close JMX connection with ID: " + this.connectionId, e); + } + } finally { + this.jmxConnector = null; + this.connectionId = null; + this.mbsc = null; + } + } + } + + /** + * Retrieve the current {@link MBeanServerConnection} + * + * @return the current {@link MBeanServerConnection} + * @throws IllegalStateException if no connection exists + */ + protected MBeanServerConnection getMBeanServerConnection() throws IllegalStateException { + if (this.mbsc == null) { + throw new IllegalStateException("An attempt was made to operate on MBean without a JMX connection."); + } + return this.mbsc; + } + + /** + * Invokes an operation on an MBean with the current connection + * + * @param objectName the MBean to invoke + * @param operationName the operation to invoke on the MBean + * @param params parameters for the operation + * @param signature the class signature of the operation + * @return the result of the operation + * @throws JmxException if the operation fails + */ + public Object invoke(ObjectName objectName, String operationName, Object[] params, String[] signature) throws JmxException { + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Invoking an MBean operation"); + PropertyMap args = new PropertyMap(); + args.put("Object Name", objectName); + args.put("Operation Name", operationName); + args.put("Param", params); + args.put("Signature", signature); + args.log(Level.INFO, " ", false); + } + Object result; + try { + MBeanServerConnection conn = this.getMBeanServerConnection(); + // String handback = "Operation: " + operationName; + // ApplicationMBeanListener listener = new ApplicationMBeanListener(); + // conn.addNotificationListener(name, listener, null, handback); + result = conn.invoke(objectName, operationName, params, signature); + } catch (Exception e) { + throw new JmxException("Failed to invoke the \"" + operationName + "\" operation on " + objectName, e); + } + if (LOG.isLoggable(Level.INFO)) { + LOG.info("MBean operation completed. Result: " + result); + } + return result; + } + + /** + * Logs the canonical name of all registered MBeans + * + * @param level the level where you want to log the names + * @throws JmxException if the names can't be queried + */ + public void logObjectNames(Level level) throws JmxException { + if (!LOG.isLoggable(level)) { + return; + } + try { + Set objectNames = this.getMBeanServerConnection().queryNames(null, null); + for (ObjectName objectName : objectNames) { + LOG.log(level, objectName.getCanonicalName()); + } + } catch (Exception e) { + throw new JmxException("Failed to log canonical name of all registered MBeans", e); + } + } + + /** + * Logs detailed information about a specific MBean + * + * @param level the level where you want to log MBean details + * @param name the name of the MBean to log + * @throws JmxException if MBean information can't be retrieved + */ + public void logMBeanInfo(Level level, ObjectName name) throws JmxException { + if (!LOG.isLoggable(level)) { + return; + } + Props props = Props.getInstance(); + String mediumDelimiter = props.getProperty(Props.LOGGING_BREAK_MEDIUM); + String smallDelimiter = props.getProperty(Props.LOGGING_BREAK_SMALL); + LOG.log(level, mediumDelimiter); + LOG.log(level, "MBean: " + name.getCanonicalName()); + MBeanInfo bean; + try { + bean = this.getMBeanServerConnection().getMBeanInfo(name); + } catch (Exception e) { + throw new JmxException("Failed to get MBeanInfo for: " + name, e); + } + MBeanOperationInfo[] operations = bean.getOperations(); + if (operations == null || operations.length < 1) { + LOG.log(level, "(No operations)"); + } else { + for (MBeanOperationInfo operation : operations) { + LOG.log(level, smallDelimiter); + LOG.log(level, "Operation : " + operation.getName()); + LOG.log(level, "Description : " + operation.getDescription()); + LOG.log(level, "Returns : " + operation.getReturnType()); + LOG.log(level, "Impact : " + operation.getImpact()); + MBeanParameterInfo[] params = operation.getSignature(); + if (params == null || params.length < 1) { + LOG.log(level, "Parameters : (none)"); + } else { + for (int i = 0; i < params.length; i++) { + MBeanParameterInfo param = params[i]; + LOG.log(level, "Parameter " + i + " : "); + LOG.log(level, " Type : " + param.getType()); + LOG.log(level, " Name : " + param.getName()); + LOG.log(level, " Description : " + param.getDescription()); + } + } + } + } + MBeanAttributeInfo[] attrs = bean.getAttributes(); + if (attrs == null || attrs.length < 1) { + LOG.log(level, "(No attributes)"); + } else { + for (int i = 0; i < attrs.length; i++) { + MBeanAttributeInfo attr = attrs[i]; + LOG.log(level, smallDelimiter); + LOG.log(level, "Attribute : " + attr.getName()); + LOG.log(level, "Type : " + attr.getType()); + LOG.log(level, "Description : " + attr.getDescription()); + } + } + MBeanNotificationInfo[] notifications = bean.getNotifications(); + if (notifications == null || notifications.length < 1) { + LOG.log(level, "(No notifications)"); + } else { + for (int i = 0; i < notifications.length; i++) { + MBeanNotificationInfo notification = notifications[i]; + LOG.log(level, smallDelimiter); + LOG.log(level, "Notification : " + notification.getName()); + LOG.log(level, "Description : " + notification.getDescription()); + LOG.log(level, "Types :"); + String[] notifTypes = notification.getNotifTypes(); + for (String type : notifTypes) { + LOG.log(level, " " + type); + } + } + } + } + + /** + * Gets the value of a specific attribute of a named MBean. + * + * @param objectName The object name of the MBean from which the attribute is to be retrieved. + * @param attribute The object name of the MBean from which the attribute is to be retrieved. + * @return The object name of the MBean from which the attribute is to be retrieved. + * @throws JmxException if the value can't be retrieved + */ + public Object getAttribute(ObjectName objectName, String attribute) throws JmxException { + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Geting the \"" + attribute + "\" attribute of the the MBean " + objectName); + } + Object value; + try { + value = this.getMBeanServerConnection().getAttribute(objectName, "State"); + } catch (Exception e) { + throw new JmxException("Failed to get the \"" + attribute + "\" attribute of the the MBean " + objectName, e); + } + if (LOG.isLoggable(Level.INFO)) { + LOG.info(attribute + "=" + value); + } + return value; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/JmxException.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/JmxException.java new file mode 100755 index 000000000000..4d34e17931a7 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/JmxException.java @@ -0,0 +1,41 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util.jmx; + +import java.io.Serializable; + +/** + * Indicates that a JMX-related failure occurred; Typically wraps another exception with more specific problem analysis + * + * @author Tim Burns + */ +public class JmxException extends Exception implements Serializable { + + private static final long serialVersionUID = 1L; + + public JmxException() { + super(); + } + + public JmxException(String message) { + super(message); + } + + public JmxException(String message, Throwable cause) { + super(message, cause); + } + + public JmxException(Throwable cause) { + super(cause); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/JmxServiceUrlFactory.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/JmxServiceUrlFactory.java new file mode 100755 index 000000000000..b003f4e23914 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/JmxServiceUrlFactory.java @@ -0,0 +1,112 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util.jmx; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.remote.JMXServiceURL; + +import componenttest.topology.impl.LibertyServer; + +/** + * Caches the location of the local connector's JMX service address + * + * @author Tim Burns + */ +public class JmxServiceUrlFactory { + + private static final Logger LOG = Logger.getLogger(JmxConnection.class.getName()); + + protected static JmxServiceUrlFactory INSTANCE; + + /** + * Retrieve a global instance of this class; useful if the JMX local address files + * for your liberty servers do not change during the lifetime of your JVM. + * + * @return a global instance of this class + */ + public static JmxServiceUrlFactory getInstance() { + if (INSTANCE == null) { + INSTANCE = new JmxServiceUrlFactory(); + } + return INSTANCE; + } + + /** + * Convenience method that derives the base directory from a {@link LibertyServer}. + * + * @see #getUrl(String) + * @param server a liberty server with the localConnector-1.0 feature enabled + * @return a {@link JMXServiceURL} that allows you to invoke MBeans on the server + * @throws JmxException + * if the server can't be found, + * the localConnector-1.0 feature is not enabled, + * or the address file is not valid + */ + public JMXServiceURL getUrl(LibertyServer server) throws JmxException { + return this.getUrl(server.getServerRoot()); + } + + /** + *

    + * Detects a {@link JMXServiceURL} given a liberty server's base directory, and caches that URL for future reference. + * The localConnector-1.0 feature must be enabled on the server in order for this method to work. + *

    + *

    + * Caching the URL is tricky since a new URL will be generated every time the server restarts. + *

    + * + * @param serverRoot the base directory of a liberty server with the localConnector-1.0 feature enabled + * @return a {@link JMXServiceURL} that allows you to invoke MBeans on the server + * @throws JmxException + * if the server can't be found, + * the localConnector-1.0 feature is not enabled, + * or the address file is not valid + */ + public JMXServiceURL getUrl(String serverRoot) throws JmxException { + JMXServiceURL url = null; + String connectorFile = serverRoot + File.separator + "workarea" + File.separator + "com.ibm.ws.jmx.local.address"; + LOG.info("Reading JMXServiceURL from local address file: " + connectorFile); + try { + String connectorAddr = null; + File file = new File(connectorFile); + BufferedReader br = null; + try { + br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8")); + connectorAddr = br.readLine(); + } finally { + try { + if (br != null) { + br.close(); + } + } catch (IOException e) { + LOG.log(Level.INFO, "Failed to close reader for " + file, e); + } + } + url = new JMXServiceURL(connectorAddr); + LOG.info("JMXServiceURL: " + connectorAddr); + } catch (Exception e) { + StringBuilder msg = new StringBuilder(); + msg.append("Failed to read a JMXServiceURL from a server's local address file; is the localConnector-1.0 feature enabled? Address File: "); + msg.append(connectorFile); + throw new JmxException(msg.toString(), e); + } + return url; + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/SimpleJmxOperation.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/SimpleJmxOperation.java new file mode 100755 index 000000000000..8425c91b3799 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/SimpleJmxOperation.java @@ -0,0 +1,156 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util.jmx; + +import java.util.logging.Level; + +import javax.management.ObjectName; +import javax.management.remote.JMXServiceURL; + +/** + *

    Convenience class to establish a JMX connection, invoke an MBean operation, and then then close the connection.

    + *

    This class is useful when you want to perform one very simple task with an MBean, but inefficient if you want to do a lot of work with lots of MBeans.

    + * + * @author Tim Burns + */ +public abstract class SimpleJmxOperation { + + protected static class GetAttributeOperation extends SimpleJmxOperation { + protected ObjectName objectName; + protected String attribute; + + protected GetAttributeOperation(ObjectName objectName, String attribute) { + this.objectName = objectName; + this.attribute = attribute; + } + + @Override + protected Object invokeOperation(JmxConnection conn) throws JmxException { + return conn.getAttribute(this.objectName, this.attribute); + } + } + + protected static class InvokeOperation extends SimpleJmxOperation { + protected ObjectName objectName; + protected String operationName; + protected Object[] params; + protected String[] signature; + + protected InvokeOperation(ObjectName objectName, String operationName, Object[] params, String[] signature) { + this.objectName = objectName; + this.operationName = operationName; + this.params = params; + this.signature = signature; + } + + @Override + protected Object invokeOperation(JmxConnection conn) throws JmxException { + return conn.invoke(this.objectName, this.operationName, this.params, this.signature); + } + } + + protected static class LogMBeanInfoOperation extends SimpleJmxOperation { + protected Level level; + protected ObjectName objectName; + + protected LogMBeanInfoOperation(Level level, ObjectName objectName) { + this.level = level; + this.objectName = objectName; + } + + @Override + protected Object invokeOperation(JmxConnection conn) throws JmxException { + conn.logMBeanInfo(this.level, this.objectName); + return null; + } + } + + protected static class LogObjectNamesOperation extends SimpleJmxOperation { + protected Level level; + + protected LogObjectNamesOperation(Level level) { + this.level = level; + } + + @Override + protected Object invokeOperation(JmxConnection conn) throws JmxException { + conn.logObjectNames(this.level); + return null; + } + } + + /** + * Establishes a JMX connection, gets the value of a specific attribute of a named MBean, and then then closes the connection. + * + * @param url the JMX connection URL where you want to find the MBean + * @param objectName The object name of the MBean from which the attribute is to be retrieved. + * @param attribute The object name of the MBean from which the attribute is to be retrieved. + * @return The object name of the MBean from which the attribute is to be retrieved. + * @throws JmxException if the value can't be retrieved + */ + public static Object getAttribute(JMXServiceURL url, ObjectName objectName, String attribute) throws JmxException { + return new GetAttributeOperation(objectName, attribute).invoke(url); + } + + /** + * Establishes a JMX connection, invokes an MBean operation, and then then closes the connection. + * + * @param url the JMX connection URL where you want to find the MBean + * @param objectName the MBean to invoke + * @param operationName the operation to invoke on the MBean + * @param params parameters for the operation + * @param signature the class signature of the operation + * @return the result of the operation + * @throws JmxException if the operation fails + */ + public static Object invoke(JMXServiceURL url, ObjectName objectName, String operationName, Object[] params, String[] signature) throws JmxException { + return new InvokeOperation(objectName, operationName, params, signature).invoke(url); + } + + /** + * Establishes a JMX connection, logs detailed information about a specific MBean, and then then closes the connection. + * + * @param url the JMX connection URL where you want to find the MBean + * @param level the level where you want to log MBean details + * @param objectName the name of the MBean to log + * @throws JmxException if MBean information can't be retrieved + */ + public static void logMBeanInfo(JMXServiceURL url, Level level, ObjectName objectName) throws JmxException { + new LogMBeanInfoOperation(level, objectName).invoke(url); + } + + /** + * Establishes a JMX connection, logs the canonical name of all registered MBeans, and then then closes the connection. + * + * @param url the JMX connection URL where you want to find the MBeans + * @param level the level where you want to log the names + * @throws JmxException if the names can't be queried + */ + public static void logObjectNames(JMXServiceURL url, Level level) throws JmxException { + new LogObjectNamesOperation(level).invoke(url); + } + + protected Object invoke(JMXServiceURL url) throws JmxException { + JmxConnection conn = new JmxConnection(); + try { + conn.open(url); + return this.invokeOperation(conn); + } finally { + if (conn != null) { + conn.close(); + } + } + } + + protected abstract Object invokeOperation(JmxConnection conn) throws JmxException; + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/SimpleMBean.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/SimpleMBean.java new file mode 100755 index 000000000000..1f6836ab1977 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/SimpleMBean.java @@ -0,0 +1,79 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util.jmx; + +import java.util.logging.Level; + +import javax.management.ObjectName; +import javax.management.remote.JMXServiceURL; + +/** + * Encapsulates a simple, reusable MBean accessible from a specific JMX URL + * + * @author Tim Burns + */ +public class SimpleMBean { + + /** + * Convenience method to construct an {@link ObjectName}. + * + * @param name A string representation of the object name + * @return an {@link ObjectName} + * @throws JmxException the string passed as a parameter does not have the right format + */ + public static ObjectName getObjectName(String name) throws JmxException { + try { + return new ObjectName(name); + } catch (Exception e) { + throw new JmxException("Failed to construct the ObjectName of an MBean given the string representation: " + name, e); + } + } + + private final JMXServiceURL url; + private final ObjectName objectName; + + /** + * Encapsulate a particular MBean on a server + * + * @param url the JMX connection URL where you want to find the MBean + * @param objectName the name of the MBean you want to operate on + */ + public SimpleMBean(JMXServiceURL url, ObjectName objectName) { + this.url = url; + this.objectName = objectName; + } + + /** + * @return the JMX connection URL + */ + public JMXServiceURL getUrl() { + return this.url; + } + + /** + * @return the name of the encapsulated MBean + */ + public ObjectName getObjectName() { + return this.objectName; + } + + /** + * Establishes a JMX connection, logs detailed information about a specific MBean, and then then closes the connection. + * + * @param level the level where you want to log MBean details + * @throws JmxException if MBean information can't be retrieved + */ + public void logMBeanInfo(Level level) throws JmxException { + SimpleJmxOperation.logMBeanInfo(this.getUrl(), level, this.getObjectName()); + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/mbeans/ApplicationMBean.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/mbeans/ApplicationMBean.java new file mode 100755 index 000000000000..43d3b5cc0507 --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/mbeans/ApplicationMBean.java @@ -0,0 +1,149 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util.jmx.mbeans; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.remote.JMXServiceURL; + +import com.ibm.ws.fat.util.Props; +import com.ibm.ws.fat.util.StopWatch; +import com.ibm.ws.fat.util.jmx.JmxException; +import com.ibm.ws.fat.util.jmx.SimpleJmxOperation; +import com.ibm.ws.fat.util.jmx.SimpleMBean; + +/** + * Convenience class to work with the ApplicationMBean for a particular application on a specific Liberty server + * + * @author Tim Burns + */ +public class ApplicationMBean extends SimpleMBean { + + private final static Logger LOG = Logger.getLogger(ApplicationMBean.class.getName()); + + /** + * Describes the current state of an application + */ + public static enum ApplicationState { + /** The application is running */ + STARTED, + /** The application is not running */ + STOPPED, + /** The state of the application is unknown or unrecognized */ + OTHER + } + + private final String applicationName; + + /** + * Encapsulate the MBean for a particular application on a server + * + * @param url the JMX connection URL where you want to find the MBean + * @param applicationName the name of an application + * @throws JmxException if the object name for the input application cannot be constructed + */ + public ApplicationMBean(JMXServiceURL url, String applicationName) throws JmxException { + super(url, getObjectName("WebSphere:service=com.ibm.websphere.application.ApplicationMBean,name=" + applicationName)); + this.applicationName = applicationName; + } + + /** + * @return the name of the application + */ + public String getApplicationName() { + return this.applicationName; + } + + /** + * Changes the state of the application + * + * @param operationName the state change to invoke + * @throws JmxException if the state change fails + */ + protected void invokeOperation(String operationName) throws JmxException { + StopWatch timer = null; + if (LOG.isLoggable(Level.INFO)) { + LOG.info(Props.getInstance().getProperty(Props.LOGGING_BREAK_SMALL)); + LOG.info(operationName + "ing the application named " + this.getApplicationName()); + LOG.info(Props.getInstance().getProperty(Props.LOGGING_BREAK_SMALL)); + timer = new StopWatch(); + timer.start(); + } + SimpleJmxOperation.invoke(this.getUrl(), this.getObjectName(), operationName, null, null); + if (LOG.isLoggable(Level.INFO)) { + timer.stop(); + LOG.info(Props.getInstance().getProperty(Props.LOGGING_BREAK_SMALL)); + LOG.info(operationName + " operation completed after " + timer.getTimeElapsedAsString()); + LOG.info(Props.getInstance().getProperty(Props.LOGGING_BREAK_SMALL)); + } + } + + /** + * Start the application. This method will not return until the start has finished? + * + * @throws JmxException if the start fails + */ + public void start() throws JmxException { + this.invokeOperation("start"); + } + + /** + * Stop the application. This method will not return until the stop has finished? + * + * @throws JmxException if the stop fails + */ + public void stop() throws JmxException { + this.invokeOperation("stop"); + } + + /** + * Restart the application. This method will not return until the restart has finished? + * + * @throws JmxException if the restart fails + */ + public void restart() throws JmxException { + this.invokeOperation("restart"); + this.waitForState(ApplicationState.STARTED); + } + + private void waitForState(ApplicationState expectedState) throws JmxException { + int attempts = 60; + while (attempts-- > 0) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.getCause(); + } + ApplicationState currentState = this.getState(); + if (currentState == expectedState) { + break; + } + } + } + + /** + * Detects the current state of the application + * + * @return the current state of the application, or null if the state cannot be determined + * @throws JmxException if the state can't be detected + */ + public ApplicationState getState() throws JmxException { + Object result = SimpleJmxOperation.getAttribute(this.getUrl(), this.getObjectName(), "State"); + try { + return ApplicationState.valueOf(result.toString().trim().toUpperCase()); + } catch (Throwable thrown) { + return ApplicationState.OTHER; + } + } + +} diff --git a/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/mbeans/PluginConfigMBean.java b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/mbeans/PluginConfigMBean.java new file mode 100755 index 000000000000..3fbfa2e0125a --- /dev/null +++ b/dev/fattest.simplicity/src/com/ibm/ws/fat/util/jmx/mbeans/PluginConfigMBean.java @@ -0,0 +1,46 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.util.jmx.mbeans; + +import javax.management.remote.JMXServiceURL; + +import com.ibm.ws.fat.util.jmx.JmxException; +import com.ibm.ws.fat.util.jmx.SimpleJmxOperation; +import com.ibm.ws.fat.util.jmx.SimpleMBean; + +/** + * Convenience class to work with the PluginConfigMBean for a specific Liberty server + * + * @author Tim Burns + */ +public class PluginConfigMBean extends SimpleMBean { + + /** + * Encapsulate the PluginConfigMBean for a specific Liberty server + * + * @param url the JMX connection URL where you want to find the MBean + * @throws JmxException if the object name for the PluginConfigMBean cannot be constructed + */ + public PluginConfigMBean(JMXServiceURL url) throws JmxException { + super(url, getObjectName("WebSphere:name=com.ibm.ws.jmx.mbeans.generatePluginConfig")); + } + + /** + * Generates a default configuration file for the HTTP Plugin + * + * @throws JmxException if plugin generation fails + */ + protected void generateDefaultPluginConfig() throws JmxException { + SimpleJmxOperation.invoke(this.getUrl(), this.getObjectName(), "generateDefaultPluginConfig", null, null); + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/AllowedFFDC.java b/dev/fattest.simplicity/src/componenttest/annotation/AllowedFFDC.java new file mode 100755 index 000000000000..5bbfd71a7b15 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/AllowedFFDC.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.annotation; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; + +/** + * An FFDC produced for the specified exception will be ignored; it will not cause the test to fail. + */ +@Retention(RUNTIME) +public @interface AllowedFFDC { + String[] value(); + +} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/CheckForLeakedPasswords.java b/dev/fattest.simplicity/src/componenttest/annotation/CheckForLeakedPasswords.java new file mode 100755 index 000000000000..93fcec81027c --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/CheckForLeakedPasswords.java @@ -0,0 +1,43 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.annotation; + +import static java.lang.annotation.ElementType.METHOD; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Test methods with this annotation must specify the list of passwords + * that will be searched by the LeakedPasswordChecker in the server's output files. + * To verify a single password, + *
    + * @CheckForLeakedPasswords("passwordToVerify")
    + * @Test public void myTest(....)
    + * 
    + * To verify an encoded passwords, + *
    + * @CheckForLeakedPasswords("\\{xor\\ ")
    + * @Test public void myTest(....)
    + * 
    + * To verify more than one password, + *
    + * @CheckForLeakedPasswords( { "passwordToVerify", "\\{xor\\}" })
    + * @Test public void myTest(....)
    + * 
    + * + */ +@Target(METHOD) +@Retention(java.lang.annotation.RetentionPolicy.RUNTIME) +public @interface CheckForLeakedPasswords { + String[] value(); +} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/ExpectedFFDC.java b/dev/fattest.simplicity/src/componenttest/annotation/ExpectedFFDC.java new file mode 100755 index 000000000000..99f6440f9500 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/ExpectedFFDC.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.annotation; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; + +/** + * + */ +@Retention(RUNTIME) +public @interface ExpectedFFDC { + String[] value(); + +} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/FeatureRequiresMinimumJavaLevel.java b/dev/fattest.simplicity/src/componenttest/annotation/FeatureRequiresMinimumJavaLevel.java new file mode 100755 index 000000000000..301bc6c8f83c --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/FeatureRequiresMinimumJavaLevel.java @@ -0,0 +1,31 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation for expressing that if the feature under test is the named feature, + * tests should only run when the java level is above the given level. + */ +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +public @interface FeatureRequiresMinimumJavaLevel { + + String feature(); + + double javaLevel(); + +} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/IgnoreTestNamesRule.java b/dev/fattest.simplicity/src/componenttest/annotation/IgnoreTestNamesRule.java new file mode 100755 index 000000000000..f49332f65e8c --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/IgnoreTestNamesRule.java @@ -0,0 +1,24 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation that excludes a test from being run with the RunFatClientUsingTestNamesRule + */ +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +public @interface IgnoreTestNamesRule {} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/MaximumJavaLevel.java b/dev/fattest.simplicity/src/componenttest/annotation/MaximumJavaLevel.java new file mode 100755 index 000000000000..1d56db37754c --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/MaximumJavaLevel.java @@ -0,0 +1,32 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation for expressing tests should only run when the java level is at or below the given level. + * The argument is a double, such as 1.6 or 1.7. + * Example: + * + * @MaximumJavaLevel(javaLevel=1.7) + */ +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +public @interface MaximumJavaLevel { + + double javaLevel(); + +} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/MinimumJavaLevel.java b/dev/fattest.simplicity/src/componenttest/annotation/MinimumJavaLevel.java new file mode 100755 index 000000000000..70fd9e234a5b --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/MinimumJavaLevel.java @@ -0,0 +1,38 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation for expressing tests should only run when the java level is above the given level. + * The argument is a double, such as 1.6 or 1.7. + * Example + * + * @MinimumJavaLevel(javaLevel=1.7) + */ +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +public @interface MinimumJavaLevel { + + double javaLevel(); + + /** + * Whether or not a synthetic test should be created and ran to ensure that + * the server does not start when the java level is too low. + */ + boolean runSyntheticTest() default true; + +} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/Server.java b/dev/fattest.simplicity/src/componenttest/annotation/Server.java new file mode 100755 index 000000000000..abb4a47c6cae --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/Server.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.FIELD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface Server { + + String value() default "defaultServer"; + +} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/SkipIfSysProp.java b/dev/fattest.simplicity/src/componenttest/annotation/SkipIfSysProp.java new file mode 100755 index 000000000000..74acf9938ac1 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/SkipIfSysProp.java @@ -0,0 +1,61 @@ +package componenttest.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation for expressing tests should be skipped if a certain system property is set. + * An array of string values may be supplied. If multiple values are supplied, tests will + * be skipped if ANY of the conditions are satisfied (logical OR). + *

    + * If a string is specified with [key]=[value] format, System.getProperty(key) must return + * a string value that equalsIgnoreCase the [value]. + *

    + * If a string is specified with only a [key], if System.getProperty(key) returns any non-null + * result, the test(s) will be skipped. + *

    + * Examples: + * + *

    + * 
    + * // Skipped if the system property "is.sle" is non-null
    + * {@literal @}Test
    + * {@literal @}SkipIfSysProp("is.sle")
    + * public void testSomething() {}
    + *
    + * // Skipped if the system property "is.sle" has a value of "true"
    + * {@literal @}Test
    + * {@literal @}SkipIfSysProp("is.sle=true")
    + * public void testSomething() {}
    + *
    + * // Skipped if the system property "favorite.color" has a value of "blue"
    + * {@literal @}Test
    + * {@literal @}SkipIfSysProp("favorite.color=blue")
    + * public void testSomething() {}
    + *
    + * // Skipped if the system property "is.monday" is non-null
    + * // OR the system property "is.raining" has a value of "false"
    + * {@literal @}Test
    + * {@literal @}SkipIfSysProp({"is.monday", "is.raining=false"})
    + * public void testSomething() {}
    + * 
    + * 
    + */ +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +public @interface SkipIfSysProp { + + public static final String IS_SLE = "is.sle=true"; + + // DB type system properties + public static final String DB_DB2 = "fat.bucket.db.type=DB2"; + public static final String DB_Derby = "fat.bucket.db.type=Derby"; + public static final String DB_Informix = "fat.bucket.db.type=Informix"; + public static final String DB_Oracle = "fat.bucket.db.type=Oracle"; + public static final String DB_Sybase = "fat.bucket.db.type=Sybase"; + + String[] value(); + +} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/TestServlet.java b/dev/fattest.simplicity/src/componenttest/annotation/TestServlet.java new file mode 100644 index 000000000000..0bc0ba3b3705 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/TestServlet.java @@ -0,0 +1,31 @@ +package componenttest.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.servlet.http.HttpServlet; + +@Target({ ElementType.FIELD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface TestServlet { + + /** + * The path to the test servlet URL (i.e. application/servlet). + * The hostname and port are inferred from the LibertyServer field which is being annotated. + */ + String path(); + + /** + * The servlet class.
    + * IMPORTANT: To use this annotation in a FAT, the project's build-test.xml must + * specify either of the following in order to get the servlet class on the javac classpath: + *
      + *
    • <property name="project.compile.use.classpath.source" value="true"/>
    • + *
    • <import file="../ant_build/public_imports/shrinkwrap_fat_imports.xml"/>
    • + *
    + */ + Class servlet(); + +} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/TestServlets.java b/dev/fattest.simplicity/src/componenttest/annotation/TestServlets.java new file mode 100644 index 000000000000..eb0d6d99297b --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/TestServlets.java @@ -0,0 +1,14 @@ +package componenttest.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.FIELD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface TestServlets { + + TestServlet[] value(); + +} diff --git a/dev/fattest.simplicity/src/componenttest/annotation/processor/TestServletProcessor.java b/dev/fattest.simplicity/src/componenttest/annotation/processor/TestServletProcessor.java new file mode 100644 index 000000000000..2420e07898ec --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/annotation/processor/TestServletProcessor.java @@ -0,0 +1,72 @@ +package componenttest.annotation.processor; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.junit.Test; +import org.junit.runners.model.FrameworkField; +import org.junit.runners.model.FrameworkMethod; +import org.junit.runners.model.TestClass; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.annotation.TestServlet; +import componenttest.annotation.TestServlets; +import componenttest.custom.junit.runner.SyntheticServletTest; +import componenttest.topology.impl.LibertyServer; + +public class TestServletProcessor { + + private static final Class c = TestServletProcessor.class; + + public static List getServletTests(TestClass testClass) { + final String m = "getServletTests"; + + List testMethods = new ArrayList(); + + Set servers = new HashSet(); + servers.addAll(testClass.getAnnotatedFields(TestServlet.class)); + servers.addAll(testClass.getAnnotatedFields(TestServlets.class)); + for (FrameworkField server : servers) { + // Verify server is declared as "public static LibertyServer" + if (!server.isStatic()) + throw new RuntimeException("Annotated field '" + server.getName() + "' must be static."); + if (!server.isPublic()) + throw new RuntimeException("Annotated field '" + server.getName() + "' must be public."); + if (!LibertyServer.class.isAssignableFrom(server.getType())) + throw new RuntimeException("Annotated field '" + server.getName() + "' must be of type or subtype of " + LibertyServer.class.getCanonicalName()); + + // Get the @TestServlet annotation(s) and linked HttpServlet + Field serverField = server.getField(); + List testServlets = new ArrayList(); + if (serverField.getAnnotation(TestServlet.class) != null) + testServlets.add(serverField.getAnnotation(TestServlet.class)); + if (serverField.getAnnotation(TestServlets.class) != null) + testServlets.addAll(Arrays.asList(serverField.getAnnotation(TestServlets.class).value())); + + // For each @TestServlet for this server, add all @Test methods + for (TestServlet anno : testServlets) + for (Method method : getTestServletMethods(anno)) + if (method.isAnnotationPresent(Test.class)) { + Log.info(c, m, "adding servlet test: " + method); + testMethods.add(new SyntheticServletTest(serverField, anno, method)); + } + } + return testMethods; + } + + private static Method[] getTestServletMethods(TestServlet anno) { + try { + return anno.servlet().getMethods(); + } catch (TypeNotPresentException e) { + throw new RuntimeException("The HttpServlet referenced by the @TestServlet(servlet=???, path=" + anno.path() + + ") annotation imported a class that was not available to the JUnit classpath.", e); + } + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/aries/AriesFatTestBase.java b/dev/fattest.simplicity/src/componenttest/aries/AriesFatTestBase.java new file mode 100755 index 000000000000..5aec7e79604a --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/aries/AriesFatTestBase.java @@ -0,0 +1,152 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.aries; + +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.HttpURLConnection; +import java.util.Set; +import java.util.logging.Logger; + +import org.junit.AfterClass; + +import com.ibm.componenttest.common.ComponentTest; +import com.ibm.componenttest.common.Record; +import componenttest.topology.impl.LibertyServer; + +public abstract class AriesFatTestBase { + protected static LibertyServer server; + protected static AriesTopologyForLiberty topology; + protected static Logger LOGGER; + + public static void setUp(Logger log, String serverName) throws Exception { + setUp(log, serverName, null); + } + + public static void setUp(Logger log, String serverName, Set appNamesToValidate) throws Exception { + preSetUp(log, serverName, appNamesToValidate); + topology.startLibertyServer(); + } + + public static void preSetUp(Logger log, String serverName) throws Exception { + preSetUp(log, serverName, null); + } + + public static void preSetUp(Logger log, String serverName, Set appNamesToValidate) throws Exception { + topology = new TopologyImpl(log, serverName); + server = topology.getServer(); + if (appNamesToValidate != null) { + for (String appNameToValidate : appNamesToValidate) { + server.addInstalledAppForValidation(appNameToValidate); + } + } + server.pathToAutoFVTTestFiles = "lib"; + LOGGER = log; + } + + @AfterClass + public static void tearDown() throws Exception { + server.stopServer(); + } + + protected void assertTestPass(String bundleName, String testName) throws Exception { + Record testResult = ComponentTest.getResult(bundleName, testName); + LOGGER.info("assertTestPass : test name is " + testName + ", result message is " + testResult.getMsg()); + assertTrue(testResult.toString(), (testResult.getResult() == Record.Result.PASS)); + } + + protected static void readLog(String logFileName) { + try { + ComponentTest.readResultLog(new File(logFileName)); + } catch (Exception e2) { + System.out.println("Failed to obtain test log results"); + } + } + + /* + * Bug 89173 improved diagnostics below (and the set-up of the calling + * test). If errors due to the servlet not being available are still seen, + * retry logic can be added to this method (in a similar manner to the + * Topology.checkForComponentTestFinish method). + */ + public String getWebContent(String testUri) throws Exception { + // Defect 119101: we're still seeing timeouts here, typically because the JPA/OSGi + // server is still initialising and while the context root is available, the servlets + // aren't up behind it yet. + // If the first attempt fails, we'll wait 2, 4, 8, 16 and finally 32 seconds + // before retrying. + String result = null; + int waitTime = 1; + while (result == null) { // Forever loop prevented by 'throw x' once waitTime > 60 + try { + result = doGetWebContent(testUri); + } catch (Exception x) { + waitTime *= 2; + if (waitTime > 60) { + throw x; + } + try { + Thread.sleep(waitTime * 1000); + } catch (InterruptedException ix) { + } + } + } + return result; + } + + private String doGetWebContent(String testUri) throws Exception + { + HttpURLConnection con = null; + try { + String testServerAndUri = "http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + testUri; + con = topology.getConnection(testServerAndUri); + con.setRequestMethod("GET"); + InputStream is; + try { + is = con.getInputStream(); + } catch (IOException ioe) { + LOGGER.severe("couldn't get input stream at uri : " + testServerAndUri); + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + ioe.printStackTrace(pw); + pw.flush(); + LOGGER.severe("exception stack trace is : " + sw.toString()); + pw.close(); + int httpResponseCode = con.getResponseCode(); + LOGGER.severe("connection response code is : " + httpResponseCode); + is = con.getErrorStream(); + LOGGER.info("error stream is : " + is); + } + String lineSeparator = System.getProperty("line.separator"); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(lineSeparator); + } + return builder.toString(); + } finally { + if (con != null) { + con.disconnect(); + } + } + } +} diff --git a/dev/fattest.simplicity/src/componenttest/aries/AriesTopologyForLiberty.java b/dev/fattest.simplicity/src/componenttest/aries/AriesTopologyForLiberty.java new file mode 100755 index 000000000000..edcbb10b16ad --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/aries/AriesTopologyForLiberty.java @@ -0,0 +1,72 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.aries; + +import java.io.IOException; +import java.net.HttpURLConnection; + +import com.ibm.ws.topology.exceptions.TopologyException; +import com.ibm.ws.topology.helper.Topology; +import componenttest.topology.impl.LibertyServer; + +/** + * + */ +public interface AriesTopologyForLiberty extends Topology { + + public LibertyServer getServer(); + + public void startLibertyServer() throws Exception; + + public String getServerRoot(); + + public void addExpectedBundle(String bundleName); + + /** + * Some bundles log that they have finished execution of some code multiple + * times, for example each time a reference to some resource is injected. + * This method ensures that the given bundle has logged that it has finished + * execution the expected number of times. + * + * @param bundleName bundle name to look for in the list of finished bundles + * @param nTimes number of times the bundle should log that it has finished + */ + public void addExpectedBundle(String bundleName, int nTimes); + + /** + * This version is internal and takes a boolean for the special case of checking whether we are + * ready to being a component test (i.e. the server is started). + * + * @param customTimeout + * @param checkingReady + * @return boolean indicating if all tests completed + * @throws InterruptedException + * @throws TopologyException + */ + public boolean checkForComponentTestFinish(long customTimeout) + throws InterruptedException, TopologyException; + + /** + * This method checks if we are ready to start installing and running component tests. + * It does this by checking if the commong logging bundle has reported as as finished. + * The logging bundle reports finished when its init-method of loggingActive is run. + * + * @param customTimeout + * @throws Exception + */ + public void checkReady(long customTimeout) throws InterruptedException, TopologyException; + + public void setIBR(String IBRDir); + + public HttpURLConnection getConnection(String urlAddress) throws IOException; + +} diff --git a/dev/fattest.simplicity/src/componenttest/aries/InjectionEntry.java b/dev/fattest.simplicity/src/componenttest/aries/InjectionEntry.java new file mode 100755 index 000000000000..85570ca93594 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/aries/InjectionEntry.java @@ -0,0 +1,59 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.aries; + +import java.util.Enumeration; +import java.util.Hashtable; + +/** + * + */ +public class InjectionEntry { + public static final String INJECTION_PROP = "injection_files"; + + private final Hashtable filesToUpdate = new Hashtable(); + private final Hashtable filesToRemove = new Hashtable(); + private final Hashtable nestedInjections = new Hashtable(); + + public void addEntry(String fileNameInsideArchive, String newFileToUse) { + filesToUpdate.put(fileNameInsideArchive, newFileToUse); + } + + public void removeEntry(String fileNameInsideArchive) { + filesToRemove.put(fileNameInsideArchive, ""); + } + + public void addNestedEntry(String fileNameInsideArchive, InjectionEntry child) { + nestedInjections.put(fileNameInsideArchive, child); + } + + public boolean containsFile(String fileName) { + return filesToUpdate.containsKey(fileName) || filesToRemove.containsKey(fileName) || nestedInjections.containsKey(fileName); + } + + public Enumeration getEnumFilesToUpdate() { + return filesToUpdate.keys(); + } + + public String getUpdatedFile(String key) { + return filesToUpdate.get(key); + } + + public Enumeration getEnumNestedEntries() { + return nestedInjections.keys(); + } + + public InjectionEntry getUpdatedNestedEntry(String key) { + return nestedInjections.get(key); + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/aries/LibertySecurityConfigurator.java b/dev/fattest.simplicity/src/componenttest/aries/LibertySecurityConfigurator.java new file mode 100755 index 000000000000..6e6dfb9dc395 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/aries/LibertySecurityConfigurator.java @@ -0,0 +1,217 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.aries; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.Cell; +import com.ibm.websphere.simplicity.OperationResults; +import com.ibm.websphere.simplicity.Topology; +import com.ibm.websphere.simplicity.commands.authorizationgroup.MapUsersToAdminRole; +import com.ibm.websphere.simplicity.config.WIMUserAndGroupConfiguration; +import com.ibm.websphere.simplicity.config.securitydomain.JAASJ2CAuthenticationEntrySettings; +import com.ibm.websphere.simplicity.config.securitydomain.UserRealmType; +import com.ibm.websphere.simplicity.config.usersgroups.Group; +import com.ibm.websphere.simplicity.config.usersgroups.User; +import com.ibm.ws.topology.helper.SecurityConfigurator; +import com.ibm.ws.topology.helper.UserRealmConfigurator; +import com.ibm.ws.topology.helper.impl.WASSecurityConfigurator; + +/** + * + */ +public class LibertySecurityConfigurator implements SecurityConfigurator { + + private static final Logger _logger = Logger.getLogger(WASSecurityConfigurator.class.getName()); + + private boolean adminSecurity = getSwitchDefault("aries.componenttest.security", false); + private boolean appSecurity = getSwitchDefault("aries.componenttest.app.security", false); + + // No nonsense: every cell must have the same administrator! + private final String primaryAdmin = getDefaultUser(); + private final String primaryAdminPassword = getDefaultPassword(); + + private UserRealmType realmType = UserRealmType.WIMUserRegistry; + private final WIMConfigurator wimConfigurator = new WIMConfigurator(); + + private final List j2cAuthData = new ArrayList(); + + private static boolean getSwitchDefault(String propertyName, boolean defaultValue) { + boolean result = defaultValue; + if (System.getProperty(propertyName) != null) { + result = System.getProperty(propertyName).equalsIgnoreCase("true"); + } + + _logger.fine("Property '" + propertyName + "' -> " + result); + return result; + } + + public static String getDefaultUser() { + return Topology.getCells().get(0).getConnInfo().getUser(); + } + + public static String getDefaultPassword() { + return Topology.getCells().get(0).getConnInfo().getPassword(); + } + + /** {@inheritDoc} */ + @Override + public SecurityConfigurator adminSecurity(boolean enabled) { + adminSecurity = enabled; + return this; + } + + @Override + public SecurityConfigurator appSecurity(boolean enabled) { + appSecurity = enabled; + return this; + } + + /** {@inheritDoc} */ + @Override + public void apply() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public SecurityConfigurator j2cAuthData(String alias, String user, String password) { + JAASJ2CAuthenticationEntrySettings entry = new JAASJ2CAuthenticationEntrySettings(); + entry.setAlias(alias); + entry.setUser(user); + entry.setPassword(password); + entry.setDescription("No description :)"); + j2cAuthData.add(entry); + + return this; + } + + /** {@inheritDoc} */ + @Override + public SecurityConfigurator java2Security(boolean arg0) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public SecurityConfigurator localOSRealm() { + throw new UnsupportedOperationException("Not implemented"); + } + + @Override + public UserRealmConfigurator wimUserRealm() { + realmType = UserRealmType.WIMUserRegistry; + return wimConfigurator; + } + + private class WIMConfigurator implements UserRealmConfigurator { + private class UserInfo { + String uid; + String password; + String[] groups; + String[] roles; + + public UserInfo(String uid, String password, String[] groups, String[] roles) { + this.groups = groups; + this.uid = uid; + this.password = password; + this.roles = roles; + } + } + + private final List users = new ArrayList(); + private final Set groups = new HashSet(); + private final Map roles = new HashMap(); + + @Override + public SecurityConfigurator end() { + return LibertySecurityConfigurator.this; + } + + @Override + public UserRealmConfigurator group(String cn) { + groups.add(cn); + return this; + } + + @Override + public UserRealmConfigurator user(String uid, String password, String... groups) { + users.add(new UserInfo(uid, password, groups, new String[0])); + return this; + } + + @Override + public UserRealmConfigurator role(String role, String... users) { + roles.put(role, users); + return this; + } + + public void setupUsersAndGroups(Cell cell) throws Exception { + WIMUserAndGroupConfiguration conf = cell.getSecurityConfiguration().getWIMUserAndGroupConfiguration(); + cleanup(conf); + + Map groupsByName = new HashMap(); + + // work-around for NullPointer bug, fill the group cache by doing a lookup + conf.getGroupByCommonName("random"); + + for (String group : groups) { + OperationResults gres = conf.createGroup(group, "No description :)"); + groupsByName.put(group, gres.getResult()); + } + + // work-around for NullPointer bug, fill the group cache by doing a lookup + conf.getUserByUserID("random"); + + for (UserInfo user : users) { + OperationResults ures = + conf.createUser(user.uid, user.password, user.uid + "first", user.uid + "last", user.uid + "@aries.ibm.com"); + User u = ures.getResult(); + for (String groupName : user.groups) { + Group group = groupsByName.get(groupName); + if (group != null) { + group.addNewUserMember(u.getUniqueName()); + } else { + throw new IllegalStateException("Group " + groupName + " for user " + user.uid + " is not defined."); + } + } + } + + for (Map.Entry entry : roles.entrySet()) { + String role = entry.getKey(); + String[] userIds = entry.getValue(); + MapUsersToAdminRole roleTask = new MapUsersToAdminRole(role, userIds); + + roleTask.run(cell); + } + } + + private void cleanup(WIMUserAndGroupConfiguration conf) throws Exception { + Set users = conf.searchUsersByUserID("*", 300000, null); + for (User u : users) { + if (!!!u.getUid().equals(primaryAdmin)) + conf.deleteUser(u.getUniqueName()); + } + + Set groups = conf.searchGroups(true, "*", 1000, null); + for (Group g : groups) { + conf.deleteGroup(g.getUniqueName()); + } + } + } +} diff --git a/dev/fattest.simplicity/src/componenttest/aries/TopologyImpl.java b/dev/fattest.simplicity/src/componenttest/aries/TopologyImpl.java new file mode 100755 index 000000000000..2350df097a7d --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/aries/TopologyImpl.java @@ -0,0 +1,1107 @@ +/* + * @start_prolog@ + * ============================================================================ + * IBM Confidential OCO Source Materials + * + * 5724-J08, 5724-I63, 5724-H88, 5724-H89, 5655-N02, 5733-W70 Copyright IBM Corp. 2009, 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * ============================================================================ + * @end_prolog@ + * + * Change activity: + * + * Issue Date Name Description + * ----------- ----------- ----------- ------------------------------------ + * 2640 16-Jul-2009 ricellis@uk created + * 3004 05-Aug-2009 ricellis@uk clean up closing of resources, loop result file checking + * 2867 10-Aug-2009 ricellis@uk Catch exceptions to retry getTestLog for FEP, increase retries + * 3106 11-Aug-2009 mahrwald@uk Fix status servlet uninstall + * 3120 21-Aug-2009 emijiang@uk cleanup first before a new test run in order to make debug easier. + * 3307 03-Sep-2009 mitchet@uk Add removeServerLogs() and getServerLogs(). + * 3376 18-Sep-2009 not@uk Minor API updates + * 3480 17-Sep-2009 timoward@uk Fixes for JPA component tests + * 3577 21-Sep-2009 mahrwald@uk Spead up JPA component test + * 3411 21-Sep-2009 emijiang@uk Added executeWsadminCommad() and executeWsadminScript() + * 3624 23-Sep-2009 emijiang@uk Added getTestDir() + * 3912 13-Oct-2009 bakowski@uk Allow setting of JVM args + * 4089 20-Oct-2009 mahrwald@uk Change copyright + * 3893 14-Oct-2009 timoward@uk Pull web app configuration from WAS config + * 3739 30-Oct-2009 bakowski@uk Move WAS server log gathering + * 4296 12-Nov-2009 emijiang@uk Added setTraceOn and setTraceOff + * 4294 06-Nov-2009 ricellis@uk Move address.url to scripts folder + * 4537 26-Nov-2009 lewisms@uk Changes to support use of install and uninstall scripts in blog sample tests + * 4265 29-Nov-2009 cwilkin@uk Lifecycle Component Tests + * 4783 10-Dec-2009 emijiang@uk changed startServer to restartServer to reflect its functionality + * 4787 09-Dec-2009 cwilkin@uk ND Framework updates + * 4724 15-Dec-2009 rjhannah@uk IHS updates + * 4897 22-Dec-2009 emijiang@uk Interface tidy up - removed two unnecessary overloading methods createDerbyDatabase() + * 5425 02-Feb-2010 cumminsh@uk Diagnosic message improvement + * 5219 20-Feb-2010 rjhannah@uk Update to enable Java 2 security + * 5469 22-Feb-2010 cwilkin@uk Console tests + * 5870 05-Mar-2010 emijiang@uk Added clearCache/start/stop/restart bla methods + * 5975 09-Mar-2010 linsun@us add getNodeMetadataFile and putNodeMetadataFile methods + * 5894 12-Mar-2010 applebyd@uk added getSIBEndpoint and enableServletCaching methods + * 6360 26-Mar-2010 applebyd@uk added disableServletCaching and listApps + * 6618 08-Apr-2010 rjhannah@uk added updateServerPolicy + * 6772 14-Apr-2010 applebyd@uk added getCell + * 6715 26-Apr-2010 ricellis@uk added more get methods for port numbers + * 7322 12-May-2010 cwilkin@uk ND Updates + * 7502 18-May-2010 cwilkin@uk Add new ND test cases + * 7347 20-May-2010 emijiang@uk Updated to cope with ND topology. + * 7215 29-Jun-2010 parkerda@uk AutoWAS compatibility work + * 8634 02-Jul-2010 parkerda@uk Add installIntoInternalRepository() + * 8763 12-Jul-2010 parkerda@uk Remove executeWsadminCommandRemote, modify installIntoInternalRepository() + * 8670 12-Jul-2010 ricellis@uk Update simplicity wsadmin usage + * 8253 21-Jul-2010 ricellis@uk Simplicity wsadmin refactoring + * 8970 28-Jul-2010 ricellis@uk Add remoteFileExists() + * 8877 08-Oct-2010 mahrwald@uk New update admin prototype + * 10681 18-Nov-2010 ricellis@uk Add extra installIntoInternalRepository with expose flag + * 11230 22-Nov-2010 ricellis@uk Add doesConfigFileExist() method + * 11355 22-Nov-2010 timoward@uk Support Hot Extension tests + * 12306 13-Jan-2011 rbtprkr@uk Beginning Changes for CTT Component Tests in development stream + * 12335 14-Jan-2011 applebyd@uk Added getWebServerToUse + * 12112 18-Jan-2011 mnuttall@uk Remove -exposeContents from CBA import + * 11516 02-Feb-2011 mahrwald@uk Correct update synching to v7 servers + * 11196 02-Feb-2011 emijiang@uk Added clearBundleCache_Repositories + * 11587 03-Feb-2011 mitchet@uk Added some new Migration methods + * 11660 01-Feb-2011 cumminsh@uk Common up sysout scanning + * 18065 18-May-2011 mahrwald@uk Speed up tests by removing extraneous BLA ops + * 18898 08-Jun-2011 applebyd@uk Extra methods for z/OS + * 20814 05-Aug-2011 applebyd@uk Added getRMIPort + * 21161 19-Aug-2011 mitchet@uk Added installEar and uninstallEar methods. + * 22883 20-Sep-2011 emijiang@uk Added setupSystemExternalBundleRepository. + * 27667 15-Nov-2011 mnuttall@uk Add waits after installing/updating an application to prevent FFDCs from async startup + * 23981 22-Nov-2011 mitchet@uk Added matching of existing profile ports in Migration profile creation. + * 28509 06-Dec-2011 mnuttall@uk Remove the wait introduced under task 27667 + * 29155 09-Dec-2011 applebyd@uk Added v7jdk functionality for migration setup + */ + +package componenttest.aries; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.Properties; +import java.util.jar.JarEntry; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipOutputStream; + +import com.ibm.websphere.simplicity.WebServer; +import com.ibm.ws.topology.exceptions.TopologyException; +import com.ibm.ws.topology.helper.OSGiApplication; +import com.ibm.ws.topology.helper.SecurityConfigurator; +import com.ibm.ws.topology.helper.WebClient; +import com.ibm.ws.topology.helper.impl.WASSecurityConfigurator; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + */ +public class TopologyImpl implements AriesTopologyForLiberty { + private static List _expectedBundles = new ArrayList(); + private final LibertyServer _server; + private final Logger _LOGGER; + private String _IBRDirectory = "wabIBR"; + + private final Hashtable _installedApps = new Hashtable(); + + public TopologyImpl(Logger log, String serverName) throws Exception { + _LOGGER = log; + _server = LibertyServerFactory.getLibertyServer(serverName); + writeUrlFile(); + } + + /** + * {@inheritDoc} + * + * @throws Exception + */ + @Override + public void startLibertyServer() throws Exception { + _server.startServer(); + } + + @Override + public Logger getLogger() { + return _LOGGER; + } + + /** + * Write the URL file for use by the framework + * + * @throws TopologyException + */ + private void writeUrlFile() throws TopologyException { + File addressDir = new File(getServerRoot() + "/testarea/test"); + addressDir.mkdirs(); + File address = new File(addressDir, "address.url"); + try { + FileWriter fw = new FileWriter(address); + fw.write(_server.getHostname() + ":" + getDefaultWCPort()); + fw.close(); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } + + @Override + public int getDefaultWCPort() { + return _server.getHttpDefaultPort(); + } + + /** {@inheritDoc} */ + @Override + public int getAdminWCPort() { + return _server.getHttpDefaultPort(); + } + + /** {@inheritDoc} */ + @Override + public int getDefaultWCSecurePort() { + return _server.getHttpDefaultSecurePort(); + } + + /** {@inheritDoc} */ + @Override + public String getHost() throws TopologyException { + return _server.getHostname(); + } + + /** + * This method checks the status of the tests for completion every second + * unitl the timeout is exceeded. + * + * @param customTimeout - the time until we give up in ms + * @return boolean indicating if all tests completed + */ + @Override + public boolean checkForComponentTestFinish(long customTimeout) throws InterruptedException, + TopologyException { + return checkForComponentTestFinish(customTimeout, false); + } + + private boolean loggingReady() throws TopologyException, IOException { + boolean loggingReady = false; + List actualFinishedBundles = checkFinished(); + if (actualFinishedBundles.contains("com.ibm.componenttest.logging")) { + _LOGGER.log(Level.INFO, "Logging bundle is ready."); + loggingReady = true; + } + return loggingReady; + } + + private boolean testBundleStatus() throws TopologyException, IOException { + boolean testsComplete = false; + List actualFinishedBundles = checkFinished(); + if (actualFinishedBundles.isEmpty()) { + _LOGGER.log(Level.INFO, "No completed bundles"); + } else { + _LOGGER.log(Level.INFO, "Finished bundles: " + actualFinishedBundles); + } + List expectedFinishedBundles = getExpected(); + if (allBundlesFinished(actualFinishedBundles, expectedFinishedBundles)) { + _LOGGER.log(Level.INFO, "All expected bundles have finished."); + testsComplete = true; + } + + return testsComplete; + } + + private List getExpected() { + return _expectedBundles; + } + + private boolean allBundlesFinished(List finished, List expected) { + Collections.sort(finished); + Collections.sort(expected); + + return finished.equals(expected); + } + + private List checkFinished() throws TopologyException, IOException { + HttpURLConnection conn = getConnection(); + List finishedBundles = null; + //timeout if we don't get any data back in 1 second + //the IOException thrown on timeout will be caught and + //we will try again to get the data + conn.setReadTimeout(1000); + + InputStream urlIS = null; + InputStreamReader isr = null; + BufferedReader br = null; + String csList = null; + try { + urlIS = conn.getInputStream(); + isr = new InputStreamReader(urlIS); + br = new BufferedReader(isr); + csList = br.readLine(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (br != null) + br.close(); + if (urlIS != null) + urlIS.close(); + } + + //if the line we read isn't empty get the data + if (!!!(csList == null || csList.equals(""))) { + + //remove the opening [ and closing ] + csList = csList.substring(1, csList.length() - 1); + String[] finishedBundlesArray = csList.split(", "); + + finishedBundles = new ArrayList(finishedBundlesArray.length); + for (String s : finishedBundlesArray) { + finishedBundles.add(s); + } + } + + if (finishedBundles == null) { + //if null return an empty list + finishedBundles = new ArrayList(0); + } + + return finishedBundles; + } + + private HttpURLConnection getConnection() throws IOException { + String urlAddress = "http://" + _server.getHostname() + ":" + getDefaultWCPort() + + "/ComponentTestStatusServlet/"; + return getConnection(urlAddress); + } + + @Override + public HttpURLConnection getConnection(String urlAddress) throws IOException { + HttpURLConnection cnxn = null; + URL url = new URL(urlAddress); + cnxn = (HttpURLConnection) url.openConnection(); + if (cnxn == null) { + throw new IOException( + "No connection to component test status servlet"); + } + cnxn.setRequestMethod("GET"); + cnxn.setAllowUserInteraction(false); + cnxn.setDoInput(true); + return cnxn; + } + + /** {@inheritDoc} */ + @Override + public OSGiApplication installEBA(String EBAName, String filename) throws TopologyException { + // TODO Auto-generated method stub + return installEBA(EBAName, filename, null); + } + + private void copyStream(InputStream is, OutputStream os) throws IOException { + copyStream(is, os, true); + } + + private void copyStream(InputStream is, OutputStream os, boolean closeOutput) throws IOException { + byte[] buf = new byte[8096]; + int len = 0; + while ((len = is.read(buf)) > 0) { + os.write(buf, 0, len); + } + + if (closeOutput) { + os.close(); + } + is.close(); + } + + private void extractFile(ZipFile source, String fileToExtract, String extractTarget) throws IOException { + ZipEntry entry = source.getEntry(fileToExtract); + if (entry == null) { + _LOGGER.log(Level.WARNING, "Could not find " + fileToExtract + " inside " + source.getName()); + } + InputStream is = source.getInputStream(entry); + File f = new File(extractTarget); + f.getParentFile().mkdirs(); + if (!f.getParentFile().exists()) { + throw new IOException("Unable to create directory " + f.getParent()); + } + FileOutputStream warOS = new FileOutputStream(extractTarget); + copyStream(is, warOS); + _LOGGER.log(Level.INFO, "extracted " + fileToExtract + " to " + extractTarget); + } + + private void injectFilesIntoArchive(String sourceArchiveFileName, String targetArchiveFileName, + InjectionEntry entry, String tmpDirName) throws IOException { + File tmpDir = new File(tmpDirName); + if (!tmpDir.exists()) { + if (!tmpDir.mkdirs()) { + _LOGGER.log(Level.WARNING, "Failed to create tmp dir " + tmpDirName); + return; + } + } + + ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(targetArchiveFileName)); + try { + _LOGGER.log(Level.INFO, "Reading " + sourceArchiveFileName); + + ZipFile sourceFile = new ZipFile(sourceArchiveFileName); + Enumeration enumWarContents = sourceFile.entries(); + while (enumWarContents.hasMoreElements()) { + ZipEntry nextEntry = enumWarContents.nextElement(); + + // Don't copy files that we are overriding + if (!(entry.containsFile(nextEntry.getName()))) { + zos.putNextEntry(new JarEntry(nextEntry.getName())); + // dont copy dirs + if (!nextEntry.isDirectory()) { + copyStream(sourceFile.getInputStream(nextEntry), zos, false); + } + } + } + + // Deal with any nested entries + Enumeration enumNested = entry.getEnumNestedEntries(); + while (enumNested.hasMoreElements()) { + String nestedFile = enumNested.nextElement(); + _LOGGER.log(Level.INFO, "Nested " + nestedFile); + String extractTarget = tmpDirName + nestedFile; + extractFile(sourceFile, nestedFile, extractTarget + ".tmp"); + injectFilesIntoArchive(extractTarget + ".tmp", tmpDirName + nestedFile, entry.getUpdatedNestedEntry(nestedFile), + tmpDirName + nestedFile + "tmp/"); + ZipEntry ze = new ZipEntry(nestedFile); + zos.putNextEntry(ze); + File fileToInject = new File(extractTarget); + _LOGGER.log(Level.INFO, "reading nested file from " + fileToInject.getAbsolutePath()); + FileInputStream manifestIS = new FileInputStream(fileToInject); + copyStream(manifestIS, zos, false); + } + + // Go through any files that need updating + Enumeration enumDestinations = entry.getEnumFilesToUpdate(); + while (enumDestinations.hasMoreElements()) { + String destinationForFile = enumDestinations.nextElement(); + String fileNameToInject = entry.getUpdatedFile(destinationForFile); + ZipEntry ze = new ZipEntry(destinationForFile); + zos.putNextEntry(ze); + File fileToInject = new File(fileNameToInject); + _LOGGER.log(Level.INFO, "reading file from " + fileToInject.getAbsolutePath()); + FileInputStream manifestIS = new FileInputStream(fileToInject); + copyStream(manifestIS, zos, false); + } + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + zos.close(); + } + _LOGGER.log(Level.INFO, "finished creating " + targetArchiveFileName); + } + + @Override + public OSGiApplication installEBA(String EBAName, String filename, Properties props) throws TopologyException { + _LOGGER.log(Level.INFO, "Installing " + EBAName + " from " + filename); + + if (null == props) { + props = new Properties(); + } + + String EBAToCopyToLiberty = filename; + + if (null != props && props.size() > 0) { + InjectionEntry entry = (InjectionEntry) props.get(InjectionEntry.INJECTION_PROP); + + if (null != entry) { + String tmpDirName = _server.pathToAutoFVTTestFiles + "/tmp/"; + + try { + + injectFilesIntoArchive(_server.pathToAutoFVTTestFiles + "/" + filename, tmpDirName + filename, entry, tmpDirName); + + // autoFVT/lib/tmp/ Note we don't use newEBA here as the "copyToLibertyServer" + // method uses the autoFVT/lib directory as its base rather than the current directory + // (autoFVT). + EBAToCopyToLiberty = "tmp/" + filename; + } catch (IOException ioe) { + + ioe.printStackTrace(); + + } + } + + } + + try { + _LOGGER.log(Level.INFO, "Install file " + EBAToCopyToLiberty); + String installTo = props.getProperty("location"); + if (null == installTo) { + installTo = "dropins"; + } + + boolean eitherOr = props.containsKey("update_or_install"); + Integer waitFor = (Integer) props.get("wait_for_install"); + Integer updateWait = (Integer) props.get("wait_for_update"); + + //very quick check to see whats there before copying file in.. + int initialInstallCount = _server.waitForMultipleStringsInLog(999, "CWWKZ0001I.* " + EBAName, 1000); + _LOGGER.log(Level.INFO, "Initial count of " + initialInstallCount + " installed hits for <" + EBAName + "> (test wanted " + String.valueOf(waitFor) + ")"); + int initialUpdateCount = _server.waitForMultipleStringsInLog(999, "CWWKZ0003I.* " + EBAName, 1000); + _LOGGER.log(Level.INFO, "Initial count of " + initialUpdateCount + " updated hits for <" + EBAName + "> (test wanted " + String.valueOf(updateWait) + ")"); + int initialEitherCount = _server.waitForMultipleStringsInLog(999, "(CWWKZ0001I|CWWKZ0003I).* " + EBAName, 1000); + _LOGGER.log(Level.INFO, "Initial count of " + initialEitherCount + " combined hits for <" + EBAName + "> "); + + _server.copyFileToLibertyServerRoot(installTo, EBAToCopyToLiberty); + + if (null != waitFor) { + if (waitFor > 0) { + int wantedCount = initialInstallCount + waitFor; + String pattern = "CWWKZ0001I.* " + EBAName; + + if (eitherOr) { + pattern = "(CWWKZ0001I|CWWKZ0003I).* " + EBAName; + wantedCount = initialEitherCount + waitFor; //waitFor & updateWait SHOULD match if using eitheror + _LOGGER.log(Level.INFO, "Using either/or pattern of " + pattern + " and wanted of " + wantedCount); + } + + int hits = _server.waitForMultipleStringsInLog(wantedCount, pattern, 60000); + + if (hits != wantedCount) { + _LOGGER.log(Level.SEVERE, "Found " + hits + " installed hits but expected " + wantedCount + " for <" + EBAName + ">"); + assertEquals("Incorrect number of install messages found ", wantedCount, hits); + } + } + } else { + assertNotNull("The application " + EBAName + " did not appear to have started.", + _server.waitForStringInLog("CWWKZ0001I.* " + EBAName, 60000)); + } + + if (null != updateWait) { + //skip the either/or case, since would have been handled above. + if (updateWait > 0 && !eitherOr) { + int wantedCount = initialUpdateCount + updateWait; + int hits = _server.waitForMultipleStringsInLog(wantedCount, "CWWKZ0003I.* " + EBAName, 60000); + if (hits != wantedCount) { + _LOGGER.log(Level.SEVERE, "Found " + hits + " update hits but expected " + wantedCount + " for <" + EBAName + ">"); + assertEquals("Incorrect number of update messages found ", wantedCount, hits); + } + } + } + + _LOGGER.log(Level.INFO, "Install complete"); + _installedApps.put(EBAName, installTo + "/" + filename); + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } + + /** {@inheritDoc} */ + @Override + public OSGiApplication installEBAContainingWAR(String EBAName, String filename, Properties props) + throws TopologyException { + return installEBA(EBAName, filename, props); + } + + @Override + public void uninstallEBA(String EBAName, String filename) throws TopologyException { + uninstallEBA(EBAName, filename, new Properties()); + } + + /** {@inheritDoc} */ + @Override + public void uninstallEBA(String EBAName, String filename, Properties uninstallProps) throws TopologyException { + try { + if (_installedApps.get(EBAName) != null) { + _LOGGER.log(Level.INFO, "Uninstalling " + EBAName); + int startHits = 0; + boolean waitFor = uninstallProps.containsKey("wait_for_uninstall"); + if (waitFor) { + startHits = _server.waitForMultipleStringsInLog(999, "CWWKZ0009I.* " + EBAName, 1000); + _LOGGER.log(Level.INFO, " - Initial count for uninstall of " + EBAName + " was " + startHits); + } + _server.deleteFileFromLibertyServerRoot(_installedApps.get(EBAName)); + if (waitFor) { + int endHits = _server.waitForMultipleStringsInLog((startHits + 1), "CWWKZ0009I.* " + EBAName, 60000); + _LOGGER.log(Level.INFO, " - Final count for uninstall of " + EBAName + " was " + endHits); + if (endHits != (startHits + 1)) { + _LOGGER.log(Level.SEVERE, "Found " + endHits + " hits but expected " + (startHits + 1)); + } + } else { + assertNotNull("The application " + EBAName + "did not appear to have been stopped after deletion.", + _server.waitForStringInLog("CWWKZ0009I.* " + EBAName, 60000)); + } + _installedApps.remove(EBAName); + _LOGGER.log(Level.INFO, "Uninstall complete for " + EBAName); + } else { + _LOGGER.log(Level.INFO, "Unable to satisfy request to uninstall EBAName " + EBAName + " as it is not known in the current installedApps map"); + } + } catch (Throwable e) { + _LOGGER.log(Level.SEVERE, "Uninstall failed for " + EBAName); + e.printStackTrace(); + } + } + + /** {@inheritDoc} */ + @Override + public void installIntoInternalRepository(String bundleName) throws Exception { + _LOGGER.log(Level.INFO, "Installing " + bundleName + " to the IBR "); + + try { + _server.copyFileToLibertyServerRoot(_IBRDirectory, bundleName); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** {@inheritDoc} */ + @Override + public SecurityConfigurator getSecurityConfigurator() { + return new WASSecurityConfigurator(this); + } + + /** + * -------------------------------------------------------------------------------------------------- + * Methods from AriesTopologyForLiberty interface + * -------------------------------------------------------------------------------------------------- + */ + @Override + public void setIBR(String IBRDir) { + _IBRDirectory = IBRDir; + } + + @Override + public LibertyServer getServer() { + return _server; + } + + @Override + public String getServerRoot() { + return _server.getServerRoot(); + } + + @Override + public void addExpectedBundle(String bundleName) { + _expectedBundles.add(bundleName); + } + + @Override + public void addExpectedBundle(String bundleName, int nTimes) { + for (int i = 0; i < nTimes; i++) { + _expectedBundles.add(bundleName); + } + } + + /** + * This version is internal and takes a boolean for the special case of checking whether we are + * ready to being a component test (i.e. the server is started). + * + * @param customTimeout + * @param checkingReady + * @return boolean indicating if all tests completed + * @throws InterruptedException + * @throws TopologyException + */ + public boolean checkForComponentTestFinish(long customTimeout, boolean checkingReady) + throws InterruptedException, TopologyException { + long startTime = System.currentTimeMillis(); + boolean testsComplete = false; + _LOGGER.log(Level.INFO, "Expecting bundles: " + _expectedBundles); + //loop until the tests are completed or we have exceeded the timeout + while (!testsComplete && ((customTimeout - (System.currentTimeMillis() - startTime) > 0))) { + try { + if (checkingReady) { + //in this special case we are checking that the server is ready + testsComplete = loggingReady(); + } else { + testsComplete = testBundleStatus(); + } + } catch (IOException e) { + _LOGGER.log(Level.WARNING, "IOException contacting status servlet: " + e.getMessage()); + /* + * we catch IOExceptions within the loop because we might just be too early + * for the servlet to be ready, so we move on to the next iteration and try again + */ + } + //if we're going round the loop again then pause for 1 s so + // we don't keep hammering the servlet + if (!testsComplete) + Thread.sleep(1000); + } + return testsComplete; + } + + /** + * This method checks if we are ready to start installing and running component tests. + * It does this by checking if the commong logging bundle has reported as as finished. + * The logging bundle reports finished when its init-method of loggingActive is run. + * + * @param customTimeout + * @throws Exception + */ + @Override + public void checkReady(long customTimeout) throws InterruptedException, TopologyException { + checkForComponentTestFinish(customTimeout, true); + } + + /** + * -------------------------------------------------------------------------------------------------- + * UNIMPLEMENTED METHODS + * -------------------------------------------------------------------------------------------------- + */ + + /** {@inheritDoc} */ + @Override + public void addExtensions(String arg0, String... arg1) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String adminConfigSave() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void applyUpdates(String arg0, String arg1, SaveConfig arg2) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void clearBundleCache() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void clearBundleCache_Repositories() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String copyFileToTestDir(String arg0) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String copyRemoteFileToLocal(String arg0, String arg1) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void createDerbyDatabase(String arg0, String arg1, String arg2, boolean arg3, String arg4, File arg5) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void createPhysicalDatabase(String arg0, File arg1) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean createWASProfile(String arg0, String arg1, String arg2, String arg3, String arg4) throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void createj2cAuthData(String arg0, String arg1, String arg2) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean deleteWASProfile(String arg0) throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean disableJava2Security() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void disableServletCaching(String arg0) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean doesConfigFileExist(String arg0) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean enableJava2Security() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void enableServletCaching(String arg0) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String executeConsoleCommand(String arg0) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String executeWsadminCommand(String arg0) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String executeWsadminCommand(String arg0, boolean arg1) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String executeWsadminScript(File arg0) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String executeWsadminScript(File arg0, Properties arg1) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String executeWsadminScript(File arg0, String... arg1) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String generateMigrationPortDefProperties() throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String getCUUpdateStatus(String arg0) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String getCellName() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String getName() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public File getNodeMetadataFile() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String getNodeName() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public int getRMIPort() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public int getSIBEndpoint() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public File getServerLogs() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String getSystemExternalBundleRepository() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String getTestDir() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public File getTestLog(String arg0) throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String getWASInstallRoot() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public String getWASProfileRoot() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public List getWASProfiles() throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public WebClient getWebClient() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public int getWebServerPort() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public WebServer getWebServerToUse() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void initWebServer() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public OSGiApplication installEBAContainingWARDefaultBindings(String arg0, String arg1, Properties arg2) throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean installEar(String arg0, String arg1, Properties arg2) throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void installServlet(String arg0, String arg1, String arg2, String arg3, String arg4) throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean iszos() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public List listApps() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean migrationCleanup(File arg0, String arg1, String arg2) throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean migrationSetup(File arg0, String arg1, String arg2, String arg3, String arg4, String arg5, String arg6, boolean arg7) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void postTestingTidyUp() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean putNodeMetadataFile(String arg0) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void refreshCache() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean remoteFileExists(String arg0) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void removeExtensions(String arg0, String... arg1) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void restart() throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void restartBLA(String arg0) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean runPostMigration(File arg0, String arg1, String arg2, String arg3, String arg4) throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void setSystemProperty(String arg0, String arg1) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void setTraceOff() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void setTraceOn(Properties arg0) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void setupSystemExternalBundleRepository() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void startBLA(String arg0) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean stop() throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void stopBLA(String arg0) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void syncNodes() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean sysoutContains(String arg0, String arg1) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean uninstallEar(String arg0) throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void uninstallServlet(String arg0) throws TopologyException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void updateBundleVersions(String arg0, Object... arg1) throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void updateServerPolicy() { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public boolean webserverPluginContains(String arg0) { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void zOSAddNodeNameGlobal() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + + /** {@inheritDoc} */ + @Override + public void zOSRemoveNodeNameGlobal() throws Exception { + throw new UnsupportedOperationException("Not implemented"); + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/common/apiservices/Bootstrap.java b/dev/fattest.simplicity/src/componenttest/common/apiservices/Bootstrap.java new file mode 100755 index 000000000000..44406314a1a5 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/common/apiservices/Bootstrap.java @@ -0,0 +1,239 @@ +package componenttest.common.apiservices; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.Properties; + +import com.ibm.websphere.simplicity.ConnectionInfo; +import com.ibm.websphere.simplicity.configuration.PropertiesConfigurationProvider; +import com.ibm.websphere.simplicity.log.Log; + +public class Bootstrap { + + private static Class c = Bootstrap.class; + private static Bootstrap instance; + + private PropertiesConfigurationProvider config; + + /** + * Get the default Bootstrap instance, or the cached one if obtained previously. + * + * @return + * @throws Exception + */ + public static Bootstrap getInstance() throws Exception { + if (instance == null) + instance = new Bootstrap(); + return instance; + } + + /** + * Get the Bootstrap instance for the file, or the cached one if obtained previously.
    + * Note: if bootstrap is already cached, file argument is ignored. + * + * @return + * @throws Exception + */ + public static Bootstrap getInstance(File file) throws Exception { + if (instance == null) + instance = new Bootstrap(file); + return instance; + } + + /** + * Get a Bootstrap instance that corresponds to the file passed, do not cache the response. + * + * @param file properties for the bootstrap + * @return BootStrap instance to correspond to the input file. + * @throws Exception + */ + public static Bootstrap getSpecialInstance(File file) throws Exception { + return new Bootstrap(file); + } + + File file; + + private Bootstrap() throws Exception { + this(null); + } + + private Bootstrap(File file) throws Exception { + Log.entering(c, "", file); + this.file = file; // first, try the input File + if (this.file == null || !this.file.exists()) { + // if the input file is no good, try the system property + String path = System.getProperty("bootstrapping.properties"); + if (path != null) { + this.file = new File(path); + System.out.println("Trying system property: " + this.file.getAbsolutePath()); + } + if (this.file == null || !this.file.exists()) { + // if the system property's file is no good, try the user + // directory + this.file = new File(System.getProperty("user.dir") + + "/bootstrapping.properties"); + System.out.println("Trying user.dir: " + this.file.getAbsolutePath()); + if (this.file == null || !this.file.exists()) { + // if the user.dir's file is no good, try the current + // working directory + this.file = new File("bootstrapping.properties"); + System.out.println("Trying current working dir: " + this.file.getAbsolutePath()); + } + if (this.file == null || !this.file.exists()) { + //This could be a tWAS FAT suite so finally check in the local.properties + Properties localProps = new Properties(); + String props = System.getProperty("local.properties"); + if (props != null) { + FileInputStream in = new FileInputStream(props); + localProps.load(in); + in.close(); + this.file = new File(localProps.getProperty("bootstrapping.properties")); + } + } + if (this.file == null || !this.file.exists()) + generateDefaultBootstrapFile(); + } + } + init(); + Log.exiting(c, ""); + } + + /** + * Only works for Alpine installations. + * + * @return Path to the server. + */ + public List getServerKeys() { + Log.entering(c, "getServerKeys"); + List ret = findKeys("alpine."); + Log.exiting(c, "getServerKeys", ret); + return ret; + } + + public File getFile() { + return this.file; + } + + public String getValue(String key) { + Log.entering(c, "getValue", key); + String ret = config.getProperty(key); + Log.exiting(c, "getValue", ret); + return ret; + } + + public void setValue(String key, String value) throws Exception { + config.setProperty(key, value); + config.writeProperties(); + } + + public ConnectionInfo getMachineConnectionData(String hostname) throws Exception { + String method = "getMachineConnectionData"; + Log.entering(c, method, hostname); + String user = null; + String password = null; + + boolean exact = config.hasProperty(hostname + ".user"); + Log.finer(c, method, "Found exact match: " + exact); + user = config.getProperty(hostname + ".user"); + password = config.getProperty(hostname + ".password"); + + Log.finer(c, method, "Values", new Object[] { "User: " + user, + "Password: " + password }); + + ConnectionInfo ret = null; + if (user == null) { + //Assume a username is not required and just default it. + //This is required for tWAS FAT suites as the user and pword aren't + //set in the bootstrapping.properties when security is off + //and the tWAS FAT suites require them + ret = new ConnectionInfo(hostname, "USERNAME", "PASSWORD"); + } else { + if (password != null) + ret = new ConnectionInfo(hostname, user, password); + else { + String keystorePath = config.getProperty("keystore"); + Log.finer(c, method, "Keystore: " + keystorePath); + File f = new File(keystorePath); + ret = new ConnectionInfo(hostname, f, user, password); + } + } + + Log.exiting(c, method, ret); + return ret; + } + + private void generateDefaultBootstrapFile() throws Exception { + final String method = "generateDefaultBootstrapFile"; + + Log.finer(c, method, "Creating auto-generated bootstrapping properties."); + + Properties props = new Properties(); + props.setProperty("hostName", "localhost"); + props.setProperty("HOSTNAME.user", "USER"); + props.setProperty("HOSTNAME.password", "PASSWORD"); + props.setProperty("local.sharedLib", "../../test_prereqs/moonstone/sharedlibraries"); + props.setProperty("junit_jar", "../../ant_build/lib"); + props.setProperty("local.java", "../../fattest.simplicity"); + props.setProperty("shared.resources", "../../build.sharedResources/lib"); + props.setProperty("localhost.JavaHome", System.getProperty("java.home")); + + // Try a couple options in order to generate a libertyInstallPath + String wlpInstallDir = null; + if (new File("../build.image/wlp").exists()) + wlpInstallDir = "../build.image/wlp"; + if (wlpInstallDir == null) + wlpInstallDir = System.getProperty("wlp.install.dir"); + if (wlpInstallDir == null) + wlpInstallDir = ""; // this will fail later, but the error will be clear + props.setProperty("libertyInstallPath", wlpInstallDir); + Log.finer(c, method, "Using libertyInstallPath of: " + wlpInstallDir); + + OutputStream output = new FileOutputStream("bootstrapping.properties"); + try { + props.store(output, "Auto-generated properties by " + c.getCanonicalName()); + } finally { + output.close(); + } + } + + private void init() throws Exception { + Log.entering(c, "init"); + config = new PropertiesConfigurationProvider(file); + Log.exiting(c, "init", config); + } + + /** + * Get a List of unique keys that begin with keyStart + * + * @param keyStart + * The prefix of the key to find + * @return A List of unique keys that begin with keyStart + */ + private List findKeys(String keyStart) { + List keyList = new ArrayList(); + Enumeration propNames = config.getPropertyNames(); + while (propNames.hasMoreElements()) { + String next = (String) propNames.nextElement(); + if (next.startsWith(keyStart)) { + String suffix = next.substring(keyStart.length()); + String key = keyStart + + suffix.substring(0, suffix.indexOf(BootstrapProperty.PROPERTY_SEP.toString())); + if (!keyList.contains(key)) { + keyList.add(key); + } + } + } + return keyList; + } + + @Override + public String toString() { + return "Bootstrap properties: " + getFile(); + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/common/apiservices/BootstrapProperty.java b/dev/fattest.simplicity/src/componenttest/common/apiservices/BootstrapProperty.java new file mode 100755 index 000000000000..49e5b369bcba --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/common/apiservices/BootstrapProperty.java @@ -0,0 +1,212 @@ +package componenttest.common.apiservices; + +/** + * This enum contains the valid properties and property keys for the bootstrapping properties file. + * Property "keys" end with the String "KEY" (ex: HOST_NAME) and are used to identify what entity + * a property value belongs to.
    + * Ex: hostName=machine.ibm.com identifies the name of the machine referenced by key hostName + */ +public enum BootstrapProperty { + + // Properties + ALIAS("alias"), + BASE_PRODUCT_VERSION("baseProductVersion"), + BUILD_DATE("buildDate"), + BUILD_LEVEL("buildLevel"), + CELL_NAME("cellName"), + CLUSTER_NAME("clusterName"), + CONFIG_PATH("configPath"), + CONN_TYPE("connType"), + CONN_PORT("connPort"), + DEFAULT_ENCODING("defaultEncoding"), + EXEC_FILE_SUFFIX("execFileSuffix"), + FILE_SEPARATOR("fileSeparator"), + FINALIZED("finalized"), + HOSTNAME("hostname"), + INSTALL("install"), + INSTALL_ROOT("installRoot"), + INSTALL_TYPE("installType"), + JVM_ARGS("jvmargs"), + LINE_SEPARATOR("lineSeparator"), + LOCAL_WSADMIN("local.wsadmin"), + MACHINE("machine"), + NODE_NAME("nodeName"), + OBJECT_NAME("objectName"), + OS("operatingSystem"), + OS_VERSION("osVersion"), + PASSWORD("password"), + PATH_SEPARATOR("pathSeparator"), + PLUGIN_CONFIG_PATH("pluginConfigPath"), + PLUGIN_INSTALL_ROOT("pluginInstallRoot"), + PORT("port"), + PORT_HOST("portHost"), + PROFILE_PATH("profilePath"), + PROFILE_NAME("profileName"), + RAW_OS_NAME("rawOSName"), + ROOT_NODE_HOSTNAME("rootNodeHostname"), + ROOT_NODE_PROFILE_PATH("rootNodeProfilePath"), + ROOT_NODE_INSTALL_PATH("rootNodeInstallPath"), + SECURITY_ENABLED("securityEnabled"), + SERVER("server"), + SERVER_NAME("serverName"), + SERVER_TYPE("serverType"), + TEMP_DIR("tempDir"), + TOPOLOGY_TYPE("topology"), + USER("user"), + WAS_USERNAME("WASUsername"), + WAS_PASSWORD("WASPassword"), + WAS_PRODUCT("wasProduct"), + WAS_PRODUCT_ID("wasProductId"), + WAS_PRODUCT_NAME("wasProductName"), + WAS_VERSION("wasVersion"), + WEB_SERVER_START_CMD("webServerStartCommand"), + WEB_SERVER_START_CMD_ARGS("webServerStartCommandArgs"), + WEB_SERVER_STOP_CMD("webServerStopCommand"), + WEB_SERVER_STOP_CMD_ARGS("webServerStopCommandArgs"), + WSADMIN_CONFIG_ID("wsadminConfigId"), + + // Bootstrap Keys + WAS_CELL_KEY("was.cell."), + WAS_CLUSTER_KEY("was.cluster."), + WAS_CLUSTER_MEMBER_KEY("was.cluster.member."), + WAS_INSTALL_KEY("was.install."), + WAS_NODE_KEY("was.node."), + WAS_PRODUCT_KEY("was.product."), + WAS_SERVER_KEY("was.server."), + + // 134018-start + + WEB_SERVER_HOST_NAME("webserver1.hostName"), + WEB_SERVER_PORT_NUMBER("webserver1.PortNumber"), + WEB_SERVER_INSTALL_ROOT("webserver1.InstallRoot"), + WEB_SERVER_PLUGINS_INSTALL_ROOT("webserver1.PluginsInstallRoot"), + WEB_SERVER_USERNAME("webserver1.username"), + WEB_SERVER_PASSWORD("webserver1.password"), + + //134018 -- end + + SERVER_JAVA_HOME("JavaHome"), + HOST_NAME("hostName"), + LIBERTY_INSTALL_PATH("libertyInstallPath"), + HOST_USER("user"), + HOST_PASSWORD("password"), + OSGI_PORT("osgi.console"), + + // Bootstrap Keys + MACHINE_KEY("machine"), + LIBERTY_INSTALL_KEY("liberty.install"), + + // SSH properties + KEYSTORE("keystore"), + PASSPHRASE("passphrase"), + + DATA("data"), + PROPERTY_SEP("."), + + // Database properties + // Values needed for each type of database can be found in prereq.dbtest + // properties files for databases and jdbc drivers + LIBERTY_DBJARS("liberty.db_jars"), + // location of the jdbc jars. this is set by run-fat-bucket.xml + DB_HOSTNAME("database.hostname"), + // name of machine database is located on + DB_HOME("database.home"), + // location of the database on the machine + DB_PORT("database.port"), + DB_PORT_SECURE("database.port.secure"), + // database port number + DB_NAME("database.name"), + // database name + DB_USER1("database.user1"), + // database user 1 + DB_PASSWORD1("database.password1"), + // database user 1 password + DB_USER2("database.user2"), + // database user 2 + DB_PASSWORD2("database.password2"), + // database user 2 password + DB_DRIVERNAME("database.drivername"), + // database jdbc driver name + DB_DRIVERNAME_DEFAULT("Derby"), + // database jdbc driver name to default to if not specified in bootstrapping.properties + DB_DRIVERVERSION("database.driverversion"), + // database jdbc driver version + DB_DRIVERVERSION_DEFAULT("10.8"), + // database jdbc driver version to default to if not specified in bootstrapping.properties + DB_JDBCJAR("database.jdbcjar"), + // space separated list of jdbc driver jars + DB_IFXSERVERNAME("database.servername"), + // Informix host name + DB_DBAUSER("database.adminuser"), + // database dba user + DB_DBAPASSWORD("database.adminpassword"), + // database dba user password + DB_MACHINEUSER("database.machineuser"), + // database machine user + DB_MACHINEPWD("database.machinepwd"), + // database machine user password + DB_DROPANDCREATE("database.dropandcreate"), + // drop and create option + DB_VENDORNAME("database.vendorname"), + // database vendor name + DB_VENDORVERSION("database.vendorversion"), + // database vendor version + DB_ACCOUNT("database.account"), + + // Database types + DB_DERBYEMB("DerbyEmbedded"), + DB_DERBYNET("DerbyNetwork"), + DB_DB2("DB2"), + DB_DB2_ISERIES("DB2iSeries"), + DB_DB2_ZOS("DB2zOS"), + DB_INFORMIX("Informix"), + DB_ORACLE("Oracle"), + DB_SQLSERVER("SQLServer"), + DB_SYBASE("Sybase"), + DB_CLOUDANT("Cloudant"), + + // JDBC types, names are taken from Moonstone WFM resources + DB_DATADIRECT_DRIVER("DataDirect_Connect_for_JDBC"), + DB_DERBY_EMBEDDED_DRIVER("Derby_Embedded"), + DB_DERBY_EMBEDDED_DRIVER_40("Derby_Embedded_40"), + DB_DERBY_NETWORK_CLIENT_DRIVER("Derby_Network_Client"), + DB_DERBY_NETWORK_CLIENT_DRIVER_40("Derby_Network_Client_40"), + DB_DB2_JCC_DRIVER("DB2"), + DB_DB2_INATIVE_DRIVER("DB2_iNative"), + DB_DB2_ITOOLBOX_DRIVER("DB2_iToolbox"), + DB_INFORMIX_DRIVER("Informix"), + DB_ORACLE_DRIVER("Oracle"), + DB_SQLSERVER_DRIVER("Microsoft_SQL_Server_JDBC_Driver"), + DB_SYBASE_DRIVER6("jConnect-6_0"), + DB_SYBASE_DRIVER7("jConnect-7_0"); + + public static BootstrapProperty fromPropertyName(String prop) { + for (BootstrapProperty boot : BootstrapProperty.values()) { + if (boot.getPropertyName().equalsIgnoreCase(prop)) { + return boot; + } + } + return null; + } + + private String propertyName; + + private BootstrapProperty(String propertyName) { + this.propertyName = propertyName; + } + + /** + * Get the String value of the property that is read from and written to the bootstrapping + * properties file. + * + * @return The String value of the property + */ + public String getPropertyName() { + return this.propertyName; + } + + @Override + public String toString() { + return this.propertyName; + } +} diff --git a/dev/fattest.simplicity/src/componenttest/common/apiservices/LocalMachine.java b/dev/fattest.simplicity/src/componenttest/common/apiservices/LocalMachine.java new file mode 100755 index 000000000000..540b22e12592 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/common/apiservices/LocalMachine.java @@ -0,0 +1,136 @@ +package componenttest.common.apiservices; + +import java.io.OutputStream; +import java.util.Date; +import java.util.Properties; + +import com.ibm.websphere.simplicity.AsyncProgramOutput; +import com.ibm.websphere.simplicity.ConnectionInfo; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.cmdline.LocalProvider; + +public class LocalMachine extends Machine { + + private static Class c = Machine.class; + private static LocalMachine instance = null; + + public static LocalMachine getInstance() throws Exception { + if (instance == null) + instance = new LocalMachine(); + return instance; + } + + public LocalMachine() throws Exception { + super(Bootstrap.getInstance().getMachineConnectionData("localhost")); + isLocal = true; + } + + public LocalMachine(String user, String password) throws Exception { + super(new ConnectionInfo("localhost", user, password)); + isLocal = true; + } + + @Override + public void connect() throws Exception {} + + @Override + public void disconnect() throws Exception {} + + @Override + public ProgramOutput execute(String cmd, String[] parameters, + String workDir, Properties envVars) throws Exception { + return LocalProvider.executeCommand(this, cmd, parameters, workDir, + envVars); + } + + public void executeAsync(String cmd, String[] parameters, String workDir, Properties envVars, OutputStream redirect) throws Exception { + LocalProvider.executeCommandAsync(this, cmd, parameters, workDir, envVars, redirect); + } + + @Override + public AsyncProgramOutput executeAsync(String cmd, String[] parameters) throws Exception { + return LocalProvider.executeCommandAsync(this, cmd, parameters, workDir, null); + } + + @Override + public String getBootstrapFileKey() { + return null; + } + + @Override + public String getHostname() { + return "localhost"; + } + + @Override + public String getPassword() { + return ""; + } + + @Override + public RemoteFile getTempDir() throws Exception { + return new RemoteFile(this, System.getProperty("java.io.tmpdir")); + } + + @Override + public String getUsername() { + return ""; + } + + @Override + public boolean isConnected() throws Exception { + return true; + } + + @Override + public OperatingSystem getOperatingSystem() throws Exception { + if (this.os == null) { + this.os = OperatingSystem.getOperatingSystem(getRawOSName()); + } + return this.os; + } + + /* + * (non-Javadoc) + * + * @see componenttest.common.apiservices.Machine#killProcess(int) + */ + @Override + public void killProcess(int processId) throws Exception { + killProcessLocal(processId, 0); + } + + private void killProcessLocal(int processID, int attemptNumber) throws Exception { + ProgramOutput po = LocalProvider.killProcess(this, processID); + Thread.sleep(1000); + if (processStillRunning(processID)) { + if (attemptNumber >= 3) { + String ErrorMessage = "The processID " + processID + " could not be killed. The command ran was " + po.getCommand() + " The Std Output is: \'" + + po.getStdout() + "\' and the Std Error was \'" + po.getStderr() + "\'"; + throw new Exception(ErrorMessage); + } else { + Log.warning(c, "Unable to kill process " + processID + " - Retrying, this is attempt number " + attemptNumber); + killProcessLocal(processID, ++attemptNumber); + } + } + } + + /* + * (non-Javadoc) + * + * @see componenttest.common.apiservices.Machine#getDate() + */ + @Override + public Date getDate() throws Exception { + return LocalProvider.getDate(this); + } + + @Override + public String getRawOSName() throws Exception { + return System.getProperty("os.name"); + } +} diff --git a/dev/fattest.simplicity/src/componenttest/common/apiservices/ProcessStatus.java b/dev/fattest.simplicity/src/componenttest/common/apiservices/ProcessStatus.java new file mode 100755 index 000000000000..2273dce22423 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/common/apiservices/ProcessStatus.java @@ -0,0 +1,9 @@ +package componenttest.common.apiservices; + +public enum ProcessStatus { + + STOPPED, + RUNNING, + UNKNOWN; + +} diff --git a/dev/fattest.simplicity/src/componenttest/common/apiservices/cmdline/LocalProvider.java b/dev/fattest.simplicity/src/componenttest/common/apiservices/cmdline/LocalProvider.java new file mode 100755 index 000000000000..305daac9521a --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/common/apiservices/cmdline/LocalProvider.java @@ -0,0 +1,425 @@ +package componenttest.common.apiservices.cmdline; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import com.ibm.websphere.simplicity.AsyncProgramOutput; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; + +public class LocalProvider { + + private static final String WLP_CYGWIN_HOME = System.getenv("WLP_CYGWIN_HOME"); + + @SuppressWarnings("unchecked") + private static final Class c = LocalProvider.class; + + public static boolean copy(RemoteFile sourceFile, RemoteFile destFile, + boolean binary) throws Exception { + File src = new File(sourceFile.getAbsolutePath()); + File dest = new File(destFile.getAbsolutePath()); + if (dest.exists() && dest.isDirectory()) { + dest = new File(destFile.getAbsolutePath() + File.separatorChar + + src.getName()); + } else if (!dest.exists()) + dest.getParentFile().mkdirs(); + FileInputStream fis = new FileInputStream(src); + FileOutputStream fos = new FileOutputStream(dest); + int read; + try { + byte[] buffer = new byte[8192]; + while ((read = fis.read(buffer)) > 0) { + fos.write(buffer, 0, read); + } + } catch (Exception e) { + throw e; + } finally { + try { + fis.close(); + } catch (Exception e) { + // let it go + } + try { + fos.close(); + } catch (Exception e) { + // let it go + } + } + + return dest.exists(); + } + + public static boolean delete(RemoteFile file) throws Exception { + File f = new File(file.getAbsolutePath()); + if (f.isFile()) + return f.delete(); + else { + // recursive delete + deleteFolder(f); + return !f.exists(); + } + } + + private static void deleteFolder(File folder) throws Exception { + if (!folder.exists()) + return; + + for (File f : folder.listFiles()) { + if (f.isFile()) + f.delete(); + else + deleteFolder(f); + } + folder.delete(); + } + + public static ProgramOutput executeCommand(Machine machine, String cmd, + String[] parameters, String workDir, Properties envVars) throws Exception { + ByteArrayOutputStream bufferOut = new ByteArrayOutputStream(); + ByteArrayOutputStream bufferErr = new ByteArrayOutputStream(); + int rc = execute(machine, cmd, parameters, envVars, workDir, bufferOut, + bufferErr, false); + ProgramOutput ret = new ProgramOutput(cmd, rc, bufferOut.toString(), bufferErr.toString()); + return ret; + } + + public static void executeCommandAsync(Machine machine, String cmd, String[] parameters, String workDir, Properties envVars, OutputStream redirect) throws Exception { + execute(machine, cmd, parameters, envVars, workDir, redirect, null, true); + } + + private static final int execute(Machine machine, final String command, + final String[] parameterArray, Properties envp, + final String workDir, final OutputStream stdOutStream, + final OutputStream stdErrStream, boolean async) throws Exception { + final String method = "execute"; + Log.entering(c, method, "async is " + async); + + if (command == null) { + throw new IllegalArgumentException("command cannot be null."); + } + String[] cmd = null; + if (parameterArray != null) { + cmd = new String[parameterArray.length + 1]; + cmd[0] = command; + for (int i = 0; i < parameterArray.length; i++) { + cmd[i + 1] = parameterArray[i]; + } + } else { + cmd = new String[] { command }; + } + + /* + * Windows does not permit execution of batch files directly through + * Runtime.exec. We have to wrap the call to the batch file with a call + * to "cmd /c". + */ + if (machine.getOperatingSystem() == OperatingSystem.WINDOWS && WLP_CYGWIN_HOME == null) { + if (!cmd[0].startsWith("cmd /c")) { + String[] tmp = new String[cmd.length + 2]; + tmp[0] = "cmd"; + tmp[1] = "/c"; + for (int i = 0; i < cmd.length; i++) + tmp[i + 2] = cmd[i]; + cmd = tmp; + } + } else { + if (!cmd[0].startsWith("sh -c")) { + String[] tmp = new String[3]; + String parsedCommand = shArrayTransform(cmd); + tmp[0] = WLP_CYGWIN_HOME == null ? "sh" : WLP_CYGWIN_HOME + "/bin/sh"; + tmp[1] = "-c"; + tmp[2] = parsedCommand; + cmd = tmp; + } + } + + // By default, the subprocess should inherit the working directory of + // the current process + File dir = null; + if (workDir != null) { + dir = new File(workDir); + if (!dir.isDirectory()) { + dir = null; + } + } + + /* + * make sure SystemRoot is defined. For some reason on WindowsXP this + * disappears when passing in evn variables causing socket issues + */ + if (envp != null + && machine.getOperatingSystem() == OperatingSystem.WINDOWS) { + boolean systemRootFound = false; + for (Object p : envp.keySet()) { + // first check if the user defined it. most likely not + if (envp.get(p) != null + && ((String) envp.get(p)).startsWith("SystemRoot")) { + systemRootFound = true; + break; + } + } + if (!systemRootFound) { + // not user defined, so lets make sure it stays set. most likely + // scenario + String systemRoot = System.getenv("SystemRoot"); + envp.setProperty("SystemRoot", systemRoot); + } + } + + //Create the ProcessBuilder object here as we need the environment property map + ProcessBuilder pb = new ProcessBuilder(); + + //Inject the the environment properties + if (envp != null) { + Map tmp = pb.environment(); //This will already have the system environment + for (Map.Entry p : envp.entrySet()) { + tmp.put((String) p.getKey(), (String) p.getValue()); + } + } + + // execute the command + pb.command(cmd); + if (dir != null) + pb.directory(dir); + pb.redirectErrorStream(true); + Process proc = pb.start(); // Runtime.getRuntime().exec(cmd, envVars, + // dir); + StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), stdOutStream, async); + + // listen to subprocess output + outputGobbler.start(); + + if (async) { + Log.exiting(c, method); + return -1; + } + + // wait till completion + proc.waitFor(); + // let the streams catch up (critical step) + outputGobbler.doJoin(); + Log.exiting(c, method); + return proc.exitValue(); + } + + /** + * This method takes the parameter array and turns it into one long string for + * use by the sh -c part of running the command locally on linux + * + * @param cmd + * @return + */ + private static String shArrayTransform(String[] cmd) { + String returned = ""; + for (int i = 0; i < cmd.length; i++) { + returned += cmd[i] + " "; + } + returned = returned.substring(0, (returned.length() - 1)); //should remove the space at the end; + Log.info(c, "shArrayTransform", "Transformed Command now is: " + returned); + return returned; + } + + public static synchronized AsyncProgramOutput executeCommandAsync(Machine machine, + String cmd, String[] parameters, String workDir, + Properties envVars) throws Exception { + String[] tmp = new String[parameters.length + 1]; + tmp[0] = cmd; + for (int i = 0; i < parameters.length; i++) { + tmp[i + 1] = parameters[i]; + } + ProcessBuilder builder = new ProcessBuilder(); + builder.command(tmp); + + /* + * What we're aiming for here is a command which doesn't block, + * but we don't really care about its life continuing past the life + * of this process (with nohup). We also don't think wsscript is + * a great idea, since it pops up firewall questions, which isn't + * really viable on an unattended machine. + * ProcessBuilder.start() should be sufficient for our needs. + */ + Process process = builder.start(); + return new AsyncProgramOutput(cmd, parameters, process); + + } + + public static boolean exists(RemoteFile file) throws Exception { + File f = new File(file.getAbsolutePath()); + return f.exists(); + } + + public static String getOSName(Machine machine) throws Exception { + return System.getProperty("os.name"); + } + + public static boolean isDirectory(RemoteFile dir) throws Exception { + File f = new File(dir.getAbsolutePath()); + return f.isDirectory(); + } + + public static boolean isFile(RemoteFile file) throws Exception { + File f = new File(file.getAbsolutePath()); + return f.isFile(); + } + + public static String[] list(RemoteFile file, boolean recursive) throws Exception { + File f = new File(file.getAbsolutePath()); + List list = new ArrayList(); + String[] children = listDirectory(f); + for (int i = 0; i < children.length; i++) { + File child = new File(f, children[i]); + list.add(child.getAbsolutePath()); + if (recursive && child.isDirectory()) { + RemoteFile childKey = new RemoteFile(file.getMachine(), child.getAbsolutePath()); + String[] grandchildren = list(childKey, recursive); + for (int k = 0; k < grandchildren.length; ++k) { + list.add(grandchildren[k]); + } + } + } + return list.toArray(new String[0]); + } + + private static final String[] listDirectory(File directory) { + File[] files = directory.listFiles(); + String[] result = new String[files.length]; + for (int i = 0; i < files.length; i++) { + result[i] = files[i].getName(); + } + return result; + } + + public static boolean mkdir(RemoteFile dir) throws Exception { + File f = new File(dir.getAbsolutePath()); + return f.mkdir(); + } + + public static boolean mkdirs(RemoteFile dir) throws Exception { + File f = new File(dir.getAbsolutePath()); + return f.mkdirs(); + } + + public static boolean isConnected() throws Exception { + return true; + } + + public static String getTempDir() throws Exception { + return System.getProperty("java.io.tmpdir"); + } + + public static InputStream openFileForReading(RemoteFile file) throws Exception { + return new FileInputStream(file.getAbsolutePath()); + } + + public static OutputStream openFileForWriting(RemoteFile file, + boolean append) throws Exception { + return new FileOutputStream(file.getAbsolutePath(), append); + } + + public static ProgramOutput killProcess(Machine machine, int processId) throws Exception { + final String method = "killProcess"; + Log.entering(c, method, new Object[] { processId }); + String cmd = null; + String[] parameters = null; + if (machine.getOperatingSystem() != OperatingSystem.WINDOWS) { + cmd = "kill" + " -9 " + processId; + // Defect 42663: For some reason passing the kill command with the parameters does not seem to work. + // I do not understand why but giving the whole already built command does work... + // This may need investigation later but for the time being this appears to fix the non-killing problem + // parameters = new String[] { "-9", "" + processId }; + } else { + cmd = "taskkill"; + parameters = new String[] { "/F", "/PID", "" + processId }; + } + Log.finer(c, method, cmd, parameters); + return executeCommand(machine, cmd, parameters, null, null); + } + + public static RemoteFile ensureFileIsOnMachine(Machine target, + RemoteFile file) throws Exception { + if ((target.getHostname() != null && !target.isLocal()) + || (file.getMachine().getHostname() != null && !file.getMachine().isLocal())) + throw new Exception("A remote provider is required to transfer files between physical machines."); + // If we're here, the file already exists on the local machine + return file; + } + + public static Date getDate(Machine machine) throws Exception { + System.out.println(System.currentTimeMillis()); + return new Date(System.currentTimeMillis()); + } + +} + +/** + * This Runnable basically just copies the input from one stream and copies it + * to the output of another. It is designed to copy the output from the Orca + * server process to a file, although it is more general than this. + * + *

    + * It is critical that it reads from an InputStream, and the InputStream from + * the Orca Process, because the other stream types perform buffering this can + * cause all kinds of problems like, causing hangs in the child process because + * we did not read all the content, or only part of the output being captured to + * file. + *

    + */ +class InputCopier implements Runnable { + + /** The input stream to read from */ + private final InputStream input; + /** The output stream to write to */ + private final OutputStream output; + + /** + * @param serverOut + * the output from the Orca process, ownership is passed and this + * stream is closed at the end of the thread + * @param writer + * the file to write to, ownership is passed and this stream is + * closed at the end of the thread + */ + public InputCopier(InputStream serverOut, OutputStream writer) { + input = serverOut; + output = writer; + } + + @Override + public void run() { + int len; + + // create a byte buffer + byte[] buffer = new byte[1024]; + + try { + // read in some data into the buffer, keep doing this until + // we get -1 back which generally indicates that stream is + // closed. + while ((len = input.read(buffer)) != -1) { + // and write and flush + output.write(buffer, 0, len); + output.flush(); + } + + // close the streams + output.close(); + input.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/common/apiservices/cmdline/RXAProvider.java b/dev/fattest.simplicity/src/componenttest/common/apiservices/cmdline/RXAProvider.java new file mode 100755 index 000000000000..dd2c642cd6e9 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/common/apiservices/cmdline/RXAProvider.java @@ -0,0 +1,731 @@ +package componenttest.common.apiservices.cmdline; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import com.ibm.tivoli.remoteaccess.FileInfo; +import com.ibm.tivoli.remoteaccess.OSResourceType; +import com.ibm.tivoli.remoteaccess.ProtocolSelector; +import com.ibm.tivoli.remoteaccess.RemoteAccess; +import com.ibm.tivoli.remoteaccess.SSHProtocol; +import com.ibm.tivoli.remoteaccess.UNIXProtocol; +import com.ibm.websphere.simplicity.ConnectionInfo; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; + +public class RXAProvider { + + public static String LOCAL_HOSTNAME; + public static String LOCAL_IP_ADDRESS; + public static String LOCAL_IP_ADDRESS2 = "127.0.0.1"; + public static final String LOCALHOST = "localhost"; + public static final String CYGWIN_DRIVE = "/cygdrive/"; + private static final Class c = RXAProvider.class; + private static final OSResourceType[] POSIX = { OSResourceType.HPUX, + OSResourceType.IBMAIX, OSResourceType.OS400, + OSResourceType.OtherLinux, OSResourceType.RedHatLinux, + OSResourceType.SunSolaris, OSResourceType.SUSELinux, + OSResourceType.zOS }; + + private static Map cache = new HashMap(); + private static Map dataCache = new HashMap(); + + static { + try { + LOCAL_HOSTNAME = InetAddress.getLocalHost().getCanonicalHostName(); + } catch (Exception e) { + LOCAL_HOSTNAME = "localhost"; + } + try { + LOCAL_IP_ADDRESS = InetAddress.getLocalHost().getHostAddress(); + } catch (Exception e) { + LOCAL_IP_ADDRESS = LOCAL_IP_ADDRESS2; + } + } + + public static RemoteAccess getRemoteAccess(ConnectionInfo connInfo) + throws Exception { + return getRemoteAccess(connInfo, true, true); + } + + public static boolean isLocal(String hostname) throws Exception { + boolean local = ((LOCAL_HOSTNAME.equalsIgnoreCase(hostname)) + || (LOCALHOST.equalsIgnoreCase(hostname)) + || (LOCAL_IP_ADDRESS.equals(hostname)) || (LOCAL_IP_ADDRESS2 + .equals(hostname))); + return local; + } + + public static SSHProtocol getRemoteAccess(ConnectionInfo connInfo, + boolean connect, boolean useCached) throws Exception { + final String method = "getRemoteAccess"; + Log.entering(c, method, new Object[] { connInfo, connect, useCached }); + String key = connInfo.getHost() + connInfo.getUser() + + connInfo.getPassword() + connInfo.getKeystore(); + Log.finer(c, method, "key: " + key); + ConnectionInfo connData = dataCache.get(key); + if (connData == null) { + if (connInfo.getKeystore() != null) { + connData = new ConnectionInfo(connInfo.getHost(), + connInfo.getKeystore(), connInfo.getUser(), connInfo + .getPassword()); + } else { + connData = new ConnectionInfo(connInfo.getHost(), + connInfo.getUser(), connInfo.getPassword()); + } + Log.finer(c, method, "Adding new RXAConnectionData to cache."); + dataCache.put(key, connData); + } + SSHProtocol ra = null; + if (useCached) { + Log.finer(c, method, "Getting cached RemoteAccess."); + ra = cache.get(connData); + } + if (ra == null) { + Log.finer(c, method, + "RemoteAccess is null. Obtaining a new instance."); + RemoteAccess[] protocols = getProtocols(connData); + ra = (SSHProtocol) ProtocolSelector.selectProtocol(protocols); + if (ra == null) { + throw new Exception( + "Unable to make remote connection with specified credentials: hostname=" + + connInfo.getHost() + ",username=" + + connInfo.getUser() + ",password=" + + connInfo.getPassword() + ",keystore=" + + connInfo.getKeystore()); + } + if (useCached) { + Log.finer(c, method, "Caching new RemoteAccess."); + cache.put(connData, ra); + } + if (!connect && ra.inSession()) { + Log + .finer( + c, + method, + "RemoteAccess is connected and we want an unconnected session. Closing connection."); + ra.endSession(); + } + } + if (connect && !ra.inSession()) { + Log.finer(c, method, + "RemoteAccess is not connected. Establishing connection."); + ra.beginSession(); + } + Log.exiting(c, method, ra); + return ra; + } + + private static RemoteAccess[] getProtocols(ConnectionInfo connData) { + final String method = "getProtocols"; + Log.entering(c, method, connData); + RemoteAccess[] accessProtocols = new RemoteAccess[4]; + + // instantiate various protocols we want to attempt + String username = ""; + String password = ""; + File keyStore = null; + String hostname = connData.getHost(); + if (connData.getUser() != null) { + username = connData.getUser(); + } + if (connData.getPassword() != null) { + password = connData.getPassword(); + } + if (connData.getKeystore() != null) { + keyStore = connData.getKeystore(); + } + SSHProtocol ssh = null; + if (keyStore != null) { + ssh = new SSHProtocol(keyStore, username, password.getBytes(), + hostname); + } else { + ssh = new SSHProtocol(username, password.getBytes(), hostname); + } + accessProtocols[0] = ssh; + + Log.exiting(c, method, accessProtocols); + return accessProtocols; + } + + /** + * @param absolutePath + * @param newPath + * @return + */ + public static boolean rename(RemoteFile oldPath, RemoteFile newPath) throws Exception { + final String method = "rename"; + Log.entering(c, method, new Object[] { oldPath, newPath }); + String srcHost = oldPath.getMachine().getHostname(); + String destHost = newPath.getMachine().getHostname(); + + boolean ret = false; + if (srcHost.equals(destHost)) { + RemoteAccess ra = getRemoteAccess(oldPath.getMachine().getConnInfo()); + ra.rename(fixOutgoingPath(ra, oldPath.getAbsolutePath()), fixOutgoingPath(ra, newPath.getAbsolutePath())); + ret = ra.exists(fixOutgoingPath(ra, newPath.getAbsolutePath())); + } + Log.exiting(c, method, ret); + return ret; + } + + public static boolean copy(RemoteFile sourceFile, RemoteFile destFile, boolean binary) throws Exception { + final String method = "copy"; + Log.entering(c, method, new Object[] { sourceFile, destFile }); + RemoteAccess source = null; + RemoteAccess dest = null; + boolean srcLocal = isLocal(sourceFile.getMachine().getHostname()); + boolean destLocal = isLocal(destFile.getMachine().getHostname()); + + boolean ret; + if (srcLocal && destLocal) { + if (destFile.isDirectory()) + destFile = new RemoteFile(destFile.getMachine(), destFile, sourceFile.getName()); + InputStream is = sourceFile.openForReading(); + OutputStream os = null; + byte[] buf = new byte[8096]; + int len = 0; + try { + os = destFile.openForWriting(false); + + while ((len = is.read(buf)) > 0) { + os.write(buf, 0, len); + } + } finally { + try { + if (os != null) + os.close(); + } catch (Exception e) { + throw e; + } finally { + is.close(); + } + } + ret = destFile.exists(); + } else if (!srcLocal && !destLocal) { + Log.finer(c, method, "Both source and destination files are remote."); + source = getRemoteAccess(sourceFile.getMachine().getConnInfo()); + dest = getRemoteAccess(destFile.getMachine().getConnInfo()); + File tempFile = new File(System.getProperty("java.io.tmpdir"), new File(sourceFile.getAbsolutePath()).getName()); + tempFile.getParentFile().mkdirs(); + source.getFile(fixOutgoingPath(source, sourceFile.getAbsolutePath()), tempFile); + dest.mkDirs(fixOutgoingPath(dest, destFile.getParent())); + + if (binary) { + dest.putFile(tempFile, fixOutgoingPath(dest, destFile.getAbsolutePath())); + } else { + dest.putTextFile(tempFile, fixOutgoingPath(dest, destFile.getAbsolutePath())); + } + + tempFile.delete(); + ret = dest.exists(fixOutgoingPath(dest, destFile.getAbsolutePath())); + } else if (srcLocal) { + Log.finer(c, method, "Source file is local. Destination file is remote."); + File srcFile = new File(sourceFile.getAbsolutePath()); + dest = getRemoteAccess(destFile.getMachine().getConnInfo()); + dest.mkDirs(fixOutgoingPath(dest, destFile.getParent())); + if (binary) { + dest.putFile(srcFile, fixOutgoingPath(dest, destFile.getAbsolutePath())); + } else { + dest.putTextFile(srcFile, fixOutgoingPath(dest, destFile.getAbsolutePath())); + } + + ret = dest.exists(fixOutgoingPath(dest, destFile.getAbsolutePath())); + } else { + // destLocal + Log.finer(c, method, "Source file is remote. Destination file is local."); + source = getRemoteAccess(sourceFile.getMachine().getConnInfo()); + File localDestFile = new File(destFile.getAbsolutePath()); + localDestFile.getParentFile().mkdirs(); + if (binary) { + source.getFile(fixOutgoingPath(source, sourceFile.getAbsolutePath()), localDestFile); + } else { + source.getTextFile(fixOutgoingPath(source, sourceFile.getAbsolutePath()), localDestFile); + } + + ret = localDestFile.exists(); + } + Log.exiting(c, method, ret); + return ret; + } + + public static boolean delete(RemoteFile file) throws Exception { + final String method = "delete"; + Log.entering(c, method, file); + RemoteAccess ra = getRemoteAccess(file.getMachine().getConnInfo()); + ra.rm(fixOutgoingPath(ra, file.getAbsolutePath()), true, true); + boolean ret = !ra.exists(fixOutgoingPath(ra, file.getAbsolutePath())); + Log.exiting(c, method, ret); + return ret; + } + + public static ProgramOutput executeCommand(Machine machine, String cmd, + String[] parameters, String workDir, Properties envVars) + throws Exception { + return executeCommand(machine, cmd, parameters, workDir, envVars, 0); + } + + public static ProgramOutput executeCommand(Machine machine, String cmd, + String[] parameters, String workDir, Properties envVars, int timeout) + throws Exception { + final String method = "executeCommand"; + Log.entering(c, method, new Object[] { machine, cmd, parameters, + workDir, envVars }); + + long start = System.currentTimeMillis(); + + ProgramOutput ret = null; + SSHProtocol ra = getRemoteAccess(machine.getConnInfo(), true, + true); + if (!ra.inSession()) + ra.beginSession(); + try { + // first change the work directory + if (workDir != null) { + workDir = workDir.replace('\\', '/'); + workDir = fixOutgoingPath(ra, workDir); + ra.setCurrentDirectory(workDir); + } + + Hashtable envBackup = new Hashtable(); + // figure out if this is Unix env or Windows and use appropriate + // command + OperatingSystem os = OperatingSystem.getOperatingSystem(getOSName(machine)); + + // next set the environment variables + if (envVars != null) { + String setEnvCmd = null; + Enumeration keys = envVars.keys(); + while (keys.hasMoreElements()) { + String var = (String) keys.nextElement(); + // backup the original value + String orig = ra.getEnvValue(var); + if (orig != null) + envBackup.put(var, orig); + // set the new value + if (ra instanceof UNIXProtocol) { + setEnvCmd = "export " + var + "=" + + (String) envVars.get(var); + } else { + setEnvCmd = os.getEnvVarSet() + " " + var + "=" + + (String) envVars.get(var); + } + ra.run(setEnvCmd); + } + } + + // now run the requested command + String command = cmd; + if (parameters != null) { + for (int i = 0; i < parameters.length; i++) { + command += (" " + parameters[i]); + } + } + Log.finer(c, method, "Final command: " + command); + com.ibm.tivoli.remoteaccess.ProgramOutput po = null; + if (timeout > 0) { + po = ra.run(command, timeout); + } else { + po = ra.run(command); + } + Log.finer(c, method, "Stdout", po.getStdout()); + Log.finer(c, method, "Stderr", po.getStderr()); + ret = new ProgramOutput(command, po.getReturnCode(), + po.getStdout(), po.getStderr()); + + // Restore any backed-up env variables + for (Map.Entry e : envBackup.entrySet()) { + String setEnvCmd = null; + if (ra instanceof UNIXProtocol) { + setEnvCmd = "export " + e.getKey() + "=" + e.getValue(); + } else { + setEnvCmd = os.getEnvVarSet() + " " + e.getKey() + "=" + + e.getValue(); + } + ra.run(setEnvCmd); + } + } finally { + // ra.endSession(); + } + + long dur = (System.currentTimeMillis() - start) / 1000; + Log.finer(c, method, "Performance audit", new String[] { "Command: " + cmd, "Duration: " + dur }); + Log.exiting(c, method, ret); + return ret; + } + + public static ProgramOutput executeAsync(Machine machine, String cmd, String[] parameters, + String workDir, Properties envVars) throws Exception { + final String method = "executeAsync"; + Log.entering(c, method, new Object[] { machine, cmd, parameters, workDir, + envVars }); + + String newcmd = null; + if (!machine.getOperatingSystem().equals(OperatingSystem.WINDOWS)) { + newcmd = "nohup "; + } + newcmd += cmd + " "; + for (int i = 0; i < parameters.length; i++) + newcmd += parameters[i] + " "; + newcmd += "&"; + + ProgramOutput ret = executeCommand(machine, newcmd, null, workDir, + envVars); + Log.exiting(c, method, ret); + return ret; + } + + public static boolean exists(RemoteFile file) throws Exception { + final String method = "exists"; + Log.entering(c, method, file); + RemoteAccess ra = getRemoteAccess(file.getMachine().getConnInfo()); + boolean ret = ra.exists(fixOutgoingPath(ra, file.getAbsolutePath())); + Log.exiting(c, method, ret); + return ret; + } + + public static String getOSName(Machine machine) throws Exception { + final String method = "getOSName"; + Log.entering(c, method, machine); + RemoteAccess ra = getRemoteAccess(machine.getConnInfo()); + //We do this as the second part of the argument returns a unknown when ran against a remote Mac. + //By getting two versions of the OS name and appending to the front when it determines the OS type + //It will look at the freeform before looking at the rest. + String osName = ra.getOS().getFreeformOSName() + " " + ra.getOS().getOSResourceType().toString(); + Log.exiting(c, method, osName); + return osName; + } + + public static boolean isDirectory(RemoteFile dir) throws Exception { + final String method = "isDirectory"; + Log.entering(c, method, dir); + File file = new File(dir.getAbsolutePath()); + if (file.getParentFile() == null) { + // root + Log.finer(c, method, "Directory is root."); + Log.exiting(c, method, true); + return true; + } + RemoteAccess ra = getRemoteAccess(dir.getMachine().getConnInfo()); + String parent = fixOutgoingPath(ra, dir.getParent().replace('\\', '/')); + boolean ret = (getFileType(ra, parent, fixOutgoingPath(ra, dir + .getAbsolutePath())) == FileInfo.isDirectory); + Log.exiting(c, method, ret); + return ret; + } + + public static boolean isFile(RemoteFile file) throws Exception { + final String method = "isFile"; + Log.entering(c, method, file); + File f = new File(file.getAbsolutePath()); + if (f.getParentFile() == null) { + // root + Log.finer(c, method, "Directory is root."); + Log.exiting(c, method, false); + return false; + } + RemoteAccess ra = getRemoteAccess(file.getMachine().getConnInfo()); + String parent = fixOutgoingPath(ra, file.getParent().replace('\\', '/')); + boolean ret = (getFileType(ra, parent, fixOutgoingPath(ra, file + .getAbsolutePath())) == FileInfo.isFile); + Log.exiting(c, method, ret); + return ret; + } + + private static int getFileType(RemoteAccess ra, String parent, String file) + throws Exception { + final String method = "getFileType"; + Log.entering(c, method, new Object[] { ra, parent, file }); + FileInfo[] files = ra.listFiles(parent); + int type = FileInfo.unknown; + for (int i = 0; i < files.length; ++i) { + FileInfo f = files[i]; + String filePath = null; + if (!parent.equals("/")) { + filePath = parent + "/" + f.getFilename(); + } else { + filePath = parent + f.getFilename(); + } + if (filePath.equals(file)) { + Log.finer(c, method, "File match found."); + type = f.getFileType(); + break; + } + } + Log.exiting(c, method, type); + return type; + } + + public static String[] list(RemoteFile file, boolean recursive) + throws Exception { + final String method = "list"; + Log.entering(c, method, new Object[] { file, recursive }); + RemoteAccess ra = getRemoteAccess(file.getMachine().getConnInfo()); + String fixedFilePath = fixOutgoingPath(ra, file.getAbsolutePath()); + System.out.println("Fixed file path: " + fixedFilePath); + FileInfo[] files = ra.listFiles(fixedFilePath); + List returnList = new ArrayList(); + for (int i = 0; i < files.length; ++i) { + if (!(files[i].getFilename().equals(".") || files[i].getFilename() + .equals(".."))) { + String child = null; + if (fixedFilePath.endsWith("/")) { + child = fixIncomingPath(file.getAbsolutePath() + + files[i].getFilename()); + } else { + child = fixIncomingPath(file.getAbsolutePath() + "/" + + files[i].getFilename()); + } + returnList.add(child); + RemoteFile childKey = new RemoteFile(file.getMachine(), child); + if (recursive && isDirectory(childKey)) { + String[] grandChildren = list(childKey, recursive); + for (int k = 0; k < grandChildren.length; ++k) { + returnList.add(grandChildren[k]); + } + } + } + } + + String[] ret = returnList.toArray(new String[0]); + Log.exiting(c, method, ret); + return ret; + } + + public static boolean mkdir(RemoteFile dir) throws Exception { + final String method = "mkdir"; + Log.entering(c, method, dir); + RemoteAccess ra = getRemoteAccess(dir.getMachine().getConnInfo()); + try { + ra.mkDir(fixOutgoingPath(ra, dir.getAbsolutePath())); + } catch (IOException e) { + // Swallow the failure since it probably means the folder already + // exists + } + boolean ret = ra.exists(fixOutgoingPath(ra, dir.getAbsolutePath())); + Log.exiting(c, method, ret); + return ret; + + } + + public static boolean mkdirs(RemoteFile dir) throws Exception { + final String method = "mkdirs"; + Log.entering(c, method, dir); + RemoteAccess ra = getRemoteAccess(dir.getMachine().getConnInfo()); + // javadoc for mkdirs says it succeeds if the file exists... but mkdir + // fails in the same case... + ra.mkDirs(fixOutgoingPath(ra, dir.getAbsolutePath())); + boolean ret = ra.exists(fixOutgoingPath(ra, dir.getAbsolutePath())); + Log.exiting(c, method, ret); + return ret; + } + + public static void connect(ConnectionInfo connInfo) throws Exception { + final String method = "connect"; + Log.entering(c, method, connInfo); + getRemoteAccess(connInfo); + Log.exiting(c, method); + } + + public static void disconnect(ConnectionInfo connInfo) + throws Exception { + final String method = "disconnect"; + Log.entering(c, method, connInfo); + getRemoteAccess(connInfo).endSession(); + Log.exiting(c, method); + } + + public static boolean isConnected(ConnectionInfo connInfo) + throws Exception { + final String method = "isConnected"; + Log.entering(c, method, connInfo); + boolean ret = getRemoteAccess(connInfo, false, true).inSession(); + Log.exiting(c, method, ret); + return ret; + } + + public static String getTempDir(ConnectionInfo connInfo) + throws Exception { + final String method = "getTempDir"; + Log.entering(c, method, connInfo); + String ret = fixIncomingPath(getRemoteAccess(connInfo).getTempDir()); + Log.exiting(c, method, ret); + return ret; + } + + public static ProgramOutput killProcess(Machine machine, int processId) + throws Exception { + final String method = "killProcess"; + Log.entering(c, method, new Object[] { machine, processId }); + String cmd = null; + String[] parameters = null; + if (machine.getOperatingSystem() != OperatingSystem.WINDOWS) { + cmd = "kill"; + parameters = new String[] { "-9", "" + processId }; + } else { + cmd = "taskkill"; + parameters = new String[] { "/F", "/PID", "" + processId }; + } + Log.finer(c, method, cmd, parameters); + return executeCommand(machine, cmd, parameters, null, null); + } + + public static InputStream openFileForReading(RemoteFile file) + throws Exception { + final String method = "openFileForReading"; + Log.entering(c, method, file); + RemoteAccess ra = getRemoteAccess(file.getMachine().getConnInfo()); + InputStream is = ra.getRemoteInputStream(fixOutgoingPath(file + .getMachine(), file.getAbsolutePath())); + Log.exiting(c, method, is); + return is; + } + + public static OutputStream openFileForWriting(RemoteFile file, + boolean append) throws Exception { + final String method = "openFileForWriting"; + Log.entering(c, method, new Object[] { file, append }); + RemoteAccess ra = getRemoteAccess(file.getMachine().getConnInfo()); + OutputStream os = ra.getRemoteOutputStream(fixOutgoingPath(file + .getMachine(), file.getAbsolutePath()), append); + Log.exiting(c, method, os); + return os; + } + + protected static String fixOutgoingPath(Machine machine, String path) + throws Exception { + final String method = "fixOutGoingPath"; + Log.entering(c, method, new Object[] { machine, path }); + RemoteAccess ra = getRemoteAccess(machine.getConnInfo()); + String ret = fixOutgoingPath(ra, path); + Log.entering(c, method, ret); + return ret; + } + + /** + * Makes necessary changes to the path for compatibility with the target + * system. Windows paths are converted to Posix and vice- versa. + * + * @param path + * The path to convert + * @return The converted path + */ + public static String fixOutgoingPath(RemoteAccess ra, String path) + throws Exception { + Log.entering(c, "fixOutgoingPath", path); + if (path == null) + return null; + boolean isPosixOS = true; + OperatingSystem os = OperatingSystem.getOperatingSystem(ra.getOS().getFreeformOSName()); + //Makes the isPosixOS if it is not a unix machine (at least that's what i think it means) + if (os.equals(OperatingSystem.WINDOWS)) + isPosixOS = false; + + if (isPosixOS && !isPosixPath(path)) { + // Convert from Windows to posix (NOT cygwin) + path = path.replace("\\", "/").replace("/cygdrive", "").replace(":", ""); + } else if (!isPosixOS) { + // Convert from posix to Windows (cygwin) + if (isPosixPath(path)) + path = "/cygdrive/c/" + path; + else { + if (path.indexOf(":") != -1) + path = "/cygdrive/" + + path.replace(":", "").replace("\\", "/"); + else if (path.indexOf("cygdrive") == -1) + path = "/cygdrive/c/" + path; + } + } + + Log.exiting(c, "fixOutgoingPath", path); + return path; + } + + /** + * Converts a Cygwin path to a standard Windows path. This is independent of + * the local system path type. + * + * @param path + * The path to fix + * @return The converted path String + */ + protected static String fixIncomingPath(String path) { + String result = path; + if (path != null) { + if (path.indexOf(CYGWIN_DRIVE) != -1) { + result = path.replace('\\', '/').substring( + CYGWIN_DRIVE.length()); + result = ("" + result.charAt(0)).toUpperCase() + ":" + + result.substring(result.indexOf("/")); + } + } + return result; + } + + private static boolean isPosixOS(OSResourceType os) { + for (OSResourceType res : POSIX) + if (res.equals(os)) + return true; + return false; + } + + private static boolean isPosixPath(String path) { + return (path.indexOf("cygdrive") == -1 && path.indexOf(":") == -1 && path + .indexOf("\\") == -1); + } + + public static RemoteFile ensureFileIsOnMachine(Machine target, + RemoteFile file) throws Exception { + final String method = "ensureFileIsOnMachine"; + Log.entering(c, method, new Object[] { target, file }); + if (file.getMachine().equals(target)) { + Log.finer(c, method, "The file is already on the target machine."); + Log.exiting(c, method, file); + return file; + } + + RemoteFile remoteFile = target.getFile(target.getTempDir(), file + .getName()); + try { + remoteFile.getParentFile().mkdirs(); + } catch (IOException ie) { + } + + // Catch this because it *is* possible the two files are on the same + // machine, and + // you can't read & write to the file at the same time + try { + remoteFile.copyFromSource(file); + } catch (IOException ie) { + } + + Log.exiting(c, method, remoteFile); + return remoteFile; + } + + public static Date getDate(Machine machine) throws Exception { + final String method = "getTime"; + Log.entering(c, method, machine); + RemoteAccess ra = getRemoteAccess(machine.getConnInfo()); + long milliseconds = ra.getEpochTime() * 1000; + Log.finer(c, method, "milliseconds: " + milliseconds); + Date date = new Date(milliseconds); + Log.exiting(c, method, date); + return date; + + } +} diff --git a/dev/fattest.simplicity/src/componenttest/common/apiservices/cmdline/StreamGobbler.java b/dev/fattest.simplicity/src/componenttest/common/apiservices/cmdline/StreamGobbler.java new file mode 100755 index 000000000000..18ad74ff8afb --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/common/apiservices/cmdline/StreamGobbler.java @@ -0,0 +1,129 @@ +package componenttest.common.apiservices.cmdline; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.util.concurrent.TimeUnit; + +/** + * When instances of this Thread object are run, all the character data that is + * written to the input stream is written (and flushed) line by line to the + * output stream.
    + * + * @author Tim Burns + * + */ +public class StreamGobbler extends Thread { + + protected static final String METHOD_RUN = "run"; + + protected final InputStream input; + protected final OutputStream redirect; + protected final boolean async; + + private boolean joined; + private boolean terminated; + + public static void main(String[] args) throws Exception { + ProcessBuilder pb = new ProcessBuilder(); + pb.command(args); + pb.redirectErrorStream(true); + Process p = pb.start(); + StreamGobbler sg = new StreamGobbler(p.getInputStream(), System.out, false); + sg.start(); + p.waitFor(); + sg.doJoin(); + System.exit(p.exitValue()); + } + + /** + * Constructs a new StreamGobbler. + * + * @param input + * The stream of data you want to listen to + * @param redirect + * The stream of data you want to notify about events on the + * input stream. If this argument is null, the underlying + * OutputStream is initialized to a new ByteArrayOutputStream, + * and events occurring on the input stream will be printed to + * trace but otherwise ignored. + */ + public StreamGobbler(final InputStream input, final OutputStream redirect, boolean async) { + this.input = input; + if (redirect == null) { + this.redirect = new ByteArrayOutputStream(); + } else { + this.redirect = redirect; + } + this.async = async; + if (!async) { + setDaemon(true); + } + } + + /* + * (non-Javadoc) + * + * @see java.lang.Thread#run() + */ + @Override + public void run() { + PrintWriter writer = new PrintWriter(this.redirect, true); + BufferedReader reader = new BufferedReader(new InputStreamReader( + this.input)); + try { + for (String line; (line = reader.readLine()) != null;) { + synchronized (this) { + if (joined) { + // The main thread was notified that the process + // ended and has already given up waiting for + // output from the foreground process. + break; + } + + writer.println(line); + } + } + } catch (IOException ex) { + throw new Error(ex); + } finally { + synchronized (this) { + terminated = true; + notifyAll(); + } + if (async) { + writer.close(); + } + } + } + + public void doJoin() throws InterruptedException { + // Windows and Solaris don't disconnect background processes (start /b + // or cmd & if output is not redirected) from the console of foreground + // processes, so waiting until the end of output from the server script + // means waiting until the server process itself ends. We can't wait + // that long, so we wait one second after .waitFor() ends. Hopefully + // this will be long enough to copy all the output from the script. + + synchronized (this) { + long begin = System.nanoTime(); + long end = begin + TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS); + long duration = end - begin; + while (!terminated && duration > 0) { + TimeUnit.NANOSECONDS.timedWait(this, duration); + duration = end - System.nanoTime(); + } + + // If the thread didn't end after waiting for a second, + // then assume it's stuck in a blocking read. Oh well, + // it's a daemon thread, so it'll go away eventually. Let + // it know that we gave up to avoid spurious output in case + // it eventually wakes up. + joined = true; + } + } +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/AlwaysPassesTest.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/AlwaysPassesTest.java new file mode 100755 index 000000000000..d0a7f32d13c4 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/AlwaysPassesTest.java @@ -0,0 +1,27 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import org.junit.Test; + +/** + * Test that will pass in all test modes on all platforms with any JDK. + * + * Intended for use in test buckets where all other tests may be filtered out + * for some test modes or environments (such as only for Java 7). Since the build + * requires at lest one passing test, this provides a simple way to insure one + * test is not filtered, and always reports passing. + */ +public class AlwaysPassesTest { + @Test + public void testThatWillAlwaysPass() throws Exception {} +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/ClientOnly.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/ClientOnly.java new file mode 100755 index 000000000000..46bfb41c90af --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/ClientOnly.java @@ -0,0 +1,29 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Annotation to specify that a test class only tests a client and does not use any servers. + *

    + * Classes which have this method will not have a synthetic tests + */ +@Retention(RUNTIME) +@Target(TYPE) +public @interface ClientOnly { + +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/CompoundFilter.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/CompoundFilter.java new file mode 100755 index 000000000000..b1fcfb3f71e0 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/CompoundFilter.java @@ -0,0 +1,58 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import org.junit.runner.Description; +import org.junit.runner.manipulation.Filter; + +/** + * + *Junit seems to only apply the last filter, so we have this compound filter + *to allow us to use multiple filters. + * + *If any of the filters returns false then the test is removed from the run list. + * + */ +public class CompoundFilter extends Filter { + + private final Filter[] filters; + + CompoundFilter(Filter[] filters) { + this.filters = filters; + } + + /* + * (non-Javadoc) + * + * @see org.junit.runner.manipulation.Filter#describe() + */ + @Override + public String describe() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.junit.runner.manipulation.Filter#shouldRun(org.junit.runner.Description) + */ + @Override + public boolean shouldRun(Description arg0) { + boolean shouldRun = true; + for (Filter f : filters) { + shouldRun &= f.shouldRun(arg0); + } + return shouldRun; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/FATRunner.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/FATRunner.java new file mode 100755 index 000000000000..50c67b35b860 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/FATRunner.java @@ -0,0 +1,767 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.junit.ClassRule; +import org.junit.internal.AssumptionViolatedException; +import org.junit.runner.manipulation.Filter; +import org.junit.runner.manipulation.NoTestsRemainException; +import org.junit.runner.notification.RunNotifier; +import org.junit.runners.BlockJUnit4ClassRunner; +import org.junit.runners.model.FrameworkField; +import org.junit.runners.model.FrameworkMethod; +import org.junit.runners.model.MultipleFailureException; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.config.HttpEndpoint; +import com.ibm.websphere.simplicity.config.IncludeElement; +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.annotation.AllowedFFDC; +import componenttest.annotation.ExpectedFFDC; +import componenttest.annotation.Server; +import componenttest.annotation.processor.TestServletProcessor; +import componenttest.exception.TopologyException; +import componenttest.logging.ffdc.IgnoredFFDCs; +import componenttest.logging.ffdc.IgnoredFFDCs.IgnoredFFDC; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.impl.LibertyServerWrapper; +import junit.framework.AssertionFailedError; + +public class FATRunner extends BlockJUnit4ClassRunner { + private static final Class c = FATRunner.class; + + /** + * We look for lines like + * Exception = com.ibm.ws.security.authentication.AuthenticationException + * in the ffdc file. + */ + + private static final int MAX_FFDC_LINES = 1000; + private static final boolean DISABLE_FFDC_CHECKING = Boolean.getBoolean("disable.ffdc.checking"); + + /** + * Unlike FFDC checking, the tmp dir checking will default to being off, but can be enabled with the + * "enabled.tmpdir.checking" property. + */ + private static final boolean ENABLE_TMP_DIR_CHECKING = Boolean.getBoolean("enable.tmpdir.checking"); + private static final long TMP_DIR_SIZE_THRESHOLD = 20 * 1024; // 20k + + //list of filters to apply + private static final Filter[] testFiltersToApply = new Filter[] { new TestModeFilter(), new TestNameFilter(), new FeatureFilter(), new SystemPropertyFilter() }; + // This filter gets managed separately + private static final JavaLevelFilter JAVA_LEVEL_FILTER = new JavaLevelFilter(); + + private volatile FrameworkMethod syntheticTest = null; + + static { + Log.info(c, "", "Using filters " + Arrays.toString(testFiltersToApply)); + } + + //flag for whether the current test class has any tests to run + private boolean hasTestsToRun = true; + + class FFDCInfo { + int count; + final String ffdcFile; + final Machine machine; + String ffdcHeader; + + FFDCInfo(Machine machine, String file, int count) { + this.machine = machine; + this.ffdcFile = file; + this.count = count; + } + + FFDCInfo(FFDCInfo copy, int newCount) { + this(copy.machine, copy.ffdcFile, newCount); + } + + @Override + public String toString() { + return "[count=" + count + ", file=" + ffdcFile + ", machine=" + machine + "]"; + } + } + + public FATRunner(Class tc) throws Exception { + super(tc); + try { + //filter any tests, using our list of filters + filter(new CompoundFilter(testFiltersToApply)); + + try { + // Now try again filtering out the tests which can't run on this version of Java + // Check to see if this sets a minimum java level that might need independent validation + //filter any tests, using our list of filters + filter(JAVA_LEVEL_FILTER); + + } catch (NoTestsRemainException e) { + //swallow this exception which Should Never Happen (the synthetic test would always pass through) + //log a warning so we know something went Wrong + Log.finer(this.getClass(), "filter", "All tests were filtered out because of a java-level mismatch for class " + getTestClass().getName() + + ", and the synthetic test did not get added as it has previously been run in this suite"); + hasTestsToRun = false; + } + } catch (NoTestsRemainException e) { + //swallow this exception, because we might have Test classes that contain only tests that run in a mode we aren't currently in + //log a warning so we know + Log.warning(this.getClass(), "All tests were filtered out for class " + getTestClass().getName()); + //set the flag so we can shortcut and avoid wasting time on @BeforeClass etc for stuff we aren't going to run any tests for + hasTestsToRun = false; + } + } + + /* + * We only get one chance to add a child, because the runner determines what tests to run using getFilteredChildren(), + * and that method caches the results of getChildren(). + */ + @Override + public List getChildren() { + List unfilteredChildren = super.getChildren(); + // It seems we only go through this method once but let's be defensive and check if we already stuffed in the synthetic method + if (syntheticTest == null || !unfilteredChildren.contains(syntheticTest)) { + // Stuff a synthetic test into the list. If it's not needed the filter will remove it again. + syntheticTest = JAVA_LEVEL_FILTER.createSyntheticTest(getTestClassNameForAssociatedServers()); + unfilteredChildren.add(syntheticTest); + } + unfilteredChildren.addAll(TestServletProcessor.getServletTests(getTestClass())); + return unfilteredChildren; + } + + @Override + public void run(RunNotifier notifier) { + if (JavaLevelFilter.shouldRunTest(this.getDescription()) == false) { + LibertyServer.setValidateApps(false); + } + injectLibertyServers(); + try { + if (hasTestsToRun) { + super.run(notifier); + } + } finally { + LibertyServer.setValidateApps(true); + } + } + + /** + * Intercepting and over-riding at this point seems to be the cleanest way + * of generating a test failure and having it assigned to the right test method. + * A TestRule would be more elegant, but we seem to have to annotate + * it to each Test class, which defeats the point. + */ + @Override + public Statement methodBlock(final FrameworkMethod method) { + final Statement superStatement = super.methodBlock(method); + + Statement statement = new Statement() { + @Override + public void evaluate() throws Throwable { + Map tmpDirFilesBeforeTest = createDirectorySnapshot("/tmp"); + try { + Log.info(c, "evaluate", "entering " + getTestClass().getName() + "." + method.getName()); + + Map ffdcBeforeTest = retrieveFFDCCounts(); + + superStatement.evaluate(); + + // If we got to here without error, do a final check that + // any FFDCs were expected + Map ffdcAfterTest = retrieveFFDCCounts(); + + Map unexpectedFFDCs = filterOutPreexistingFFDCs(ffdcBeforeTest, ffdcAfterTest); + + ArrayList errors = new ArrayList(); + + List expectedFFDCs = getExpectedFFDCAnnotationFromTest(method); + // check for expectedFFDCs + for (String ffdcException : expectedFFDCs) { + FFDCInfo info = unexpectedFFDCs.remove(ffdcException); + if (info == null) { + errors.add("An FFDC reporting " + ffdcException + " was expected but none was found."); + } + } + + List allowedFFDCs = getAllowedFFDCAnnotationFromTest(method); + // remove allowedFFDCs + for (String ffdcException : allowedFFDCs) { + unexpectedFFDCs.remove(ffdcException); + } + + for (FFDCInfo ffdcInfo : unexpectedFFDCs.values()) { + ffdcInfo.ffdcHeader = getFFDCHeader(new RemoteFile(ffdcInfo.machine, ffdcInfo.ffdcFile)); + } + + for (IgnoredFFDC ffdcToIgnore : IgnoredFFDCs.FFDCs) { + FFDCInfo ffdcInfo = unexpectedFFDCs.get(ffdcToIgnore.exception); + if (ffdcInfo != null && ffdcToIgnore.ignore(ffdcInfo.ffdcHeader)) { + unexpectedFFDCs.remove(ffdcToIgnore.exception); + } + } + + // anything remaining is an error + for (Map.Entry unexpected : unexpectedFFDCs.entrySet()) { + FFDCInfo ffdcInfo = unexpected.getValue(); + int count = ffdcInfo.count; + if (count > 0) { + String error = "Unexpected FFDC reporting " + unexpected.getKey() + " was found (count = " + count + ")"; + if (ffdcInfo.ffdcFile != null) { + error += ": " + ffdcInfo.ffdcFile + "\n" + ffdcInfo.ffdcHeader; + } + + errors.add(error); + } + } + + if (errors.size() > 0) { + blowup(errors.toString()); + } + } catch (Throwable t) { + if (t instanceof AssumptionViolatedException) { + Log.info(c, "evaluate", "assumption violated: " + t); + } else { + Log.error(c, "evaluate", t); + if (t instanceof MultipleFailureException) { + Log.info(c, "evaluate", "Multiple failure"); + MultipleFailureException e = (MultipleFailureException) t; + for (Throwable t2 : e.getFailures()) { + Log.error(c, "evaluate", t2, "Specific failure:"); + } + } + } + throw newThrowableWithTimeStamp(t); + } finally { + Map tmpDirFilesAfterTest = createDirectorySnapshot("/tmp"); + compareDirectorySnapshots("/tmp", tmpDirFilesBeforeTest, tmpDirFilesAfterTest); + Log.info(c, "evaluate", "exiting " + getTestClass().getName() + "." + method.getName()); + } + } + + }; + + return statement; + } + + private static Throwable newThrowableWithTimeStamp(Throwable orig) throws Throwable { + // Create a new throwable that includes the current timestamp to help with the + // investigation of test failures. We want to create the same type of exception + // as the original in order to distinguish between a test failure (AssertionFailedError) + // and an error (RuntimeException, IOException, etc.). + final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss:SSS"); + String newMsg = sdf.format(new Date()) + " " + orig.getMessage(); + Throwable newThrowable; + + try { + Constructor ctor = orig.getClass().getDeclaredConstructor(String.class); + ctor.setAccessible(true); + newThrowable = ctor.newInstance(newMsg); + newThrowable.setStackTrace(orig.getStackTrace()); + } catch (Throwable t) { + newThrowable = new Throwable(newMsg, orig); + } + return newThrowable; + } + + private static void blowup(String string) { + if (!!!DISABLE_FFDC_CHECKING) { + throw new AssertionFailedError(string); + } + } + + /** + * Run at the end of the whole test. Tidy up and check for any FFDCs which were produced by the cleanup. + */ + @Override + public Statement classBlock(RunNotifier notifier) { + + final Statement superStatement = super.classBlock(notifier); + + Statement statement = new Statement() { + @Override + public void evaluate() throws Throwable { + try { + superStatement.evaluate(); + } finally { + String ffdcHeader = null; + + // This won't detect (and never did) FFDCs generated during class initialization - oh well! + ArrayList ffdcAfterTest = retrieveFFDCLogs(); + //Now force the post test tidy + LibertyServerFactory.tidyAllKnownServers(getTestClassNameForAssociatedServers()); + ArrayList ffdcAfterTidying = retrieveFFDCLogs(); + // Get any FFDCs we care about before recovering the servers + List unexpectedFFDCs = filterOutPreexistingFFDCs(ffdcAfterTest, ffdcAfterTidying); + // Any new FFDC after the tests run is bad - fail, including the message from the first one + if (unexpectedFFDCs.size() > 0) { + // Sort to pick up the chronologically first FFDC. + Collections.sort(unexpectedFFDCs); + ffdcHeader = findFFDCAndGetHeader(unexpectedFFDCs.get(0)); + } + + //Now recover the servers + LibertyServerFactory.recoverAllServers(getTestClassNameForAssociatedServers()); + + // Now that we're all done, throw any assertion failures for FFDCs we spotted earlier + if (ffdcHeader != null) { + blowup("A problem was detected during post-test tidy up. New FFDC file is generated. Please check the log directory. The beginning of the FFDC file is:\n" + + ffdcHeader); + } + } + } + }; + + return statement; + } + + private String getTestClassNameForAssociatedServers() { + //Some tests had to do things differently from all the others (I'm looking at you CDI!) + //So we should check for class rule fields and see if any of those classes have our + //special workaround annotation, and if it does, we should use the name of that class + //instead of the test class name that we would normally use. + String testClassName = getTestClass().getName(); + final List classRuleFields = getTestClass().getAnnotatedFields(ClassRule.class); + for (FrameworkField ff : classRuleFields) { + Class c = ff.getType(); + if (c.isAnnotationPresent(LibertyServerWrapper.class)) + testClassName = c.getName(); + } + return testClassName; + } + + /** + * Creates a new list which includes all the strings in the after list which + * are not in the before list. + * + * @param before + * @param after + * @return + */ + private List filterOutPreexistingFFDCs(List before, List after) { + // The after list is modified in this method so create a copy + List filtered = new ArrayList(after); + // Filter out pre-existing FFDCs + filtered.removeAll(before); + return filtered; + } + + private Map filterOutPreexistingFFDCs(Map ffdcBeforeTest, Map ffdcAfterTest) { + HashMap filtered = new HashMap(ffdcAfterTest.size()); + for (Map.Entry afterEntry : ffdcAfterTest.entrySet()) { + FFDCInfo beforeInfo = ffdcBeforeTest.get(afterEntry.getKey()); + if (beforeInfo != null && beforeInfo.ffdcFile.equals(afterEntry.getValue().ffdcFile)) { + int newVal = afterEntry.getValue().count - beforeInfo.count; + if (newVal != 0) { + FFDCInfo filteredInfo = new FFDCInfo(afterEntry.getValue(), newVal); + filtered.put(afterEntry.getKey(), filteredInfo); + } + } else { + filtered.put(afterEntry.getKey(), afterEntry.getValue()); + } + + } + + return filtered; + } + + private String findFFDCAndGetHeader(String ffdcFileName) { + // Find the FFDC file with the right name + Iterator it = getRunningLibertyServers().iterator(); + // We'll probably only have to check one server + while (it.hasNext()) { + try { + LibertyServer server = it.next(); + RemoteFile ffdcLogFile = server.getFFDCLogFile(ffdcFileName); + // Assume no two servers have FFDC logs with the same name + return getFFDCHeader(ffdcLogFile); + } catch (FileNotFoundException e) { + // This is fine - it just means the file didn't exist on this server + } catch (Exception e) { + Log.warning(this.getClass(), "Difficulties encountered searching for exceptions in FFDC logs: " + e); + return "[Could not read file contents because of unexpected exception: " + e + "]"; + } + } + // We really should never get to this code since we just found the FFDC file + return "[Could not find FFDC file " + ffdcFileName + "]"; + } + + private String getFFDCHeader(RemoteFile ffdcLogFile) throws Exception { + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(ffdcLogFile.openForReading())); + StringBuilder lines = new StringBuilder(); + int numLines = 1; + for (String line; (line = reader.readLine()) != null; numLines++) { + if (line.isEmpty()) { + // FFDC incident reports put a blank line between + // the exception stack trace and the introspection. + break; + } + + if (numLines > MAX_FFDC_LINES) { + lines.append("...").append('\n'); + break; + } + + lines.append('>').append(line).append('\n'); + } + return lines.toString(); + } catch (Exception e) { + Log.error(this.getClass(), "Could not read " + ffdcLogFile, e); + return "[Could not read " + ffdcLogFile + ": " + e + "]"; + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + // Fail silently + } + } + } + } + + private Collection getRunningLibertyServers() { + return LibertyServerFactory.getKnownLibertyServers(getTestClassNameForAssociatedServers()); + } + + private Map retrieveFFDCCounts() { + HashMap ffdcPrimaryInfo = new LinkedHashMap(); + + try { + for (LibertyServer server : getRunningLibertyServers()) { + int readAttempts = 0; + boolean retry = true; + while (retry && readAttempts++ <= 5) { + try { + ArrayList summaries = server.listFFDCSummaryFiles(server.getServerName()); + if (summaries.size() > 0) { + Collections.sort(summaries); + String lastSummary = summaries.get(summaries.size() - 1); + // Copy ffdcInfo so any partial updates can be discarded if there is a failure + HashMap ffdcServerInfo; + if ((ffdcServerInfo = parseSummary(server.getFFDCSummaryFile(lastSummary))) != null) { + //merge returned map from server with primary map + for (Map.Entry entry : ffdcServerInfo.entrySet()) { + FFDCInfo oldInfo = ffdcPrimaryInfo.get(entry.getKey()); + if (oldInfo != null) { + // Add the counts if the primary map already had a value for that exception key. + oldInfo.count += entry.getValue().count; + } else { + ffdcPrimaryInfo.put(entry.getKey(), entry.getValue()); + } + } + retry = false; + } else { + Log.info(c, "retrieveFFDCCounts", "Read incomplete FFDC summary file, readAttempts = " + readAttempts); + //returned null, file is truncated + retry = true; + //wait a bit and retry + Thread.sleep(500); + } + } + } catch (TopologyException e) { + //ignore the exception as log directory doesn't exist and no FFDC log + Log.info(c, "retrieveFFDCCounts", "Ignoring exception: " + e); + retry = false; + } catch (Exception e) { + Log.info(c, "retrieveFFDCCounts", "Exception parsing FFDC summary"); + Log.error(c, "retrieveFFDCCounts", e); + retry = false; + } + } + // Only bother logging if a failure was previously logged + if (readAttempts > 1 && !retry) { + Log.info(c, "retrieveFFDCCounts", "Retry Successful"); + } else if (retry) { + //retry failed 5 times + Log.info(c, "retrieveFFDCCounts", "Retry Unsuccessful"); + } + } + } catch (Exception e) { + //Exception obtaining Liberty servers + Log.error(c, "retrieveFFDCCounts", e); + } + return ffdcPrimaryInfo; + } + + // FFDC summary file format: + // """ + // + // Index Count Time of first Occurrence Time of last Occurrence Exception SourceId ProbeId + // ------+------+---------------------------+---------------------------+--------------------------- + // 0 2 4/11/13 2:25:30:312 BST 4/11/13 2:25:30:312 BST java.lang.ClassNotFoundException com.ibm.ws.config.internal.xml.validator.XMLConfigValidatorFactory 112 + // - /test/jazz_build/jbe_rheinfelden/jazz/buildsystem/buildengine/eclipse/build/build.image/wlp/usr/servers/com.ibm.ws.config.validator/logs/ffdc/ffdc_13.04.11_02.25.30.0.log + // - /test/jazz_build/jbe_rheinfelden/jazz/buildsystem/buildengine/eclipse/build/build.image/wlp/usr/servers/com.ibm.ws.config.validator/logs/ffdc/ffdc_13.04.11_02.25.30.0.log + // 1 1 4/11/13 2:25:31:959 BST 4/11/13 2:25:31:959 BST java.lang.NullPointerException com.ibm.ws.threading.internal.Worker 446 + // ------+------+---------------------------+---------------------------+--------------------------- + // """ + private HashMap parseSummary(RemoteFile summaryFile) throws Exception { + HashMap ffdcInfo = new LinkedHashMap(); + if (summaryFile.exists()) { + BufferedReader reader = new BufferedReader(new InputStreamReader(summaryFile.openForReading())); + String line = null; + try { + // parse exception_summary + reader.readLine(); // empty line + reader.readLine(); // header line + reader.readLine(); // --- line + Machine machine = summaryFile.getMachine(); + int count = 0; + String exception = ""; + + line = reader.readLine(); + //truncated file + if (line == null) { + return null; + } + + while (!(line.startsWith("---"))) { + String[] parts = line.trim().split("\\s+"); + if (parts.length > 9) { + // 0 1 4/11/13 2:25:30:312 BST 4/11/13 2:25:30:312 BST java.lang.ClassNotFoundException com.ibm.ws.config.internal.xml.validator.XMLConfigValidatorFactory 112 + count = Integer.parseInt(parts[1]); + exception = parts[8]; + } else if (parts.length > 1 && parts[0].equals("-")) { + String ffdcFile = parts[1]; + FFDCInfo oldInfo = ffdcInfo.get(exception); + if (oldInfo != null) { + oldInfo.count += count; + } else { + ffdcInfo.put(exception, new FFDCInfo(machine, ffdcFile, count)); + } + + } else { + Log.warning(this.getClass(), "Failed to match FFDC line: " + line); + } + + line = reader.readLine(); + //truncated file + if (line == null) { + return null; + } + } + } catch (Exception e) { + throw e; + } finally { + reader.close(); + } + } + return ffdcInfo; + } + + private ArrayList retrieveFFDCLogs() { + + ArrayList ffdcList = new ArrayList(); + try { + Iterator iterator = getRunningLibertyServers().iterator(); + while (iterator.hasNext()) { + try { + ffdcList = LibertyServerFactory.retrieveFFDCFile(iterator.next()); + } catch (TopologyException e) { + //ignore the exception as log directory doesn't exist and no FFDC log + Log.info(c, "retrieveFFDCCounts", "Ignoring exception: " + e); + } catch (Exception e) { + Log.error(c, "retrieveFFDCLogs", e); + } + } + } catch (Exception e) { + Log.error(c, "retrieveFFDCLogs", e); + } + return ffdcList; + } + + public List getExpectedFFDCAnnotationFromTest(FrameworkMethod m) { + + ArrayList annotationListPerClass = new ArrayList(); + ExpectedFFDC ffdc = m.getAnnotation(ExpectedFFDC.class); + if (ffdc != null) { + String[] exceptionClasses = ffdc.value(); + for (String exceptionClass : exceptionClasses) { + annotationListPerClass.add(exceptionClass); + } + } + return annotationListPerClass; + + } + + public List getAllowedFFDCAnnotationFromTest(FrameworkMethod m) { + + ArrayList annotationListPerClass = new ArrayList(); + AllowedFFDC ffdc = m.getAnnotation(AllowedFFDC.class); + if (ffdc != null) { + String[] exceptionClasses = ffdc.value(); + for (String exceptionClass : exceptionClasses) { + annotationListPerClass.add(exceptionClass); + } + } + return annotationListPerClass; + + } + + private void injectLibertyServers() { + String method = "injectLibertyServers"; + + List servers = getTestClass().getAnnotatedFields(Server.class); + for (FrameworkField frameworkField : servers) { + Field serverField = frameworkField.getField(); + + if (!frameworkField.isStatic()) + throw new RuntimeException("Annotated field '" + serverField.getName() + "' must be static."); + if (!frameworkField.isPublic()) + throw new RuntimeException("Annotated field '" + serverField.getName() + "' must be public."); + if (!LibertyServer.class.isAssignableFrom(serverField.getType())) + throw new RuntimeException("Annotated field '" + serverField.getName() + "' must be of type or subtype of " + LibertyServer.class.getCanonicalName()); + + Server anno = serverField.getAnnotation(Server.class); + String serverName = anno.value(); + Class testClass = getTestClass().getJavaClass(); + try { + LibertyServer serv = LibertyServerFactory.getLibertyServer(serverName, testClass); + // Set the HTTP and IIOP ports for the LibertyServer instance + if (serv.getHttpDefaultPort() == 0) { + // Note that this case block only applies to running a FAT locally without Ant. + // Any builds using Ant to invoke JUnit will bypass this block completely. + ServerConfiguration config = serv.getServerConfiguration(); + HttpEndpoint http = config.getHttpEndpoints().getById("defaultHttpEndpoint"); + IncludeElement include = config.getIncludes().getBy("location", "../fatTestPorts.xml"); + if (http != null) { + Log.info(c, method, "Using ports from element in " + serverName + " server.xml"); + // If there is an element in the server config, use those ports + serv.setHttpDefaultPort(http.getHttpPort()); + serv.setHttpDefaultSecurePort(http.getHttpsPort()); + } else if (include != null) { + Log.info(c, method, "Using BVT HTTP port defaults in fatTestPorts.xml for " + serverName); + serv.setHttpDefaultPort(8010); + serv.setHttpDefaultSecurePort(8020); + serv.setHttpSecondaryPort(8030); + serv.setHttpSecondarySecurePort(8040); + } else { + Log.info(c, method, "No http endpoint. Using defaultInstance config for " + serverName); + serv.setHttpDefaultPort(9080); + serv.setHttpDefaultSecurePort(9443); + } + } + if (serv.getIiopDefaultPort() == 0) { + // Note that this case block only applies to running a FAT locally without Ant. + // Any builds using Ant to invoke JUnit will bypass this block completely. + serv.setIiopDefaultPort(2809); + } + serv.setConsoleLogName(testClass.getSimpleName() + ".log"); + serverField.set(testClass, serv); + Log.info(c, method, "Injected LibertyServer " + serv.getServerName() + " to class " + testClass.getCanonicalName()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + private static Map createDirectorySnapshot(String path) { + Map snapshot = new HashMap(); + + File dir = new File(path); + File[] childFiles = dir.listFiles(); // will be null if dir is not really a directory + if (childFiles != null) { + for (File f : childFiles) { + String fileName = f.getAbsolutePath(); + if (f.isDirectory()) { + snapshot.putAll(createDirectorySnapshot(fileName)); + } else { + snapshot.put(fileName, f.length()); + } + } + } + return snapshot; + } + + private static void compareDirectorySnapshots(String path, Map before, Map after) { + final String method = "compareDirectorySnapshots"; + + if (before.isEmpty() || after.isEmpty()) { + Log.info(c, method, "Unable to calculate directories for " + path); + return; + } + + long sizeDiff = 0; + + // remove all files that were previously there - adding/subtracting any changes to file sizes in between. + for (Map.Entry entry : before.entrySet()) { + String fileName = entry.getKey(); + Long afterFileSize = after.remove(fileName); + if (afterFileSize != null) { + Long beforeFileSize = entry.getValue(); + if (beforeFileSize != null) { + long difference = afterFileSize - beforeFileSize; + sizeDiff += difference; + if (difference > 0) { + Log.info(c, method, fileName + " grew by " + difference + " bytes."); + } else if (difference < 0) { + // using debug here, because we'll rarely care when a file takes up _less_ space + Log.debug(c, method + " " + fileName + " shrank by " + difference + " bytes."); + } + } + } + } + + // Now the after map should only contain files that were created during this test class's execution. + for (Map.Entry entry : after.entrySet()) { + Long size = entry.getValue(); + if (size != null) { + sizeDiff += size; + } + Log.info(c, method, "New file found during test class execution: + " + entry.getKey() + " size: " + size + " bytes."); + } + + // While it is possible that a file was deleted during the test class execution, this is probably pretty rare, + // so we will not consider that possibility when determining whether the test exceeded the file size threshold. + if (ENABLE_TMP_DIR_CHECKING && sizeDiff > TMP_DIR_SIZE_THRESHOLD) { + throw new AssertionFailedError("This test class left too much garbage in the " + path + " directory. Total difference in size between start and finish is " + sizeDiff + + " bytes"); + } + } + + @Override + protected void collectInitializationErrors(List errors) { + // Override this method to allow test classes to only declare @Test methods + // via the @TestServlet(s) annotation. Otherwise JUnit will throw an + // initialization exception because there are no tests to run + super.collectInitializationErrors(errors); + if (errors.size() > 0) { + List remove = new ArrayList(); + for (Throwable error : errors) { + if ("No runnable methods".equals(error.getMessage())) + remove.add(error); + } + errors.removeAll(remove); + } + } +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/FeatureDoesNotStartOnLowJavaVersionsTestStub.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/FeatureDoesNotStartOnLowJavaVersionsTestStub.java new file mode 100755 index 000000000000..4214eaacdb2b --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/FeatureDoesNotStartOnLowJavaVersionsTestStub.java @@ -0,0 +1,127 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.junit.Test; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This is a special test which the test framework decides it should run if a test class would + * otherwise not run any tests because the Java level being run isn't one where running the + * tests makes sense. + */ +public class FeatureDoesNotStartOnLowJavaVersionsTestStub { + + private static Class c = FeatureDoesNotStartOnLowJavaVersionsTestStub.class; + + public static String SYNTHETIC_METHOD_NAME = "testFeatureDidNotStartWhenJavaIsTooLow"; + /** + * Looks for messages of the form [12/09/14 21:42:35:513 BST] 0000002c id= com.ibm.ws.kernel.feature.internal.FeatureManager E CWWKF0032E: The + * com.ibm.websphere.appserver.javax.interceptor-1.2 feature requires a minimum Java runtime environment version of JavaSE 1.7. + */ + private static final String FEATURE_DID_NOT_MEET_PREREQS_MESSAGE_CODE = "CWWKF0032E"; + private final String testClassName; + + public FeatureDoesNotStartOnLowJavaVersionsTestStub(String testClassName) + { + this.testClassName = testClassName; + } + + /** + * This is a JUnit test intended to be fake-hosted by other classes. + */ + @Test + public void testFeatureDidNotStartWhenJavaIsTooLow() throws Exception + { + + // Cheat to find the server we're probably supposed to be testing + Collection servers = LibertyServerFactory.getKnownLibertyServers(testClassName); + boolean isClient = isClient(); + if (servers.isEmpty() && !isClient) + { + fail("There were no servers for test class " + + testClassName + + ". Ensure that you have a class or method setUp method which starts a server (or use a @ClassRule or @Rule annotation on the field which declares the liberty server)."); + } + else if (!servers.isEmpty() && isClient) { + fail(testClassName + + " is marked ClientOnly but appears to create servers. Ensure that you're not setting up servers in a class or method setUp method, or using a @ClassRule or @Rule that sets up servers."); + } + + // We'll get servers from previous tests here (LibertyServerFactory doesn't clean up knownServers), so be cautious + for (LibertyServer server : servers) { + // make sure there are logs indicating a server start - if not, don't check anything + // We can do a find, not a wait, because the LibertyServer will already have waited if there's anything to find + List started = null; + try { + started = server.findStringsInLogs("CWWKF0011I"); + } catch (FileNotFoundException e) + { + // If we don't have a log this is a defunct (cleaned-up) server, so don't check anything + } + if (started != null && !started.isEmpty()) + { + + String line = server.waitForStringInLog(FEATURE_DID_NOT_MEET_PREREQS_MESSAGE_CODE); + assertNotNull("The server logs for server " + + server.getServerName() + + " did not report that a feature did not start (was looking for " + + FEATURE_DID_NOT_MEET_PREREQS_MESSAGE_CODE + + "). \n" + getWhereThisCameFromMessage() + + "Checked all server logs for " + servers.size() + " servers started by " + testClassName + ".)", + line); + // It's unclear whether we should check the feature is included in the message or not - it could be a source of spurious failures if the server + // names a different feature than the one under test + + // The server logs are checked for errors, and hence this test will fail unless + // The relevant messages are ignored. + ArrayList errors = new ArrayList(); + errors.add("CWWKF0032E"); //E CWWKF0032E: The feature requires a minimum Java runtime environment version of "java-version". + errors.add("CWWKE0702E"); //E CWWKE0702E: Could not resolve module: + errors.add("CWWKZ0124E"); //E CWWKZ0124E: Application does not contain any modules. + errors.add("CWWKE0701E"); //E CWWKE0701E: FrameworkEvent ERROR Bundle:com.ibm.websphere.appserver.thirdparty.eclipselink(id=116) org.osgi.framework.BundleException: Error starting module. + server.addIgnoredErrors(errors); + + } + // Otherwise the server may be an old one which is cleared up + + } + + } + + protected String getWhereThisCameFromMessage() { + return "(If you're wondering where this test came from, it is a synthetic test which was added because the running test declares that the feature being tested requires a minimum java level.\n"; + } + + private boolean isClient() { + try { + Class clazz = Class.forName(testClassName); + if (clazz.getAnnotation(ClientOnly.class) != null) { + return true; + } + } catch (ClassNotFoundException e) { + Log.error(c, "isClient", e); + } + return false; + } +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/FeatureFilter.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/FeatureFilter.java new file mode 100755 index 000000000000..6c93678400a3 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/FeatureFilter.java @@ -0,0 +1,86 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import org.junit.runner.Description; +import org.junit.runner.manipulation.Filter; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * + */ +public class FeatureFilter extends Filter { + + public static final String FEATURE_UNDER_TEST_PROPERTY_NAME = "fat.test.feature.under.test"; + + public static final String FEATURE_UNDER_TEST; + + static { + FEATURE_UNDER_TEST = System.getProperty(FEATURE_UNDER_TEST_PROPERTY_NAME); + Log.info(FeatureFilter.class, "", "System property: " + FEATURE_UNDER_TEST_PROPERTY_NAME + " is " + FEATURE_UNDER_TEST); + } + + /** {@inheritDoc} */ + @Override + public String describe() { + return "only run when feature is " + FEATURE_UNDER_TEST; + } + + /** + * Like {@link Description#getTestClass}, but without initializing the class. + */ + private Class getTestClass(Description desc) { + try { + return Class.forName(desc.getClassName(), false, getClass().getClassLoader()); + } catch (ClassNotFoundException e) { + return null; + } + } + + /** {@inheritDoc} */ + @Override + public boolean shouldRun(Description desc) { + RunIfFeatureBeingTested requiredFeature = desc.getAnnotation(RunIfFeatureBeingTested.class); + RunUnlessFeatureBeingTested excludedFeature = desc.getAnnotation(RunUnlessFeatureBeingTested.class);; + //check for a method level annotation first + + //method level annotations supercede any class level annotation + if (requiredFeature == null) { + //there was no method level annotation + //check for a test class level annotation + requiredFeature = getTestClass(desc).getAnnotation(RunIfFeatureBeingTested.class); + } + if (excludedFeature == null) { + //there was no method level annotation + //check for a test class level annotation + excludedFeature = getTestClass(desc).getAnnotation(RunUnlessFeatureBeingTested.class); + } + + boolean requiredFeatureNotPresent = requiredFeature != null && !requiredFeature.value().equals(FEATURE_UNDER_TEST); + boolean excludedFeaturePresent = excludedFeature != null && excludedFeature.value().equals(FEATURE_UNDER_TEST); + + if (requiredFeatureNotPresent) { + Log.debug(getClass(), "Removing test " + desc.getMethodName() + " with required feature " + requiredFeature + + " from list to run, because not valid for current feature under test " + + FEATURE_UNDER_TEST); + return false; + } else if (excludedFeaturePresent) { + Log.debug(getClass(), "Removing test " + desc.getMethodName() + " with \"run-unless\" feature " + excludedFeature + + " from list to run, because it matches current feature under test " + + FEATURE_UNDER_TEST); + return false; + } else + return true; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/JavaLevelFilter.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/JavaLevelFilter.java new file mode 100755 index 000000000000..7deb842047fe --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/JavaLevelFilter.java @@ -0,0 +1,218 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import java.lang.reflect.Method; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.junit.runner.Description; +import org.junit.runner.manipulation.Filter; +import org.junit.runners.model.FrameworkMethod; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.FeatureRequiresMinimumJavaLevel; +import componenttest.annotation.MaximumJavaLevel; +import componenttest.annotation.MinimumJavaLevel; + +public class JavaLevelFilter extends Filter { + + public static final String FEATURE_UNDER_TEST; + public static final double JAVA_VERSION; + public static boolean hasSyntheticTestRan = false; + + static { + FEATURE_UNDER_TEST = System.getProperty(FeatureFilter.FEATURE_UNDER_TEST_PROPERTY_NAME); + Log.info(JavaLevelFilter.class, "", "System property: " + FeatureFilter.FEATURE_UNDER_TEST_PROPERTY_NAME + " is " + FEATURE_UNDER_TEST); + String specVersion = System.getProperty("java.specification.version"); + Log.info(JavaLevelFilter.class, "", "System property java.specification.version: " + specVersion); + // Convert to a double (by stripping any non-numeric characters) + if (specVersion != null) + { + Matcher matcher = Pattern.compile("([0-9][0-9]*\\.[0-9][0-9]*)").matcher(specVersion); + boolean hasNumber = matcher.find(); + if (hasNumber) + { + JAVA_VERSION = Double.parseDouble(matcher.group(1)); + Log.info(JavaLevelFilter.class, "", "Parsed java version: " + JAVA_VERSION); + + } + else + { + JAVA_VERSION = 0; + Log.info(JavaLevelFilter.class, "", "Could not parse a java version, so assuming " + JAVA_VERSION); + + } + } else + { + JAVA_VERSION = 0; + Log.info(JavaLevelFilter.class, "", "Could not find a system property for java.specification.version, so assuming " + JAVA_VERSION); + + } + } + + private static Class getMyClass() { + return JavaLevelFilter.class; + } + + /** {@inheritDoc} */ + @Override + public String describe() { + return "only run when feature is " + FEATURE_UNDER_TEST; + } + + /** + * Like {@link Description#getTestClass}, but without initializing the class. + */ + private static Class getTestClass(Description desc) { + try { + return Class.forName(desc.getClassName(), false, getMyClass().getClassLoader()); + } catch (ClassNotFoundException e) { + return null; + } + } + + /** {@inheritDoc} */ + @Override + public boolean shouldRun(Description desc) { + return shouldRunTest(desc); + } + + public static boolean shouldRunTest(Description desc) { + // Pass through our synthetic method only if the class level annotation disables + // This property reverses what we return if we're looking at the synthetic method + boolean isSyntheticTest = (FeatureDoesNotStartOnLowJavaVersionsTestStub.SYNTHETIC_METHOD_NAME.equals(desc.getMethodName())); + + MaximumJavaLevel maximumJavaLevelAnnotation = desc.getAnnotation(MaximumJavaLevel.class); + if (maximumJavaLevelAnnotation == null) { + //there was no method level annotation + //check for a test class level annotation + maximumJavaLevelAnnotation = getTestClass(desc).getAnnotation(MaximumJavaLevel.class); + } + if (maximumJavaLevelAnnotation != null) + { + if (JAVA_VERSION > maximumJavaLevelAnnotation.javaLevel()) { + Log.debug(getMyClass(), "Removing test " + desc.getMethodName() + + " from list to run, because its maximum java level is " + maximumJavaLevelAnnotation.javaLevel() + + " and we are running with " + JAVA_VERSION); + return false; + } + } + + // checks to see if the method is the synthetic method + // if the synthetic method has already been ran we don't run it again + if (isSyntheticTest) { + if (hasSyntheticTestRan) { + return false; + } + else { + hasSyntheticTestRan = true; + } + } + + MinimumJavaLevel minimumJavaLevelAnnotation = desc.getAnnotation(MinimumJavaLevel.class); + FeatureRequiresMinimumJavaLevel featureRequiresLevelAnnotation = desc.getAnnotation(FeatureRequiresMinimumJavaLevel.class); + //check for a method level annotation first + + //method level annotations supercede any class level annotation + if (minimumJavaLevelAnnotation == null) { + //there was no method level annotation + //check for a test class level annotation + minimumJavaLevelAnnotation = getTestClass(desc).getAnnotation(MinimumJavaLevel.class); + } + if (featureRequiresLevelAnnotation == null) { + //there was no method level annotation + //check for a test class level annotation + featureRequiresLevelAnnotation = getTestClass(desc).getAnnotation(FeatureRequiresMinimumJavaLevel.class); + } + + // If the annotation has explicitly stated we don't want to run the synthetic test + if (isSyntheticTest && minimumJavaLevelAnnotation != null && !minimumJavaLevelAnnotation.runSyntheticTest()) + return false; + + // If there's a minimum java level annotaton, that sets a global minimum level, so if we don't meet that, don't run tests + + boolean javaLevelTooLowForAllFeatures = minimumJavaLevelAnnotation != null && JAVA_VERSION < minimumJavaLevelAnnotation.javaLevel(); + if (javaLevelTooLowForAllFeatures) { + Log.debug(getMyClass(), "Removing test " + desc.getMethodName() + " with minimum java level " + minimumJavaLevelAnnotation.javaLevel() + + " from list to run, because it is too high for current java level " + + JAVA_VERSION); + // Usually false + return isSyntheticTest; + } else { + + // Check if this is testing the feature with the minimum level + boolean applicableFeaturePresent = featureRequiresLevelAnnotation != null && featureRequiresLevelAnnotation.feature().equals(FEATURE_UNDER_TEST); + if (applicableFeaturePresent) + { + // This feature has a minimum java level, do we meet it? + + if (JAVA_VERSION < featureRequiresLevelAnnotation.javaLevel()) + { + Log.debug(getMyClass(), "Removing test " + desc.getMethodName() + " because feature " + featureRequiresLevelAnnotation.feature() + + " from list to run, because it requires java level " + featureRequiresLevelAnnotation.javaLevel() + + " and we are running with " + + JAVA_VERSION); + // Usually false + return isSyntheticTest; + } + } + } + + // Usually true + return !isSyntheticTest; + } + + /** + * Returns a method which can be run as a junit test. + */ + public FrameworkMethod createSyntheticTest(String testClassName) { + try { + // Make an instance to hold the data our test method needs to work properly + FeatureDoesNotStartOnLowJavaVersionsTestStub stub = new FeatureDoesNotStartOnLowJavaVersionsTestStub(testClassName); + + return new SneakyRedirectingFrameworkMethod(stub, FeatureDoesNotStartOnLowJavaVersionsTestStub.class.getMethod(FeatureDoesNotStartOnLowJavaVersionsTestStub.SYNTHETIC_METHOD_NAME)); + } catch (Exception e) { + e.printStackTrace(); + // This is a code failure and needs a user intervention + throw new RuntimeException(e); + } + } + + /** + * A hack ("extension") of a junit class which allows us to invoke a test method + * which is owned by a class other than the class whose tests are currently being run. + * This is useful for inserting tests dynamically at runtime. + */ + private static class SneakyRedirectingFrameworkMethod extends FrameworkMethod + { + + private final Object actualTarget; + + /** + * @param method + */ + public SneakyRedirectingFrameworkMethod(Object actualTarget, Method method) { + super(method); + this.actualTarget = actualTarget; + } + + @Override + public Object invokeExplosively(Object target, Object... params) throws Throwable + { + // Smuggle in the real class which owns the method + return super.invokeExplosively(actualTarget, params); + } + + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/Mode.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/Mode.java new file mode 100755 index 000000000000..752ff67e1c24 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/Mode.java @@ -0,0 +1,41 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation for expressing that a test method should only run in a given framework mode. + * Unannotated tests default to lite, so the the default for an annotated + * test that hasn't specified mode=something will be full + */ +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +public @interface Mode { + + /** + * The test modes in order from least complete, to fullest set of tests + * Use uppercase, since we toUpperCase on the value passed in for the framework + */ + public static enum TestMode { + //RAPID, - could be easily added later for example + LITE, + FULL, + QUARANTINE, + EXPERIMENTAL + } + + TestMode value() default TestMode.FULL; +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/NoOpTestForOldJava7.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/NoOpTestForOldJava7.java new file mode 100755 index 000000000000..6e27fa270391 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/NoOpTestForOldJava7.java @@ -0,0 +1,28 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * This test is an alternative to {@link SimpleFindServerAndStartItTest} for when there is no server to be found. + */ +public class NoOpTestForOldJava7 { + + @Test + public void noOp() { + assertTrue(true); + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/OnlyRunInIBMJava7ForMultitenancyRule.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/OnlyRunInIBMJava7ForMultitenancyRule.java new file mode 100755 index 000000000000..7458a8f8489a --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/OnlyRunInIBMJava7ForMultitenancyRule.java @@ -0,0 +1,50 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import componenttest.topology.utils.JavaMTUtils; + +/** + * Rule to test the all the criteria for running the FATs in multitenancy mode. + */ +public class OnlyRunInIBMJava7ForMultitenancyRule implements TestRule { + private static final Class c = OnlyRunInIBMJava7ForMultitenancyRule.class; + + @Override + public Statement apply(Statement statement, Description arg1) { + return new Java7MutlitenancyStatement(statement); + } + + private static class Java7MutlitenancyStatement extends Statement { + + private final Statement statement; + + public Java7MutlitenancyStatement(Statement statement) { + this.statement = statement; + } + + @Override + public void evaluate() throws Throwable { + + if (JavaMTUtils.checkSupportedEnvForMultiTenancy()) + statement.evaluate(); // Run the test + else { + // Skip the test + } + } + + } +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/OnlyRunInJava7Rule.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/OnlyRunInJava7Rule.java new file mode 100755 index 000000000000..bcb8eb196f94 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/OnlyRunInJava7Rule.java @@ -0,0 +1,43 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.FeatureRequiresMinimumJavaLevel; +import componenttest.annotation.MinimumJavaLevel; + +/** + * See also {@link JavaLevelFilter}, {@link MinimumJavaLevel}, and {@link FeatureRequiresMinimumJavaLevel} which is a nicer way + * of disabling tests. + */ +public class OnlyRunInJava7Rule implements TestRule { + /** This constant is exposed to any test code to use. It is true iff the FAT is running in Java 7 or higher. */ + public static final boolean IS_JAVA_7_OR_HIGHER = System.getProperty("java.specification.version").matches("1\\.[789]"); + + @Override + public Statement apply(final Statement statement, final Description description) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + if (IS_JAVA_7_OR_HIGHER) { + statement.evaluate(); + } else { + Log.info(description.getTestClass(), description.getMethodName(), "Test class or method is skipped due to Java 7 rule"); + } + } + }; + } +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/RepeatAfterFeatureSubstitutionRule.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/RepeatAfterFeatureSubstitutionRule.java new file mode 100755 index 000000000000..e62efbb94899 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/RepeatAfterFeatureSubstitutionRule.java @@ -0,0 +1,174 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.junit.rules.ExternalResource; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * Adding this test rule to a fat bucket will repeat running all the test classes listed in FATSuite or FATSuiteLite twice, + * Once with the server configurations already defined in "/publish" directory and once after all the *.xml files in "/publish" + * are updated. + * You can replace a feature in server configuration files with one feature or a list of features when repeating. + * Look at the "com.ibm.ws.jmx.connector.client.rest.fat.FATSuite" as an example of how to use this test rule. + */ +public class RepeatAfterFeatureSubstitutionRule extends ExternalResource { + private final String originalFeature; + private final List substituteFeatures; + + public RepeatAfterFeatureSubstitutionRule(String originalFeature, String substituteFeature) { + ensureArgIsValid(originalFeature, "originalFeature"); + ensureArgIsValid(substituteFeature, "substituteFeature"); + + this.originalFeature = originalFeature; + this.substituteFeatures = Arrays.asList(substituteFeature); + } + + public RepeatAfterFeatureSubstitutionRule(String originalFeature, List substituteFeatures) { + ensureArgIsValid(originalFeature, "originalFeature"); + ensureArgIsValid(substituteFeatures, "substituteFeatures"); + + this.originalFeature = originalFeature; + this.substituteFeatures = substituteFeatures; + } + + @Override + public Statement apply(Statement statement, Description description) { + return new FeatureSubstitutionStatement(originalFeature, substituteFeatures, statement); + } + + private void ensureArgIsValid(String value, String argName) { + if (value == null || value.isEmpty()) { + throw new IllegalArgumentException("Argument '" + argName + "' is null or empty."); + } + } + + private void ensureArgIsValid(List values, String argName) { + if (values == null || values.isEmpty()) { + throw new IllegalArgumentException("Argument '" + argName + "' is null or empty."); + } + + for (String value : values) { + if (value == null || value.isEmpty()) { + throw new IllegalArgumentException("Argument '" + argName + "' contains null or empty values."); + } + } + } + + private static class FeatureSubstitutionStatement extends Statement { + private static Class logClass = FeatureSubstitutionStatement.class; + + private static String pathToAutoFVTTestFiles = "lib/LibertyFATTestFiles/"; + private static String pathToAutoFVTTestServers = "publish/servers/"; + private static final String featurePattern = "%s"; + + private final Statement statement; + private final String originalFeature; + private final List substituteFeatures; + + private FeatureSubstitutionStatement(String originalFeature, List substituteFeatures, Statement statement) { + this.statement = statement; + this.originalFeature = originalFeature; + this.substituteFeatures = substituteFeatures; + } + + @Override + public void evaluate() throws Throwable { + statement.evaluate(); + + // Find all server.xml in this test project + File serverFolder = new File(pathToAutoFVTTestServers); + File filesFolder = new File(pathToAutoFVTTestFiles); + Set serverConfigs = findFile(serverFolder, ".xml"); + serverConfigs.addAll(findFile(filesFolder, ".xml")); + + // change all the server.xml files + assertTrue("There were no servers (*.xml) in " + serverFolder.getAbsolutePath() + " and in " + filesFolder.getAbsolutePath() + + ". If you see this failure, what you need to do is add a simple server to publish/servers which includes the feature you're trying to test.", + serverConfigs.size() > 0); + + String originalFeatureText = String.format(featurePattern, originalFeature); + String substituteFeaturesText = formatFeatureString(substituteFeatures); + + replaceAll(serverConfigs, originalFeatureText, substituteFeaturesText); + + statement.evaluate(); + + replaceAll(serverConfigs, substituteFeaturesText, originalFeatureText); + } + + private static Set findFile(File dir, String suffix) { + HashSet set = new HashSet(); + + File[] list = dir.listFiles(); + if (list != null) { + for (File file : list) { + if (file.isDirectory()) { + set.addAll(findFile(file, suffix)); + } else if (file.getName().endsWith(suffix)) { + set.add(file); + } + } + } + + Log.info(logClass, "findFile", "All the files: " + set.toString()); + + return set; + } + + private static void replaceAll(Set files, String from, String to) throws Exception { + for (File file : files) { + replaceAll(file, from, to); + } + } + + private static void replaceAll(File file, String from, String to) throws Exception { + BufferedReader reader = new BufferedReader(new FileReader(file)); + String line = null; + StringBuilder stringBuilder = new StringBuilder(); + String lineSeparator = System.getProperty("line.separator"); + + while ((line = reader.readLine()) != null) { + stringBuilder.append(line); + stringBuilder.append(lineSeparator); + } + + FileWriter fw = new FileWriter(file.getPath()); + fw.write(stringBuilder.toString().toString().replaceAll(from, to)); + fw.close(); + reader.close(); + } + + private static String formatFeatureString(List features) { + StringBuilder sb = new StringBuilder(); + for (String feature : features) { + sb.append(String.format(featurePattern, feature)); + } + + return sb.toString(); + } + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/RunIfFeatureBeingTested.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/RunIfFeatureBeingTested.java new file mode 100755 index 000000000000..5966d29a23c7 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/RunIfFeatureBeingTested.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation for expressing that a test method or class should only run when the named feature is + * available (ie under test). Availability is determined by looking at system properties, rather than + * the server configuration. In other words, it's an expression of intent rather than a statement + * about the exact state of the server. + */ +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +public @interface RunIfFeatureBeingTested { + + String value(); +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/RunUnlessFeatureBeingTested.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/RunUnlessFeatureBeingTested.java new file mode 100755 index 000000000000..18cfbc32bbcf --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/RunUnlessFeatureBeingTested.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation for expressing that a test method or class should *not* run when the named feature is + * available (ie under test). Availability is determined by looking at system properties, rather than + * the server configuration. In other words, it's an expression of intent rather than a statement + * about the exact state of the server. + */ +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +public @interface RunUnlessFeatureBeingTested { + + String value(); +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/SimpleFindServerAndStartItTest.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/SimpleFindServerAndStartItTest.java new file mode 100755 index 000000000000..34295dcff358 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/SimpleFindServerAndStartItTest.java @@ -0,0 +1,94 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import java.io.File; +import java.io.FileOutputStream; + +import org.junit.AfterClass; +import org.junit.BeforeClass; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This test is designed to be a way of accessing the + * #FeatureDoesNotStartOnLowVersionsTestStub without instrumentation or JUnit magic. It's useful for projects which are compiled with + * Java 7 (or higher) syntax. + */ +public class SimpleFindServerAndStartItTest extends FeatureDoesNotStartOnLowJavaVersionsTestStub { + + private static final String SYNTHETIC_SERVER = "syntheticServer"; + + private static final String SYNTHETIC_SERVER_XML = "" + + "" + + " FEATURE_UNDER_TEST" + + " componenttest-1.0" + + "" + + "" + + ""; + + private static final String BOOTSTRAP_PROPERTIES = "bootstrap.include=../testports.properties"; + + public SimpleFindServerAndStartItTest() { + super(SimpleFindServerAndStartItTest.class.getName()); + } + + @BeforeClass + public static void setUp() throws Exception { + String feature = FeatureFilter.FEATURE_UNDER_TEST; + File serverFolder = new File("publish/servers/" + SYNTHETIC_SERVER); + if (!serverFolder.exists()) { + serverFolder.mkdir(); + } + File serverXML = new File(serverFolder, "server.xml"); + if (!serverXML.exists()) { + String xml = SYNTHETIC_SERVER_XML.replace("FEATURE_UNDER_TEST", feature); + FileOutputStream fos = new FileOutputStream(serverXML); + byte[] bytes = xml.getBytes("UTF-8"); + try { + fos.write(bytes, 0, bytes.length); + fos.flush(); + } finally { + fos.close(); + } + } + File bootstrap = new File(serverFolder, "bootstrap.properties"); + if (!bootstrap.exists()) { + FileOutputStream fos = new FileOutputStream(bootstrap); + byte[] bytes = BOOTSTRAP_PROPERTIES.getBytes("UTF-8"); + try { + fos.write(bytes, 0, bytes.length); + fos.flush(); + } finally { + fos.close(); + } + } + + LibertyServer server = LibertyServerFactory.getLibertyServer(SYNTHETIC_SERVER); + + server.startServer(); + + } + + @AfterClass + public static void tearDown() throws Exception { + LibertyServer server = LibertyServerFactory.getExistingLibertyServer(SYNTHETIC_SERVER); + server.stopServer(".*CWWKG0059E.*"); + } + + @Override + protected String getWhereThisCameFromMessage() { + return "(If you're wondering where this test came from, it is being run instead of the usual test suite, probably because the usual tests require a level of Java higher than the current one .\n"; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/SyntheticServletTest.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/SyntheticServletTest.java new file mode 100644 index 000000000000..4652ab91188d --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/SyntheticServletTest.java @@ -0,0 +1,34 @@ +package componenttest.custom.junit.runner; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.junit.runners.model.FrameworkMethod; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.annotation.TestServlet; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.utils.FATServletClient; + +public class SyntheticServletTest extends FrameworkMethod { + + private final Field server; + private final String queryPath; + private final String testName; + + public SyntheticServletTest(Field server, TestServlet anno, Method method) { + super(method); + this.server = server; + this.queryPath = anno.path(); + this.testName = method.getName(); + } + + @Override + public Object invokeExplosively(Object target, Object... params) throws Throwable { + Log.info(SyntheticServletTest.class, "invokeExplosively", "Running test: " + testName); + LibertyServer s = (LibertyServer) server.get(null); + FATServletClient.runTest(s, queryPath, testName); + return null; + } +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/SystemPropertyFilter.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/SystemPropertyFilter.java new file mode 100755 index 000000000000..76f30aead09f --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/SystemPropertyFilter.java @@ -0,0 +1,64 @@ +package componenttest.custom.junit.runner; + +import org.junit.runner.Description; +import org.junit.runner.manipulation.Filter; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.SkipIfSysProp; + +public class SystemPropertyFilter extends Filter { + + /** {@inheritDoc} */ + @Override + public String describe() { + return null; + } + + /** + * Like {@link Description#getTestClass}, but without initializing the class. + */ + private Class getTestClass(Description desc) { + try { + return Class.forName(desc.getClassName(), false, getClass().getClassLoader()); + } catch (ClassNotFoundException e) { + return null; + } + } + + /** {@inheritDoc} */ + @Override + public boolean shouldRun(Description desc) { + SkipIfSysProp anno = desc.getAnnotation(SkipIfSysProp.class); + //method level annotations supersede any class level annotation + if (anno == null) { + //there was no method level annotation + //check for a test class level annotation + anno = getTestClass(desc).getAnnotation(SkipIfSysProp.class); + } + + if (anno == null) + return true; + + for (String sysProp : anno.value()) { + if (sysProp.contains("=")) { + // Only skip if the system prop is a certain value + String[] keyValue = sysProp.split("="); + String actualPropValue = System.getProperty(keyValue[0]); + if (keyValue[1].equalsIgnoreCase(actualPropValue)) { + Log.info(SystemPropertyFilter.class, "shouldTestRun", "System property " + keyValue[0] + " was found with value=" + keyValue[1] + + " The test " + desc.getDisplayName() + " will be skipped."); + return false; + } + } else { + // Skip if the system prop is found at all + if (System.getProperty(sysProp) != null) { + Log.info(SystemPropertyFilter.class, "shouldTestRun", "System property " + sysProp + " was found. " + + " The test " + desc.getDisplayName() + " will be skipped."); + return false; + } + } + } + // No system properties were found indicating that a test should be skipped + return true; + } +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/TestModeFilter.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/TestModeFilter.java new file mode 100755 index 000000000000..69f6fc45a984 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/TestModeFilter.java @@ -0,0 +1,96 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import java.util.Locale; + +import org.junit.runner.Description; +import org.junit.runner.manipulation.Filter; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.custom.junit.runner.Mode.TestMode; + +/** + * + */ +public class TestModeFilter extends Filter { + + public static final String FAT_MODE_PROPERTY_NAME = "fat.test.mode"; + + //Run levels for various FAT modes + public static final TestMode FRAMEWORK_TEST_MODE; + + static { + //get and set the framework mode, default to LITE + String modeProperty = System.getProperty(FAT_MODE_PROPERTY_NAME); + FRAMEWORK_TEST_MODE = modeProperty != null ? TestMode.valueOf(modeProperty.toUpperCase(Locale.ROOT)) : TestMode.LITE; + + Log.info(TestModeFilter.class, "", "System property: " + FAT_MODE_PROPERTY_NAME + " is " + modeProperty + " running in test mode " + FRAMEWORK_TEST_MODE); + } + + /** {@inheritDoc} */ + @Override + public String describe() { + // TODO Auto-generated method stub + return null; + } + + /** + * Like {@link Description#getTestClass}, but without initializing the class. + */ + private Class getTestClass(Description desc) { + try { + return Class.forName(desc.getClassName(), false, getClass().getClassLoader()); + } catch (ClassNotFoundException e) { + return null; + } + } + + /** {@inheritDoc} */ + @Override + public boolean shouldRun(Description desc) { + Mode mode; + //check for a method level annotation first + mode = desc.getAnnotation(Mode.class); + //method level annotations supercede any class level annotation + if (mode == null) { + //there was no method level annotation + //check for a test class level annotation + mode = getTestClass(desc).getAnnotation(Mode.class); + } + //default to lite for unannotated tests + TestMode testMode = TestMode.LITE; + //if the test was annotated, get the mode from the annotation + if (mode != null) { + testMode = mode.value(); + } + + //don't filter out the synthetic method based on the test mode + boolean isPassThroughMethod = (FeatureDoesNotStartOnLowJavaVersionsTestStub.SYNTHETIC_METHOD_NAME.equals(desc.getMethodName())); + + //compare the current run level of the framework to the + //test annotated run level + //exclude the test if the current run mode is lower than the test's + //e.g. for a test annotated lite + // FRAMEWORK_TEST_MODE | test annotation level | comparison | result | filter result + // full | lite | full > lite | > 0 | true, full should run lite tests + // lite | lite | lite = lite | 0 | true, lite should run lite tests + // rapid | lite | rapid < lite | < 0 | false, rapid should not run lite tests + if (FRAMEWORK_TEST_MODE.compareTo(testMode) < 0 && !isPassThroughMethod) { + Log.debug(getClass(), "Removing test " + desc.getMethodName() + " with mode " + testMode + " from list to run, because not valid for current mode " + + FRAMEWORK_TEST_MODE); + return false; + } else + return true; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/custom/junit/runner/TestNameFilter.java b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/TestNameFilter.java new file mode 100755 index 000000000000..50214d63fb76 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/custom/junit/runner/TestNameFilter.java @@ -0,0 +1,55 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.custom.junit.runner; + +import org.junit.runner.Description; +import org.junit.runner.manipulation.Filter; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * + */ +public class TestNameFilter extends Filter { + + private static final String FAT_TEST_CLASS; + private static final String FAT_TEST_METHOD; + + static { + //these properties allow shortcutting to a single test class and/or method + FAT_TEST_CLASS = System.getProperty("fat.test.class.name"); + FAT_TEST_METHOD = System.getProperty("fat.test.method.name"); + + if (FAT_TEST_CLASS != null) + Log.info(TestNameFilter.class, "", "Running only test class with name: " + FAT_TEST_CLASS); + if (FAT_TEST_METHOD != null) + Log.info(TestNameFilter.class, "", "Running only test with method name: " + FAT_TEST_METHOD); + } + + @Override + public String describe() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean shouldRun(Description arg0) { + if (FAT_TEST_CLASS != null && !arg0.getClassName().equals(FAT_TEST_CLASS)) { + return false; + } + if (FAT_TEST_METHOD != null && !arg0.getMethodName().equals(FAT_TEST_METHOD)) { + return false; + } + return true; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/exception/NoStringFoundInLogException.java b/dev/fattest.simplicity/src/componenttest/exception/NoStringFoundInLogException.java new file mode 100755 index 000000000000..37f89e1671ef --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/exception/NoStringFoundInLogException.java @@ -0,0 +1,38 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.exception; + +/** + * This exception is thrown to indicate that the expected string could not be + * found in the logs + */ +public class NoStringFoundInLogException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public NoStringFoundInLogException() { + super(); + } + + public NoStringFoundInLogException(String message) { + super(message); + } + + public NoStringFoundInLogException(String message, Throwable cause) { + super(message, cause); + } + + public NoStringFoundInLogException(Throwable cause) { + super(cause); + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/exception/TopologyException.java b/dev/fattest.simplicity/src/componenttest/exception/TopologyException.java new file mode 100755 index 000000000000..df3e07c23301 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/exception/TopologyException.java @@ -0,0 +1,35 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +package componenttest.exception; + +public class TopologyException extends Exception { + + public TopologyException() { + super(); + } + + public TopologyException(String message, Throwable cause) { + super(message, cause); + } + + public TopologyException(String message) { + super(message); + + } + + public TopologyException(Throwable cause) { + super(cause); + } + + private static final long serialVersionUID = 1L; + +} diff --git a/dev/fattest.simplicity/src/componenttest/exception/UnavailableDatabaseException.java b/dev/fattest.simplicity/src/componenttest/exception/UnavailableDatabaseException.java new file mode 100755 index 000000000000..7e5cb505294f --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/exception/UnavailableDatabaseException.java @@ -0,0 +1,23 @@ +package componenttest.exception; + +public class UnavailableDatabaseException extends Exception { + + public UnavailableDatabaseException() { + super(); + } + + public UnavailableDatabaseException(String message, Throwable cause) { + super(message, cause); + } + + public UnavailableDatabaseException(String message) { + super(message); + + } + + public UnavailableDatabaseException(Throwable cause) { + super(cause); + } + + private static final long serialVersionUID = 1L; +} diff --git a/dev/fattest.simplicity/src/componenttest/logging/ffdc/IgnoredFFDCs.java b/dev/fattest.simplicity/src/componenttest/logging/ffdc/IgnoredFFDCs.java new file mode 100755 index 000000000000..c629bcc98c8f --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/logging/ffdc/IgnoredFFDCs.java @@ -0,0 +1,214 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.logging.ffdc; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; + +import org.xml.sax.Attributes; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.DefaultHandler; +import org.xml.sax.helpers.XMLReaderFactory; + +/** + * + */ +public class IgnoredFFDCs { + + public static class IgnoredFFDC { + public final String exception; + public final String message; + final String stack; + + IgnoredFFDC(String exception, String message, String stack) { + this.exception = exception; + this.message = message; + this.stack = stack; + } + + public boolean ignore(String ffdcHeader) { + return (message == null ? true : (ffdcHeader == null ? false : ffdcHeader.contains(message))); + } + + @Override + public String toString() { + return "[exception=" + exception + ", message=" + message + ", stack=" + stack + "]"; + } + } + + private static class TracingDefHandler extends DefaultHandler { + private static class ParseException extends IllegalArgumentException { + private static final long serialVersionUID = 20111018165653L; + + /* -------------------------------------------------------------------------- */ + /* + * ParseException constructor + * /* -------------------------------------------------------------------------- + */ + /** + * Construct a new ParseException. + * + * @param text The text of the exception + * @param locator Where were we in the parse? + */ + public ParseException(final String text, final Locator locator) { + super(text + " (Line: " + locator.getLineNumber() + ", Column: " + locator.getColumnNumber() + ")"); + } + } + + /** The plain text being parsed */ + private String _text; + /** Where are we in the parse? */ + private Locator _locator; + /** Which exception to ignore? */ + private String _exception; + /** What message does the exception contain? */ + private String _message; + /** A subset of the exception stack */ + private String _stack; + + /** + * @see org.xml.sax.helpers.DefaultHandler#setDocumentLocator(org.xml.sax.Locator) + * @param locator The current location in the parse + */ + @Override + public void setDocumentLocator(final Locator locator) { + _locator = locator; + } + + /** + * @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int) + * @param text The characters. + * @param start The start position in the character array. + * @param length The number of characters to use from the character array. + */ + + @Override + public void characters(char[] text, int start, int length) throws SAXException { + String textString = new String(text, start, length); + setText(textString); + } + + /** + * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) + * @param uri The name space of the tag (ignored) + * @param localName The name of the tag + * @param qName The qName of the tag (ignored) + * @param attribs The attributes of the tag + */ + @Override + public void startElement(final String uri, final String localName, final String qName, final Attributes attributes) { + if (localName.equals("IgnoredFFDC")) { + ; // Placeholder to allow the top level element to be present + } + + else if (localName.equals("FFDC")) { + ; // Placeholder to allow the FFDC element to be present + } + + else if (localName.equals("Exception")) { + ; // Placeholder to allow the Exception element to be present + } + + else if (localName.equals("Message")) { + ; // Placeholder to allow the Message element to be present + } + + else if (localName.equals("Stack")) { + ; // Placeholder to allow the Message element to be present + } else { + throw new ParseException("Unknown element " + localName, _locator); + } + } + + /** + * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, java.lang.String, java.lang.String) + * @param uri The namespace of the end tag (ignored) + * @param localName The name of the ending tag + * @param qName The qName of the end tag (ignored) + */ + @Override + public void endElement(final String uri, final String localName, final String qName) { + if (localName.equals("IgnoredFFDC")) { + ; // Placeholder to allow the bottom level element to be present + } else if (localName.equals("FFDC")) { + FFDCs.add(new IgnoredFFDC(_exception, _message, _stack)); + _exception = null; + _message = null; + _stack = null; + } else if (localName.equals("Exception")) { + _exception = _text; + } else if (localName.equals("Message")) { + _message = _text; + } else if (localName.equals("Stack")) { + _stack = _text; + } else { + throw new ParseException("Unknown element " + localName, _locator); + } + } + + /** + * Set the string to e passed to _exception or _message + * + * @param text The plain text that has been parsed + */ + public void setText(String text) { + this._text = text; + } + } + + /** The Exception and corresponding message to be ignored */ + public static Collection FFDCs = new ArrayList(); + + static { + try { + String fileName = System.getProperty("fileFFDC", ""); + File file = new File(fileName); + if (file != null && file.exists()) { + InputStream is = new FileInputStream(file); + if (is != null) { + InputSource src = new InputSource(is); + try { + XMLReader rdr = XMLReaderFactory.createXMLReader(); + rdr.setContentHandler(new TracingDefHandler()); + rdr.parse(src); + } catch (SAXException e) { + throw new IllegalStateException("SAXException: ", e); + } catch (IOException e) { + throw new IllegalStateException("IOExcetion: ", e); + } + } + } + } catch (Exception re) { + System.out.println("--- Runtime Exception while trying to initialise ---"); + re.printStackTrace(); + System.out.println("----------------------------------------------------"); + try { + throw re; + } catch (Exception e) { + e.printStackTrace(); + } + } catch (Error e) { + System.out.println("--- Error while trying to initialise ---"); + e.printStackTrace(); + System.out.println("----------------------------------------"); + throw e; + } + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/componenttest/rules/AutoStartRule.java b/dev/fattest.simplicity/src/componenttest/rules/AutoStartRule.java new file mode 100755 index 000000000000..426e671a1aa5 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/rules/AutoStartRule.java @@ -0,0 +1,32 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.rules; + +import org.junit.rules.ExternalResource; + +import componenttest.topology.impl.LibertyServer; + +/** + * Automatically start a given LibertyServer before tests. + */ +class AutoStartRule extends ExternalResource { + private final LibertyServer server; + + public AutoStartRule(final LibertyServer server) { + this.server = server; + } + + @Override + protected void before() throws Throwable { + server.startServer(); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/componenttest/rules/AutoStopRule.java b/dev/fattest.simplicity/src/componenttest/rules/AutoStopRule.java new file mode 100755 index 000000000000..bef12987c64f --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/rules/AutoStopRule.java @@ -0,0 +1,39 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.rules; + +import org.junit.rules.ExternalResource; + +import componenttest.topology.impl.LibertyServer; + +/** + * Automatically stop the given LibertyServer after tests. + */ +class AutoStopRule extends ExternalResource { + private final LibertyServer server; + + public AutoStopRule(final LibertyServer server) { + this.server = server; + } + + @Override + protected void after() { + if (server != null && server.isStarted()) { + try { + server.stopServer(); + } catch (final Exception e) { + // not much we can do? + e.printStackTrace(); + } + } + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/componenttest/rules/CollectiveFailureDumpRule.java b/dev/fattest.simplicity/src/componenttest/rules/CollectiveFailureDumpRule.java new file mode 100755 index 000000000000..3ae29c7b4a78 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/rules/CollectiveFailureDumpRule.java @@ -0,0 +1,52 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.rules; + +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; + +/** + * This inner class sets up the logging class name correctly for all subclassed FATs. + */ +public class CollectiveFailureDumpRule extends TestWatcher { + + private final LibertyServer server; + private final String adminUser; + private final String adminPassword; + + /** + * @param server The server which is hosting the controller capabilities + * @param mbsc The MBeanServerConnection for the given server + */ + public CollectiveFailureDumpRule(final LibertyServer server, final String adminUser, final String adminPassword) { + this.server = server; + this.adminUser = adminUser; + this.adminPassword = adminPassword; + } + + @Override + public void failed(final Throwable e, final Description desc) { + if (server == null) { + Log.info(desc.getTestClass(), desc.getMethodName(), "Test method failed. No collective controller available - skipping gather collective diagnostics"); + } else { + Log.info(desc.getTestClass(), desc.getMethodName(), "Test method failed. Capturing Collective diagnostics"); + final String dumpFilePrefix = desc.getTestClass().getSimpleName() + "." + desc.getMethodName() + "_failureDump_" + System.currentTimeMillis(); + DumpUtils utils = new DumpUtils(server, adminUser, adminPassword); + utils.dumpCollectiveRepository(desc, dumpFilePrefix); + utils.captureCollectiveAPIDiagnostics(desc, dumpFilePrefix); + } + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/componenttest/rules/DumpUtils.java b/dev/fattest.simplicity/src/componenttest/rules/DumpUtils.java new file mode 100755 index 000000000000..b45e7b8a99f6 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/rules/DumpUtils.java @@ -0,0 +1,240 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.rules; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.Closeable; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.HashMap; +import java.util.Map; + +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.junit.runner.Description; + +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import componenttest.topology.impl.LibertyServer; + +/** + * + */ +public class DumpUtils { + + private static final String CollectiveRepositoryMBean_OBJECT_NAME = "WebSphere:feature=collectiveController,type=CollectiveRepository,name=CollectiveRepository"; + private static final String COLLECTIVE_DUMP_URL = "/ibm/api/collective/v1/dump"; + private static final String BASIC_AUTH_CREDS = "YWRtaW46YWRtaW5wd2Q="; // base64 encoded "admin:adminpwd" if this ever changes this needs to be updated + private static final File DEFAULT_DUMP_DIR = new File(System.getProperty("user.dir"), "results/dumps"); + + private final LibertyServer server; + private final String adminUser; + private final String adminPassword; + + public DumpUtils(final LibertyServer server, final String adminUser, final String adminPassword) { + this.server = server; + this.adminUser = adminUser; + this.adminPassword = adminPassword; + } + + /** + * Captures the Collective REST API and writes it to a file. + */ + void captureCollectiveAPIDiagnostics(final Description desc, final String dumpFilePrefix) { + captureCollectiveAPIDiagnostics(desc.getTestClass(), dumpFilePrefix); + } + + /** + * This method allows non-JUnit code to perform collective API dumps. + */ + public void captureCollectiveAPIDiagnostics(final Class c, final String dumpFilePrefix) { + final File dumpFile = createFile(dumpFilePrefix + "api.json"); + Log.info(c, "captureCollectiveAPIDiagnostics", "Dumping collective REST API to file " + dumpFile.getAbsolutePath()); + BufferedReader in = null; + BufferedWriter out = null; + try { + setupHttpsConnection(); + URL url = new URL("https", server.getHostname(), server.getHttpDefaultSecurePort(), COLLECTIVE_DUMP_URL); + HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection(); + + httpConnection.setRequestProperty("Authorization", "Basic " + BASIC_AUTH_CREDS); + httpConnection.setUseCaches(false); + + in = new BufferedReader(new InputStreamReader(httpConnection.getInputStream(), "UTF-8")); + out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dumpFile))); + for (String s = in.readLine(); s != null; s = in.readLine()) { + out.write(s); + } + } catch (Throwable t) { + // Catch and supress all errors, this is debug and we don't want to mess up the JUnit error handling + Log.error(c, "captureCollectiveAPIDiagnostics", t, "Unable to dump collective REST API. Caught exception: " + t.getMessage()); + } finally { + close(in); + close(out); + } + } + + /** + * Creates the File object, and any necessary parent directories. + * + * @param filename The file name + * @return The created File object + */ + private File createFile(final String filename) { + DEFAULT_DUMP_DIR.mkdirs(); + return new File(DEFAULT_DUMP_DIR, filename); + } + + /** + * Dump the Collective Repository. + */ + void dumpCollectiveRepository(final Description desc, final String dumpFilePrefix) { + dumpCollectiveRepository(desc.getTestClass(), dumpFilePrefix); + } + + /** + * This method allows non-JUnit code to perform collective repository dumps + */ + public void dumpCollectiveRepository(final Class c, final String dumpFilePrefix) { + JMXConnector jmxConnector = null; + try { + final File dumpFile = createFile(dumpFilePrefix + "repository.txt"); + Log.info(c, "dumpCollectiveRepository", "Dumping collective repository to file " + dumpFile.getAbsolutePath()); + + jmxConnector = createJMXConnection(); + final MBeanServerConnection mbsc = jmxConnector.getMBeanServerConnection(); + final ObjectName repository = new ObjectName(CollectiveRepositoryMBean_OBJECT_NAME); + mbsc.invoke(repository, "dump", new Object[] { "/", dumpFile.getAbsolutePath(), null }, new String[] { "java.lang.String", "java.lang.String", "java.lang.String" }); + } catch (Throwable t) { + // Catch and supress all errors, this is debug and we don't want to mess up the JUnit error handling + Log.error(c, "dumpCollectiveRepository", t, "Unable to dump collective repository. Caught exception: " + t.getMessage()); + } finally { + if (jmxConnector != null) { + close(jmxConnector); + } + } + } + + /** + * Tries to close the Closeable. + * + * @param c The Closeable, may be {@code null}. + */ + private void close(Closeable c) { + try { + if (c != null) { + c.close(); + } + } catch (Exception e) { + // Ignore it + } + } + + /** + * Initialize the HTTP connection for this JVM to ignore SSL security. + * These tests are not SSL centric and we can safely ignore SSL in our tests. + */ + private void setupHttpsConnection() throws NoSuchAlgorithmException, KeyManagementException { + + // Ignore SSL certificate trust + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + + // Ignore host names during SSL validation + HostnameVerifier hv = new HostnameVerifier() { + @Override + public boolean verify(String urlHostName, SSLSession session) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(hv); + } + + /** + * @throws NoSuchAlgorithmException + * @throws KeyManagementException + * @throws MalformedURLException + * @throws IOException + */ + private JMXConnector createJMXConnection() throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, IOException { + // Ignore SSL certificate trust + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + + // Ignore host names during SSL validation + HostnameVerifier hv = new HostnameVerifier() { + @Override + public boolean verify(String urlHostName, SSLSession session) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(hv); + + // Establish up JMX connection + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { adminUser, adminPassword }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", server.getHttpDefaultSecurePort(), "/IBMJMXConnectorREST"); + return JMXConnectorFactory.connect(url, environment); + } +} diff --git a/dev/fattest.simplicity/src/componenttest/rules/RunFatClientUsingTestNamesRule.java b/dev/fattest.simplicity/src/componenttest/rules/RunFatClientUsingTestNamesRule.java new file mode 100755 index 000000000000..c1e622ab03e8 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/rules/RunFatClientUsingTestNamesRule.java @@ -0,0 +1,50 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.rules; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import componenttest.annotation.IgnoreTestNamesRule; +import componenttest.custom.junit.runner.FeatureDoesNotStartOnLowJavaVersionsTestStub; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.utils.FATServletClient; + +/** + * Run all tests with their method names using {@link FATServletClient}. + */ +class RunFatClientUsingTestNamesRule implements TestRule { + private final LibertyServer server; + private final String path; + + public RunFatClientUsingTestNamesRule(final LibertyServer server, final String path) { + this.server = server; + this.path = path; + } + + @Override + public Statement apply(final Statement base, final Description description) { + if (!description.getMethodName().equals(FeatureDoesNotStartOnLowJavaVersionsTestStub.SYNTHETIC_METHOD_NAME) + && description.getAnnotation(IgnoreTestNamesRule.class) == null) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + final String testName = description.getMethodName(); + FATServletClient.runTest(server, path, testName); + } + }; + } else { + return base; + } + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/componenttest/rules/ServerRules.java b/dev/fattest.simplicity/src/componenttest/rules/ServerRules.java new file mode 100755 index 000000000000..654c0093f98e --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/rules/ServerRules.java @@ -0,0 +1,51 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.rules; + +import org.junit.rules.RuleChain; +import org.junit.rules.TestRule; + +import componenttest.topology.impl.LibertyServer; + +/** + * JUnit rules for doing stuff with LibertyServers before and after tests e.g. starting and stopping. + */ +public final class ServerRules { + + /** + * Use this rule to automatically start a given Liberty server before tests. + * E.g. @Rule public TestRule startRule = ServerRules.startAutomatically(myServer); + */ + public static TestRule startAutomatically(final LibertyServer server) { + return new AutoStartRule(server); + } + + /** + * Use this rule to automatically stop a given Liberty server after tests. + * E.g. @Rule public TestRule stopRule = ServerRules.stopAutomatically(myServer); + */ + public static TestRule stopAutomatically(final LibertyServer server) { + return new AutoStopRule(server); + } + + /** + * Use this rule to automatically start and stop a given Liberty server before and after tests. + * E.g. @Rule public TestRule startStopRule = ServerRules.startAndStopAutomatically(myServer); + */ + public static TestRule startAndStopAutomatically(final LibertyServer server) { + return RuleChain.outerRule(new AutoStartRule(server)).around(new AutoStopRule(server)); + } + + // prevent instantiation of static utility class + private ServerRules() {} + +} diff --git a/dev/fattest.simplicity/src/componenttest/rules/TestRules.java b/dev/fattest.simplicity/src/componenttest/rules/TestRules.java new file mode 100755 index 000000000000..aa116d49a252 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/rules/TestRules.java @@ -0,0 +1,64 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.rules; + +import org.junit.rules.TestRule; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.utils.FATServletClient; + +/** + * Some helpful JUnit rules. + */ +public class TestRules { + + public interface PathGetter { + TestRule onPath(String path); + + ServletGetter usingApp(String appName); + } + + public interface ServletGetter { + TestRule andServlet(String servletName); + } + + /** + * Run all tests with their method names using {@link FATServletClient}. + *

    + * Examples:
    + * @Rule public TestRule runAll = TestRules.runAllUsingTestNames(server).onPath("appName/servletName");
    + * @Rule public TestRule runAll = TestRules.runAllUsingTestNames(server).usingApp("appName").andServlet("servletName"); + */ + public static PathGetter runAllUsingTestNames(final LibertyServer server) { + return new PathGetter() { + @Override + public TestRule onPath(final String path) { + return new RunFatClientUsingTestNamesRule(server, path); + } + + @Override + public ServletGetter usingApp(final String appName) { + return new ServletGetter() { + + @Override + public TestRule andServlet(final String servletName) { + final String path = appName + "/" + servletName; + return new RunFatClientUsingTestNamesRule(server, path); + } + }; + } + }; + } + + // prevent instantiation of static utility class + private TestRules() {} +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/database/CloudantDatabase.java b/dev/fattest.simplicity/src/componenttest/topology/database/CloudantDatabase.java new file mode 100644 index 000000000000..ed87817151c8 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/database/CloudantDatabase.java @@ -0,0 +1,232 @@ +package componenttest.topology.database; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import java.util.regex.Pattern; + +import com.ibm.websphere.simplicity.config.ConfigElementList; +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import com.ibm.websphere.simplicity.config.Variable; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; +import componenttest.exception.UnavailableDatabaseException; +import componenttest.topology.impl.LibertyServer; + +/** + * @see https://docs.cloudant.com/database.html + */ +public class CloudantDatabase extends Database { + + /** + * If you ever need to do manual DB administration, run this main method to invoke + * whatever list/delete/create operations that you need. + */ + public static void main(String args[]) throws Exception { + + Properties props = new Properties(); + props.put("database.hostname", ""); + props.put("database.port", "5984"); + props.put("database.port.secure", "6984"); + props.put("database.user1", "username"); + props.put("database.password1", "password"); + CloudantDatabase db = new CloudantDatabase(Bootstrap.getInstance(), props, System.getProperty("user.dir")); + db.testConnection(); + + for (String dbName : db.existing_names()) + System.out.println("found db: " + dbName); + } + + private final static Class c = CloudantDatabase.class; + + public CloudantDatabase(Bootstrap bootstrap, Properties dbProps, String testBucketPath) throws Exception { + super(bootstrap, dbProps, testBucketPath); + } + + private void createDatabase(String dbname) throws Exception { + final String method = "createDatabase"; + Log.info(c, method, "Creating database " + dbname + " on " + dbhostname); + + checkValidDBName(dbname); + + HttpURLConnection con = executeHTTPQuery("PUT", '/' + dbname); + int rc = con.getResponseCode(); + if (rc == 201 || rc == 202 || rc == 412) + Log.info(c, method, "Database " + dbname + " created successfully"); + else + throw new Exception("Creating database " + dbname + " failed with response code: " + rc); + } + + @Override + protected void createVendorDatabase() throws Exception { + final String method = "createVendorDatabase"; + + if (dbname == null) { + String unused_name = get_unused_name(); + Log.info(c, method, "Attempt to create new database with name: " + unused_name); + createDatabase(unused_name); + // A new name is only created if the name is not provided in the bootstrapping.properties file. + // Set the new name in the bootstrapping.properties so test bucket can retrieve these values. + // Since the name was not provided, this means that the object should be dropped at the end + // of the test run. + dbname = unused_name; + bootstrap.setValue("database.name", dbname); + bootstrap.setValue("database.dropdatabase", "true"); + } else { + Log.info(c, method, "Use specified database name: " + dbname); + String db_dropandcreate = bootstrap.getValue(BootstrapProperty.DB_DROPANDCREATE.getPropertyName()); + Log.info(c, method, "Drop and create set to: " + db_dropandcreate); + boolean dropandcreate = db_dropandcreate == null ? false : db_dropandcreate.equalsIgnoreCase("true") ? true : false; + Log.info(c, method, "Drop and create is: " + dropandcreate); + if (dropandcreate) { + Log.info(c, method, "Dropping and creating database"); + dropDatabase(dbname); + createDatabase(dbname); + } else { + Log.info(c, method, "Creating database"); + createDatabase(dbname); + } + } + } + + @Override + protected void dropVendorDatabase() throws Exception { + String dbname = bootstrap.getValue(BootstrapProperty.DB_NAME.getPropertyName()); + dropDatabase(dbname); + } + + private void dropDatabase(String dbname) throws Exception { + final String method = "dropDatabase"; + Log.info(c, method, "Dropping database " + dbname); + + HttpURLConnection con = executeHTTPQuery("DELETE", '/' + dbname); + + try { + int rc = con.getResponseCode(); + if (rc == 200) + Log.info(c, method, "Successfully dropped database " + dbname); + else { + dumpResponse(con); + throw new Exception("Dropping database " + dbname + " failed with response code: " + rc); + } + } catch (FileNotFoundException ignore) { + Log.info(c, method, "Database " + dbname + " did not exist"); + } + } + + @Override + protected void runVendorDDL(String testBucketDDLPath, String tempMachineDDLPath) throws Exception { + // no-op + } + + @Override + protected String get_unused_name() throws Exception { + final String method = "get_unused_name"; + String[] existingNames = existing_names(); + + // Search for a name that does not exist + List dbs_list = Arrays.asList(existingNames); + for (int i = 0; i < MAX_NUMBER_NAMES; i++) + if (!dbs_list.contains(String.format("libr%04d", i))) { + Log.info(c, method, String.format("libr%04d is not being used", i)); + return String.format("libr%04d", i); + } + + // This is unlikely unless something is terribly wrong with the Moonstone database maintenance procedure + throw new Exception("Could not find available name"); + } + + @Override + protected String[] existing_names() throws Exception { + HttpURLConnection con = executeHTTPQuery("GET", "/_all_dbs"); + return dumpResponse(con).replace("[", "").replace("]", "").replace("\"", "").split(","); + } + + @Override + public void testConnection() throws Exception { + HttpURLConnection con = executeHTTPQuery("GET", "/"); + + try { + int rc = con.getResponseCode(); + String response = dumpResponse(con); + + if (rc != 200) + throw new UnavailableDatabaseException("Pinging database failed with response code: " + rc); + + if (!response.contains("Welcome")) + throw new UnavailableDatabaseException("Did not get valid data from the initial database ping: " + response); + } finally { + con.disconnect(); + } + } + + @Override + public void addConfigTo(LibertyServer server) throws Exception { + String securePort = bootstrap.getValue(BootstrapProperty.DB_PORT_SECURE.getPropertyName()); + ServerConfiguration config = server.getServerConfiguration(); + + ConfigElementList varList = config.getVariables(); + addOrUpdate(varList, "cloudant.url", "http://" + dbhostname + ':' + dbport); + addOrUpdate(varList, "cloudant.url.secure", "https://" + dbhostname + ':' + securePort); + addOrUpdate(varList, "cloudant.username", dbuser1); + addOrUpdate(varList, "cloudant.password", dbuser1pwd); + addOrUpdate(varList, "cloudant.databaseName", dbname); + + server.updateServerConfiguration(config); + } + + private static String dumpResponse(HttpURLConnection con) throws Exception { + StringBuffer sb = new StringBuffer(); + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + + // Send output from servlet to console output + for (String line = br.readLine(); line != null; line = br.readLine()) { + sb.append(line); + Log.info(c, "dumpResponse", line); + } + + br.close(); + isr.close(); + is.close(); + + return sb.toString(); + } + + private HttpURLConnection executeHTTPQuery(String requestMethod, String query) throws Exception { + + String auth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary((dbuser1 + ':' + dbuser1pwd).getBytes()); + URL url = new URL("http://" + dbhostname + ':' + dbport + query); + + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setRequestProperty("Authorization", auth); + con.setRequestProperty("Accept", "application/json"); + con.setRequestProperty("Content-type", "application/json"); + con.setRequestProperty("User-Agent", "java-cloudant/unknown"); + + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + + con.setRequestMethod(requestMethod); + + return con; + } + + private void checkValidDBName(String dbName) { + if (dbName == null) + throw new IllegalArgumentException("Database name cannot be null."); + + if (!Pattern.matches("^[a-z0-9_$()+-/]*$", dbName)) + throw new IllegalArgumentException("Database name '" + dbName + "' must only contain: [a-z] [0-9] and chars: _$()+-/"); + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/database/DB2Database.java b/dev/fattest.simplicity/src/componenttest/topology/database/DB2Database.java new file mode 100755 index 000000000000..7416ba572445 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/database/DB2Database.java @@ -0,0 +1,231 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014, 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.database; + +import java.io.File; +import java.util.Properties; +import java.util.StringTokenizer; + +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; + +/** + * DB2 database setup. + */ +public class DB2Database extends Database { + + private final static Class c = DB2Database.class; + private final static int DB2_MAX_NAME_LENGTH = 8; + + public DB2Database(Bootstrap bootstrap, Properties dbProps, String testBucketPath) throws Exception { + super(bootstrap, dbProps, testBucketPath); + } + + @Override + protected void createVendorDatabase() throws Exception { + final String method = "createVendorDatabase"; + + if (dbname == null) { + String unused_name = get_unused_name(); + Log.info(c, method, "Attempt to create new database with name: " + unused_name); + createDatabase(unused_name); + // A new name is only created if the name is not provided in the bootstrapping.properties file. + // Set the new name in the bootstrapping.properties so test bucket can retrieve these values. + // Since the name was not provided, this means that the object should be dropped at the end + // of the test run. + dbname = unused_name; + bootstrap.setValue("database.name", dbname); + bootstrap.setValue("database.dropdatabase", "true"); + } else { + Log.info(c, method, "Use specified database name: " + dbname); + String db_dropandcreate = bootstrap.getValue(BootstrapProperty.DB_DROPANDCREATE.getPropertyName()); + Log.info(c, method, "Drop and create set to: " + db_dropandcreate); + boolean dropandcreate = db_dropandcreate == null + ? false : db_dropandcreate.equalsIgnoreCase("true") ? true : false; + Log.info(c, method, "Drop and create is: " + dropandcreate); + if (dropandcreate) { + Log.info(c, method, "Dropping and creating database"); + dropDatabase(dbname); + createDatabase(dbname); + } else { + Log.info(c, method, "Creating database"); + try { + createDatabase(dbname); + } catch (Exception e) { + // If the "database already exists" exception occurs, then go on + // otherwise throw the exception. + if (!e.getMessage().contains("SQL1005N")) { + throw e; + } + } + } + } + } + + @Override + protected void dropVendorDatabase() throws Exception { + final String method = "dropVendorDatabase"; + + String dbname = bootstrap.getValue(BootstrapProperty.DB_NAME.getPropertyName()); + Log.info(c, method, "Drop database " + dbname); + dropDatabase(dbname); + } + + @Override + protected void runVendorDDL(String testBucketDDLPath, String tempMachineDDLPath) throws Exception { + final String method = "runVendorDDL"; + + File bucketDir = new File(testBucketDDLPath); + File[] ddlFiles = bucketDir.listFiles(); + ProgramOutput result; + + String runDDLFile = tempMachineDDLPath + "tempRunDDL.ddl"; + for (File ddlFile : ddlFiles) { + if (ddlFile.isFile()) { + Log.finer(c, method, "Local File Canonical Path is: " + ddlFile.getCanonicalPath()); + Log.info(c, method, "Remote File is: " + tempMachineDDLPath + ddlFile.getName()); + + String[] cmd = new String[10]; + String db2cmd = null; + int numcmdlines = 0; + if (databaseMachine.getOperatingSystem().equals(OperatingSystem.WINDOWS)) + { + db2cmd = "db2cmd -c -w -i "; + // build a file to pass to db2cmd + cmd[numcmdlines++] = "echo \"" + "connect to " + dbname + " user " + dbuser1 + " using " + dbuser1pwd + ";\" > " + runDDLFile; + cmd[numcmdlines++] = "cat \"" + tempMachineDDLPath + ddlFile.getName() + "\" >> " + runDDLFile; + cmd[numcmdlines++] = db2cmd + "db2 -tvf " + runDDLFile; + cmd[numcmdlines++] = "echo \"" + "connect to " + dbname + " user " + dbuser2 + " using " + dbuser2pwd + ";\" > " + runDDLFile; + cmd[numcmdlines++] = "cat \"" + tempMachineDDLPath + ddlFile.getName() + "\" >> " + runDDLFile; + cmd[numcmdlines++] = db2cmd + "db2 -tvf " + runDDLFile; + } else { + cmd[numcmdlines++] = "db2 connect to " + dbname + " user " + dbuser1 + " using " + dbuser1pwd; + cmd[numcmdlines++] = "db2 -tvf " + tempMachineDDLPath + ddlFile.getName(); + cmd[numcmdlines++] = "db2 connect to " + dbname + " user " + dbuser2 + " using " + dbuser2pwd; + cmd[numcmdlines++] = "db2 -tvf " + tempMachineDDLPath + ddlFile.getName(); + } + for (int i = 0; i < numcmdlines; i++) { + Log.finer(c, method, "execute db2 ddl: " + cmd[i]); + result = databaseMachine.execute(cmd[i]); + // There really isn't a way to tell if this worked or not + // since DDL files often contain statements that can fail with no harm, + // for example DROP will fail if the object to be dropped has not yet been created. + // In case debugging is needed, displaying the message in stdout + // + // DROP TABLE MYJOBINSTANCEDATA1 + // DB21034E The command was processed as an SQL statement because it was not a + // valid Command Line Processor command. During SQL processing it returned: + // SQL0204N "DB2ADMIN.MYJOBINSTANCEDATA1" is an undefined name. SQLSTATE=42704 + if (result.getReturnCode() != 0 + && !result.getStdout().contains("SQL0204N")) { + Log.info(c, method, "ddl execute std out: " + result.getStdout()); + Log.info(c, method, "ddl execute std err: " + result.getStderr()); + } + } + } else { + Log.finer(c, method, "Local Directory Canonical Path is: " + ddlFile.getCanonicalPath()); + Log.finer(c, method, "Remote Directory Canonical Path is: " + tempMachineDDLPath + "/" + ddlFile.getName()); + runVendorDDL(ddlFile.getCanonicalPath(), tempMachineDDLPath + ddlFile.getName() + "/"); + } + } + } + + @Override + protected String[] existing_names() throws Exception { + final String method = "existing_names"; + Log.finer(c, method, "Return list of existing databases."); + + String cmd; + if (databaseMachine.getOperatingSystem().equals(OperatingSystem.WINDOWS)) + cmd = "db2cmd -c -w -i db2 LIST DATABASE DIRECTORY"; + else + cmd = "db2 LIST DATABASE DIRECTORY"; + + ProgramOutput dbs_list = databaseMachine.execute(cmd); + + if (dbs_list.getReturnCode() != 0) { + if (dbs_list.getStdout() != null && dbs_list.getStdout().contains("SQL1057W")) { + // If there are no existing databases on the macine, we will get the following warning: + // SQL1057W The system database directory is empty. SQLSTATE=01606 + } else { + Log.info(c, method, "db2cmd std out: " + dbs_list.getStdout()); + Log.info(c, method, "db2cmd std err: " + dbs_list.getStderr()); + throw new Exception("Was not able to obtain list of DB2 database names"); + } + } + + int numdbs = 0; + String[] dbs = new String[MAX_NUMBER_NAMES]; + StringTokenizer st = new StringTokenizer(dbs_list.getStdout(), "\n"); + while (st.hasMoreTokens()) { + String line = st.nextToken().trim(); + if (line.startsWith("Database name") && line.contains("= LIBR")) { + dbs[numdbs] = line.substring(line.indexOf("=") + 2); + Log.info(c, method, "Add name to list of names: " + dbs[numdbs]); + numdbs++; + if (numdbs > MAX_NUMBER_NAMES) + throw new Exception("Exceeded maximum number of database names that can be created"); + } + } + return dbs; + } + + private void createDatabase(String dbname) throws Exception { + final String method = "createDatabase"; + Log.info(c, method, "Creating database " + dbname + " on " + dbhostname); + + if (dbname.length() > DB2_MAX_NAME_LENGTH) + throw new Exception(DATABASE_NAME_LENGTH_EXCEEDED + DB2_MAX_NAME_LENGTH + " characters or less"); + + String cmd; + if (databaseMachine.getOperatingSystem().equals(OperatingSystem.WINDOWS)) + cmd = "db2cmd -c -w -i db2 CREATE DATABASE " + dbname; + else + cmd = "db2 CREATE DATABASE " + dbname; + + Log.finer(c, method, "execute line " + cmd); + ProgramOutput result = databaseMachine.execute(cmd); + if (result.getReturnCode() != 0) { + Log.info(c, method, "Create database returncode: " + result.getReturnCode()); + Log.info(c, method, "Create database stdout: " + result.getStdout()); + Log.info(c, method, "Create database stderr: " + result.getStderr()); + throw new Exception("Creation of database " + dbname + " failed with : " + result.getStdout()); + } + } + + private void dropDatabase(String dbname) throws Exception { + final String method = "dropDatabase"; + + String cmd; + if (databaseMachine.getOperatingSystem().equals(OperatingSystem.WINDOWS)) + cmd = "db2cmd -c -w -i db2 DROP DATABASE " + dbname; + else + cmd = "db2 DROP DATABASE " + dbname; + + ProgramOutput result = databaseMachine.execute(cmd); + int rc = result.getReturnCode(); + if (rc != 0) { + Log.info(c, method, "Drop database returncode: " + rc); + Log.info(c, method, "Drop database stdout: " + result.getStdout()); + Log.info(c, method, "Drop database stderr: " + result.getStderr()); + throw new Exception("Dropping database " + dbname + " failed with return code " + rc + + " STDOUT: " + result.getStdout() + + " STDERR: " + result.getStderr()); + } else { + Log.info(c, method, "Dropped database " + dbname); + } + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/database/Database.java b/dev/fattest.simplicity/src/componenttest/topology/database/Database.java new file mode 100755 index 000000000000..a1930f7d51e3 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/database/Database.java @@ -0,0 +1,339 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014, 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.database; + +import static componenttest.common.apiservices.BootstrapProperty.DB_DBAPASSWORD; +import static componenttest.common.apiservices.BootstrapProperty.DB_DBAUSER; +import static componenttest.common.apiservices.BootstrapProperty.DB_HOME; +import static componenttest.common.apiservices.BootstrapProperty.DB_HOSTNAME; +import static componenttest.common.apiservices.BootstrapProperty.DB_MACHINEPWD; +import static componenttest.common.apiservices.BootstrapProperty.DB_MACHINEUSER; +import static componenttest.common.apiservices.BootstrapProperty.DB_NAME; +import static componenttest.common.apiservices.BootstrapProperty.DB_PASSWORD1; +import static componenttest.common.apiservices.BootstrapProperty.DB_PASSWORD2; +import static componenttest.common.apiservices.BootstrapProperty.DB_PORT; +import static componenttest.common.apiservices.BootstrapProperty.DB_USER1; +import static componenttest.common.apiservices.BootstrapProperty.DB_USER2; +import static componenttest.common.apiservices.BootstrapProperty.DB_VENDORNAME; +import static componenttest.common.apiservices.BootstrapProperty.DB_VENDORVERSION; + +import java.io.File; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.TimeUnit; + +import com.ibm.websphere.simplicity.ConnectionInfo; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.config.ConfigElementList; +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import com.ibm.websphere.simplicity.config.Variable; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; +import componenttest.exception.UnavailableDatabaseException; +import componenttest.topology.impl.LibertyServer; + +/** + * Base class that defines the methods for database test processing. + */ +public abstract class Database { + + private final static Class c = Database.class; + + private final static int NUMBER_OF_CREATE_RETRIES = 3; + + private final static int NUMBER_OF_DROP_RETRIES = 3; + + /** + * Maximum number of database or user id names available due to naming scheme used by Moonstone. + */ + protected final static int MAX_NUMBER_NAMES = 10000; + + /** + * Exception message text to indicate database name length exceeded + */ + protected final static String DATABASE_NAME_LENGTH_EXCEEDED = "Database name must be "; + + protected final String dbhostname, dbhome, dbmachineuser, dbmachinepwd, dbport, + dbauser, dbapwd, + dbuser1, dbuser2, dbuser1pwd, dbuser2pwd, + dbtype, dbversion, + testBucketPath, testBucketName; + protected String dbname; + + protected final Machine localMachine, databaseMachine; + + final Bootstrap bootstrap; + final Properties dbProps; + + public Database(Bootstrap bootstrap, Properties dbProps, String testBucketPath) throws Exception { + this.bootstrap = bootstrap; + this.testBucketPath = testBucketPath; + this.dbProps = dbProps; + testBucketName = new File(new File(testBucketPath).getParent()).getName(); + + dbhostname = readProp(DB_HOSTNAME); + dbhome = readProp(DB_HOME); + dbmachineuser = readProp(DB_MACHINEUSER); + dbmachinepwd = readProp(DB_MACHINEPWD); + dbport = readProp(DB_PORT); + + dbauser = readProp(DB_DBAUSER); + dbapwd = readProp(DB_DBAPASSWORD); + dbname = readProp(DB_NAME); + + dbuser1 = readProp(DB_USER1); + dbuser2 = readProp(DB_USER2); + dbuser1pwd = readProp(DB_PASSWORD1); + dbuser2pwd = readProp(DB_PASSWORD2); + + dbtype = readProp(DB_VENDORNAME); + dbversion = readProp(DB_VENDORVERSION); + + localMachine = Machine.getMachine(new ConnectionInfo("localhost", null, null)); + databaseMachine = Machine.getMachine(new ConnectionInfo(dbhostname, dbmachineuser, dbmachinepwd)); + } + + /** + * Create new test database or user IDs based on the properties in the bootstrap. + * + * The create will be tried NUMBER_OF_CREATE_RETRIES times before giving up. + * + * @param bootstrap Contents of the bootstrapping.properties file. + * @throws Exception If the database or user IDs could not be created. This may be due to problems with the + * database or because of collisions with other running test buckets selecting the same names. + */ + final public void createDatabase() throws Exception { + final String method = "createDatabase"; + + testConnection(); + + // Physically update the bootstrapping.properties file with the + // java.util.Properties used to construct the object + for (String key : dbProps.stringPropertyNames()) { + String value = dbProps.getProperty(key); + Log.info(c, method, "Update bootstrapping.properties: " + key + '=' + value); + bootstrap.setValue(key, value); + } + + for (int i = 1; i <= NUMBER_OF_CREATE_RETRIES; i++) { + Log.info(c, method, "Attempt " + i + " to create database."); + try { + createVendorDatabase(); + return; + } catch (Exception ex) { + Log.warning(c, ex.getMessage()); + if (ex.getMessage().startsWith(DATABASE_NAME_LENGTH_EXCEEDED)) { + throw ex; + } + if (i == NUMBER_OF_CREATE_RETRIES) { + Log.warning(c, "Aborting create database after trying " + NUMBER_OF_CREATE_RETRIES + " times."); + throw ex; + } + } + } + } + + /** + * Create test objects for a specific vendor. + */ + abstract protected void createVendorDatabase() throws Exception; + + /** + * Drop the test database or user IDs + * + * @throws Exception If the drop fails. + */ + final public void dropDatabase() throws Exception { + final String method = "dropDatabase"; + if (bootstrap.getValue("database.dropdatabase") != null) { + for (int i = 1; i <= NUMBER_OF_DROP_RETRIES; i++) { + Log.finer(c, method, "drop database attempt " + i); + try { + dropVendorDatabase(); + return; + } catch (Exception e) { + if (i == NUMBER_OF_DROP_RETRIES) + throw e; + Log.finer(c, method, "Waiting for 30s before retrying drop"); + TimeUnit.SECONDS.sleep(30); + } + } + } else { + Log.info(c, method, + "Drop database ignored since database.dropandcreate has been added to the bootstrapping.properties to save the database after tests have been run."); + } + } + + /** + * Drop test objects for a specific vendor. + */ + abstract protected void dropVendorDatabase() throws Exception; + + /** + * Runs all the DDL files in the test bucket for the specific type of database. + * The files must be located in a directory "ddl" under the project. + * Under ddl, there should be a directory for each type of database. + * For example: + *

      ddl + *
        /db2 + *
        /informix + *
        /oracle + *
        /sqlserver + *
        /sybase + * + *

    The files are copied to the database machine's temporary directory and + * deleted after being executed on the test bucket database. + * + * @throws Exception + */ + final public void runDDL() throws Exception { + String method = "runDDL"; + + Log.info(c, "runDDL", "OS temp path is: " + databaseMachine.getTempDir().getAbsolutePath()); + + String ddlSourceFileName = testBucketPath + "/ddl/" + dbtype.toLowerCase(); + RemoteFile sourceFile = localMachine.getFile(ddlSourceFileName); + if (!sourceFile.exists()) { + Log.finer(c, method, "local file path: " + sourceFile.getAbsolutePath() + " does not exist, no DDL to process for this database type"); + return; + } + + // The DDL files must be kept separate for each database install and each test bucket since + // they are kept in one global location on the machine. + // Either the database name or the user name will be unique, depending on the database type. + // + // Delete remote ddl database directory if it already exists to make sure we have a clean copy of + // the current set of files. + // + // The DDL files are only copied under one user id because the user id is just part of making sure + // the directory name is unique for a test bucket run. + String remoteMachineDDLPath = databaseMachine.getTempDir().getAbsolutePath() + + "/libertyfat/" + dbtype + "/" + dbversion + "/" + dbname + "/" + dbuser1 + "/" + + testBucketName + "/ddl/" + dbtype.toLowerCase() + "/"; + RemoteFile destFile = new RemoteFile(databaseMachine, remoteMachineDDLPath); + if (!destFile.delete()) + throw new Exception("The ddl directory was not successfully deleted before copy."); + if (!sourceFile.copyToDestText(destFile, true, true)) + throw new Exception("DDL files were not copied to the database machine."); + Log.info(c, method, "DDL files copied to the database machine."); + + runVendorDDL(ddlSourceFileName + "/", remoteMachineDDLPath); + } + + /** + * Execute DDL using specific vendor techniques. + */ + abstract protected void runVendorDDL(String testBucketDDLPath, String tempMachineDDLPath) throws Exception; + + /** + * Generate a name that is not already in a list of existing names obtained from the database. + * + * There is a possible window where the name is selected and then the name is created + * by another running bucket since buckets can be run asynchronously. + */ + protected String get_unused_name() throws Exception { + final String method = "get_unused_name"; + String[] existingNames = existing_names(); + + // Search for a name that does not exist + List dbs_list = Arrays.asList(existingNames); + for (int i = 0; i < MAX_NUMBER_NAMES; i++) { + if (!dbs_list.contains(String.format("LIBR%04d", i))) { + Log.info(c, method, String.format("LIBR%04d is not being used", i)); + return String.format("LIBR%04d", i); + } + } + // This is unlikely unless something is terribly wrong with the Moonstone database maintenance procedure + throw new Exception("Could not find available name"); + } + + /** + * List of existing names in the database for the type of object that is created by + * the specific database test setup object. + *

    + * For example, the list of existing database names could be returned. + *

    + * Database object should implement this to provide a list of existing names + * for the type of object that will be created. + * + * @return list of existing names + */ + abstract protected String[] existing_names() throws Exception; + + public void testConnection() throws Exception { + final String m = "testConnection"; + try { + Log.info(c, m, "Attempting to connect to database server " + dbhostname + " to make sure it's available."); + databaseMachine.connect(); + Log.info(c, m, "Successfully connected to database server " + dbhostname); + } catch (Exception ex) { + // TODO we should have a more prominent way of letting people know that we had to failover? + // perhaps sending an email out? + UnavailableDatabaseException unavailableMachine = new UnavailableDatabaseException("The database server " + dbhostname + " is unreachable.", ex); + Log.error(c, m, unavailableMachine); + throw unavailableMachine; + } + } + + public void addConfigTo(LibertyServer server) throws Exception { + ServerConfiguration config = server.getServerConfiguration(); + ConfigElementList varList = config.getVariables(); + + addOrUpdate(varList, "jdbc.serverName", dbhostname); + addOrUpdate(varList, "jdbc.portNumber", dbport); + addOrUpdate(varList, "jdbc.databaseName", dbname); + addOrUpdate(varList, "jdbc.user", dbuser1); + addOrUpdate(varList, "jdbc.password", dbuser1pwd); + + server.updateServerConfiguration(config); + } + + void addOrUpdate(ConfigElementList vars, String name, String value) { + Variable var = vars.getBy("name", name); + if (var == null) + vars.add(new Variable(name, value)); + else + var.setValue(value); + } + + public String getName() { + return dbname; + } + + public String getHostname() { + return dbhostname; + } + + public String getPort() { + return dbport; + } + + @Override + public String toString() { + return this.getClass().getName() + '{' + dbuser1 + '@' + dbhostname + ':' + dbport + '}'; + } + + /** + * Look for a property in bootstrapping.properties and then the .dbprops file + */ + private String readProp(BootstrapProperty propName) { + String bootstrapProp = bootstrap.getValue(propName.getPropertyName()); + if (bootstrapProp != null) + return bootstrapProp; + else + return dbProps.getProperty(propName.getPropertyName()); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/componenttest/topology/database/DatabaseCluster.java b/dev/fattest.simplicity/src/componenttest/topology/database/DatabaseCluster.java new file mode 100755 index 000000000000..611eb99dba95 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/database/DatabaseCluster.java @@ -0,0 +1,223 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.database; + +import static componenttest.common.apiservices.BootstrapProperty.DB_VENDORNAME; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; +import componenttest.exception.UnavailableDatabaseException; +import componenttest.topology.impl.LibertyServer; + +/** + * A collection of Databases + */ +public class DatabaseCluster { + private final Class c = DatabaseCluster.class; + public final Bootstrap b; + public final String testBucketPath; + + private BootstrapProperty dbType; + private final List databases = new ArrayList(); + private Database dbInUse; + + public static String[] getAllDbProps(String dir) { + File dirFile = new File(dir); + return dirFile.list(new FilenameFilter() { + @Override + public boolean accept(File dir, String filename) { + return filename.endsWith(".dbprops"); + } + }); + } + + private static Properties[] toPropsArr(String... dbPropsArr) throws IOException { + Properties[] propsArr = new Properties[dbPropsArr.length]; + for (int i = 0; i < dbPropsArr.length; i++) { + InputStream is = new FileInputStream(dbPropsArr[i]); + Properties dbProps = new Properties(); + dbProps.load(is); + is.close(); + propsArr[i] = dbProps; + } + return propsArr; + } + + private static Properties[] toPropsArr(String pathToProps, String... dbPropNames) throws IOException { + String[] dbPropsArr = new String[dbPropNames.length]; + for (int i = 0; i < dbPropNames.length; i++) + dbPropsArr[i] = pathToProps + '/' + dbPropNames[i]; + return toPropsArr(dbPropsArr); + } + + public DatabaseCluster() throws Exception { + this(getAllDbProps(System.getProperty("user.dir"))); + } + + /** + * Will use Bootstrap.getInstance() to obtain an instance of bootstrapping.properties. + * Will also assume that the test bucket path is the current working dir (i.e. user.dir) + * + * @param dbPropsArr A varargs array file names to use for the database properties + */ + public DatabaseCluster(String... dbPropsArr) throws Exception { + this(toPropsArr(dbPropsArr)); + } + + /** + * Will use Bootstrap.getInstance() to obtain an instance of bootstrapping.properties. + * Will also assume that the test bucket path is the current working dir (i.e. user.dir) + * + * @param dbPropsArr A varargs array of java.util.Properties with database info + */ + public DatabaseCluster(Properties... dbPropsArr) throws Exception { + this(Bootstrap.getInstance(), System.getProperty("user.dir"), dbPropsArr); + } + + public DatabaseCluster(Bootstrap bootstrap, String testBucketPath) throws Exception { + this(bootstrap, testBucketPath, toPropsArr(testBucketPath, getAllDbProps(testBucketPath))); + } + + public DatabaseCluster(Bootstrap bootstrap, String testBucketPath, String dbPropsPath) throws Exception { + this(bootstrap, testBucketPath, toPropsArr(dbPropsPath, getAllDbProps(dbPropsPath))); + } + + /** + * @param bootstrap The instance of a bootstrapping.properties file to use + * @param testBucketPath The location of the test bucket using this cluster + * @param dbPropsArr A varargs array of java.util.Properties with database info + */ + public DatabaseCluster(Bootstrap bootstrap, String testBucketPath, Properties... dbPropsArr) throws Exception { + this.b = bootstrap; + this.testBucketPath = testBucketPath; + + Log.info(c, "", "bootstrap, testBucketPath, [dbPropsArr]", + new Object[] { bootstrap, testBucketPath, Arrays.toString(dbPropsArr) }); + + for (Properties dbProps : dbPropsArr) + addMachine(dbProps); + + dbInUse = getInUseDatabase(); + } + + public boolean addMachine(Properties dbProps) throws Exception { + final String method = "addMachine"; + + BootstrapProperty dbType = BootstrapProperty.fromPropertyName(dbProps.getProperty(DB_VENDORNAME.toString())); + + if (dbType == null) + throw new IllegalArgumentException("Invalid database.vendorname specified: " + dbProps.getProperty(DB_VENDORNAME.toString())); + else if (this.dbType == null) + this.dbType = dbType; + else if (this.dbType != dbType) + throw new IllegalArgumentException("Unable to add a database of type " + dbType + " to a cluster of databases with type " + this.dbType); + + try { + Database db; + switch (dbType) { + case DB_DB2: + db = new DB2Database(b, dbProps, testBucketPath); + break; + case DB_INFORMIX: + db = new InformixDatabase(b, dbProps, testBucketPath); + break; + case DB_ORACLE: + db = new OracleDatabase(b, dbProps, testBucketPath); + break; + case DB_SQLSERVER: + db = new SQLServerDatabase(b, dbProps, testBucketPath); + break; + case DB_SYBASE: + db = new SybaseDatabase(b, dbProps, testBucketPath); + break; + case DB_CLOUDANT: + db = new CloudantDatabase(b, dbProps, testBucketPath); + break; + default: + throw new IllegalArgumentException("database.vendorname " + dbType + " is not spelled correctly or is not yet supported."); + } + Log.info(c, method, "Adding database " + db + " to the cluster."); + return databases.add(db); + } catch (UnavailableDatabaseException unavailable) { + return false; + } + } + + public void createDatabase() throws Exception { + if (dbInUse != null) + throw new IllegalStateException("Cannot call createDatabase more than once per cluster instance."); + + Exception last = null; + for (Database db : databases) + try { + db.createDatabase(); + dbInUse = db; + return; + } catch (Exception e) { + last = e; + Log.warning(c, "Failed to create a database for " + db + ". Removing this machine from the cluster."); + } + throw new UnavailableDatabaseException("Unable to create a database on any of the servers in the Database cluster." + + " Servers attempted were: " + databases, last); + } + + public void runDDL() throws Exception { + checkInUse(); + dbInUse.runDDL(); + } + + public void dropDatabase() throws Exception { + checkInUse(); + dbInUse.dropDatabase(); + } + + private void checkInUse() { + if (dbInUse == null) + throw new IllegalStateException("There is no in-use database for this cluster instance, first call createDatabase()"); + } + + public void addConfigTo(LibertyServer server) throws Exception { + checkInUse(); + getInUseDatabase().addConfigTo(server); + } + + public Database getInUseDatabase() throws Exception { + if (dbInUse != null) + return dbInUse; + + // When a database is 'in use' it will update the bootstrapping.properties file + // with a its own hostname. Match the hostname to one of the machines in the cluster + String targetHost = b.getValue(BootstrapProperty.DB_HOSTNAME.toString()); + + if (targetHost == null) + return null; // there is no DB in use yet + + for (Database db : databases) + if (targetHost.equalsIgnoreCase(db.dbhostname)) { + Log.info(c, "getInUseDatabase", "Marking DB in use: " + db); + return db; + } + return null; + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/database/DatabaseTester.java b/dev/fattest.simplicity/src/componenttest/topology/database/DatabaseTester.java new file mode 100755 index 000000000000..1e04961a849c --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/database/DatabaseTester.java @@ -0,0 +1,346 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014, 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.database; + +import static componenttest.common.apiservices.BootstrapProperty.DB_DRIVERNAME; +import static componenttest.common.apiservices.BootstrapProperty.DB_DRIVERVERSION; +import static componenttest.common.apiservices.BootstrapProperty.DB_VENDORNAME; +import static componenttest.common.apiservices.BootstrapProperty.LIBERTY_DBJARS; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.Properties; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; + +/** + *

    Database Setup and Cleanup

    + * + *

    This class provides options for setting up testing for relational databases that are certified by WebSphere. + * + *

    FAT buckets that test with databases setup their server.xml to test with Derby Embedded by default. + * This class provides options for starting and stopping DerbyNetwork so Derby Client can be used as the + * default instead of Derby Embedded. None of the other setup options provided by this class are processed + * at this time for Derby. + * + *

    Fat buckets can run with both Derby and another database specified in the bootstrapping.properties + * at the same time. + * + *

    For each test bucket run, the database is created, the DDL files are executed + * against the database, the test bucket is executed, and the database is dropped. + * + *

    There is also a way to create a database or use an existing database and have the database not + * be dropped at the end of the test run that can be useful for sandbox testing. + * + *

    See the main method javadoc for the options that are provided. + * + *


    + *

    Property driven setup

    + * + *

    Database setup is driven by properties specified on the build project or on the individual project. + * + *

    The build properties have the same names as the bootstrapping.properties. + * See BootstrapProperty for a list of property names. + * + *

    The FAT infrastructure uses the options provided by this class to set up and tear down + * the database environment. + * This class depends on the Ant FAT testing infrastructure populating the bootstrapping.properties file + * from Ant properties that contain the database connection and jdbc driver information + * before it is called. + * + *

    See the prereq.dbtest project for property files that contain database + * connection properties and jdbc driver properties that are available for testing. + * There is also a "create" properties file to use with sandbox testing that allows for a + * database name to be specified and the database to be available after the test bucket has completed. + * + *

    There are two types of setups created for use by a test bucket. + *

      + *
    1. Databases access is managed by creating a unique database instance for each bucket. + *
    2. Databases access is managed by creating two unique user ids or schemas in the database + * for each bucket because creating a unique database for each bucket is too expensive. + *
    + * + *

    As part of normal continuous test, for each test bucket that requires a database, the database or user IDs + * will be setup and deleted. Unique names are created for each active database run so that each + * test bucket is isolated from another running test bucket. + * For Liberty, these names will start with "LIBR" and be followed by four digits, e.g. "LIBR0000". + * + *

    A bootstrapping property, database.dropandcreate, is provided for sandbox testing + * where the database or schemas can be created and saved after the run or if the database or schemas + * already exists, then they can be used by the test bucket. + * This can be useful for debugging, but care must be taken not to overload the database machines + * with extra databases. + *

      + *
    • Note 1: There is no way to delete the database or schemas after they have been created using this option. + * It is up to the tester to take care of cleanup. + *
    • Note 2: When creating a database this way, the tester must provide the name of the database. + * Do not use names that start with "MOON" or "LIBR" as these are created as part of + * continuous test and may be deleted as part of regular clean up of the database machines. + *
    • Note 3: For Oracle, a pair of user ids are created instead of a database. The same naming + * rules are used for these names, so names that start with "MOON" or "LIBR" should be + * avoided. + *
    + * + *
    + *

    DDL support

    + *

    The test bucket can provide a set of DDL files to be executed after the database is created. + *

    The files should be placed in a "ddl" directory that is under the main project directory. + *

    There should be a set of DDL files for each database type under the ddl directory. + *

    The directory and sub-directories will all be processed. + *

    The file can end in any suffix. + *

    For example: + * + *

    + * com.ibm.ws.mytestproject_fat
    + *   ddl
    + *     db2
    + *       test1.ddl
    + *       dir1
    + *         test2.ddl
    + *         test3.sql
    + *     informix
    + *       test1.ddl
    + *     oracle
    + *       test1.ddl
    + *     sqlserver
    + *       test1.ddl
    + *     sybase
    + *       test1ddl
    + * 
    + * + *
    + *

    Database setup details

    + *

    1. Databases other than Oracle

    + *
      + *
    • The userid/pw pair must be specified in bootstrapping.properties + *
    • If database name is not specified: + *

      Then the next available database name that starts with "LIBR" plus four digits will be determined. + *

      The database will be created before the test run starts. + *

      The database will be dropped after the test run completes. + * + *

    • If database name is specified: + *

      If database.dropandcreate = false or is not specified + * and the database does not already exist then it will be created using the name provided + *

      If database.dropandcreate = true + *

        + *
      • The database will be dropped if it exists + *
      • The database will be created using the name specified. + *
      • The userid/pw pairs will be created in the database. + *
      • The database will not be dropped after the test run completes and can be used for + * additional runs or for debugging. + *
      + *
    + * + *

    2. Oracle

    + *
      + *
    • The database name must be specified and exist. This should be the Oracle "service name". + *
    • If userid/pw pairs are not specified: + *

      Then the next available userid/pw pair names that starts with "LIBR" plus four digits will be determined. + *

      The userids will be created before the test run starts. + *

      The userids will be dropped after the test run completes. + * + *

    • If userid/pw pair is specified: + *

      If database.dropandcreate = false or is not specified + * and the userids do not already exist then they will be created using the names provided. + *

      If database.dropandcreate = true + *

        + *
      • The user ids will be dropped if they exist. + *
      • The user ids will be created using the names specified. + *
      • The user ids will not be dropped after the test run completes and can be used for + * additional runs or for debugging. + *
      + *
    + * + */ +public class DatabaseTester { + + private final static Class c = DatabaseTester.class; + + /** + * Options for database environment set up and tear down. + * + * @param args Set of strings
      + *
    • [0] bootstrapping file name + *
    • [1] option + *
      create - create the database and/or user IDs. + *
         The database or user IDs are NOT created if database.dropandcreate=false + * and the names are provided. + *
      + *
      drop - drop the database or user IDs. + *
         The database or user IDs are NOT dropped if database.keepdatabase was added to the + * bootstrapping.properties file during the create option. It is then the tester's responsibility + * to drop the database or user IDs when they are no longer needed. + *
      + *
      runDDL - execute all DDL files in the ddl directory for the database type + *
      + *
      startDerbyNet - start Derby Network Server + *
      + *
      stopDerbyNet - stop Derby Network Server + *
    • [2] test bucket path name + *
    • [3] (optional) database properties/jars directory (i.e. /path/to/prereq.dbtest/lib/DB2 ). + * Omit this parameter to reuse the database information that is stored in bootstrapping.properties + * after a test has previously invoked the create operation. + *
    • [4] (optional) The path to the JDBC driver jar to use. If this argument is null,
      + * then the database jar will be used from the location specified in arg [3]. Note that if + * the bootstrapping.properties file already has a liberty.db_jars property set, that value + * will always be used and not overridden by arg[3] or arg[4]. + *
    + * + * @throws Exception see exception for details + */ + public static void main(String[] args) throws Exception { + try { + doMain(args); + } catch (Exception e) { + e.printStackTrace(System.out); + throw e; + } + } + + private static void doMain(String[] args) throws Exception { + String method = "main"; + if (args.length < 3) + throw new Exception("At least three arguments are required, see javadoc"); + + Log.info(c, method, "[bootstrapLoc, option, testBucketPath, dbPropsPath, dbJarPath] " + Arrays.toString(args)); + + String bootstrapLoc = args[0]; + String option = args[1]; + String testBucketPath = args[2]; + // Assume the dbPropsPath is in the same location as the testBucketPath unless otherwise specified + String dbPropsPath = args.length == 3 || args[3] == null ? args[2] : args[3]; + + // Initialize the bootstrap singleton instance as soon as args have been parsed + Bootstrap bootstrap = Bootstrap.getInstance(new File(bootstrapLoc)); + + // Run start/stop Derby Network options + if (option.equalsIgnoreCase("startDerbyNet")) { + DerbyNetworkUtilities.startDerbyNetwork(); + return; + } else if (option.equalsIgnoreCase("stopDerbyNet")) { + DerbyNetworkUtilities.stopDerbyNetwork(); + return; + } + + // Exit if we are Derby and nothing needs to be done + if (isDerby(dbPropsPath)) + return; + + DatabaseCluster dbCluster; + + if (!dbPropsPath.isEmpty()) + dbCluster = new DatabaseCluster(bootstrap, testBucketPath, dbPropsPath); + else { + // reuse values that were previously saved to bootstrapping.properties + Properties dbProps = new Properties(); + for (BootstrapProperty bp : BootstrapProperty.values()) { + String key = bp.getPropertyName(); + String value = bootstrap.getValue(key); + if (value != null) + dbProps.put(key, value); + } + dbCluster = new DatabaseCluster(bootstrap, testBucketPath, dbProps); + } + + if (bootstrap.getValue(LIBERTY_DBJARS.getPropertyName()) == null) { + // If the DB jar path is not defined, set it in the bootstrapping.properties + String drivername = bootstrap.getValue(DB_DRIVERNAME.getPropertyName()); + String driververs = bootstrap.getValue(DB_DRIVERVERSION.getPropertyName()); + if (drivername != null && driververs != null) { + String dbJarPath = args.length >= 5 && args[4] != null ? args[4] : args[3]; + String dbJars = dbJarPath + "/jars/" + drivername + '/' + driververs; + Log.info(c, method, "Setting liberty.db_jars to: " + dbJars); + bootstrap.setValue(LIBERTY_DBJARS.getPropertyName(), dbJars); + } + } + + if (option.equalsIgnoreCase("create")) { + dbCluster.createDatabase(); + } else if (option.equalsIgnoreCase("drop")) { + dbCluster.dropDatabase(); + } else if (option.equalsIgnoreCase("runDDL")) { + dbCluster.runDDL(); + } else + throw new Exception("Invalid configuration option specified: " + option); + } + + private static boolean isDerby(String dbPropsPath) throws Exception { + // First, check if the database.vendorname was directly added to the boostrapping.properties file + String bootstrapVendorName = Bootstrap.getInstance().getValue(DB_VENDORNAME.getPropertyName()); + if (bootstrapVendorName != null && !bootstrapVendorName.equalsIgnoreCase("derby")) { + return false; + } + + File dbPropsDir = new File(dbPropsPath); + if (!dbPropsDir.exists() || !dbPropsDir.isDirectory()) { + blowUpUnlessDerby("Database properties directory did not exit at: " + dbPropsPath); + return true; + } + + String[] dbProps = DatabaseCluster.getAllDbProps(dbPropsPath); + if (dbProps == null || dbProps.length == 0) { + blowUpUnlessDerby("No *.dbprops files found at location: " + dbPropsPath); + return true; + } + + boolean allDerbySoFar = true; + for (String dbProp : dbProps) { + Properties prop = loadProperties(new File(dbPropsPath, dbProp), null); + String vendorName = prop.getProperty(DB_VENDORNAME.getPropertyName()); + if (vendorName != null && !vendorName.equalsIgnoreCase("derby")) { + allDerbySoFar = false; + } + } + + if (allDerbySoFar) { + blowUpUnlessDerby("No database.vendorname specified."); + return true; + } else { + return false; + } + } + + private static void blowUpUnlessDerby(String msg) throws Exception { + // To run with a different DB, fat.test.databases=true must be set + String fat_test_databases = System.getProperty("fat.test.databases"); + if (!"true".equals(fat_test_databases)) { + Log.info(c, "blowUpUnlessDerby", msg + " This is OK because we are running with Derby."); + return; + } + + String fat_bucket_db_type = System.getProperty("fat.bucket.db.type", "Derby"); + if ("Derby".equals(fat_bucket_db_type)) { + Log.info(c, "blowUpUnlessDerby", msg + " This is OK because we are running with Derby."); + return; + } + + throw new Exception(msg); + } + + private static Properties loadProperties(File propsFile, String jarLoc) throws IOException { + if (!propsFile.exists()) + return null; + + Properties props = new Properties(); + InputStream is = new FileInputStream(propsFile); + props.load(is); + is.close(); + + return props; + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/database/DerbyNetworkUtilities.java b/dev/fattest.simplicity/src/componenttest/topology/database/DerbyNetworkUtilities.java new file mode 100755 index 000000000000..c7125182d83e --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/database/DerbyNetworkUtilities.java @@ -0,0 +1,60 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.database; + +import java.io.PrintWriter; +import java.net.InetAddress; +import java.net.UnknownHostException; + +import org.apache.derby.drda.NetworkServerControl; + +/** + * Provides methods for starting and stopping Derby Network. + * The server is checked a number of times to be sure it has started, + * otherwise the exception returned from the ping is thrown. + */ +public class DerbyNetworkUtilities { + + static final int NUMBER_OF_PINGS = 10; + static final int SLEEP_BETWEEN_PINGS = 10000; + // TODO serverName and portNumber are hard coded, + // but in the future should be taken from bootstrapping.properties if specified + static final String serverName = "localhost"; + static final int portNumber = 1527; + + static public void startDerbyNetwork() throws UnknownHostException, Exception { + NetworkServerControl serverControl = + new NetworkServerControl(InetAddress.getByName(serverName), portNumber); + serverControl.start(new PrintWriter(System.out)); + for (int i = 1; i <= NUMBER_OF_PINGS; i++) { + try { + System.out.println("Attempt " + i + " to see if Derby Network server started"); + serverControl.ping(); + break; + } catch (Exception ex) { + if (i == NUMBER_OF_PINGS) { + System.out.println("Derby Network server failed to start"); + ex.printStackTrace(); + throw ex; + } + Thread.sleep(SLEEP_BETWEEN_PINGS); + } + } + } + + static public void stopDerbyNetwork() throws Exception { + NetworkServerControl serverControl = + new NetworkServerControl(InetAddress.getByName(serverName), portNumber); + serverControl.shutdown(); + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/database/InformixDatabase.java b/dev/fattest.simplicity/src/componenttest/topology/database/InformixDatabase.java new file mode 100755 index 000000000000..4aa98f35c0a2 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/database/InformixDatabase.java @@ -0,0 +1,271 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014, 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.database; + +import java.io.File; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.regex.Pattern; + +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; + +/** + * Informix database setup. + */ +public class InformixDatabase extends Database { + + private final static Class c = InformixDatabase.class; + private final static int INFORMIX_MAX_NAME_LENGTH = 8; + private final static String ifxSystemUser = "sysmaster"; + + private final String dbifxservername, IfxRunCmdFile; + private final String uniquifier; + + public InformixDatabase(Bootstrap bootstrap, Properties dbProps, String testBucketPath) throws Exception { + super(bootstrap, dbProps, testBucketPath); + + final String method = "InformixDatabase constructor"; + dbifxservername = dbProps.getProperty(BootstrapProperty.DB_IFXSERVERNAME.getPropertyName()); + + // build a file to pass to ifxcmd + if (dbname != null) { + uniquifier = dbname; + } else { + uniquifier = Long.toString(System.currentTimeMillis()); + } + String remoteMachineIfxTempPath; + if (databaseMachine.getOperatingSystem().equals(OperatingSystem.WINDOWS)) { + remoteMachineIfxTempPath = databaseMachine.getTempDir().getAbsolutePath(); + } else { + remoteMachineIfxTempPath = dbhome; + } + Log.finer(c, method, "database machine temp directory is: " + remoteMachineIfxTempPath); + String remoteMachineIfxSqlPath = remoteMachineIfxTempPath + + "/libertyfat/" + dbtype + "/" + dbversion + "/" + + uniquifier + "/" + + testBucketName + "/ifxsql/" + dbtype.toLowerCase() + "/"; + Log.finer(c, method, "Remote sql commands file path: " + remoteMachineIfxSqlPath); + RemoteFile destFile = new RemoteFile(databaseMachine, remoteMachineIfxSqlPath); + destFile.mkdirs(); + IfxRunCmdFile = remoteMachineIfxSqlPath + "runIFXCmd_" + uniquifier + ".sql"; + Log.finer(c, method, "IfxRunCmdFile: " + IfxRunCmdFile); + } + + @Override + protected void createVendorDatabase() throws Exception { + final String method = "createVendorDatabase"; + + if (dbname == null) { + String unused_name = get_unused_name(); + Log.info(c, method, "Attempt to create new database with name: " + unused_name); + createDatabase(unused_name); + // A new name is only created if the name is not provided in the bootstrapping.properties file. + // Set the new name in the bootstrapping.properties so test bucket can retrieve these values. + // Since the name was not provided, this means that the object should be dropped at the end + // of the test run. + dbname = unused_name; + bootstrap.setValue("database.name", dbname); + bootstrap.setValue("database.dropdatabase", "true"); + } else { + Log.info(c, method, "Use specified database name: " + dbname); + String db_dropandcreate = bootstrap.getValue(BootstrapProperty.DB_DROPANDCREATE.getPropertyName()); + Log.info(c, method, "Drop and create set to: " + db_dropandcreate); + boolean dropandcreate = db_dropandcreate == null + ? false : db_dropandcreate.equalsIgnoreCase("true") ? true : false; + Log.info(c, method, "Drop and create is: " + dropandcreate); + if (dropandcreate) { + Log.info(c, method, "Dropping and creating database"); + dropDatabase(dbname); + createDatabase(dbname); + } else { + Log.info(c, method, "Creating database"); + try { + createDatabase(dbname); + } catch (Exception e) { + // If the "database already exists" exception occurs, then go on + // otherwise throw the exception. + if (!e.getMessage().contains("330: Cannot create or rename the database")) { + throw e; + } + } + } + } + } + + @Override + protected void dropVendorDatabase() throws Exception { + final String method = "dropVendorDatabase"; + + String dbname = bootstrap.getValue(BootstrapProperty.DB_NAME.getPropertyName()); + Log.info(c, method, "Drop database " + dbname); + dropDatabase(dbname); + } + + @Override + protected void runVendorDDL(String testBucketDDLPath, String tempMachineDDLPath) throws Exception { + final String method = "runVendorDDL"; + + File bucketDir = new File(testBucketDDLPath); + File[] ddlFiles = bucketDir.listFiles(); + ProgramOutput result; + + String runDDLFile = tempMachineDDLPath + "tempRunDDL.sql"; + for (File ddlFile : ddlFiles) { + if (ddlFile.isFile()) { + Log.finer(c, method, "Local File Canonical Path is: " + ddlFile.getCanonicalPath()); + Log.info(c, method, "Remote File is: " + tempMachineDDLPath + ddlFile.getName()); + + String[] cmd = new String[10]; + int numcmdlines = 0; + // TODO this currently only works on Informix installed on Windows + // TODO only one user can own a table by the same name, so for now only + // the dbuser1 will have tables created for it + // build a file to pass to ifxcmd + cmd[numcmdlines++] = "echo \"" + "connect to '" + dbname + "' user '" + dbuser1 + "' using '" + dbuser1pwd + "';\" > " + runDDLFile; + cmd[numcmdlines++] = "cat \"" + tempMachineDDLPath + ddlFile.getName() + "\" >> " + runDDLFile; + cmd[numcmdlines++] = ifxcmd(ifxSystemUser, runDDLFile); + //cmd[numcmdlines++] = "echo \"" + "connect to '" + dbname + "' user '" + dbuser2 + "' using '" + dbuser2pwd + "';\" > " + runDDLFile; + //cmd[numcmdlines++] = "cat \"" + tempMachineDDLPath + ddlFile.getName() + "\" >> " + runDDLFile; + //cmd[numcmdlines++] = ifxcmd(ifxSystemUser, runDDLFile); + for (int i = 0; i < numcmdlines; i++) { + Log.finer(c, method, "execute informix ddl: " + cmd[i]); + result = databaseMachine.execute(cmd[i]); + // There really isn't a way to tell if this worked or not + // since DDL files often contain statements that can fail with no harm, + // for example DROP will fail if the object to be dropped has not yet been created. + // In case debugging is needed, displaying the message in stdout and stderr + // + // 310: Table (xxxxx) already exists in database. + // 206: The specified table (xxxxx) is not in the database. + if (result.getReturnCode() != 0 + && !result.getStderr().contains("310:") + && !result.getStderr().contains("206:")) { + Log.info(c, method, "ddl execute std out: " + result.getStdout()); + Log.info(c, method, "ddl execute std err: " + result.getStderr()); + } + } + } else { + Log.finer(c, method, "Local Directory Canonical Path is: " + ddlFile.getCanonicalPath()); + Log.finer(c, method, "Remote Directory Canonical Path is: " + tempMachineDDLPath + "/" + ddlFile.getName()); + runVendorDDL(ddlFile.getCanonicalPath(), tempMachineDDLPath + ddlFile.getName() + "/"); + } + } + } + + @Override + protected String[] existing_names() throws Exception { + final String method = "existing_names"; + Log.finer(c, method, "Return list of existing databases."); + + String[] cmd = new String[10]; + int numcmdlines = 0; + cmd[numcmdlines++] = "echo \"" + "select name from sysdatabases;" + "\" > " + IfxRunCmdFile; + cmd[numcmdlines++] = ifxcmd(ifxSystemUser, IfxRunCmdFile); + + ProgramOutput dbs_list = null; + for (int i = 0; i < numcmdlines; i++) { + Log.finer(c, method, "execute ifxsql: " + cmd[i]); + dbs_list = databaseMachine.execute(cmd[i]); + if (dbs_list.getReturnCode() != 0) { + Log.info(c, method, "ifx sql execute std out: " + dbs_list.getStdout()); + Log.info(c, method, "ifx sql execute std err: " + dbs_list.getStderr()); + throw new Exception("Was not able to obtain list of Informix database names"); + } + } + + int numdbs = 0; + String[] dbs = new String[MAX_NUMBER_NAMES]; + StringTokenizer st = new StringTokenizer(dbs_list.getStdout(), "\n"); + while (st.hasMoreTokens()) { + String line = st.nextToken().trim(); + if (line.toLowerCase().startsWith("name libr")) { + dbs[numdbs] = line.substring(6).toUpperCase(); + Log.info(c, method, "Add name to list of names: " + dbs[numdbs]); + numdbs++; + if (numdbs > MAX_NUMBER_NAMES) + throw new Exception("Exceeded maximum number of database names that can be created"); + } + } + return dbs; + } + + private void createDatabase(String dbname) throws Exception { + final String method = "createDatabase"; + Log.info(c, method, "Creating database " + dbname + " on " + dbhostname); + + if (dbname.length() > INFORMIX_MAX_NAME_LENGTH) + throw new Exception(DATABASE_NAME_LENGTH_EXCEEDED + INFORMIX_MAX_NAME_LENGTH + " characters or less"); + + int numcmdlines = 0; + String[] cmd = new String[10]; + + cmd[numcmdlines++] = "echo \"" + "CREATE DATABASE " + dbname + " WITH LOG;" + "\" > " + IfxRunCmdFile; + cmd[numcmdlines++] = ifxcmd(ifxSystemUser, IfxRunCmdFile); + cmd[numcmdlines++] = "echo \"" + "GRANT DBA TO " + dbuser1 + "," + dbuser2 + ";" + "\" > " + IfxRunCmdFile; + cmd[numcmdlines++] = ifxcmd(dbname, IfxRunCmdFile); + + for (int cmdline = 0; cmdline < numcmdlines; cmdline++) { + Log.finer(c, method, "execute line " + cmd[cmdline]); + ProgramOutput result = databaseMachine.execute(cmd[cmdline]); + if (result.getReturnCode() != 0) { + Log.info(c, method, "Create database returncode: " + result.getReturnCode()); + Log.info(c, method, "Create database stdout: " + result.getStdout()); + Log.info(c, method, "Create database stderr: " + result.getStderr()); + throw new Exception("Creation of database " + dbname + " failed with : " + result.getStderr()); + } + } + } + + private void dropDatabase(String dbname) throws Exception { + final String method = "dropDatabase"; + + int numcmdlines = 0; + String[] cmd = new String[10]; + + cmd[numcmdlines++] = "echo \"" + "DROP DATABASE " + dbname + ";\" > " + IfxRunCmdFile; + cmd[numcmdlines++] = ifxcmd(ifxSystemUser, IfxRunCmdFile); + + for (int cmdline = 0; cmdline < numcmdlines; cmdline++) { + Log.finer(c, method, "execute line " + cmd[cmdline]); + ProgramOutput result = databaseMachine.execute(cmd[cmdline]); + int rc = result.getReturnCode(); + if (rc != 0) { + Log.info(c, method, "Drop database returncode: " + rc); + Log.info(c, method, "Drop database stdout: " + result.getStdout()); + Log.info(c, method, "Drop database stderr: " + result.getStderr()); + throw new Exception("Dropping database " + dbname + " failed with return code " + rc + + " STDOUT: " + result.getStdout() + + " STDERR: " + result.getStderr()); + } + } + Log.info(c, method, "Dropped database " + dbname); + } + + private String ifxcmd(String conndb, String command) throws Exception { + final String method = "ifxcmd"; + // translate cygwin form of path to windows form + // cygwin path is passed in to be consistent with the other databases + String windowsPath = Pattern.compile("/cygdrive/c/").matcher(dbhome).replaceAll("c:/"); + Log.finer(c, method, "configured path: " + dbhome); + Log.finer(c, method, "windows path: " + windowsPath); + if (databaseMachine.getOperatingSystem().equals(OperatingSystem.WINDOWS)) + return "cmd /C \"" + windowsPath + "/" + dbifxservername + ".cmd && dbaccess " + conndb + " " + command + "\""; + else + return dbhome + "/" + dbifxservername + ".ksh && dbaccess " + conndb + " " + command; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/database/OracleDatabase.java b/dev/fattest.simplicity/src/componenttest/topology/database/OracleDatabase.java new file mode 100755 index 000000000000..3e8b8f7705cc --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/database/OracleDatabase.java @@ -0,0 +1,281 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014, 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.database; + +import java.io.File; +import java.util.Properties; +import java.util.StringTokenizer; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.config.ConfigElementList; +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import com.ibm.websphere.simplicity.config.Variable; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; +import componenttest.topology.impl.LibertyServer; + +/** + * Oracle database setup. + */ +public class OracleDatabase extends Database { + + private final static Class c = OracleDatabase.class; + private final static int NUM_USERS = 2; + + public OracleDatabase(Bootstrap bootstrap, Properties dbProps, String testBucketPath) throws Exception { + super(bootstrap, dbProps, testBucketPath); + } + + @Override + protected void createVendorDatabase() throws Exception { + final String method = "createVendorDatabase"; + + if ((dbuser1 != null && dbuser2 == null) || (dbuser1 == null && dbuser2 != null)) + throw new Exception("either specify both dbuser1 and dbuser2 or neither"); + + String[] dbuser_names = new String[NUM_USERS]; + String[] dbuser_passwords = new String[NUM_USERS]; + if (dbuser1 == null && dbuser2 == null) { + for (int i = 0; i < NUM_USERS; i++) { + dbuser_names[i] = get_unused_name(); + dbuser_passwords[i] = dbuser_names[i] + "PWD"; + Log.info(c, method, "Attempt to creating new schema with name: " + dbuser_names[i]); + createSchema(dbuser_names[i], dbuser_passwords[i]); + } + // A new name is only created if the name is not provided in the bootstrapping.properties file. + // Set the new name in the bootstrapping.properties so test bucket can retrieve these values. + // Since the name was not provided, this means that the object should be dropped at the end + // of the test run. + bootstrap.setValue("database.user1", dbuser_names[0]); + bootstrap.setValue("database.password1", dbuser_passwords[0]); + bootstrap.setValue("database.user2", dbuser_names[1]); + bootstrap.setValue("database.password2", dbuser_passwords[1]); + bootstrap.setValue("database.dropdatabase", "true"); + } else { + dbuser_names[0] = dbuser1; + dbuser_names[1] = dbuser2; + dbuser_passwords[0] = dbuser1pwd; + dbuser_passwords[1] = dbuser2pwd; + Log.info(c, method, "Use specified user name: " + dbuser_names[0]); + Log.info(c, method, "Use specified user name: " + dbuser_names[1]); + String db_dropandcreate = bootstrap.getValue(BootstrapProperty.DB_DROPANDCREATE.getPropertyName()); + Log.info(c, method, "Drop and create set to: " + db_dropandcreate); + boolean dropandcreate = db_dropandcreate == null + ? false : db_dropandcreate.equalsIgnoreCase("true") ? true : false; + Log.info(c, method, "Drop and create is: " + dropandcreate); + if (dropandcreate) { + Log.info(c, method, "Dropping and creating schemas"); + dropSchema(dbuser_names[0]); + dropSchema(dbuser_names[1]); + createSchema(dbuser_names[0], dbuser_passwords[0]); + createSchema(dbuser_names[1], dbuser_passwords[1]); + } else { + Log.info(c, method, "Creating schemas"); + for (int i = 0; i < NUM_USERS; i++) { + try { + createSchema(dbuser_names[i], dbuser_passwords[i]); + } catch (Exception e) { + // If the "schema already exists" exception occurs, then go on + // otherwise throw the exception. + // ORA-01920: user name 'LIBRxxxx' conflicts with another user or role name + if (!e.getMessage().contains("ORA-01920")) { + throw e; + } + } + } + } + } + } + + @Override + protected void dropVendorDatabase() throws Exception { + final String method = "dropVendorDatabase"; + + String dbuser_name1 = bootstrap.getValue(BootstrapProperty.DB_USER1.getPropertyName()); + Log.info(c, method, "Drop schema " + dbuser_name1); + dropSchema(dbuser_name1); + + String dbuser_name2 = bootstrap.getValue(BootstrapProperty.DB_USER2.getPropertyName()); + Log.info(c, method, "Drop schema " + dbuser_name2); + dropSchema(dbuser_name2); + } + + @Override + protected void runVendorDDL(String testBucketDDLPath, String tempMachineDDLPath) throws Exception { + final String method = "runVendorDDL"; + + File bucketDir = new File(testBucketDDLPath); + File[] ddlFiles = bucketDir.listFiles(); + ProgramOutput result; + + for (File ddlFile : ddlFiles) { + if (ddlFile.isFile()) { + Log.finer(c, method, "Local File Canonical Path is: " + ddlFile.getCanonicalPath()); + Log.info(c, method, "Remote File is: " + tempMachineDDLPath + ddlFile.getName()); + + Log.finer(c, method, "Execute " + ddlFile.getName() + " for user " + dbuser1); + String[] cmd = new String[10]; + int numcmdlines = 0; + cmd[numcmdlines++] = "sqlplus -L -S " + dbuser1 + "/" + dbuser1pwd + "@" + dbname + " @" + + tempMachineDDLPath + ddlFile.getName(); + cmd[numcmdlines++] = "sqlplus -L -S " + dbuser2 + "/" + dbuser2pwd + "@" + dbname + " @" + + tempMachineDDLPath + ddlFile.getName(); + for (int i = 0; i < numcmdlines; i++) { + Log.finer(c, method, "execute oracle ddl: " + cmd[i]); + result = databaseMachine.execute(cmd[i]); + // There really isn't a way to tell if this worked or not + // since DDL files often contain statements that can fail with no harm, + // for example DROP will fail if the object to be dropped has not yet been created. + // In case debugging is needed, displaying the message in stdout + // + // ORA-00942: table or view does not exist + if (result.getStdout().contains("ORA-") && !result.getStdout().contains("ORA-00942")) { + Log.info(c, method, "ddl execute command: " + result.getCommand()); + Log.info(c, method, "ddl execute std err: " + result.getStderr()); + Log.info(c, method, "ddl execute std out: " + result.getStdout()); + throw new Exception("ddl file: " + ddlFile + " failed to execute"); + } + } + } else { + Log.finer(c, method, "Local Directory Canonical Path is: " + ddlFile.getCanonicalPath()); + Log.finer(c, method, "Remote Directory Canonical Path is: " + tempMachineDDLPath + "/" + ddlFile.getName()); + runVendorDDL(ddlFile.getCanonicalPath(), tempMachineDDLPath + ddlFile.getName() + "/"); + } + } + } + + @Override + protected String[] existing_names() throws Exception { + final String method = "existing_names"; + Log.finer(c, method, "Return list of existing user names."); + + String OraUsersFile = "ora_users_libr_" + System.currentTimeMillis() + ".sql"; + + int numcmdlines = 0; + String[] cmd = new String[10]; + cmd[numcmdlines++] = "echo \"set head off\" > " + OraUsersFile; + cmd[numcmdlines++] = "echo \"select username from DBA_USERS where lower(username) like 'libr%' and lower(username) not in 'librdba';\" >> " + OraUsersFile; + cmd[numcmdlines++] = "echo \"exit;\" >> " + OraUsersFile; + for (int cmdline = 0; cmdline < numcmdlines; cmdline++) { + ProgramOutput pgmout = databaseMachine.execute(cmd[cmdline]); + if (pgmout.getReturnCode() != 0) { + Log.info(c, method, "echo std out: " + pgmout.getStdout()); + Log.info(c, method, "echo std err: " + pgmout.getStderr()); + throw new Exception("Was not able to obtain list of Oracle user names"); + } + } + + ProgramOutput db_users_list = databaseMachine.execute("sqlplus -L -S " + dbauser + "/" + dbapwd + "@" + dbname + " @" + OraUsersFile); + Log.info(c, method, "got list of existing users"); + if (db_users_list.getStdout().contains("ORA-")) + throw new Exception("Failed to get list of users"); + + int numusers = 0; + String[] dbusers = new String[MAX_NUMBER_NAMES]; + StringTokenizer st = new StringTokenizer(db_users_list.getStdout(), "\n"); + while (st.hasMoreTokens()) { + String line = st.nextToken(); + if (line.toLowerCase().startsWith("libr")) { + dbusers[numusers] = line.trim(); + Log.info(c, method, "Add name to list of names: " + dbusers[numusers]); + numusers++; + if (numusers > MAX_NUMBER_NAMES) + throw new Exception("Exceeded maximum number of user names that can be created"); + } + } + return dbusers; + } + + private void createSchema(String dbuser, String dbpwd) throws Exception { + final String method = "createSchema"; + Log.info(c, method, "Creating schema " + dbuser + " on " + dbhostname); + + String OraCreateFile = "create_" + dbuser + ".sql"; + + int numcmdlines = 0; + String[] cmd = new String[10]; + cmd[numcmdlines++] = "echo \"CREATE USER " + dbuser + " IDENTIFIED BY " + dbpwd + " DEFAULT TABLESPACE users QUOTA UNLIMITED ON users ACCOUNT UNLOCK;\" >" + + OraCreateFile; + cmd[numcmdlines++] = "echo \"Grant connect,resource,dba to " + dbuser + ";\" >> " + OraCreateFile; + cmd[numcmdlines++] = "echo \"exit;\" >> " + OraCreateFile; + cmd[numcmdlines++] = "sqlplus -L -S " + dbauser + "/" + dbapwd + "@" + dbname + " @" + OraCreateFile; + + for (int cmdline = 0; cmdline < numcmdlines; cmdline++) { + Log.finer(c, method, "execute line " + cmd[cmdline]); + ProgramOutput result = databaseMachine.execute(cmd[cmdline]); + // Oracle sqlplus command always returns zero for return code, so need to check the stdout + // Check the return code for the other commands + if (result.getStdout().contains("ORA-") || result.getReturnCode() != 0) { + Log.info(c, method, "Create schema returncode: " + result.getReturnCode()); + Log.info(c, method, "Create schema stdout: " + result.getStdout()); + Log.info(c, method, "Create schema stderr: " + result.getStderr()); + throw new Exception("Creation of schema " + dbname + " failed with : " + result.getStdout()); + } + } + } + + private void dropSchema(String dbuser_name) throws Exception { + final String method = "dropSchema"; + + String dbuser = dbuser_name; + String OraSessIdFile = "kill_dbuser_" + dbuser + ".sql"; + String OraDropTempFile = "drop_temp" + dbuser + ".sql"; + String OraDropFile = "drop_" + dbuser + ".sql"; + + int numcmdlines = 0; + String[] cmd = new String[10]; + cmd[numcmdlines++] = "echo \"select 'alter system kill session ''' || sid || ',' || serial# || ''';' from vDOLLARsession where lower(username) = lower('" + dbuser + + "');\" |sed 's/DOLLAR/$/g' >" + + OraSessIdFile; + cmd[numcmdlines++] = "echo \"exit; \" >> " + OraSessIdFile; + cmd[numcmdlines++] = "sqlplus -L -S " + dbauser + "/" + dbapwd + "@" + dbname + " @" + OraSessIdFile + " > " + OraDropTempFile; + cmd[numcmdlines++] = "cat " + OraDropTempFile + " | grep alter | grep system > " + OraDropFile; + cmd[numcmdlines++] = "echo \"drop user " + dbuser + " cascade;\" >> " + OraDropFile; + cmd[numcmdlines++] = "echo \"exit;\" >> " + OraDropFile; + cmd[numcmdlines++] = "sqlplus -L -S " + dbauser + "/" + dbapwd + "@" + dbname + " @" + OraDropFile; + + boolean showDroppedMsg = true; + for (int cmdline = 0; cmdline < numcmdlines; cmdline++) { + ProgramOutput result = databaseMachine.execute(cmd[cmdline]); + int rc = result.getReturnCode(); + // cat will fail if the user session did not exist, which is normally the case + if (rc != 0 && !cmd[cmdline].startsWith("cat ")) { + Log.info(c, method, "Drop schema returncode: " + rc); + Log.info(c, method, "Drop schema stdout: " + result.getStdout()); + Log.info(c, method, "Drop schema stderr: " + result.getStderr()); + throw new Exception("Dropping database " + dbname + " failed with return code " + rc + + " STDOUT: " + result.getStdout() + + " STDERR: " + result.getStderr()); + } + if (result.getStdout().toLowerCase().contains("does not exist")) { + Log.info(c, method, "Drop schema stdout: " + result.getStdout()); + showDroppedMsg = false; + } + } + if (showDroppedMsg) + Log.info(c, method, "Dropped schema " + dbuser_name); + } + + @Override + public void addConfigTo(LibertyServer server) throws Exception { + ServerConfiguration config = server.getServerConfiguration(); + ConfigElementList varList = config.getVariables(); + + addOrUpdate(varList, "jdbc.URL", "jdbc:oracle:thin:@//" + dbhostname + ':' + dbport + '/' + dbname); + addOrUpdate(varList, "jdbc.user", bootstrap.getValue("database.user1")); + addOrUpdate(varList, "jdbc.password", bootstrap.getValue("database.password1")); + + server.updateServerConfiguration(config); + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/database/SQLServerDatabase.java b/dev/fattest.simplicity/src/componenttest/topology/database/SQLServerDatabase.java new file mode 100755 index 000000000000..1ccfaaea667f --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/database/SQLServerDatabase.java @@ -0,0 +1,229 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014, 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.database; + +import java.io.File; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.regex.Pattern; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; + +/** + * SQLServer database setup. + */ +public class SQLServerDatabase extends Database { + + private final static Class c = SQLServerDatabase.class; + private final static int SQLSERVER_MAX_NAME_LENGTH = 8; + + public SQLServerDatabase(Bootstrap bootstrap, Properties dbProps, String testBucketPath) throws Exception { + super(bootstrap, dbProps, testBucketPath); + } + + @Override + protected void createVendorDatabase() throws Exception { + final String method = "createVendorDatabase"; + + if (dbname == null) { + String unused_name = get_unused_name(); + Log.info(c, method, "Attempt to create new database with name: " + unused_name); + createDatabase(unused_name); + // A new name is only created if the name is not provided in the bootstrapping.properties file. + // Set the new name in the bootstrapping.properties so test bucket can retrieve these values. + // Since the name was not provided, this means that the object should be dropped at the end + // of the test run. + dbname = unused_name; + bootstrap.setValue("database.name", dbname); + bootstrap.setValue("database.dropdatabase", "true"); + } else { + Log.info(c, method, "Use specified database name: " + dbname); + String db_dropandcreate = bootstrap.getValue(BootstrapProperty.DB_DROPANDCREATE.getPropertyName()); + Log.info(c, method, "Drop and create set to: " + db_dropandcreate); + boolean dropandcreate = db_dropandcreate == null + ? false : db_dropandcreate.equalsIgnoreCase("true") ? true : false; + Log.info(c, method, "Drop and create is: " + dropandcreate); + if (dropandcreate) { + Log.info(c, method, "Dropping and creating database"); + dropDatabase(dbname); + createDatabase(dbname); + } else { + Log.info(c, method, "Creating database"); + try { + createDatabase(dbname); + } catch (Exception e) { + // If the "database already exists" exception occurs, then go on + // otherwise throw the exception. + if (!e.getMessage().contains("Msg 1801")) { + throw e; + } + } + } + } + } + + @Override + protected void dropVendorDatabase() throws Exception { + final String method = "dropVendorDatabase"; + + String dbname = bootstrap.getValue(BootstrapProperty.DB_NAME.getPropertyName()); + Log.info(c, method, "Drop database " + dbname); + dropDatabase(dbname); + } + + @Override + protected void runVendorDDL(String testBucketDDLPath, String tempMachineDDLPath) throws Exception { + final String method = "runVendorDDL"; + + File bucketDir = new File(testBucketDDLPath); + File[] ddlFiles = bucketDir.listFiles(); + ProgramOutput result; + + for (File ddlFile : ddlFiles) { + if (ddlFile.isFile()) { + Log.finer(c, method, "Local File Canonical Path is: " + ddlFile.getCanonicalPath()); + Log.info(c, method, "Remote File is: " + tempMachineDDLPath + ddlFile.getName()); + String windowsPath = Pattern.compile("/").matcher(tempMachineDDLPath + ddlFile.getName()).replaceAll("\\\\\\\\"); + Log.finer(c, method, "windows path: " + windowsPath); + + String[] cmd = new String[2]; + int numcmdlines = 0; + cmd[numcmdlines++] = "sqlcmd -m-1 -b -d " + dbname + + " -U " + dbuser1 + " -P " + dbuser1pwd + + " -v schemaName=" + dbuser1 + + " -i " + windowsPath; + cmd[numcmdlines++] = "sqlcmd -m-1 -b -d " + dbname + + " -U " + dbuser2 + " -P " + dbuser2pwd + + " -v schemaName=" + dbuser2 + + " -i " + windowsPath; + + for (int i = 0; i < numcmdlines; i++) { + Log.finer(c, method, "execute sqlserver ddl: " + cmd[i]); + result = databaseMachine.execute(cmd[i]); + // There really isn't a way to tell if this worked or not + // since DDL files often contain statements that can fail with no harm, + // for example DROP will fail if the object to be dropped has not yet been created. + // In case debugging is needed, displaying the message in stdout + // + // Msg 3701, Level 11, State 5, Server xxxx, Line xxx + // Cannot drop the table 'xxx', because it does not exist or you do not have permission. + if (result.getReturnCode() != 0 + && !result.getStdout().contains("Msg 3701")) { + Log.info(c, method, "ddl execute std out: " + result.getStdout()); + Log.info(c, method, "ddl execute std err: " + result.getStderr()); + } + } + } else { + Log.finer(c, method, "Local Directory Canonical Path is: " + ddlFile.getCanonicalPath()); + Log.finer(c, method, "Remote Directory Canonical Path is: " + tempMachineDDLPath + "/" + ddlFile.getName()); + runVendorDDL(ddlFile.getCanonicalPath(), tempMachineDDLPath + ddlFile.getName() + "/"); + } + } + } + + @Override + protected String[] existing_names() throws Exception { + final String method = "existing_names"; + Log.finer(c, method, "Return list of existing databases."); + + String cmd = "sqlcmd -m-1 -b -Q \"select name from sys.databases\""; + + ProgramOutput dbs_list = databaseMachine.execute(cmd); + if (dbs_list.getReturnCode() != 0) { + Log.info(c, method, "sqlcmd std out: " + dbs_list.getStdout()); + Log.info(c, method, "sqlcmd std err: " + dbs_list.getStderr()); + throw new Exception("Was not able to obtain list of SQLServer database names"); + } + + int numdbs = 0; + String[] dbs = new String[MAX_NUMBER_NAMES]; + StringTokenizer st = new StringTokenizer(dbs_list.getStdout(), "\n"); + while (st.hasMoreTokens()) { + String line = st.nextToken().trim(); + if (line.toLowerCase().startsWith("libr")) { + dbs[numdbs] = line; + Log.info(c, method, "Add name to list of names: " + dbs[numdbs]); + numdbs++; + if (numdbs > MAX_NUMBER_NAMES) + throw new Exception("Exceeded maximum number of database names that can be created"); + } + } + return dbs; + } + + private void createDatabase(String dbname) throws Exception { + final String method = "createDatabase"; + Log.info(c, method, "Creating database " + dbname + " on " + dbhostname); + + if (dbname.length() > SQLSERVER_MAX_NAME_LENGTH) + throw new Exception(DATABASE_NAME_LENGTH_EXCEEDED + SQLSERVER_MAX_NAME_LENGTH + " characters or less"); + + int numcmdlines = 0; + String[] cmd = new String[10]; + + cmd[numcmdlines++] = "sqlcmd -m-1 -b -Q \"CREATE DATABASE " + dbname + "\""; + + cmd[numcmdlines++] = "sqlcmd -m-1 -b -Q \"use " + dbname + ";" + + "create user " + dbuser1 + " for login " + dbuser1 + ";" + + "grant alter to " + dbuser1 + ";" + + "grant control to " + dbuser1 + ";" + + "grant execute to " + dbuser1 + ";" + + "\""; + cmd[numcmdlines++] = "sqlcmd -m-1 -b -d " + dbname + " -Q \"create schema " + dbuser1 + "\""; + cmd[numcmdlines++] = "sqlcmd -m-1 -b -d " + dbname + " -Q \"alter user " + dbuser1 + + " with default_schema = " + dbuser1 + "\""; + + cmd[numcmdlines++] = "sqlcmd -m-1 -b -Q \"use " + dbname + ";" + + "create user " + dbuser2 + " for login " + dbuser2 + ";" + + "grant alter to " + dbuser2 + ";" + + "grant control to " + dbuser2 + ";" + + "grant execute to " + dbuser2 + ";" + + "\""; + cmd[numcmdlines++] = "sqlcmd -m-1 -b -d " + dbname + " -Q \"create schema " + dbuser2 + "\""; + cmd[numcmdlines++] = "sqlcmd -m-1 -b -d " + dbname + " -Q \"alter user " + dbuser2 + + " with default_schema = " + dbuser2 + "\""; + + for (int cmdline = 0; cmdline < numcmdlines; cmdline++) { + Log.finer(c, method, "execute line " + cmd[cmdline]); + ProgramOutput result = databaseMachine.execute(cmd[cmdline]); + if (result.getReturnCode() != 0) { + Log.info(c, method, "Create database returncode: " + result.getReturnCode()); + Log.info(c, method, "Create database stdout: " + result.getStdout()); + Log.info(c, method, "Create database stderr: " + result.getStderr()); + throw new Exception("Creation of database " + dbname + " failed with : " + result.getStdout()); + } + } + } + + private void dropDatabase(String dbname) throws Exception { + final String method = "dropDatabase"; + + String cmd = "sqlcmd -m-1 -b -Q \"DROP DATABASE " + dbname + "\""; + + ProgramOutput result = databaseMachine.execute(cmd); + int rc = result.getReturnCode(); + if (rc != 0) { + Log.info(c, method, "Drop database returncode: " + rc); + Log.info(c, method, "Drop database stdout: " + result.getStdout()); + Log.info(c, method, "Drop database stderr: " + result.getStderr()); + throw new Exception("Dropping database " + dbname + " failed with return code " + rc + + " STDOUT: " + result.getStdout() + + " STDERR: " + result.getStderr()); + } else { + Log.info(c, method, "Dropped database " + dbname); + } + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/database/SybaseDatabase.java b/dev/fattest.simplicity/src/componenttest/topology/database/SybaseDatabase.java new file mode 100755 index 000000000000..2cc8303000b3 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/database/SybaseDatabase.java @@ -0,0 +1,226 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014, 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.database; + +import java.io.File; +import java.util.Properties; +import java.util.StringTokenizer; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.BootstrapProperty; + +/** + * Sybase database setup. + */ +public class SybaseDatabase extends Database { + + private final static Class c = SybaseDatabase.class; + private final static int SYBASE_MAX_NAME_LENGTH = 8; + private final static int dbsize = 100; + private final static int logsize = 400; + + public SybaseDatabase(Bootstrap bootstrap, Properties dbProps, String testBucketPath) throws Exception { + super(bootstrap, dbProps, testBucketPath); + } + + @Override + protected void createVendorDatabase() throws Exception { + final String method = "createVendorDatabase"; + + if (dbname == null) { + String unused_name = get_unused_name(); + Log.info(c, method, "Attempt to create new database with name: " + unused_name); + createDatabase(unused_name); + // A new name is only created if the name is not provided in the bootstrapping.properties file. + // Set the new name in the bootstrapping.properties so test bucket can retrieve these values. + // Since the name was not provided, this means that the object should be dropped at the end + // of the test run. + dbname = unused_name; + bootstrap.setValue("database.name", dbname); + bootstrap.setValue("database.dropdatabase", "true"); + } else { + Log.info(c, method, "Use specified database name: " + dbname); + String db_dropandcreate = bootstrap.getValue(BootstrapProperty.DB_DROPANDCREATE.getPropertyName()); + Log.info(c, method, "Drop and create set to: " + db_dropandcreate); + boolean dropandcreate = db_dropandcreate == null + ? false : db_dropandcreate.equalsIgnoreCase("true") ? true : false; + Log.info(c, method, "Drop and create is: " + dropandcreate); + if (dropandcreate) { + Log.info(c, method, "Dropping and creating database"); + dropDatabase(dbname); + createDatabase(dbname); + } else { + Log.info(c, method, "Creating database"); + try { + createDatabase(dbname); + } catch (Exception e) { + // If the "database already exists" exception occurs, then go on + // otherwise throw the exception. + if (!e.getMessage().contains("Msg 1801")) { + throw e; + } + } + } + } + } + + @Override + protected void dropVendorDatabase() throws Exception { + final String method = "dropVendorDatabase"; + + String dbname = bootstrap.getValue(BootstrapProperty.DB_NAME.getPropertyName()); + Log.info(c, method, "Drop database " + dbname); + dropDatabase(dbname); + } + + @Override + protected void runVendorDDL(String testBucketDDLPath, String tempMachineDDLPath) throws Exception { + final String method = "runVendorDDL"; + + File bucketDir = new File(testBucketDDLPath); + File[] ddlFiles = bucketDir.listFiles(); + ProgramOutput result; + + for (File ddlFile : ddlFiles) { + if (ddlFile.isFile()) { + Log.finer(c, method, "Local File Canonical Path is: " + ddlFile.getCanonicalPath()); + Log.info(c, method, "Remote File is: " + tempMachineDDLPath + ddlFile.getName()); + + // TODO This needs to be done for both user IDs, but the tables are being created under "dbo". + // Trying to create tables under the user id fails, looks like this has to be done + // using the admin user id and the owner must be specified as part of the table create. + String cmd = "$SYBASE/$SYBASE_OCS/bin/isql -D " + dbname + " -U " + dbauser + " -P " + dbapwd + + " -i " + tempMachineDDLPath + ddlFile.getName(); + Log.finer(c, method, "execute sybase ddl: " + cmd); + result = databaseMachine.execute(cmd); + // There really isn't a way to tell if this worked or not + // since DDL files often contain statements that can fail with no harm, + // for example DROP will fail if the object to be dropped has not yet been created. + // In case debugging is needed, displaying the message in stdout + // + // Msg 3701, Level 11, State 1 + // Server 'MOONDB00', Line 1 + // Cannot drop the table 'MYJOBINSTANCEDATA4', because it doesn't exist in the + // system catalogs. + if (result.getReturnCode() != 0 + && !result.getStderr().contains("Msg 3701")) { + Log.info(c, method, "ddl execute std out: " + result.getStdout()); + Log.info(c, method, "ddl execute std err: " + result.getStderr()); + } + } else { + Log.finer(c, method, "Local Directory Canonical Path is: " + ddlFile.getCanonicalPath()); + Log.finer(c, method, "Remote Directory Canonical Path is: " + tempMachineDDLPath + "/" + ddlFile.getName()); + runVendorDDL(ddlFile.getCanonicalPath(), tempMachineDDLPath + ddlFile.getName() + "/"); + } + } + } + + @Override + protected String[] existing_names() throws Exception { + final String method = "existing_names"; + Log.finer(c, method, "Return list of existing databases."); + + String cmd = sybcmd(null, "'sp_helpdb'"); + + ProgramOutput dbs_list = databaseMachine.execute(cmd); + if (dbs_list.getReturnCode() != 0) { + Log.info(c, method, "sqsh std out: " + dbs_list.getStdout()); + Log.info(c, method, "sqsh std err: " + dbs_list.getStderr()); + throw new Exception("Was not able to obtain list of Sybase database names"); + } + + int numdbs = 0; + String[] dbs = new String[MAX_NUMBER_NAMES]; + StringTokenizer st = new StringTokenizer(dbs_list.getStdout(), "\n"); + while (st.hasMoreTokens()) { + String line = st.nextToken().trim(); + if (line.toLowerCase().startsWith("libr")) { + dbs[numdbs] = line.substring(0, 8); + Log.info(c, method, "Add name to list of names: " + dbs[numdbs]); + numdbs++; + if (numdbs > MAX_NUMBER_NAMES) + throw new Exception("Exceeded maximum number of database names that can be created"); + } + } + return dbs; + } + + private void createDatabase(String dbname) throws Exception { + final String method = "createDatabase"; + Log.info(c, method, "Creating database " + dbname + " on " + dbhostname); + + if (dbname.length() > SYBASE_MAX_NAME_LENGTH) + throw new Exception(DATABASE_NAME_LENGTH_EXCEEDED + SYBASE_MAX_NAME_LENGTH + " characters or less"); + + int numcmdlines = 0; + String[] cmd = new String[20]; + + cmd[numcmdlines++] = sybcmd(null, "'CREATE DATABASE " + dbname + " on fvt = " + dbsize + " log on fvtlog = " + logsize + "'"); + cmd[numcmdlines++] = sybcmd(dbname, "'sp_adduser " + dbuser1 + "'"); + cmd[numcmdlines++] = sybcmd(dbname, "'sp_adduser " + dbuser2 + "'"); + cmd[numcmdlines++] = sybcmd(dbname, "'sp_adduser jpaschema" + "'"); + cmd[numcmdlines++] = sybcmd(dbname, "'sp_adduser XMLSchName" + "'"); + cmd[numcmdlines++] = sybcmd(dbname, "'sp_adduser DefSchema" + "'"); + cmd[numcmdlines++] = sybcmd(null, "'sp_modifylogin " + dbuser1 + ", defdb, " + dbname + "'"); + cmd[numcmdlines++] = sybcmd(null, "'sp_modifylogin " + dbuser2 + ", defdb, " + dbname + "'"); + cmd[numcmdlines++] = sybcmd(dbname, "'grant all to " + dbuser1 + "'"); + cmd[numcmdlines++] = sybcmd(dbname, "'grant all to " + dbuser2 + "'"); + cmd[numcmdlines++] = sybcmd(dbname, "\"sp_role 'grant', dtm_tm_role, " + dbuser1 + "\""); + cmd[numcmdlines++] = sybcmd(dbname, "\"sp_role 'grant', dtm_tm_role, " + dbuser2 + "\""); + cmd[numcmdlines++] = sybcmd(dbname, "\"sp_role 'grant', sa_role, " + dbuser1 + "\""); + cmd[numcmdlines++] = sybcmd(dbname, "\"sp_role 'grant', sa_role, " + dbuser2 + "\""); + cmd[numcmdlines++] = sybcmd(null, "\"sp_dboption " + dbname + ", 'ddl in tran',true\""); + + for (int cmdline = 0; cmdline < numcmdlines; cmdline++) { + Log.finer(c, method, "execute line " + cmd[cmdline]); + ProgramOutput result = databaseMachine.execute(cmd[cmdline]); + if (result.getReturnCode() != 0) { + Log.info(c, method, "Create database returncode: " + result.getReturnCode()); + Log.info(c, method, "Create database stdout: " + result.getStdout()); + Log.info(c, method, "Create database stderr: " + result.getStderr()); + throw new Exception("Creation of database " + dbname + " failed with : " + result.getStderr()); + } + } + } + + private void dropDatabase(String dbname) throws Exception { + final String method = "dropDatabase"; + + String cmd = sybcmd(null, "'DROP DATABASE " + dbname + "'"); + + ProgramOutput result = databaseMachine.execute(cmd); + int rc = result.getReturnCode(); + if (rc != 0) { + Log.info(c, method, "Drop database returncode: " + rc); + Log.info(c, method, "Drop database stdout: " + result.getStdout()); + Log.info(c, method, "Drop database stderr: " + result.getStderr()); + throw new Exception("Dropping database " + dbname + " failed with return code " + rc + + " STDOUT: " + result.getStdout() + + " STDERR: " + result.getStderr()); + } else { + Log.info(c, method, "Dropped database " + dbname); + } + } + + /* + * sqsh command is used in Moonstone. It is an open source alternative to isql. + */ + private String sybcmd(String conndb, String command) throws Exception { + if (conndb != null) + return "sqsh -D " + conndb + " -U " + dbauser + " -P " + dbapwd + " -w 2047 -C " + command; + else + return "sqsh -U " + dbauser + " -P " + dbapwd + " -w 2047 -C " + command; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/CountingInputStream.java b/dev/fattest.simplicity/src/componenttest/topology/impl/CountingInputStream.java new file mode 100755 index 000000000000..3eb80220d94f --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/CountingInputStream.java @@ -0,0 +1,53 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import java.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; + +class CountingInputStream extends FilterInputStream { + private long count; + + CountingInputStream(InputStream in) { + super(in); + } + + public long count() { + return count; + } + + @Override + public int read() throws IOException { + int c = in.read(); + count++; + return c; + } + + @Override + public int read(byte[] b, int off, int len) throws IOException { + int read = in.read(b, off, len); + if (read > 0) { + count += read; + } + return read; + } + + @Override + public long skip(long n) throws IOException { + long skipped = in.skip(n); + if (skipped > 0) { + count += skipped; + } + return skipped; + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/JavaInfo.java b/dev/fattest.simplicity/src/componenttest/topology/impl/JavaInfo.java new file mode 100644 index 000000000000..4c0364eeb95c --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/JavaInfo.java @@ -0,0 +1,121 @@ +package componenttest.topology.impl; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * A class used for identifying properties of a JDK other + * than the one that is currently being run. + */ +public class JavaInfo { + private static Class c = JavaInfo.class; + private static Map cache = new HashMap(); + + /** + * Get the JavaInfo for a given JDK path + * + * @param jdkPath The jdk path. For example: System.getProperty("java.home") + */ + public static JavaInfo fromPath(String jdkPath) throws IOException { + JavaInfo info = cache.get(jdkPath); + if (info == null) { + info = runJavaVersion(jdkPath); + cache.put(jdkPath, info); + } + return info; + } + + /** + * Get the JavaInfo for the JDK that will be used for a given LibertyServer. + * The priority is determined in the following way: + *
      + *
    1. ${server.config.dir}/server.env + *
    2. ${wlp.install.dir}/etc/server.env + *
    3. JAVA_HOME of the system + *
    + */ + public static JavaInfo forServer(LibertyServer server) throws IOException { + String serverJava = server.getServerEnv().getProperty("JAVA_HOME"); + return fromPath(serverJava); + } + + public static enum Vendor { + IBM, + ORACLE + } + + final String JAVA_HOME; + final int MAJOR; + final int MINOR; + final Vendor VENDOR; + + private JavaInfo(String jdk_home, int major, int minor, Vendor v) { + JAVA_HOME = jdk_home; + MAJOR = major; + MINOR = minor; + VENDOR = v; + } + + public int majorVersion() { + return MAJOR; + } + + public int minorVersion() { + return MINOR; + } + + public Vendor vendor() { + return VENDOR; + } + + private static JavaInfo runJavaVersion(String javaHome) throws IOException { + final String m = "runJavaVersion"; + // output for 'java -version' is always as follows: + // line 1: java version "1.MAJOR.MINOR" + // line 2: build info + // line 3: vendor info + ProcessBuilder pb = new ProcessBuilder(javaHome + "/bin/java", "-version"); + Process p = pb.start(); + try { + p.waitFor(); + } catch (InterruptedException e) { + } + InputStreamReader isr = new InputStreamReader(p.getErrorStream()); + BufferedReader br = new BufferedReader(isr); + String versionInfo = br.readLine(); // 1st line has version info + br.readLine(); // ignore 2nd line + String vendorInfo = br.readLine(); + br.close(); + isr.close(); + + Log.info(c, m, versionInfo); + Log.info(c, m, vendorInfo); + + // Parse vendor + Vendor v = vendorInfo.toLowerCase().contains("ibm") ? Vendor.IBM : Vendor.ORACLE; + + // Parse major/minor versions + versionInfo = versionInfo.substring(versionInfo.indexOf('"') + 1, versionInfo.lastIndexOf('"')); + String[] versions = versionInfo.split("[^0-9]"); // split on non-numeric chars + System.out.println(Arrays.toString(versions)); + + // Offset for 1.MAJOR.MINOR vs. MAJOR.MINOR version syntax + int offset = "1".equals(versions[0]) ? 1 : 0; + if (versions.length <= offset) + throw new IllegalStateException("Bad Java runtime version string: " + versionInfo); + int major = Integer.parseInt(versions[offset]); + int minor = versions.length < (2 + offset) ? 0 : Integer.parseInt(versions[(1 + offset)]); + return new JavaInfo(javaHome, major, minor, v); + } + + @Override + public String toString() { + return "major=" + MAJOR + " minor=" + MINOR + " vendor=" + VENDOR + " javaHome=" + JAVA_HOME; + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyClient.java b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyClient.java new file mode 100755 index 000000000000..405b0264f142 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyClient.java @@ -0,0 +1,4096 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2015 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import static org.junit.Assert.assertNotNull; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.Writer; +import java.nio.charset.Charset; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Scanner; +import java.util.Set; +import java.util.TreeSet; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Pattern; + +import com.ibm.websphere.simplicity.ConnectionInfo; +import com.ibm.websphere.simplicity.LocalFile; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.PortType; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.application.ApplicationManager; +import com.ibm.websphere.simplicity.application.ApplicationType; +import com.ibm.websphere.simplicity.config.ClientConfiguration; +import com.ibm.websphere.simplicity.config.ClientConfigurationFactory; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.websphere.soe_reporting.SOEHttpPostUtil; +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.LocalMachine; +import componenttest.exception.TopologyException; +import componenttest.topology.impl.LibertyFileManager.LogSearchResult; +import componenttest.topology.utils.LibertyServerUtils; + +public class LibertyClient { + protected static final Class c = LibertyClient.class; + protected static final String CLASS_NAME = c.getName(); + protected static Logger LOG = Logger.getLogger(CLASS_NAME); // why don't we always use the Logger directly? + /** How frequently we poll the logs when waiting for something to happen */ + protected static final int WAIT_INCREMENT = 300; + + protected static final String DEBUGGING_PORT = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("debugging.port"); + } + }); + + protected static final boolean DEFAULT_PRE_CLEAN = true; + + protected static final boolean DEFAULT_CLEANSTART = Boolean.parseBoolean(AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + // Default is true if not set. + return System.getProperty("default.clean.start", "true"); + } + })); + + protected static final boolean DEFAULT_VALIDATE_APPS = true; + public static boolean VALIDATE_APPS = DEFAULT_VALIDATE_APPS; + + protected static final String JAVA_VERSION = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("java.version"); + } + }); + + protected static final boolean JAVA_VERSION_6 = JAVA_VERSION.startsWith("1.6."); + + protected static final boolean J9_JVM_RUN = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + boolean b; + String vm = System.getProperty("java.vm.name"); + Log.info(c, "", "java.vm.name=" + vm); + b = vm != null && vm.contains("J9"); + Log.info(c, "", "J9_JVM_RUN=" + b); + return b; + } + }); + + protected static final boolean HOTSPOT_JVM_RUN = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + String hotspotString = System.getProperty("fat.on.hotspot"); + boolean hotspot; + if (hotspotString != null) { + Log.info(c, "", "fat.on.hotspot=" + hotspotString); + hotspot = Boolean.parseBoolean(hotspotString); + } else { + String vm = System.getProperty("java.vm.name"); + Log.info(c, "", "java.vm.name=" + vm); + hotspot = vm.contains("HotSpot"); + } + + Log.info(c, "", "HOTSPOT_JVM_RUN=" + hotspot); + return hotspot; + } + }); + + protected static final String MAC_RUN = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("fat.on.mac"); + } + }); + protected static final String GLOBAL_TRACE = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + String prop = System.getProperty("global.trace.spec"); + return prop == null ? "" : prop.trim(); + } + }); + + protected static final boolean GLOBAL_JAVA2SECURITY = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + String prop = System.getProperty("global.java2.sec"); + boolean java2security = false; + if (prop != null) { + Log.info(c, "", "global.java2.sec=" + prop); + java2security = Boolean.parseBoolean(prop); + } + Log.info(c, "", "GLOBAL_JAVA2SECURITY=" + java2security); + return java2security; + } + }); + + protected static final String GLOBAL_JVM_ARGS = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + String prop = System.getProperty("global.jvm.args"); + return prop == null ? "" : prop.trim(); + } + }); + protected static final String TMP_DIR = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("java.io.tmpdir"); + } + }); + + protected static final boolean DO_COVERAGE = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + String fatCoverageString = System.getProperty("test.coverage"); + boolean fatcoverage = false; + if (fatCoverageString != null) { + Log.info(c, "", "test.coverage=" + fatCoverageString); + fatcoverage = Boolean.parseBoolean(fatCoverageString); + } + Log.info(c, "", "DO_COVERAGE=" + fatcoverage); + return fatcoverage; + } + }); + + protected static final String JAVA_AGENT_FOR_JACOCO = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + String agent = System.getProperty("javaagent.for.jacoco"); + Log.info(c, "", "JAVA_AGENT_FOR_JACOCO=" + agent); + return agent; + } + }); + + protected static final String RELEASE_MICRO_VERSION = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + String micro = System.getProperty("micro.version"); + Log.info(c, "", "RELEASE_MICRO_VERSION=" + micro); + return micro; + } + }); + + protected static final int CLIENT_START_TIMEOUT = 30 * 1000; + protected static final int CLIENT_STOP_TIMEOUT = 30 * 1000; + + // Increasing this from 50 seconds to 120 seconds to account for poorly performing code; + // this timeout should only pop in the event of an unexpected failure of apps to start. + protected static final int LOG_SEARCH_TIMEOUT = 120 * 1000; + + protected ApplicationManager appmgr; + + protected List installedApplications; + + protected static final String DEFAULT_CLIENT = "defaultClient"; + + protected static final String DEFAULT_MSG_FILE = "messages.log"; + protected static final String DEFAULT_CONSOLE_FILE = "console.log"; + + protected static final String DEFAULT_TRACE_FILE_PREFIX = "trace"; + + protected static final String CLIENT_CONFIG_FILE_NAME = "client.xml"; + protected static final String JVM_OPTIONS_FILE_NAME = "client.jvm.options"; + + protected static final String EBCDIC_CHARSET_NAME = "IBM1047"; + + protected volatile boolean isStarted = false; + protected volatile boolean isStopped = false; + protected boolean isStartedConsoleLogLevelOff = false; + + protected int osgiConsolePort = 5678; // The port number of the OSGi Console + + // Use port 0 if the property can't be found, these should be picked up from a properties file + // if not then the test may create a liberty client and get the ports from a bootstrap port. + // If neither way obtains a port then port 0 will be used which will cause the tests to fail in + // an obvious way (rather than using a port which looks like it might be right, but isn't, e.g. 8000) + + protected int iiopDefaultPort = Integer.parseInt(System.getProperty("IIOP.client")); + + protected String installRoot; // The root of the Liberty Install + protected String userDir; // The WLP_USER_DIR for this client + + protected String policyFilePath; // Location of the kernel policy file + + protected String installRootParent; // The parent directory of the Liberty Install + + protected final AtomicBoolean checkForRestConnector = new AtomicBoolean(false); + + // used by the saveClientConfiguration / restoreClientConfiguration methods to save the current client + // configuration at a specific point in time and then be able to restore it back in the future + protected RemoteFile savedClientXml = null; + + public final static String DISABLE_FAILURE_CHECKING = "DISABLE_CHECKING"; + + /** + * @return the installRoot + */ + public String getInstallRoot() { + return installRoot; + } + + /** + * @return the release micro version + */ + public String getMicroVersion() { + return RELEASE_MICRO_VERSION; + } + + public String getMicroSuffix() { + return "." + RELEASE_MICRO_VERSION; + } + + /** + * Returns the value of WLP_USER_DIR for the client. + * + * @return + */ + public String getUserDir() { + return userDir; + } + + protected String clientRoot; // The root of the client for Liberty + protected String clientOutputRoot; // The output root of the client + protected String logsRoot; // The root of the Logs Files + + protected long lastConfigUpdate = 0; // Time stamp (in millis) of the last configuration update + + protected String relativeLogsRoot = "/logs/"; // this will be appended to logsRoot in setUp + protected String consoleFileName = DEFAULT_CONSOLE_FILE; // Console log file name + protected String messageFileName = DEFAULT_MSG_FILE; // Messages log file name (optionally changed by the FAT) + protected String messageAbsPath = null; + protected String consoleAbsPath = null; + + protected String machineJava; // Path to Java 6 JDK on the Machine + + protected String machineJarPath; //Path to the jar command + + protected Machine machine; // Machine the client is on + + protected String clientToUse; // the client to use + + //An ID given to the client topology that will be used as a reference e.g. JPAFATTestClient + protected String clientTopologyID; + + protected OperatingSystem machineOS; + + //These aren't final as we have to massage them if they are used for tWAS FAT suites + public String pathToAutoFVTTestFiles = "lib/LibertyFATTestFiles/"; + protected String pathToAutoFVTOutputClientsFolder = "output/clients"; + protected String pathToAutoFVTOutputFolder = "output/"; + + protected final String PATH_TO_AUTOFVT_CLIENTS = "publish/clients/"; + protected static final String PATH_TO_AUTOFVT_SHARED = "publish/shared/"; + //Only need this at the moment as we only support single Liberty Clients + protected String pathToAutoFVTNamedClient = PATH_TO_AUTOFVT_CLIENTS; + + protected long clientStartTimeout = CLIENT_START_TIMEOUT; + protected long clientStopTimeout = CLIENT_STOP_TIMEOUT; + + protected final AtomicInteger stopApplicationMessages = new AtomicInteger(0); + protected final AtomicInteger startApplicationMessages = new AtomicInteger(0); + + public String getPathToAutoFVTNamedClient() { + return pathToAutoFVTNamedClient; + } + + protected List originalFeatureSet = null; + + //Used for keeping track of offset positions of log files + protected final HashMap logOffsets = new HashMap(); + + //Used for keeping track of mark positions of log files + protected final HashMap logMarks = new HashMap(); + + protected boolean clientCleanupProblem = false; + + /** When we stopped searching for a string in the logs. */ + public long searchStopTime; + + protected String logStamp; + + //List of patterns to ignore when checking logs + protected List ignorePatterns; + + //Default list of patterns to ignore when checking logs + protected List fixedIgnoreErrorsList; + + protected boolean checkingDisabled; + + //list of servers exempt from log error and failure checking + protected HashMap clientsExemptFromChecking = null; + + protected Set clientsExemptFromJava2SecurityTesting = null; + + /** + * @param clientCleanupProblem the clientCleanupProblem to set + */ + public void setClientCleanupProblem(boolean clientCleanupProblem) { + this.clientCleanupProblem = clientCleanupProblem; + } + + public Machine getMachine() { + return machine; + } + + /** + * Protected - This constructor is protected as users should use the + * LibertyClientFactory's static methods to get LibertyClient instances. + * + * @param clientName The name of the client that is going to used + * @throws Exception + */ + protected LibertyClient(String clientName, Bootstrap b) throws Exception { + final String method = "setup"; + Log.entering(c, method); + clientTopologyID = b.getValue("clientTopologyID"); + String hostName = b.getValue("hostName"); + String user = b.getValue(hostName + ".user"); + String password = b.getValue(hostName + ".password"); + machineJava = b.getValue(hostName + ".JavaHome"); + String keystore = b.getValue("keystore"); + checkingDisabled = false; + fixedIgnoreErrorsList = new ArrayList(); + + if (clientName != null) { + clientToUse = clientName; + pathToAutoFVTNamedClient += clientToUse + "/"; + } else { + clientToUse = b.getValue("clientName"); + if (clientToUse == null || clientToUse.trim().equals("")) { + clientToUse = DEFAULT_CLIENT; + } + } + + // This is the only case where we will allow the messages.log name to be changed + // by the fat framework -- because we want to look at messasges.log for start/stop/blah + // messags, we shouldn't be pointing it all over everywhere else. For those FAT tests + // that need a messages file in an alternate location, they should set the corresponding + // com.ibm.ws.logging.message.file.name property in bootstrap.properties + String nonDefaultLogFile = b.getValue("NonDefaultConsoleLogFileName"); + if (nonDefaultLogFile != null && nonDefaultLogFile.startsWith("CLIENT_NAME/")) { + relativeLogsRoot = "/logs/" + clientToUse + "/"; + messageFileName = nonDefaultLogFile.substring(12); + } else { + relativeLogsRoot = "/logs/"; + messageFileName = DEFAULT_MSG_FILE; + } + + try { + osgiConsolePort = Integer.parseInt(b.getValue("osgi.console")); + } catch (Exception e) { + Log.debug(c, "No osgi.console set in bootstrap.properties. Will use default value: " + + osgiConsolePort); + } + + try { + iiopDefaultPort = Integer.parseInt(b.getValue("IIOP.client")); + } catch (Exception e) { + Log.debug(c, "No iiop.Default.Port set in bootstrap.properties. Will use default value: " + + iiopDefaultPort); + } + + if (machineJava == null) { + throw new IllegalArgumentException("No " + hostName + + ".JavaHome was set in " + b); + } + installRoot = b.getValue("libertyInstallPath"); + if (installRoot == null) { + throw new IllegalArgumentException("No installRoot was set in " + b); + } + + Log.info(c, method, + "getting Machine from credentials in Boostrapping file"); + Log.info(c, method, "Connecting to machine " + hostName + " with User " + + user + "."); + ConnectionInfo machineDetails = new ConnectionInfo(hostName, user, password); + if ((password == null || password.length() == 0) && keystore != null && keystore.length() != 0) { + File keyfile = new File(keystore); + machineDetails = new ConnectionInfo(hostName, keyfile, user, password); + } + machine = Machine.getMachine(machineDetails); + setup(); + + // Populate the fixed set error and warning messages to be ignored for those + // buckets that choose to care about error or warning messages when the client + // is stopped. + populateFixedListOfMessagesToIgnore(); + + Log.exiting(c, method); + } + + //This isn't that elegant but it works + //If this is a tWAS FAT suite the relative path to the autoFVT folder + //is different so we need to check and set variables to the autoFVT/output folder + //and autoFVT/lib/testFiles accordingly + protected void massageAutoFVTAbsolutePath() throws Exception { + final String METHOD = "massageAutoFVTAbsolutePath"; + Log.entering(c, METHOD); + + //Firstly see if the TestBuild.xml file exists + LocalFile testBuildFile = new LocalFile("TestBuild.xml"); + //If the file doesn't exist it is a tWAS FAT Suite and so need to update some vars + if (!!!testBuildFile.exists()) { + Properties localProps = new Properties(); + FileInputStream in = new FileInputStream(System.getProperty("local.properties")); + localProps.load(in); + in.close(); + + String bucketsDir = localProps.getProperty("buckets.dir"); + pathToAutoFVTTestFiles = bucketsDir + "/" + pathToAutoFVTTestFiles; + pathToAutoFVTNamedClient = bucketsDir + "/" + pathToAutoFVTNamedClient; + pathToAutoFVTOutputClientsFolder = bucketsDir + "/" + "output/clients"; + pathToAutoFVTOutputFolder = bucketsDir + "/output"; + + Log.info(c, METHOD, "This seems to be a tWAS FAT suite so updating the path to the" + + "AutoFVTTestFiles to " + pathToAutoFVTTestFiles + " and the testOutputFolder to " + + pathToAutoFVTOutputClientsFolder + " and the path to the AutoFVTNamedClient to " + + pathToAutoFVTNamedClient); + } + Log.exiting(c, METHOD); + } + + protected void setup() throws Exception { + installedApplications = new ArrayList(); + machine.connect(); + machine.setWorkDir(installRoot); + if (this.clientToUse == null) { + this.clientToUse = DEFAULT_CLIENT; + } + this.installRoot = LibertyServerUtils.makeJavaCompatible(installRoot); + this.userDir = installRoot + "/usr"; + this.clientRoot = installRoot + "/usr/clients/" + clientToUse; + this.clientOutputRoot = this.clientRoot; + this.logsRoot = clientOutputRoot + relativeLogsRoot; + this.messageAbsPath = logsRoot + messageFileName; + this.policyFilePath = installRoot + "/../../com.ibm.ws.kernel.boot/resources/security.policy"; + + File installRootfile = new File(this.installRoot); + this.installRootParent = installRootfile.getParent(); + + // Now it sets all OS specific stuff + machineOS = machine.getOperatingSystem(); + this.machineJava = LibertyServerUtils.makeJavaCompatible(machineJava); + Log.info(c, "setup", "Successfully obtained machine. Operating System is: " + machineOS.name()); + // Continues with setup, we now validate the Java used is a JDK by looking for java and jar files + String jar = "jar"; + String java = "java"; + if (machineOS == OperatingSystem.WINDOWS) { + jar += ".exe"; + java += ".exe"; + } + RemoteFile testJar = new RemoteFile(machine, machineJava + "/bin/" + jar); + RemoteFile testJava = new RemoteFile(machine, machineJava + "/bin/" + java); + machineJarPath = testJar.getAbsolutePath(); + if (!!!testJar.exists()) { + //if we come in here we might be pointing at a JRE instead of a JDK so we'll go up a level in hope it's there + testJar = new RemoteFile(machine, machineJava + "/../bin/" + jar); + machineJarPath = testJar.getAbsolutePath(); + if (!!!testJar.exists()) { + throw new TopologyException("cannot find a " + jar + " file in " + machineJava + "/bin. Please ensure you have set the machine javaHome to point to a JDK"); + } else { + Log.info(c, "setup", "Jar Home now set to: " + machineJarPath); + } + } + if (!!!testJava.exists()) + throw new TopologyException("cannot find a " + java + " file in " + machineJava + "/bin. Please ensure you have set the machine javaHome to point to a JDK"); + + massageAutoFVTAbsolutePath(); + + preTestTidyup(); + } + + protected void preTestTidyup() { + //Deletes the logs and work area folder and the apps folder + try { + machine.getFile(logsRoot).delete(); + } catch (Exception e) { + // Ignore if doesn't exist + } + try { + machine.getFile(clientRoot + "/workarea").delete(); + } catch (Exception e) { + // Ignore if doesn't exist + } + try { + RemoteFile applicationsFolder = new RemoteFile(machine, installRoot + "/usr/shared/apps"); + applicationsFolder.delete(); + applicationsFolder.mkdir(); + } catch (Exception e) { + // Ignore if doesn't exist + } + } + + /** + * Set the feature list of the client.xml to the new features specified + * in the {@code List}. Each String should be the only feature + * name, e.g. servlet-3.0 + * + * @param newFeatures + * @throws Exception + */ + public void changeFeatures(List newFeatures) throws Exception { + RemoteFile clientXML = new RemoteFile(machine, clientRoot + "/" + CLIENT_CONFIG_FILE_NAME); + LocalFile tempclientXML = new LocalFile(CLIENT_CONFIG_FILE_NAME); + boolean createOriginalList; + if (originalFeatureSet == null) { + createOriginalList = true; + originalFeatureSet = new ArrayList(); + } else { + createOriginalList = false; + } + Writer w = new OutputStreamWriter(tempclientXML.openForWriting(false)); + InputStream originalOutput = clientXML.openForReading(); + InputStreamReader in2 = new InputStreamReader(originalOutput); + Scanner s2 = new Scanner(in2); + while (s2.hasNextLine()) { + String line = s2.nextLine(); + if (line.contains("")) {//So has reached featureSets + while (s2.hasNextLine()) { + line = s2.nextLine(); + if (line.contains("")) + break; + //Otherwise is a featureset and only if the original featureset list is null do we need to get + if (createOriginalList) { + line = line.replaceAll("", ""); + line = line.replaceAll("", ""); + line = line.trim(); + originalFeatureSet.add(line); + } + } + w.write(" "); + w.write("\n"); + for (String feature : newFeatures) { + w.write(" " + feature.trim() + ""); + w.write("\n"); + } + w.write(" "); + w.write("\n"); + } else { + w.write(line); + w.write("\n"); + } + } + s2.close(); + originalOutput.close(); + w.flush(); + w.close(); + //Now we need to copy file overwriting existing client.xml and delete the temp + tempclientXML.copyToDest(clientXML, false, true); + tempclientXML.delete(); + } + + protected void printProcessHoldingPort(int port) { + final String m = "printProcessHoldingPort"; + try { + PortDetectionUtil detector = PortDetectionUtil.getPortDetector(machine); + Log.info(c, m, detector.determineOwnerOfPort(port)); + } catch (Exception ex) { + Log.error(c, m, ex, "Caught exception while trying to detect the process holding port " + port); + } + } + + public enum IncludeArg { + MINIFY, ALL, USR; + public String getIncludeString() { + return "--include=" + this.toString().toLowerCase(); + } + } + + protected ArrayList setArgs(final IncludeArg include, final String osFilter) { + final ArrayList args = new ArrayList(); + + args.add(include.getIncludeString()); + + if (osFilter != null) { + args.add("--os=" + osFilter); + } + return args; + } + + public ProgramOutput startClientWithArgs(boolean preClean, boolean cleanStart, + boolean validateApps, boolean expectStartFailure, + String clientCmd, List args, + boolean validateTimedExit) throws Exception { + return (startClientWithArgs(preClean, cleanStart, false, validateApps, expectStartFailure, clientCmd, args, validateTimedExit)); + } + + public ProgramOutput startClientWithArgs(boolean preClean, boolean cleanStart, + boolean autoAccept, boolean validateApps, boolean expectStartFailure, + String clientCmd, List args, + boolean validateTimedExit) throws Exception { + final String method = "startClientWithArgs"; + Log.entering(c, method, "clean=" + cleanStart + ", validateApps=" + validateApps + ", expectStartFailure=" + expectStartFailure + ", cmd=" + clientCmd + ", args=" + args); + + if (clientCleanupProblem) { + throw new Exception("The client was not cleaned up on the previous test."); + } + + //Tidy up any pre-existing logs + if (preClean) + preStartClientLogsTidy(); + + Properties envVars = new Properties(); + + final String cmd = installRoot + "/bin/client"; + ArrayList parametersList = new ArrayList(); + boolean executeAsync = false; + if ("run".equals(clientCmd) && DEBUGGING_PORT != null && !!!DEBUGGING_PORT.equalsIgnoreCase(Boolean.toString(false))) { + Log.info(c, method, "Setting up commands for debug"); + parametersList.add("debug"); + parametersList.add(clientToUse); + envVars.setProperty("DEBUG_PORT", DEBUGGING_PORT); + // set client time out to 15 minutes to give time to connect. Timed exit likely kicks in after that, so + // a larger value is worthless (and, since we multiply it by two later, will wrap if you use MAX_VALUE) + clientStartTimeout = 15 * 60 * 60 * 1000; + executeAsync = true; + } else { + parametersList.add(clientCmd); + parametersList.add(clientToUse); + } + + if (cleanStart) { + parametersList.add("--clean"); + } + + if (autoAccept) { + parametersList.add("--autoAcceptSigner"); + } + + if (args != null) { + parametersList.addAll(args); + } + + //Setup the client logs assuming the default setting. + messageAbsPath = logsRoot + messageFileName; + consoleAbsPath = logsRoot + consoleFileName; + + Log.info(c, method, "Starting client, messages will go to file " + messageAbsPath); + + final String[] parameters = parametersList.toArray(new String[] {}); + + //Need to ensure JAVA_HOME is set correctly - can't rely on user's environment to be set to the same Java as the build/runtime environment + envVars.setProperty("JAVA_HOME", machineJava); + + // Pick up global JVM args (forced by build properties) + String JVM_ARGS = GLOBAL_JVM_ARGS; + + // Always set tmp dir. + JVM_ARGS += " -Djava.io.tmpdir=" + TMP_DIR; + + // Avoid ClassLoader deadlocks on HotSpot Java 6. + if (HOTSPOT_JVM_RUN && JAVA_VERSION_6) { + JVM_ARGS += " -XX:+UnlockDiagnosticVMOptions" + + " -XX:+UnsyncloadClass" + + " -Dosgi.classloader.lock=classname"; + } + + // Add JaCoCo java agent to generate code coverage for FAT test run + if (DO_COVERAGE) { + JVM_ARGS += " " + JAVA_AGENT_FOR_JACOCO; + } + + //if we are on Mac then use the value of the perm gen arg that has been + //passed in via the system property + if (MAC_RUN != null && !!!MAC_RUN.equalsIgnoreCase(Boolean.toString(false))) { + JVM_ARGS += " " + MAC_RUN; + } + + // if we have java 2 security enabled, add java.security.manager and java.security.policy + if (GLOBAL_JAVA2SECURITY) { + RemoteFile f = getClientBootstrapPropertiesFile(); + Log.info(c, "startClientWithArgs", "remoteFile: " + f.getAbsolutePath()); + + if (clientNeedsToRunWithJava2Security()) { + addJava2SecurityPropertiesToBootstrapFile(f); + } else { + LOG.warning("The build is configured to run FAT tests with Java 2 Security enabled, but the FAT client " + getClientName() + + " is exempt from Java 2 Security regression testing."); + } + + Log.info(c, "", "JVM_ARGS = " + JVM_ARGS); + } + + // Look for forced client trace.. + if (!GLOBAL_TRACE.isEmpty()) { + RemoteFile f = getClientBootstrapPropertiesFile(); + Properties props = new Properties(); + + if (f.exists()) { + InputStream is = null; + try { + is = f.openForReading(); + props.load(is); + } catch (Exception e) { + LOG.warning("Error reading " + f + ": " + e.getMessage()); + } finally { + if (is != null) { + is.close(); + } + } + } + + // get configured trace string from bootstrap properties.. + // (have to take include into account, ugh.. + String configuredTrace = props.getProperty("com.ibm.ws.logging.trace.specification"); + if (configuredTrace == null) { + String includeFiles = props.getProperty("bootstrap.include"); + if (includeFiles != null) { + String[] files = includeFiles.split("\\s*,\\s*"); + for (String fileName : files) { + RemoteFile x = new RemoteFile(machine, clientRoot + "/" + fileName); + if (x.exists()) { + props.clear(); + InputStream is = null; + try { + is = x.openForReading(); + props.load(is); + configuredTrace = props.getProperty("com.ibm.ws.logging.trace.specification"); + if (configuredTrace != null) + break; + } catch (Exception e) { + LOG.warning("Error reading " + x + ": " + e.getMessage()); + } finally { + if (is != null) { + is.close(); + } + } + } + } + } + } + + if (configuredTrace != null && !configuredTrace.isEmpty()) { + configuredTrace = GLOBAL_TRACE + ":" + configuredTrace.trim(); + } else { + configuredTrace = GLOBAL_TRACE; + } + + JVM_ARGS += " -Dcom.ibm.ws.logging.trace.specification=" + configuredTrace; + } + + envVars.setProperty("JVM_ARGS", JVM_ARGS); + + // This takes the custom console file name used for tests into consideration + envVars.setProperty("LOG_DIR", logsRoot); + envVars.setProperty("LOG_FILE", consoleFileName); + + Log.info(c, method, "Using additional env props: " + envVars.toString()); + + Log.info(c, method, "Starting Client with command: " + cmd); + + ProgramOutput output; + if (executeAsync) { + if (!(machine instanceof LocalMachine)) { + throw new Exception(""); + } + + LocalMachine localMachine = (LocalMachine) machine; + File f = new File(logsRoot + File.separator + consoleFileName); + if (!f.exists()) + f.getParentFile().mkdirs(); + OutputStream redirect = new FileOutputStream(f); + String workDir = new File(this.clientOutputRoot).getAbsolutePath(); + localMachine.executeAsync(cmd, parameters, workDir, envVars, redirect); + Log.info(c, method, "Started client process in debug mode"); + output = null; + } else { + output = machine.execute(cmd, parameters, envVars); + + int rc = output.getReturnCode(); + Log.info(c, method, "Response from script is: " + output.getStdout()); + Log.info(c, method, "Return code from script is: " + rc); + + if (rc != 0 && expectStartFailure) { + Log.info(c, method, "EXPECTED: Client didn't start"); + Log.exiting(c, method); + return output; + } + } + + // Validate the client and apps started - if they didn't, that + // method will throw an appropriate exception + + if ("run".equals(clientCmd)) { + validateClientStarted(output, validateApps, expectStartFailure, validateTimedExit); + // validate will set correctly - can't assume the answer is true + //isStarted = true; + } + + // Create a marker file to indicate client is started + createClientMarkerFile(); + + if ("run".equals(clientCmd)) { + validateClientStopped(output, expectStartFailure); + } + postStopClientArchive(); + Log.exiting(c, method); + return output; + } + + private boolean clientNeedsToRunWithJava2Security() { + String method = "clientNeedsToRunWithJava2Security"; + Log.info(c, method, "Entering clientNeedsToRunWithJava2Security"); + boolean result = true; + String clientName = getClientName(); + + try { + if (clientsExemptFromJava2SecurityTesting == null) { + loadJava2SecurityExemptClients(); + } + Log.info(c, method, "Checking Client Name " + clientName); + return !clientsExemptFromJava2SecurityTesting.contains(clientName); + } catch (Exception e) { + Log.info(c, method, "Error determining Exempt Clients " + e.toString()); + Log.info(c, method, "Skipping modification of the bootstrap.properties file to enable Java 2 Security on client " + clientName); + result = false; + } + return result; + } + + private void loadJava2SecurityExemptClients() throws Exception { + String method = "loadJava2SecurityExemptClients"; + BufferedReader br = null; + Log.info(c, method, "loading exempt clients list"); + RemoteFile exempt = new RemoteFile(machine, clientRoot + "/java2SecurityExemptClientsList.txt"); + try { + br = new BufferedReader(new InputStreamReader(exempt.openForReading())); + String line = br.readLine(); + clientsExemptFromJava2SecurityTesting = new HashSet(); + while (line != null) { + if (line.startsWith("#") == false) { + clientsExemptFromJava2SecurityTesting.add(line.trim()); + } + line = br.readLine(); + } + } catch (Exception e) { + Log.info(c, method, "Error loading Java 2 Security exempt clients list " + e.toString()); + throw e; + } finally { + if (br != null) { + br.close(); + } + } + } + + private void addJava2SecurityPropertiesToBootstrapFile(RemoteFile f) throws Exception { + java.io.OutputStream w = f.openForWriting(true); + try { + w.write("\n".getBytes()); + w.write("websphere.java.security".getBytes()); + w.write("\n".getBytes()); + w.write("websphere.java.security.norethrow=false".getBytes()); + w.write("\n".getBytes()); + Log.info(c, "addJava2SecurityPropertiesToBootstrapFile", "Successfully updated bootstrap.properties file with Java 2 Security properties"); + } catch (Exception e) { + Log.info(c, "addJava2SecurityPropertiesToBootstrapFile", "Caught exception updating bootstap.properties file with Java 2 Security properties, e: ", e.getMessage()); + } + w.flush(); + w.close(); + } + + /** + * Create a marker file for the client to indicate it is started. + * + * @throws IOException + */ + protected void createClientMarkerFile() throws Exception { + + File outputFolder = new File(pathToAutoFVTOutputFolder); + if (!outputFolder.exists()) + outputFolder.mkdirs(); + + String path = pathToAutoFVTOutputFolder + getClientName() + ".mrk"; + LocalFile clientRunningFile = new LocalFile(path); + Log.info(c, "createClientMarkerFile", "Client marker file: " + clientRunningFile.getAbsolutePath()); + File createFile = new File(clientRunningFile.getAbsolutePath()); + createFile.createNewFile(); + OutputStream os = clientRunningFile.openForWriting(true); + os.write(0); + os.flush(); + os.close(); + } + + /** + * Delete a marker file for the client (after stopped). + * + * @throws IOException + */ + protected void deleteClientMarkerFile() throws Exception { + + String path = pathToAutoFVTOutputFolder + getClientName() + ".mrk"; + LocalFile clientRunningFile = new LocalFile(path); + Log.info(c, "deleteClientMarkerFile", "Client marker file: " + clientRunningFile.getAbsolutePath()); + File deleteFile = new File(clientRunningFile.getAbsolutePath()); + if (deleteFile.exists()) { + deleteFile.delete(); + } + } + + public void validateAppLoaded(String appName) throws Exception { + String exceptionText = validateAppsLoaded(Collections.singletonList(appName), LOG_SEARCH_TIMEOUT, getDefaultLogFile()); + if (exceptionText != null) { + throw new TopologyException(exceptionText); + } + } + + protected void validateAppsLoaded(RemoteFile outputFile) throws Exception { + final String method = "validateAppsLoaded"; + + if (installedApplications.isEmpty()) { + Log.info(c, method, "No applications are installed so no need to validate they are loaded"); + return; + } + + String exceptionText = validateAppsLoaded(installedApplications, LOG_SEARCH_TIMEOUT, outputFile); + if (exceptionText != null) { + throw new TopologyException(exceptionText); + } + } + + protected String validateAppsLoaded(List appList, int timeout, RemoteFile outputFile) throws Exception { + // At time of writing, timeout argument was being ignored. Preserve that for now... + timeout = LOG_SEARCH_TIMEOUT; + return validateAppsLoaded(appList, timeout, 2 * timeout, outputFile); + } + + /** + * We are adding a "soft failure" mode, in an attempt to compensate for the fact that the Virtual Machines + * we're now running regression tests on have "bursty" performance and may introduce substantial delays with + * no warning, making the originally coded times fragile. + * + * With this change, if intendedTimeout is exceeded, we report this to the SOE client + * but do not consider it a test failure. Only if extendedTimeout is exceeded will we return a not-found indication. + * + * @param regexp a regular expression to search for + * @param intendedTimeout a timeout, in milliseconds, within which string was expected to occur + * @param extendedTimeout a timeout, in milliseconds, within which string may acceptably occur + * @param outputFile file to check + * @return line that matched the regexp, or null to indicate not found within acceptable (extended) timeout + */ + protected String validateAppsLoaded(List appList, int intendedTimeout, int extendedTimeout, RemoteFile outputFile) throws Exception { + final String method = "validateAppsLoaded"; + + final long startTime = System.currentTimeMillis(); + final long finalTime = startTime + extendedTimeout; + long slowTime = startTime + intendedTimeout; + try { + long offset = 0; + final List regexpList = Collections.singletonList("CWWKZ"); + Map unstartedApps = new HashMap(); + for (String appName : appList) { + unstartedApps.put(appName, Pattern.compile(".*\\b" + appName + "\\b.*")); + } + Map> failedApps = new HashMap>(); + boolean timedOut = false; + + Log.info(c, method, "Searching for app manager messages in " + outputFile.getAbsolutePath()); + for (;;) { + LogSearchResult allMatches = LibertyFileManager.findStringsInFileCommon(regexpList, Integer.MAX_VALUE, outputFile, offset); + if (allMatches != null && !!!allMatches.getMatches().isEmpty()) { + processAppManagerMessages(allMatches, unstartedApps, failedApps); + } + if (unstartedApps.isEmpty()) { + break; + } + if (System.currentTimeMillis() > finalTime) { + timedOut = true; + break; + } + if (System.currentTimeMillis() > slowTime) { + SOEHttpPostUtil.reportSoftLogTimeoutToSOE(CLASS_NAME, method, 1071, intendedTimeout, "Unstarted: " + unstartedApps); + SOEHttpPostUtil.reportSoftLogTimeoutToSOE(CLASS_NAME, method, 1072, intendedTimeout, "Failed: " + failedApps); + slowTime = finalTime + WAIT_INCREMENT; // don't report again + } + offset = allMatches == null ? 0 : allMatches.getOffset(); + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + } + if (timedOut) { + Log.warning(c, "Timed out searching for app manager messages in log file: " + outputFile.getAbsolutePath()); + } + String plural = unstartedApps.size() > 1 ? "s" : ""; + if (failedApps.isEmpty()) { + if (unstartedApps.isEmpty()) { + return null; + } + + // If apps failed to start, try to make sure the port opened so we correctly + // flag a port issue as the culprit. + //validatePortStarted(); + + return "Timed out waiting for application" + plural + " " + unstartedApps.keySet() + " to start."; + + } + String exceptionText = "Failures occured while waiting for app" + plural + " to start:"; + for (Map.Entry> entry : failedApps.entrySet()) { + for (String failure : entry.getValue()) { + String text; + if (entry.getKey().equals("*")) { + text = "App Manager Failure: " + failure; + } else { + text = "Application " + entry.getKey() + " failure: " + failure; + } + Log.info(c, method, text); + exceptionText += "\n " + text; + } + } + return exceptionText; + } catch (Exception e) { + Log.error(c, method, e, "Exception thrown confirming apps are loaded when validating that " + + outputFile.getAbsolutePath() + " contains application install messages."); + throw e; + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(c, method, + "Started searching for app manager messages at " + + formatter.format(new Date(startTime)) + + " and finished at " + + formatter.format(new Date(endTime))); + } + } + +/* + * App Manager messages that tests wait for in the log: + * + * CWWKZ0001I - many + * CWWKZ0002E - none + * CWWKZ0003I - com.ibm.ws.app.manager_fat, com.ibm.ws.classloading_fat, com.ibm.ws.ejbcontainer.security_fat, + * com.ibm.ws.jpa_fat, com.ibm.ws.jsf_fat_lWAS, com.ibm.ws.management.repository.client_fat, + * com.ibm.ws.ssl_fat, com.ibm.ws.webcontainer-8.0_fat_lWAS + * CWWKZ0004E - none + * CWWKZ0005E - none + * CWWKZ0006E - none + * CWWKZ0007W - none + * CWWKZ0008E - none + * CWWKZ0009I - com.ibm.ws.app.manager_fat, com.ibm.ws.app.manager.eba_fat, com.ibm.ws.eba.bundle.repository_fat, + * com.ibm.ws.jaxws_fat, com.ibm.ws.jca_fat, com.ibm.ws.jsf_fat_lWAS, com.ibm.ws.management.repository.client_fat, + * com.ibm.ws.session-3.0_fat, com.ibm.ws.webcontainer-8.0_fat_lWAS, com.ibm.ws.webcontainer.security_fat + * CWWKZ0010E - none + * CWWKZ0011E - none + * CWWKZ0012I - com.ibm.ws.app.manager.eba_fat, com.ibm.ws.webcontainer-8.0_fat_lWAS + * CWWKZ0013E - com.ibm.ws.app.manager_fat, com.ibm.ws.security_fat + * CWWKZ0014W - com.ibm.ws.app.manager_fat + * CWWKZ0015E - none + * CWWKZ0016E - none + * CWWKZ0017E - none + * CWWKZ0018I - none + * CWWKZ0019I - none + * CWWKZ0020I - none + * CWWKZ0021E - none + * CWWKZ0022W - none + * CWWKZ0053E - none + * CWWKZ0054E - none + * CWWKZ0055E - none + * CWWKZ0056E - none + * CWWKZ0057E - none + * CWWKZ0058I - com.ibm.ws.app.manager_fat, javax.jaxb-2.2_fat + * CWWKZ0059E - com.ibm.ws.app.manager_fat + * CWWKZ0060E - none + * CWWKZ0060W - none + * CWWKZ0106E - none + * CWWKZ0107E - none + * CWWKZ0111E - none + * CWWKZ0112E - none + * CWWKZ0113E - none + * CWWKZ0114E - none + * CWWKZ0115E - none + * CWWKZ0116E - none + * CWWKZ0117E - none + * CWWKZ0118E - none + * CWWKZ0120E - none + * CWWKZ0121E - none + * CWWKZ0201E - none + * CWWKZ0202E - none + * CWWKZ0203E - none + * CWWKZ0204E - none + * CWWKZ0205E - none + * CWWKZ0206E - none + * CWWKZ0207E - none + * CWWKZ0301E - com.ibm.ws.app.manager.eba_fat?, com.ibm.ws.eba.fidelity_fat + * CWWKZ0302E - com.ibm.ws.app.manager.eba_fat + * CWWKZ0303E - none + * CWWKZ0304E - com.ibm.ws.app.manager.eba_fat, com.ibm.ws.eba.bundle.repository_fat + * CWWKZ0401E - none + * CWWKZ0402E - none + * CWWKZ0403E - none + * CWWKZ0404E - none + */ + protected enum Action { + REMOVE_APP_NAME_FROM_UNSTARTED_APPS, + ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS, + ADD_FAILURE_FOR_ALL_FAILED_APPS, + IGNORE + } + + protected enum AppManagerMessage { + // app.manager + // APPLICATION_START_SUCCESSFUL=CWWKZ0001I: Application {0} started in {1} seconds. + CWWKZ0001I(Action.REMOVE_APP_NAME_FROM_UNSTARTED_APPS), + // APPLICATION_START_FAILED=CWWKZ0002E: An exception occurred while starting the application {0}. The exception message was: {1} + CWWKZ0002E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // APPLICATION_UPDATE_SUCCESSFUL=CWWKZ0003I: The application {0} updated in {1} seconds. + CWWKZ0003I, + // APPLICATION_UPDATE_FAILED=CWWKZ0004E: An exception occurred while starting the application {0}. The exception message was: {1} + CWWKZ0004E, + // NO_APPLICATION_HANDLER=CWWKZ0005E: The application {0} cannot start because the client is not configured to handle applications of type {1}. + CWWKZ0005E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // CANNOT_CREATE_DIRECTORY=CWWKZ0006E: The client could not create a download location at {0} for the {1} application. + CWWKZ0006E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // DOWNLOAD_EXCEPTION_ENCOUNTERED=CWWKZ0007W: An exception occurred while downloading the file from {0}. The exception message was: {1} + CWWKZ0007W(Action.ADD_FAILURE_FOR_ALL_FAILED_APPS), + // LOCATION_SERVICE_NOT_FOUND=CWWKZ0008E: An internal error has occurred. The system could not get the location service that is required to resolve file locations. + CWWKZ0008E(Action.ADD_FAILURE_FOR_ALL_FAILED_APPS), + // APPLICATION_STOPPED=CWWKZ0009I: The application {0} has stopped successfully. + CWWKZ0009I, + // APPLICATION_STOP_FAILED=CWWKZ0010E: An exception occurred while stopping the application {0}. The exception message was: {1} + CWWKZ0010E, + // FIND_FILE_EXCEPTION_ENCOUNTERED=CWWKZ0011E: An exception occurred while searching for the file {0}. The exception message was: {1} + CWWKZ0011E, + // APPLICATION_NOT_STARTED=CWWKZ0012I: The application {0} was not started. + CWWKZ0012I(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // DUPLICATE_APPLICATION_NAME=CWWKZ0013E: It is not possible to start two applications called {0}. + CWWKZ0013E, + // APPLICATION_NOT_FOUND=CWWKZ0014W: The application {0} could not be started as it could not be found at location {1}. + CWWKZ0014W(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // APPLICATION_NO_LOCATION_NO_NAME=CWWKZ0015E: An application has been configured with no location or name. + CWWKZ0015E, + // APPLICATION_NO_LOCATION=CWWKZ0016E: The application {0} has not been configured with a location. + CWWKZ0016E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // APPLICATION_NO_TYPE=CWWKZ0017E: It was not possible to infer the application type for application {0} from the location {1}. + CWWKZ0017E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // STARTING_APPLICATION=CWWKZ0018I: Starting application {0}. + CWWKZ0018I, + // PARTIAL_START=CWWKZ0019I: Application {0} partly started in {1} seconds. + CWWKZ0019I, + // APPLICATION_NOT_UPDATED=CWWKZ0020I: Application {0} not updated. + CWWKZ0020I, + // APPLICATION_AT_LOCATION_NOT_VALID=CWWKZ0021E: Application {0} at location {1} is invalid. + CWWKZ0021E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // APPLICATION_SLOW_STARTUP=CWWKZ0022W: Application {0} has not started in {1} seconds. + CWWKZ0022W, + // + // MONITOR_APP_STOP_FAIL=CWWKZ0053E: An exception occurred while trying to stop the {0} application automatically. + CWWKZ0053E, + // INVALID_FILE_NAME=CWWKZ0054E: The application monitoring service could not find a suitable name for the {0} application. + CWWKZ0054E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // UNABLE_TO_DETERMINE_APPLICATION_TYPE=CWWKZ0055E: The application monitoring service could not determine the type of the {0} application. + CWWKZ0055E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // MONITOR_APP_START_FAIL=CWWKZ0056E: An exception occurred while trying to automatically start the {0} application. + CWWKZ0056E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // MONITOR_INVALID_CACHE_FILE_ENTRY=CWWKZ0057E: When reading the cached list of started applications from the application monitor ({0}), line number {1} was not valid. The line was: {2}. + CWWKZ0057E, + // APPLICATION_MONITOR_STARTED=CWWKZ0058I: Monitoring {0} for applications. + CWWKZ0058I, + // INVALID_DELETE_OF_APPLICATION=CWWKZ0059E: The {0} application installed from {1} has been deleted while it is still configured. + CWWKZ0059E, + // MONITOR_DIR_CLEANUP_FAIL=CWWKZ0060E: The client could not clean up the old monitored directory at {0}. + CWWKZ0060E, + // APPLICATION_MONITORING_FAIL=CWWKZ0060W: Unable to monitor the {0} application. + CWWKZ0060W, + // app.manager.eba + // eba.installer.resolver.fail=CWWKZ0301E: An exception occurred trying to resolve the application {0} into an OSGi framework. The error text is: {1} + CWWKZ0301E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // eba.installer.bundle.fail=CWWKZ0302E: A bundle exception was generated when trying to install the application {0} into an OSGi framework. The error text from the OSGi framework is: {1} + CWWKZ0302E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // eba.installer.aries.management.fail=CWWKZ0303E: A management exception was generated when trying to install the application {0} into an OSGi framework. The error text from the OSGi framework is: {1} + CWWKZ0303E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // eba.installer.aries.resolver.fail=CWWKZ0304E: An exception was generated when trying to resolve the contents of the application {0}. The exception text from the OSGi framework is: {1} + CWWKZ0304E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // app.manager.esa + // esa.installer.resolver.fail=CWWKZ0401E: An exception occurred trying to resolve the application {0} into an OSGi framework. The error text is: {1} + CWWKZ0401E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // esa.installer.bundle.fail=CWWKZ0402E: A bundle exception was generated when trying to install the application {0} into an OSGi framework. The error text from the OSGi framework is: {1} + CWWKZ0402E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // esa.installer.aries.management.fail=CWWKZ0403E: A management exception was generated when trying to install the application {0} into an OSGi framework. The error text from the OSGi framework is: {1} + CWWKZ0403E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // esa.installer.aries.resolver.fail=CWWKZ0404E: An exception was generated when trying to resolve the contents of the application {0}. The exception text from the OSGi framework is: {1} + CWWKZ0404E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // app.manager.module + // error.cache.adapt=CWWKZ0107E: An internal error occurred. Unable to adapt cache for web module {0}. + CWWKZ0107E, + // app.manager.wab + // bundle.tracker.init.fail=CWWKZ0201E: An error occurred initializing the WAB installer. + CWWKZ0201E, + // wab.install.fail=CWWKZ0202E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0202E, + // wab.install.fail.adapt=CWWKZ0203E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0203E, + // wab.install.fail.overlay=CWWKZ0204E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0204E, + // wab.install.fail.cache=CWWKZ0205E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0205E, + // wab.install.fail.container=CWWKZ0206E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0206E, + // wab.install.fail.wiring=CWWKZ0207E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0207E, + // wab.install.fail.clash=CWWKZ0208E: Unable to install bundle {0} with context root {1} into the web container because that context root is already in use by {2} + CWWKZ0208E, + // app.manager.war + // error.not.installed=CWWKZ0106E: Could not start web application {0}. + CWWKZ0106E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.application.library.container=CWWKZ0111E: Application {0} encountered a error when accessing application library {1}: {2} + CWWKZ0111E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.application.libraries=CWWKZ0112E: Application {0} encountered an error when listing application libraries: {1} + CWWKZ0112E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.application.parse.descriptor=CWWKZ0113E: Application {0} encountered a parse error when processing application descriptor {1}: {2} + CWWKZ0113E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.container=CWWKZ0114E: Application {0} encountered an error when accessing the contents of module {1} of type {2}: {3} + CWWKZ0114E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.container.null=CWWKZ0115E: Application {0} obtained a null value when accessing the contents candidate module {1} of type {2} + CWWKZ0115E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.create=CWWKZ0116E: Application {0} failed to finish creation of module {1} of type {2}: {3} + CWWKZ0116E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.locate.failed=CWWKZ0117E: Application {0} failed to locate module {1} of type {2} + CWWKZ0117E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.parse.descriptor=CWWKZ0118E: Application {0} encountered a parse error when processing descriptor {1} of module {2} of type {3}: {4} + CWWKZ0118E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.class.source=CWWKZ0120E: Application {0} failed to access classes for module {1} of type {2}: {3} + CWWKZ0120E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.annotation.targets=CWWKZ0121E: Application {0} failed to access annotations for module {1} of type {2}: {3} + CWWKZ0121E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS); + + final Action action; + + AppManagerMessage() { + this(Action.IGNORE); + } + + AppManagerMessage(Action action) { + this.action = action; + } + + public void processMessage(String[] tokens, Map unstartedApps, Map> failedApps) { + String appName; + switch (action) { + case REMOVE_APP_NAME_FROM_UNSTARTED_APPS: + appName = findAppNameInTokens(unstartedApps, tokens); + if (appName != null) { + unstartedApps.remove(appName); + } + break; + case ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS: + appName = findAppNameInTokens(unstartedApps, tokens); + if (appName != null) { + List failures = failedApps.get(appName); + if (failures == null) { + failures = new ArrayList(); + failedApps.put(appName, failures); + } + failures.add(tokensToString(tokens)); + unstartedApps.remove(appName); + } + break; + case ADD_FAILURE_FOR_ALL_FAILED_APPS: + addFailureToAllFailedApps(tokens, failedApps); + break; + case IGNORE: + break; + } + } + } + + protected static String tokensToString(String[] tokens) { + return tokens[0] + ":" + tokens[1]; + } + + protected static void addFailureToAllFailedApps(String[] tokens, Map> failedApps) { + List failures = failedApps.get("*"); + if (failures == null) { + failures = new ArrayList(); + failedApps.put("*", failures); + } + failures.add(tokensToString(tokens)); + } + + protected void processAppManagerMessages(LogSearchResult allMatches, Map unstartedApps, Map> failedApps) { + final String method = "processAppManagerMessages"; + + for (String line : allMatches.getMatches()) { + line = line.substring(line.indexOf("CWWKZ")); + Log.info(c, method, "line is " + line); + String[] tokens = line.split(":", 2); + Log.info(c, method, "tokens are (" + tokens[0] + ") (" + tokens[1] + ")"); + try { + AppManagerMessage matchedMessage = AppManagerMessage.valueOf(tokens[0]); + if (matchedMessage != null) { + matchedMessage.processMessage(tokens, unstartedApps, failedApps); + } + } catch (IllegalArgumentException ex) { + ex.getCause(); + if (tokens[0].endsWith("E")) { + addFailureToAllFailedApps(tokens, failedApps); + } + } + } + } + + protected static String findAppNameInTokens(Map unstartedApps, String[] tokens) { + final String method = "findAppNameInTokens"; + + for (Map.Entry entry : unstartedApps.entrySet()) { + Log.info(c, method, "looking for app " + entry.getKey() + " in " + tokens[1]); + if (entry.getValue().matcher(tokens[1]).matches()) { + Log.info(c, method, "matched app " + entry.getKey()); + return entry.getKey(); + } + } + Log.info(c, method, "no matches for apps found in " + tokens[1]); + return null; + } + + protected void validateClientStarted(ProgramOutput output, boolean validateApps, + boolean expectStartFailure, boolean validateTimedExit) throws Exception { + final String method = "validateClientStarted"; + + final String START_MESSAGE_CODE = "CWWKF0035I"; + + boolean clientStarted = false; + + if (checkForRestConnector.get()) { + //since this is going to connect to the secure port, that needs to be ready + //before an attempt to make the JMX connection + Log.info(c, method, "Checking that the JMX RestConnector is available and secured"); + assertNotNull("CWWKO0219I.*ssl not recieved", waitForStringInLogUsingMark("CWWKO0219I.*ssl")); + + assertNotNull("IBMJMXConnectorREST app did not report as ready", waitForStringInLogUsingMark("CWWKT0016I.*IBMJMXConnectorREST")); + + assertNotNull("Security service did not report it was ready", waitForStringInLogUsingMark("CWWKS0008I")); + + //backup the key file + copyFileToTempDir("resources/security/key.jks", "key.jks"); + } + + Log.info(c, method, "Waiting up to " + (clientStartTimeout / 1000) + + " seconds for client confirmation: " + + START_MESSAGE_CODE.toString() + " to be found in " + messageAbsPath); + + RemoteFile messagesLog = new RemoteFile(machine, messageAbsPath); + + try { + RemoteFile f = getClientBootstrapPropertiesFile(); + Properties props = new Properties(); + + if (f.exists()) { + InputStream is = null; + try { + is = f.openForReading(); + props.load(is); + } catch (Exception e) { + LOG.warning("Error reading " + f + ": " + e.getMessage()); + } finally { + if (is != null) { + is.close(); + } + } + } + + String startMessage = waitForStringInLog(START_MESSAGE_CODE, clientStartTimeout, messagesLog); + clientStarted = (startMessage != null); + // If the client started successfully, we're started + // (but the opposite isn't true since the client could already have been running) + if (clientStarted) { + isStarted = true; + Log.info(c, method, "Client has started successfully"); + } + } catch (Exception e) { + Log.error(c, method, e, "Exception thrown confirming client started in " + consoleAbsPath); + throw e; + } + + } + + protected void validateClientStopped(ProgramOutput output, boolean expectStopFailure) throws Exception { + final String method = "validateClientStopped"; + + final String STOP_MESSAGE_CODE = "CWWKE0908I"; + + boolean clientStopped = false; + + if (checkForRestConnector.get()) { + //since this is going to connect to the secure port, that needs to be ready + //before an attempt to make the JMX connection + Log.info(c, method, "Checking that the JMX RestConnector is available and secured"); + assertNotNull("CWWKO0219I.*ssl not recieved", waitForStringInLogUsingMark("CWWKO0219I.*ssl")); + + assertNotNull("IBMJMXConnectorREST app did not report as ready", waitForStringInLogUsingMark("CWWKT0016I.*IBMJMXConnectorREST")); + + assertNotNull("Security service did not report it was ready", waitForStringInLogUsingMark("CWWKS0008I")); + + //backup the key file + copyFileToTempDir("resources/security/key.jks", "key.jks"); + } + + Log.info(c, method, "Waiting up to " + (clientStopTimeout / 1000) + + " seconds for client confirmation: " + + STOP_MESSAGE_CODE.toString() + " to be found in " + messageAbsPath); + + RemoteFile messagesLog = new RemoteFile(machine, messageAbsPath); + + try { + RemoteFile f = getClientBootstrapPropertiesFile(); + Properties props = new Properties(); + + if (f.exists()) { + InputStream is = null; + try { + is = f.openForReading(); + props.load(is); + } catch (Exception e) { + LOG.warning("Error reading " + f + ": " + e.getMessage()); + } finally { + if (is != null) { + is.close(); + } + } + } + + String stopMessage = waitForStringInLog(STOP_MESSAGE_CODE, clientStopTimeout, messagesLog); + clientStopped = (stopMessage != null); + // If the client started successfully, we're started + // (but the opposite isn't true since the client could already have been running) + if (clientStopped) { + isStopped = true; + Log.info(c, method, "Client has stopped successfully"); + } + } catch (Exception e) { + Log.error(c, method, e, "Exception thrown confirming client stopped in " + consoleAbsPath); + throw e; + } + + } + + /** + * Checks client logs for any lines containing errors or warnings that + * do not match any regular expressions provided in regIgnore. + * regIgnore list provided by + * + * + * @return A list of lines containing errors/warnings from client logs + */ + protected void checkLogsForErrorsAndWarnings() throws Exception { + final String method = "checkLogsForErrorsAndWarnings"; + + if (!isClientExemptFromChecking()) { + // Get all warnings and errors in logs + List errorsInLogs = null; + try { + errorsInLogs = this.findStringsInLogs(".*\\d{4}[EW]: .*"); + } catch (Exception e) { + + } + //Add default Errors to the list of errors to ignore + if (fixedIgnoreErrorsList != null && fixedIgnoreErrorsList.size() != 0) { + if (ignorePatterns == null) + ignorePatterns = new ArrayList(); + for (String ignoreRegEx : fixedIgnoreErrorsList) { + ignorePatterns.add(Pattern.compile(ignoreRegEx)); + } + } + + // Remove any ignored warnings or patterns + if (ignorePatterns != null) + for (Pattern ignorePattern : ignorePatterns) { + Iterator iter = errorsInLogs.iterator(); + while (iter.hasNext()) { + if (ignorePattern.matcher(iter.next()).find()) { + // this is an ignored warning/error, remove it from list + iter.remove(); + } + } + } + + Exception ex = null; + if (errorsInLogs != null && !errorsInLogs.isEmpty()) { + // There were unexpected errors in logs, print them + // and set an exception to return + StringBuffer sb = new StringBuffer("Errors/warnings were found in client logs:"); + for (String errorInLog : errorsInLogs) { + sb.append("\n
    "); + sb.append(errorInLog); + Log.info(c, method, "Error/warning found: " + errorInLog); + } + ex = new Exception(sb.toString()); + } + + if (ex == null) + Log.info(c, method, "No unexpected errors or warnings found in client logs."); + else + throw ex; + } else { + Log.info(c, method, "skipping log validation for client " + getClientName()); + } + } + + protected void clearMessageCounters() { + //this is because we will be getting a new log file + stopApplicationMessages.set(0); + startApplicationMessages.set(0); + } + + /** + * This method is used to tidy away the client logs at the start. + */ + protected void preStartClientLogsTidy() throws Exception { + //should be .../alpine/usr/clients//logs + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, getClientRoot() + "/logs"); + + // Look for javacore/heapdump/snap. These are collected by stop/archive. We don't need + // to collect them in the archive of every subsequent client run. + List files = listLibertyClientRoot(null, null); + for (String name : files) { + if (name.startsWith("javacore*") || name.startsWith("heapdump*") || name.startsWith("Snap*") || name.startsWith(clientToUse + ".dump")) { + deleteFileFromLibertyInstallRoot(name); + } + } + } + + /** + * This method is used to archive client logs after the client completes. + * Also, this will prevent the client log contents from being lost (over written) in a restart case. + */ + public void postStopClientArchive() throws Exception { + final String method = "postStopClientArchive"; + Log.entering(c, method); + try { + checkLogsForErrorsAndWarnings(); + } finally { + Log.info(c, method, "Moving logs to the output folder"); + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss"); + Date d = new Date(System.currentTimeMillis()); + this.logStamp = sdf.format(d); + + String logDirectoryName = pathToAutoFVTOutputClientsFolder + "/" + clientToUse + "-" + logStamp; + LocalFile logFolder = new LocalFile(logDirectoryName); + RemoteFile clientFolder = new RemoteFile(machine, clientRoot); + + runJextract(clientFolder); + + // Copy the log files: try to move them instead if we can + recursivelyCopyDirectory(clientFolder, logFolder, false, true, true); + + deleteClientMarkerFile(); + + Log.exiting(c, method); + } + } + + protected void runJextract(RemoteFile clientFolder) throws Exception { + RemoteFile[] files = clientFolder.list(false); + if (files != null) { + for (RemoteFile file : files) { + String filename = file.getAbsolutePath(); + if (filename.endsWith(".dmp")) { + + Properties envVars = new Properties(); + envVars.setProperty("JAVA_HOME", machineJava); + Log.info(c, "runJextract", "Running jextract on file: " + filename); + + String outputFilename = filename + ".zip.DMP"; //adding .DMP to ensure it is collected even when not collecting archives + String cmd = machineJava + "/bin/jextract"; + String[] parms = new String[] { filename, outputFilename }; + ProgramOutput output = machine.execute(cmd, parms, clientFolder.getAbsolutePath(), envVars); + Log.info(c, "runJextract stdout", output.getStdout()); + Log.info(c, "runJextract stderr", output.getStderr()); + Log.info(c, "runJextract", "rc = " + output.getReturnCode()); + } + } + } + } + + /** + * @param remoteFile + * @param logFolder + * @param b + * @param d + */ + protected void recursivelyCopyDirectory(RemoteFile remoteFile, LocalFile logFolder, boolean ignoreFailures) throws Exception { + recursivelyCopyDirectory(remoteFile, logFolder, ignoreFailures, false, false); + + } + + /** + * @param method + * @throws Exception + */ + protected void recursivelyCopyDirectory(RemoteFile remoteDirectory, LocalFile destination, boolean ignoreFailures, boolean skipArchives, boolean moveFile) throws Exception { + String method = "recursivelyCopyDirectory"; + Log.entering(c, method); + destination.mkdirs(); + + ArrayList logs = new ArrayList(); + logs = listDirectoryContents(remoteDirectory); + for (String l : logs) { + if (remoteDirectory.getName().equals("workarea")) { + if (l.equals("org.eclipse.osgi") || l.startsWith(".s")) { + // skip the osgi framework cache, and runtime artifacts: too big / too racy + Log.info(c, "recursivelyCopyDirectory", "Skipping workarea element " + l); + continue; + } + } + + if (remoteDirectory.getName().equals("messaging")) { + Log.info(c, "recursivelyCopyDirectory", "Skipping message store element " + l); + continue; + } + + RemoteFile toCopy = new RemoteFile(machine, remoteDirectory, l); + LocalFile toReceive = new LocalFile(destination, l); + Log.info(c, "recursivelyCopyDirectory", "Getting: " + toCopy.getAbsolutePath()); + + if (toCopy.isDirectory()) { + // Recurse + recursivelyCopyDirectory(toCopy, toReceive, ignoreFailures, skipArchives, moveFile); + } else { + try { + if (skipArchives + && (toCopy.getAbsolutePath().endsWith(".jar") + || toCopy.getAbsolutePath().endsWith(".war") + || toCopy.getAbsolutePath().endsWith(".ear") + || toCopy.getAbsolutePath().endsWith(".rar") + //If we're only getting logs, skip jars, wars, ears, zips, unless they are client dump zips + || (toCopy.getAbsolutePath().endsWith(".zip") && !toCopy.getName().contains(clientToUse + ".dump")))) { + Log.info(c, "recursivelyCopyDirectory", "Skipping: " + toCopy.getAbsolutePath()); + continue; + } + + // We're only going to attempt to move log files. Because of ffdc log checking, we + // can't move those. But we should move other log files.. + boolean isLog = (toCopy.getAbsolutePath().contains("logs") && !toCopy.getAbsolutePath().contains("ffdc")) + || toCopy.getName().contains("javacore") + || toCopy.getName().contains("heapdump") + || toCopy.getName().contains("Snap") + || toCopy.getName().contains(clientToUse + ".dump"); + + if (moveFile && isLog) { + boolean copied = false; + + // If we're local, try to rename the file instead.. + if (machine.isLocal() && toCopy.rename(toReceive)) { + copied = true; // well, we moved it, but it counts. + Log.info(c, "recursivelyCopyDirectory", "MOVE: " + l + " to " + toReceive.getAbsolutePath()); + } + + if (!copied && toReceive.copyFromSource(toCopy)) { + // copy was successful, clean up the source log + toCopy.delete(); + Log.info(c, "recursivelyCopyDirectory", "MOVE: " + l + " to " + toReceive.getAbsolutePath()); + } + } else { + toReceive.copyFromSource(toCopy); + Log.info(c, "recursivelyCopyDirectory", "COPY: " + l + " to " + toReceive.getAbsolutePath()); + } + } catch (Exception e) { + Log.info(c, "recursivelyCopyDirectory", "unable to copy or move " + l + " to " + toReceive.getAbsolutePath()); + // Ignore on request and carry on copying the rest of the files + if (!ignoreFailures) { + throw e; + } + } + } + + } + Log.exiting(c, method); + } + + /** + * This method will copy a file from the client root into the AutoFVT {@link #pathToAutoFVTTestFiles}/tmp folder. + * If you are copying a directory and some of the files cannot be copied due to an error then these errors will + * be ignored, this can happen if the client is still active and the files are locked by another process. + * + * If copying a file the destination will be overwritten. + * + * @param pathInClientRoot The path to the file or directory in the client root, must not start with a "/" + * @param destination The place within the temp folder to store this file, must not start with a "/" + * @return the LocalFile of the copied RemoteFile + * @throws Exception + */ + public LocalFile copyFileToTempDir(String pathInClientRoot, String destination) throws Exception { + return copyFileToTempDir(new RemoteFile(machine, clientRoot + "/" + pathInClientRoot), destination); + } + + /** + * This method will copy a file from the install root into the AutoFVT {@link #pathToAutoFVTTestFiles}/tmp folder. + * If you are copying a directory and some of the files cannot be copied due to an error then these errors will + * be ignored, this can happen if the client is still active and the files are locked by another process. + * + * If copying a file the destination will be overwritten. + * + * @param pathInInstallRoot The path to the file or directory in the install root, must not start with a "/" + * @param destination The place within the temp folder to store this file, must not start with a "/" + * @return the LocalFile of the copied RemoteFile + * @throws Exception + */ + public LocalFile copyInstallRootFileToTempDir(String pathInInstallRoot, String destination) throws Exception { + return copyFileToTempDir(new RemoteFile(machine, installRoot + "/" + pathInInstallRoot), destination); + } + + protected LocalFile copyFileToTempDir(RemoteFile remoteToCopy, String destination) throws Exception { + // Make sure the tmp dir exists + LocalFile tmpDir = new LocalFile(pathToAutoFVTTestFiles + "/tmp"); + if (!tmpDir.exists()) { + tmpDir.mkdir(); + } + + LocalFile localCopy = new LocalFile(pathToAutoFVTTestFiles + "/tmp/" + destination); + + if (remoteToCopy.isDirectory()) { + recursivelyCopyDirectory(remoteToCopy, localCopy, true); + } else { + localCopy.copyFromSource(remoteToCopy, false, true); + } + + return localCopy; + } + + public String getClientRoot() { + return clientRoot; + } + + public String getClientSharedPath() { + return clientRoot + "/../../shared/"; + } + + /** + * Get the collective dir under the client resources dir. For instance, + * this is where the collective trust stores are located. + * + * @return the path + */ + public String getCollectiveResourcesPath() { + return clientRoot + "/resources/collective/"; + } + + public void setClientRoot(String clientRoot) { + this.clientRoot = clientRoot; + } + + public String getMachineJavaJDK() { + return machineJava; + } + + public String getMachineJavaJarCommandPath() { + return machineJarPath; + } + + /* not called */public void setMachineJava(String machineJava) { + this.machineJava = machineJava; + } + + public void copyFileToLibertyInstallRoot(String fileName) throws Exception { + LibertyFileManager.copyFileIntoLiberty(machine, installRoot, (pathToAutoFVTTestFiles + "/" + fileName)); + } + + public void copyFileToLibertyInstallRoot(String extendedPath, String fileName) throws Exception { + LibertyFileManager.copyFileIntoLiberty(machine, installRoot + "/" + extendedPath, (pathToAutoFVTTestFiles + "/" + fileName)); + } + + protected void copyFileToLibertyClientRootUsingTmp(String path, String relPathTolocalFile) throws Exception { + LocalFile localFileToCopy = new LocalFile(LibertyServerUtils.makeJavaCompatible(relPathTolocalFile)); + LibertyFileManager.copyFileIntoLiberty(machine, path, localFileToCopy.getName(), relPathTolocalFile, false, clientRoot); + } + + public void copyFileToLibertyClientRoot(String fileName) throws Exception { + copyFileToLibertyClientRootUsingTmp(clientRoot, (pathToAutoFVTTestFiles + "/" + fileName)); + } + + public void copyFileToLibertyClientRoot(String extendedPath, String fileName) throws Exception { + copyFileToLibertyClientRootUsingTmp(clientRoot + "/" + extendedPath, (pathToAutoFVTTestFiles + "/" + fileName)); + } + + public void renameLibertyClientRootFile(String oldFileName, String newFileName) throws Exception { + LibertyFileManager.renameLibertyFile(machine, clientRoot + "/" + oldFileName, clientRoot + "/" + newFileName); + } + + public void renameLibertyInstallRootFile(String oldFileName, String newFileName) throws Exception { + LibertyFileManager.renameLibertyFile(machine, installRoot + "/" + oldFileName, installRoot + "/" + newFileName); + } + + public RemoteFile getFileFromLibertyInstallRoot(String filePath) throws Exception { + final String method = "getFileFromLibertyInstallRoot"; + Log.entering(c, method); + return getFileFromLiberty(installRoot + "/" + filePath); + } + + public RemoteFile getFileFromLibertyClientRoot(String filePath) throws Exception { + final String method = "getFileFromLibertyClientRoot"; + Log.entering(c, method); + return getFileFromLiberty(clientRoot + "/" + filePath); + } + + /* not called */public RemoteFile getFileFromLibertySharedDir(String filePath) throws Exception { + final String method = "getFileFromLibertySharedDir"; + Log.entering(c, method); + return getFileFromLiberty(getClientSharedPath() + filePath); + } + + protected RemoteFile getFileFromLiberty(String fullPath) throws Exception { + Log.info(c, "getFileFromLiberty", "Getting file: " + fullPath); + return LibertyFileManager.getLibertyFile(machine, fullPath); + } + + public boolean fileExistsInLibertyInstallRoot(String filePath) throws Exception { + final String method = "fileExistsInLibertyInstallRoot"; + Log.entering(c, method); + return libertyFileExists(installRoot + "/" + filePath); + } + + public boolean fileExistsInLibertyClientRoot(String filePath) throws Exception { + final String method = "fileExistsInLibertyClientRoot"; + Log.entering(c, method); + return libertyFileExists(clientRoot + "/" + filePath); + } + + /* not called */public boolean fileExistsInLibertySharedDir(String filePath) throws Exception { + final String method = "fileExistsInLibertySharedDir"; + Log.entering(c, method); + return libertyFileExists(getClientSharedPath() + filePath); + } + + protected boolean libertyFileExists(String fullPath) throws Exception { + boolean exists = LibertyFileManager.libertyFileExists(machine, fullPath); + Log.info(c, "libertyFileExists", "File: " + fullPath + " exists " + exists); + return exists; + } + + public String getClientName() { + return clientToUse; + } + + public void deleteFileFromLibertyInstallRoot(String filePath) throws Exception { + LibertyFileManager.deleteLibertyFile(machine, (installRoot + "/" + filePath)); + } + + public void deleteDirectoryFromLibertyInstallRoot(String directoryPath) throws Exception { + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, (installRoot + "/" + directoryPath)); + } + + public void deleteDirectoryFromLibertyClientRoot(String directoryPath) throws Exception { + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, (clientRoot + "/" + directoryPath)); + } + + public void deleteFileFromLibertyClientRoot(String filePath) throws Exception { + LibertyFileManager.deleteLibertyFile(machine, (clientRoot + "/" + filePath)); + } + + public RemoteFile getClientBootstrapPropertiesFile() throws Exception { + return new RemoteFile(machine, clientRoot + "/bootstrap.properties"); + } + + /** + * Non-recursively list the contents of the client install root directory, or if the relativePath + * parameter is non-null, the indicated directory (relative the the install root). If filter is + * non-null, return only those directory names or filenames that contain the filter string. + * + * @param relativeDir path to a directory relative to the install root directory, should not begin with path separator, may be null. + * @param filter string to filter the results by, returned file and directory names must contain this, may be null. + * @return a list of file and directory names indicating the contents of the specified directory. + * @throws Exception + */ + public List listLibertyInstallRoot(String relativeDir, String filter) throws Exception { + String path = installRoot; + if (relativeDir != null && !relativeDir.equals("")) { + path = path + "/" + relativeDir; + } + return listDirectoryContents(LibertyServerUtils.makeJavaCompatible(path), filter); + } + + /** + * Non-recursively list the contents of the client install root directory, or if the relativePath + * parameter is non-null, the indicated directory (relative the the install root). If filter is + * non-null, return only those directory names or filenames that contain the filter string. + * + * @param relativeDir path to a directory relative to the install root directory, should not begin with path separator, may be null. + * @param filter string to filter the results by, returned file and directory names must contain this, may be null. + * @return a list of file and directory names indicating the contents of the specified directory. + * @throws Exception + */ + public ArrayList listLibertyClientRoot(String relativeDir, String filter) throws Exception { + String path = clientRoot; + if (relativeDir != null && !relativeDir.equals("")) { + path = path + "/" + relativeDir; + } + return listDirectoryContents(LibertyServerUtils.makeJavaCompatible(path), filter); + } + + /** + * Method for returning the directory contents as a list of Strings representing first level file/dir names + * + * @return ArrayList of File/Directory names + * that exist at the first level i.e. it's not recursive. If it's a directory the String in the list is prefixed with a / + * @throws TopologyException + */ + protected ArrayList listDirectoryContents(RemoteFile clientDir) throws Exception { + return listDirectoryContents(clientDir, null); + + } + + protected ArrayList listDirectoryContents(String path, String fileName) throws Exception { + + RemoteFile clientDir = new RemoteFile(machine, path); + return listDirectoryContents(clientDir, fileName); + + } + + protected ArrayList listDirectoryContents(RemoteFile clientDir, String fileName) throws Exception { + + final String method = "clientDirectoryContents"; + Log.entering(c, method); + if (!clientDir.isDirectory() || !clientDir.exists()) + throw new TopologyException("The specified directoryPath \'" + + clientDir.getAbsolutePath() + "\' was not a directory"); + + RemoteFile[] firstLevelFiles = clientDir.list(false); + ArrayList firstLevelFileNames = new ArrayList(); + + for (RemoteFile f : firstLevelFiles) { + + if (fileName == null) { + firstLevelFileNames.add(f.getName()); + } else if (f.getName().contains(fileName)) { + firstLevelFileNames.add(f.getName()); + + } + } + + return firstLevelFileNames; + } + + public RemoteFile getMostRecentTraceFile() throws Exception { + List files = listDirectoryContents(logsRoot, DEFAULT_TRACE_FILE_PREFIX); + + if (files == null || files.isEmpty()) { + return null; + } + + RemoteFile rf = null; + long maxLastModified = 0; + for (int i = 0; i < files.size(); i++) { + final RemoteFile f = getTraceFile(files.get(i)); + if (f.lastModified() > maxLastModified) { + maxLastModified = f.lastModified(); + rf = f; + } + } + + return rf; + } + + public ArrayList listFFDCFiles(String client) throws Exception { + return listDirectoryContents(LibertyServerUtils.makeJavaCompatible(installRoot + "/usr/clients/" + client + "/logs/ffdc"), "ffdc"); + } + + public ArrayList listFFDCSummaryFiles(String client) throws Exception { + return listDirectoryContents(LibertyServerUtils.makeJavaCompatible(installRoot + "/usr/clients/" + client + "/logs/ffdc"), "exception_summary"); + } + + /* not called */public int getOsgiConsolePort() { + return osgiConsolePort; + } + + /** + * @return the iiopDefaultPort + */ + /* not called */public int getIiopDefaultPort() { + return iiopDefaultPort; + } + + /** + * @param iiopDefaultPort + * the iiopDefaultPort to set + */ + /* not called */public void setIiopDefaultPort(int iiopDefaultPort) { + this.iiopDefaultPort = iiopDefaultPort; + } + + public int getPort(PortType port) throws Exception { + Log.entering(c, "getPort", port); + int ret = 0; + switch (port) { + case OSGi: + ret = getOsgiConsolePort(); + break; + case IIOP: + ret = getIiopDefaultPort(); + case JMX_REST: + // ret = getPort("com.ibm.ws.admin.core.endpoint.JMXREST_defaultEP", + // 8880); + break; + default: + Exception e = new IllegalArgumentException("The specified PortType is not supported for Liberty: " + port); + Log.error(c, "getPort", e); + throw e; + } + Log.exiting(c, "getPort", ret); + return ret; + } + + public void setClientStartTimeout(long timeout) { + clientStartTimeout = timeout; + } + + /* not called */public long getClientStartTimeout() { + return clientStartTimeout; + } + + public String getBootstrapKey() { + return clientTopologyID; + } + + /** + * Method used to autoinstall apps in + * publish/clients//dropins folder found in the FAT project + * Under the covers this will not use the install functionality found in the + * ApplicationManager but use the Application Csar which is part of Liberty. + * + * @param appName The name of the application + * @throws Exception + */ + protected void autoInstallApp(String appName) throws Exception { + Log.info(c, "InstallApp", "Adding app " + appName + " to startup verification list"); + this.addInstalledAppForValidation(appName); + } + + /** + * Shortcut for new FATTests to install apps assuming the app is + * located in the publish/clients//apps folder of the FAT project + * + * @param appName The name of the application + * @throws Exception + */ + public void installApp(String appName) throws Exception { + Log.info(c, "InstallApp", "Installing from: " + pathToAutoFVTNamedClient + "apps/" + appName); + finalInstallApp(pathToAutoFVTNamedClient + "apps/" + appName); + } + + /** + * Shortcut for new FATTests to install apps located anywhere on the file system + * + * @param path The absolute path to the application + * @param appName The name of the application + * @throws Exception + */ + public void installApp(String path, String appName) throws Exception { + Log.info(c, "InstallApp", "Installing from: " + path + "/" + appName); + finalInstallApp(path + "/" + appName); + } + + /** + * Given a sample name that corresponds to a sample in a jar named .jar in + * the FAT files directory, runs the self extractor with the --downloadDependencies and + * --acceptLicense flag in order to create a working copy of the sample client for test. + * + * @param sample + * @return + * @throws Exception + */ + public ProgramOutput installSampleWithExternalDependencies(String sample) throws Exception { + Log.info(c, "installSampleWithExternalDependencies", "Installing sample '" + sample); + + List pathsToDelete = new ArrayList(); + + String sampleJarFileName = sample + ".jar"; + String sampleJarFilePath = installRoot + "/" + sampleJarFileName; + String javaFilePath = machineJava + "/bin/java"; + + LibertyFileManager.copyFileIntoLiberty(machine, installRoot, "lib/LibertyFATTestFiles/" + sampleJarFileName); + pathsToDelete.add(sampleJarFilePath); + + // Always have the accept license and download dependencies headers as we do not run the + // command in an interactive way. This is ok from a testing point of view as the interactive + // code is re-used from the self extracting JAR file where it is already being well tested + String[] args = new String[] { "-jar", sampleJarFilePath, "--downloadDependencies", "--acceptLicense", installRoot }; + + Log.info(c, "installSampleWithExternalDependencies", "Using args " + Arrays.toString(args)); + ProgramOutput po = machine.execute(javaFilePath, args); + + if (po.getReturnCode() == 0) { + Log.info(c, "installSampleWithExternalDependencies", "Successfully installed sample: " + sample); + } else { + Log.warning(c, "Sample install process failed with return code " + po.getReturnCode()); + Log.warning(c, "Sample install process failed with error " + po.getStderr()); + Log.warning(c, "Sample install process failed with output " + po.getStdout()); + throw new Exception("Could not install sample client - return code " + po.getReturnCode()); + } + + //Move the test client xml into sample.xml + RemoteFile sampleClientFile = LibertyFileManager.createRemoteFile(machine, getClientRoot() + "/sample.xml"); + LibertyFileManager.moveLibertyFile(getClientConfigurationFile(), sampleClientFile); + //And upload the FAT client XML that will include sample.xml + LibertyFileManager.copyFileIntoLiberty(machine, getClientRoot(), "client.xml", "productSampleClient.xml"); + + //Move the test client bootstrap.properties into sample.properties if it exists + RemoteFile clientBootStrapProps = new RemoteFile(machine, getClientRoot() + "/bootstrap.properties"); + if (clientBootStrapProps.exists()) { + //This is optional + RemoteFile samplePropertiesFile = LibertyFileManager.createRemoteFile(machine, getClientRoot() + "/sample.properties"); + LibertyFileManager.moveLibertyFile(clientBootStrapProps, samplePropertiesFile); + //And upload the FAT client properties that will include the sample properties + LibertyFileManager.copyFileIntoLiberty(machine, getClientRoot(), "bootstrap.properties", "productSample.properties"); + } else { + //Just take the testports, no include of existing config needed + LibertyFileManager.copyFileIntoLiberty(machine, getClientRoot(), "bootstrap.properties", "productSample_noBootstrap.properties"); + } + + for (String pathName : pathsToDelete) { + LibertyFileManager.deleteLibertyFile(machine, pathName); + } + + return po; + } + + /** + * Method used by exposed installApp methods that calls into the ApplicationManager + * to actually install the required application + * + * @param appPath Absoulte path to application (includes app name) + * @throws Exception + */ + protected void finalInstallApp(String appPath) throws Exception { + String onlyAppName = appPath; //for getting only the name if appName given is actually a path i.e. autoinstall/acme.zip + if (appPath.contains("/")) { + String[] s = appPath.split("/"); + onlyAppName = s[s.length - 1]; //get the last one as this will be the filename only + } else if (appPath.contains("\\\\")) { + String[] s = appPath.split("\\\\"); + onlyAppName = s[s.length - 1]; //get the last one as this will be the filename only + } + + if (onlyAppName.endsWith(".xml")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 4); + } + if (onlyAppName.endsWith(".ear") || onlyAppName.endsWith(".eba") || onlyAppName.endsWith(".war") || + onlyAppName.endsWith(".jar") || onlyAppName.endsWith(".rar") || onlyAppName.endsWith(".zip")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 4); + } + Log.finer(c, "InstallApp", "Application name is: " + onlyAppName); + + } + + public String getHostname() { + return machine.getHostname(); + } + + /** + * Shortcut for new FATTests to uninstall apps + * + * @param appName The name of the application + * @throws Exception + */ + public void uninstallApp(String appName) throws Exception { + ApplicationType type = this.getApplictionType(appName); + if (type.equals(ApplicationType.ZIP)) { + appName = appName.substring(0, (appName.length() - 4)); + } + + if (type.equals(ApplicationType.EAR) || type.equals(ApplicationType.WAR)) { + //do the same thing as above + appName = appName.substring(0, (appName.length() - 4)); + } + + } + + protected ApplicationType getApplictionType(String appName) throws Exception { + ApplicationType type = null; + if (appName.endsWith("zip") || appName.endsWith("ZIP")) { + type = ApplicationType.ZIP; + } else if (appName.endsWith("ear") || appName.endsWith("EAR")) { + type = ApplicationType.EAR; + } else if (appName.endsWith("war") || appName.endsWith("WAR")) { + type = ApplicationType.WAR; + } else if (appName.endsWith("eba") || appName.endsWith("EBA")) { + type = ApplicationType.EBA; + } + + if (type == null) { + //Application type not recognised + throw new TopologyException("Can't install the application " + appName + + " as the application type is not recognised. We only support WAR, EAR, ZIP or EBA"); + } + return type; + } + + protected String getJvmOptionsFilePath() { + return this.getClientRoot() + "/" + JVM_OPTIONS_FILE_NAME; + } + + protected RemoteFile getJvmOptionsFile() throws Exception { + return LibertyFileManager.createRemoteFile(this.machine, this.getJvmOptionsFilePath()); + } + + /** + * Reads the current jvm.options file into memory and returns the result. + * Lines with a '=' in the middle are treated as key-value mappings, + * and lines without a '=' character are treated as a key with an empty value. + * + * @return key/value pairs from the jvm.options file + * @throws Exception if the file can't be read + */ + public Map getJvmOptionsAsMap() throws Exception { + Map result = new LinkedHashMap(); + List options = this.getJvmOptions(); + for (String option : options) { + int equals = option.indexOf('='); + // if '=' is not the first or last character + if (equals > 0 && equals < (option.length() - 1)) { + String key = option.substring(0, equals); + String value = option.substring(equals + 1); + result.put(key, value); + } else { + result.put(option, ""); + } + } + return result; + } + + /** + * Reads the current jvm.options file into memory and returns the result. + * + * @return key/value pairs from the jvm.options file + * @throws Exception if the file can't be read + */ + protected List getJvmOptions() throws Exception { + ArrayList result = new ArrayList(); + RemoteFile file = this.getJvmOptionsFile(); + if (file == null || !file.exists()) { + return result; + } + LOG.info("Reading " + JVM_OPTIONS_FILE_NAME + " file: " + file); + BufferedReader in = null; + try { + in = new BufferedReader(new InputStreamReader(file.openForReading(), "UTF-8")); + String line = null; + while ((line = in.readLine()) != null) { + line = line.trim(); + if (line.isEmpty() || line.startsWith("#")) { + continue; + } + result.add(line); + } + } catch (Exception e) { + throw new IOException("Failed to read JVM options file: " + file, e); + } finally { + if (in != null) { + try { + in.close(); + } catch (Exception e) { + LOG.info("Failed to close InputStream for " + file + ". Exception: " + e.getMessage()); + } + } + } + LOG.info(JVM_OPTIONS_FILE_NAME + ": " + result); // tell the user which properties you're reading + return result; + } + + /** + *

    Writes a mapping of options to the jvm.options file. + * Note that all existing mappings will be overwritten. + * If this is not the desired behavior, call {@link #getJvmOptions()} to retrieve the existing mappings first, + * and then pass the updated map into this method.

    + *
      + *
    • Null or empty keys will be ignored.
    • + *
    • Non-empty keys mapped to a null or empty value will be added to jvm.options without a value (no '=' suffix).
    • + *
    • Non-empty keys mapped to a non-empty value will be added to jvm.options in the format: key=value.
    • + *
    + * + * @param options key/value pairs to set in the jvm.options file + * @throws Exception if the jvm.options file can't be written to. Note that this exception may indicate that the file is no longer formatted correctly. + * @see #getJvmOptions() + */ + public void setJvmOptions(Map options) throws Exception { + ArrayList optionList = new ArrayList(); + if (options != null) { + for (Map.Entry entry : options.entrySet()) { + String key = entry.getKey(); + if (key == null) { + continue; + } + key = key.trim(); + if (key.isEmpty()) { + continue; + } + StringBuilder option = new StringBuilder(key); + String value = entry.getValue(); + if (value != null) { + value = value.trim(); + if (!value.isEmpty()) { + option.append("="); + option.append(value); + } + } + optionList.add(option.toString()); + } + } + this.setJvmOptions(optionList); + } + + public void setJvmOptions(List options) throws Exception { + // Step 1: Write options to local temporary file + File tmpFile = File.createTempFile("client.jvm", "options"); + LOG.info("Writing temporary " + JVM_OPTIONS_FILE_NAME + " file: " + tmpFile); + LOG.info(JVM_OPTIONS_FILE_NAME + ": " + options); // tell the user which properties you're setting + BufferedWriter out = null; + try { + out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tmpFile), "UTF-8")); + out.write("#Updated by " + this.getClass().getName() + " on " + DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(new Date())); + out.newLine(); + if (options != null) { + for (String option : options) { + if (option == null) { + continue; + } + String line = option.trim(); + if (line.isEmpty()) { + continue; + } + out.write(line); + out.newLine(); + } + } + } catch (Exception e) { + tmpFile.delete(); + throw new IOException("Failed to write JVM options to local temporary file " + tmpFile, e); + } finally { + if (out != null) { + try { + out.close(); + } catch (Exception e) { + LOG.info("Failed to close OutputStream for " + tmpFile + ". Exception: " + e.getMessage()); + } + } + } + + // Step 3: Copy temporary file to remote machine, and delete temporary file + RemoteFile remoteFile = null; + try { + remoteFile = this.getJvmOptionsFile(); // won't return null + LibertyFileManager.copyFileIntoLiberty(machine, remoteFile.getParent(), remoteFile.getName(), tmpFile.getAbsolutePath(), false); + } catch (Exception e) { + throw new IOException("Failed to write JVM options to " + remoteFile, e); + } finally { + tmpFile.delete(); + } + } + + public void deleteDropinDefaultConfiguration(String fileName) throws Exception { + deleteDropinConfiguration(fileName, true); + } + + public void deleteDropinOverrideConfiguration(String fileName) throws Exception { + deleteDropinConfiguration(fileName, false); + } + + private void deleteDropinConfiguration(String fileName, boolean isDefault) throws Exception { + String location = getClientRoot() + "/configDropins/defaults/" + fileName; + if (!isDefault) + location = getClientRoot() + "/configDropins/overrides/" + fileName; + + LibertyFileManager.deleteLibertyFile(machine, location); + } + + public void deleteAllDropinConfigurations() throws Exception { + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, getClientRoot() + "/configDropins"); + } + + public void addDropinDefaultConfiguration(String fileName) throws Exception { + addDropinConfiguration(fileName, true); + } + + public void addDropinOverrideConfiguration(String fileName) throws Exception { + addDropinConfiguration(fileName, false); + } + + private void addDropinConfiguration(String fileName, boolean isDefault) throws Exception { + String location = getClientRoot() + "/configDropins"; + if (isDefault) + location += "/defaults"; + else + location += "/overrides"; + + waitIfNeeded(); + LibertyFileManager.moveFileIntoLiberty(machine, location, new File(fileName).getName(), pathToAutoFVTTestFiles + "/" + fileName); + + lastConfigUpdate = System.currentTimeMillis(); + } + + private void waitIfNeeded() throws Exception { + String osName = System.getProperty("os.name"); + boolean isUnix = !(osName.startsWith("win") || osName.startsWith("Win")); + boolean lastConfigLessThanOneSecAgo = (System.currentTimeMillis() - lastConfigUpdate) < 1000; + + Log.finer(c, "replaceClientConfiguration", "isUnix=" + isUnix + " lastConfigLessThanOneSecAgo=" + lastConfigLessThanOneSecAgo); + if (lastConfigLessThanOneSecAgo && isUnix) { + // Due to a java limitation on Unix, we need to wait at least + // 1 second between config updates so the client can see it. + // See https://www-01.ibm.com/support/docview.wss?uid=swg21446506 + // Note that the above page says that it affects versions up to 1.6, but if you look at the sun bug it is not fixed until java 8. + Log.finer(c, "replaceClientConfiguration", "Sleeping for 1 second to work around Unix / JDK limitation fixed in Java 8"); + Thread.sleep(1000); + } + } + + /** + * Replaces the client configuration. This encapsulates the necessary logic + * to deal with system / JDK idiosyncrasies. + * + * @param fileName + * @throws Exception + */ + protected void replaceClientConfiguration(String fileName) throws Exception { + waitIfNeeded(); + + LibertyFileManager.moveFileIntoLiberty(machine, getClientRoot(), "client.xml", fileName); + lastConfigUpdate = System.currentTimeMillis(); + } + + /** + * This will put the named file into the root directory of the client and name it client.xml. As the file name is changed if you want to copy files for use in an include + * statement or if the location of the config file is being changed using the was.configroot.uri property or --config-root command line then you should use the + * {@link #copyFileToLibertyInstallRoot(String)} method. + * + * @param fileName The name of the file from the FVT test suite + * @throws Exception + */ + public void setClientConfigurationFile(String fileName) throws Exception { + replaceClientConfiguration(pathToAutoFVTTestFiles + "/" + fileName); + Thread.sleep(200); // Sleep for 200ms to ensure we do not process the file "too quickly" by a subsequent call + } + + /** + * This will save the current client configuration, so that it can be restored later on via the + * restoreClientConfiguration method. + * + * @throws Exception + */ + public void saveClientConfiguration() throws Exception { + try { + savedClientXml = new RemoteFile(machine, clientRoot + "/savedClientXml" + System.currentTimeMillis() + ".xml"); + getClientConfigurationFile().copyToDest(savedClientXml); + } catch (Exception e) { + savedClientXml = null; + throw e; + } + } + + /** + * This will restore the client configuration that was saved by a prior call to the + * saveClientConfiguration method. + * + * @throws Exception + */ + public void restoreClientConfiguration() throws Exception { + if (savedClientXml == null) { + throw new RuntimeException("The client configuration cannot be restored because it was never saved via the saveClientConfiguration method."); + } + getClientConfigurationFile().copyFromSource(savedClientXml); + } + + public String getClientConfigurationPath() { + return this.getClientRoot() + "/" + CLIENT_CONFIG_FILE_NAME; + } + + public RemoteFile getClientConfigurationFile() throws Exception { + return LibertyFileManager.getLibertyFile(machine, getClientConfigurationPath()); + } + + /** + * This will load the {@link ClientConfiguration} from the default config file returned from {@link #getClientConfigurationFile()}. + * + * @return The loaded {@link ClientConfiguration} + * @throws Exception + */ + public ClientConfiguration getClientConfiguration() throws Exception { + RemoteFile file = getClientConfigurationFile(); + return getClientConfiguration(file); + } + + /** + * This gets the {@link ClientConfiguration} for the supplied XML file. + * + * @param file The file to load the client configuration from + * @return The loaded {@link ClientConfiguration} + * @throws Exception + */ + public ClientConfiguration getClientConfiguration(RemoteFile file) throws Exception { + return ClientConfigurationFactory.getInstance().unmarshal(file.openForReading()); + } + + public void updateClientConfiguration(File clientConfig) throws Exception { + replaceClientConfiguration(clientConfig.getAbsolutePath()); + + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Client configuration updated from: " + clientConfig); + logClientConfiguration(Level.INFO, false); + } + } + + /** + * This updates the supplied file with the supplied config. + * + * @param clientConfig The config to store to the file + * @param file The file to store the config to + * @throws Exception + */ + public void updateClientConfiguration(ClientConfiguration clientConfig, RemoteFile file) throws Exception { + // write contents to a temporary file + RemoteFile newClientFile = LibertyFileManager.createRemoteFile(machine, getClientConfigurationPath() + ".tmp"); + OutputStream os = newClientFile.openForWriting(false); + ClientConfigurationFactory.getInstance().marshal(clientConfig, os); + + if (newClientFile.length() == file.length()) { + clientConfig.setDescription(clientConfig.getDescription() + " (this is some random text to make the file size bigger)"); + os = newClientFile.openForWriting(false); + ClientConfigurationFactory.getInstance().marshal(clientConfig, os); + } + + // replace the file + // This logic does not need to be time protected (as we do in method + // replaceClientConfiguration) because of the "extra random text" logic + // above. Even if the timestamp would not be changed, the size out be. + LibertyFileManager.moveLibertyFile(newClientFile, file); + + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Client configuration updated:"); + logClientConfiguration(Level.INFO, false); + } + } + + /** + * This stores the supplied content to the default client XML file returned from {@link #getClientConfigurationFile()}. + * + * @param clientConfig The configuration to store + * @throws Exception + */ + public void updateClientConfiguration(ClientConfiguration clientConfig) throws Exception { + updateClientConfiguration(clientConfig, getClientConfigurationFile()); + } + + /** + * Logs the contents of a File. If singleLine=true, then the + * whole File will be logged as one single message. Otherwise, each + * individual line in the file will be logged separately. Some logging + * formatters look prettier with single line log messages; others look + * better with multiple-line log messages. + * + * @param file + * the file whose contents you want to log. + * @param singleLine + * true to log the whole file in one message, false to log each + * individual line + */ + protected void logClientConfiguration(Level level, boolean singleLine) { + String method = "logClientConfiguration"; + BufferedReader reader = null; + try { + StringWriter stringWriter = null; + PrintWriter printWriter = null; + reader = new BufferedReader(new InputStreamReader(this.getClientConfigurationFile().openForReading())); + if (singleLine) { + stringWriter = new StringWriter(); + printWriter = new PrintWriter(stringWriter); + } + String line; + while ((line = reader.readLine()) != null) { + if (singleLine) { + printWriter.println(line); + } else { + LOG.logp(level, CLASS_NAME, method, line); + } + } + if (singleLine) { + LOG.logp(level, CLASS_NAME, method, stringWriter.toString()); + } + } catch (Exception e) { + LOG.logp(level, CLASS_NAME, method, "Failed to read " + this.getClientConfigurationPath() + ". Exception: " + e.getMessage()); + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + LOG.logp(level, CLASS_NAME, method, "Failed to close reader for " + this.getClientConfigurationPath() + ". Exception: " + e.getMessage()); + } + } + } + } + + public RemoteFile getConsoleLogFile() throws Exception { + // Find the currently configured/in-use console log file. + final RemoteFile remoteFile; + if (machineOS == OperatingSystem.ZOS) { + remoteFile = new RemoteFile(machine, consoleAbsPath, Charset.forName(EBCDIC_CHARSET_NAME)); + } else { + remoteFile = new RemoteFile(machine, consoleAbsPath); + } + return remoteFile; + } + + public RemoteFile getDefaultLogFile() throws Exception { + //Set path to client log assuming the default setting. + // ALWAYS RETURN messages.log -- tests assume they can look for INFO+ messages. + RemoteFile file = LibertyFileManager.getLibertyFile(machine, messageAbsPath); + if (file == null) { + throw new IllegalStateException("Unable to find default log file, path=" + messageAbsPath); + } + return file; + } + + protected String getDefaultLogPath() { + try { + RemoteFile file = getDefaultLogFile(); + return file.getAbsolutePath(); + } catch (Exception ex) { + return "DefaultLogFile"; + } + } + + protected RemoteFile getTraceFile(String fileName) throws Exception { + String fileAbsPath = logsRoot + fileName; + return LibertyFileManager.getLibertyFile(machine, fileAbsPath); + } + + public RemoteFile getFFDCLogFile(String ffdcName) throws Exception { + return LibertyFileManager.getLibertyFile(machine, (logsRoot + "ffdc/" + ffdcName)); + } + + public RemoteFile getFFDCSummaryFile(String ffdcSummary) throws Exception { + return LibertyFileManager.getLibertyFile(machine, (logsRoot + "ffdc/" + ffdcSummary)); + } + + /** + * Search for a file matching the given regex in the logs location. + * This is just a utility, primarily for pulling out a trace file without + * worrying about the timestamp, it isn't very clever and just returns + * the first match it finds. + * + * @param regex + * @return a matching RemoteFile, or null if no match was found + */ + public RemoteFile getMatchingLogFile(String regex) throws Exception { + Log.info(c, "getMatchingLogFile", "Looking for file matching regex: " + regex + " in " + logsRoot + " on " + machine); + RemoteFile logsDir = LibertyFileManager.getLibertyFile(machine, logsRoot); + RemoteFile[] logFiles = logsDir.list(false); + for (RemoteFile r : logFiles) { + if (r.isFile()) { + if (Pattern.matches(regex, r.getName())) { + Log.info(c, "getMatchingLogFile", "Matched log file: " + r.getName()); + return r; + } + } + } + Log.info(c, "getMatchingLogFile", "No matching log file found."); + return null; + } + + /** + * This method will search the given file on this client for the specified expression. + * The path given is relative to the install root directory. + * + * @param regexp pattern to search for. + * @param filePath the pathname relative to the install root directory. + * @return A list of the lines in the file that contains the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + /* not called */public List findStringsInFileInLibertyInstallRoot(String regexp, String filePath) throws Exception { + RemoteFile remoteFile = LibertyFileManager.getLibertyFile(machine, (installRoot + "/" + filePath)); + List strings = LibertyFileManager.findStringsInFile(regexp, remoteFile); + return strings; + } + + /** + * This method will search the given file on this client for the specified expression. + * The path given is relative to the client root directory. + * + * @param regexp pattern to search for. + * @param filePath the pathname relative to the client root directory. + * @return A list of the lines in the file that contains the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + public List findStringsInFileInLibertyClientRoot(String regexp, String filePath) throws Exception { + + /* + * On z/os, the console log will be produced in EBCDIC. We know other logs are ASCII, and + * so we can comfortably special case the console. + */ + final RemoteFile remoteFile; + String absolutePath = clientRoot + "/" + filePath; + if (machineOS == OperatingSystem.ZOS && absolutePath.equalsIgnoreCase(consoleAbsPath)) { + remoteFile = new RemoteFile(machine, absolutePath, Charset.forName(EBCDIC_CHARSET_NAME)); + } else { + remoteFile = LibertyFileManager.getLibertyFile(machine, absolutePath); + } + List strings = LibertyFileManager.findStringsInFile(regexp, remoteFile); + return strings; + } + + /** + * This method will search the output and trace files for this client + * for the specified expression. The default trace prefix is assumed. + * + * @param regexp pattern to search for + * @return A list of the lines in the trace files which contain the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + public List findStringsInLogs(String regexp) throws Exception { + return findStringsInLogs(regexp, getDefaultLogFile()); + } + + public List findStringsInCopiedLogs(String regexp) throws Exception { + String logFile = pathToAutoFVTOutputClientsFolder + "/" + clientToUse + "-" + logStamp + "/logs/messages.log"; + RemoteFile remoteLogFile = new RemoteFile(machine, logFile); + return findStringsInLogs(regexp, remoteLogFile); + } + + /** + * This method will search the output and trace files for this client + * for the specified expression. The default trace prefix is assumed. + * + * @param regexp pattern to search for + * @return A list of the lines in the trace files which contain the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + public List findStringsInLogs(String regexp, RemoteFile logFile) throws Exception { + List matches = new ArrayList(); + + List lines = LibertyFileManager.findStringsInFile(regexp, logFile); + if (!lines.isEmpty()) { + matches.addAll(lines); + } + return matches; + } + + /** + * This method will search the output and trace files for this client + * for the specified expression. The default trace prefix is assumed. + * + * @param regexp pattern to search for + * @return A list of the lines in the trace files which contain the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + public List findStringsInLogsAndTrace(String regexp) throws Exception { + return findStringsInLogsAndTrace(regexp, DEFAULT_TRACE_FILE_PREFIX); + } + + /** + * This method will search the output and trace files for this client + * for the specified expression. + * + * @param regexp pattern to search for + * @param traceFileNamePrefix trace file prefix if the trace file name is not default + * @return A list of the lines in the trace files which contain the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + /* not called */public List findStringsInLogsAndTrace(String regexp, String traceFileNamePrefix) throws Exception { + List matches = new ArrayList(); + + List lines = LibertyFileManager.findStringsInFile(regexp, getDefaultLogFile()); + if (!lines.isEmpty()) { + matches.addAll(lines); + } + + List traceLogsBaseNames = listDirectoryContents(logsRoot, traceFileNamePrefix); + for (String logBaseName : traceLogsBaseNames) { + RemoteFile logFile = getTraceFile(logBaseName); + lines = LibertyFileManager.findStringsInFile(regexp, logFile); + if (!lines.isEmpty()) { + matches.addAll(lines); + } + } + return matches; + } + + /** + * This method will search the trace files for this client + * for the specified expression. + * + * @param regexp pattern to search for + * @param traceFileNamePrefix trace file prefix if the trace file name is not default + * @return A list of the lines in the trace files which contain the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + public List findStringsInTrace(String regexp) throws Exception { + List matches = new ArrayList(); + + List traceLogsBaseNames = listDirectoryContents(logsRoot, DEFAULT_TRACE_FILE_PREFIX); + + System.out.println("traceLogsBaseNames: " + traceLogsBaseNames == null ? "null" : traceLogsBaseNames.size()); + for (String logBaseName : traceLogsBaseNames) { + RemoteFile logFile = getTraceFile(logBaseName); + System.out.println("Looking in " + logBaseName); + List lines = LibertyFileManager.findStringsInFile(regexp, logFile); + if (!lines.isEmpty()) { + matches.addAll(lines); + } + } + return matches; + } + + /** + * This method will search for the provided expression in the log and trace files + * on an incremental basis using the default trace prefix. It starts with reading + * the file at the offset where the last mark was set (or the beginning of the file + * if no mark has been set) and reads until the end of the file. + * + * @param regexp pattern to search for + * @return A list of the lines in the trace files which contain the matching + * pattern. No matches result in an empty list. + * @throws Exception + */ + public List findStringsInLogsAndTraceUsingMark(String regexp) throws Exception { + return findStringsInLogsAndTraceUsingMark(regexp, DEFAULT_TRACE_FILE_PREFIX); + } + + /** + * This method will search for the provided expression in the log and trace files + * on an incremental basis using a custom trace prefix. It starts with reading the + * file at the offset where the last mark was set (or the beginning of the file + * if no mark has been set) and reads until the end of the file. + * + * @param regexp pattern to search for + * @param traceFileNamePrefix trace file prefix if the trace file name is not default + * @return A list of the lines in the trace files which contain the matching + * pattern. No matches result in an empty list. + * @throws Exception + */ + protected List findStringsInLogsAndTraceUsingMark(String regexp, String traceFileNamePrefix) throws Exception { + + List matches = new ArrayList(); + LogSearchResult newOffsetAndMatches; + + Long offset = getMarkOffset(getDefaultLogPath()); + newOffsetAndMatches = LibertyFileManager.findStringsInFile(regexp, getDefaultLogFile(), offset); + matches.addAll(newOffsetAndMatches.getMatches()); // get the list of matches found + + List traceLogBaseNames = listDirectoryContents(logsRoot, traceFileNamePrefix); + for (String name : traceLogBaseNames) { + + offset = getMarkOffset(logsRoot + name); + newOffsetAndMatches = LibertyFileManager.findStringsInFile(regexp, getTraceFile(name), offset); + + matches.addAll(newOffsetAndMatches.getMatches()); // get the list of matches found + } + + return matches; + } + + /** + * This method will search for the provided expressions in the log and trace files + * on an incremental basis using the default trace prefix. It starts with reading the file + * at the offset where the last mark was set (or the beginning of the file + * if no mark has been set) and reads until the end of the file. + * + * @param regexpList a list of expressions to search for + * @return a List<String> containing the matches + * @throws Exception + */ + public List findStringsInLogsAndTraceUsingMarkMultiRegexp(List regexpList) throws Exception { + return findStringsInLogsAndTraceUsingMarkMultiRegexp(regexpList, DEFAULT_TRACE_FILE_PREFIX); + } + + /** + * This method will search for the provided expressions in the log and trace files + * on an incremental basis using a custom trace prefix. It starts with reading the file + * at the offset where the last mark was set (or the beginning of the file + * if no mark has been set) and reads until the end of the file. + * + * @param regexpList a list of expressions to search for + * @param traceFileNamePrefix trace file prefix if the trace file name is not default + * @return a List<String> contains the matches + * @throws Exception + */ + protected List findStringsInLogsAndTraceUsingMarkMultiRegexp(List regexpList, String traceFileNamePrefix) throws Exception { + + List matches = new ArrayList(); + LogSearchResult newOffsetAndMatches; + + Long offset = getMarkOffset(getDefaultLogPath()); + newOffsetAndMatches = LibertyFileManager.findStringsInFile(regexpList, getDefaultLogFile(), offset); + matches.addAll(newOffsetAndMatches.getMatches()); // get the list of matches found + + List traceLogBaseNames = listDirectoryContents(logsRoot, traceFileNamePrefix); + for (String name : traceLogBaseNames) { + + offset = getMarkOffset(logsRoot + name); + newOffsetAndMatches = LibertyFileManager.findStringsInFile(regexpList, getTraceFile(name), offset); + + matches.addAll(newOffsetAndMatches.getMatches()); // get the list of matches found + } + + return matches; + + } + + /** + * Reset offset values for logs back to the start of the file. + *

    + * Note: This method doesn't set the offset values to the beginning of the file per se, + * rather this method sets the list of logs and their offset values to null. When one + * of the findStringsInLogsAndTrace...(...) methods are called, it will recreate the + * list of logs and set each offset value to 0L - the start of the file. + */ + public void resetLogOffsets() { + logOffsets.clear(); + logMarks.clear(); + Log.info(LibertyClient.class, "resetLogOffsets", "cleared log and mark offsets"); + } + + /** + * Set the mark offset to the end of the log file. + * + * @param log files to mark. If none are specified, the default log file is marked. + */ + public void setMarkToEndOfLog(RemoteFile... logFiles) throws Exception { + if (logFiles == null || logFiles.length == 0) + logFiles = new RemoteFile[] { getDefaultLogFile() }; + + for (RemoteFile logFile : logFiles) { + String path = logFile.getAbsolutePath(); + + long offset; + BufferedInputStream input = new BufferedInputStream(logFile.openForReading()); + try { + int available = input.available(); + offset = input.skip(available); + while (input.read() != -1) { + offset++; + } + } finally { + input.close(); + } + + Long oldMarkOffset = logMarks.put(path, offset); + Log.info(LibertyClient.class, "setMarkToEndOfLog", path + ", old mark offset=" + oldMarkOffset + ", new mark offset=" + offset); + } + } + + /** + * Get the mark offset for the specified log file. + */ + protected Long getMarkOffset(String logFile) { + + String method = "getMarkOffset"; + Log.finer(c, method, logFile); + + if (!logMarks.containsKey(logFile)) { + Log.finer(c, method, "file does not exist in logMarks, set initial offset"); + logMarks.put(logFile, 0L); + } + + Log.info(LibertyClient.class, "getMarkOffset", "mark offset=" + logMarks.get(logFile)); + return logMarks.get(logFile); + } + + /** + * Get the offset into a log or trace file of the last message inspected. + * + * If the file name does not exist in the offsets, then create an entry for it and + * set the offset for that file to '0'. + * + * @param String value of the file name + * @return Long containing the offset into the file of the last message inspected + */ + protected Long getLogOffset(String logFile) { + + String method = "getLogOffset"; + Log.finer(c, "getLogOffset", logFile); + + if (!logOffsets.containsKey(logFile)) { + Log.finer(c, method, "file does not exist in logOffsets, set initial offset"); + logOffsets.put(logFile, 0L); + } + + Log.info(LibertyClient.class, "getLogOffset", "log offset=" + logOffsets.get(logFile)); + return logOffsets.get(logFile); + } + + /** + * Update the log offset for the specified log file to the offset provided. + */ + public void updateLogOffset(String logFile, Long newLogOffset) { + Long oldLogOffset = logOffsets.put(logFile, newLogOffset); + Log.info(LibertyClient.class, "updateLogOffset", "old log offset=" + oldLogOffset + ", new log offset=" + newLogOffset); + } + + /** + * Returns a subset of the supplied application names that appear to be installed based on the presence of messages in messages.log. + * + * @param possiblyInstalledAppNames list of application names to check if installed. The names should be sufficiently unique (not substrings of other names). + * @return a subset of the supplied application names that appear to be installed based on the presence of messages in messages.log. + * @throws Exception if an error occurs. + */ + public Set getInstalledAppNames(String... possiblyInstalledAppNames) throws Exception { + // Messages for installed/updated: + // CWWKZ0001I: Application [name] started in 0.456 seconds. + // CWWKZ0003I: The application [name] updated in 0.258 seconds. + // J2CA7001I: Resource adapter [name] installed in 0.613 seconds. + // J2CA7003I: The resource adapter [name] updated in 0.120 seconds. + + // Messages for uninstalled: + // CWWKZ0009I: The application [name] has stopped successfully. + // J2CA7009I: The resource adapter [name] has uninstalled successfully. + + Set subset = new TreeSet(); + + if (possiblyInstalledAppNames.length > 0) { + Map counters = new HashMap(); + for (String name : possiblyInstalledAppNames) + counters.put(name, 0); + + for (String line : findStringsInFileInLibertyClientRoot(".*((CWWKZ0)|(J2CA7))00[139]I: .*", "logs/messages.log")) + for (String name : possiblyInstalledAppNames) + if (line.contains(name)) + counters.put(name, counters.get(name) + (line.contains("009I: ") ? -1 : 1)); + + for (Map.Entry entry : counters.entrySet()) + if (entry.getValue() > 0) + subset.add(entry.getKey()); + } + + return subset; + } + + /** + * Wait for completion of a configuration update and feature updates associated with it. + * If feature updates are started (CWWKF0007I) before the CWWKG0017I message (config updates completed), + * then this method waits for corresponding feature update completed messages (CWWKF0008I). + * If a list of application names is supplied, this method waits for all of the apps to be started. + * The offset is incremented every time this method is called. + * + * @param appNames optional list of names of applications that should be started before returning from this method. + * @param regexps optional list of regular expressions that indicate additional messages to wait for. The list should NOT include + * the CWWKG0017I, CWWKG0018I, CWWKF0007I or CWWKF0007I messages, as those are implicitly handled by this method. + * + * @return list of lines containing relevant messages. + */ + public List waitForConfigUpdateInLogUsingMark(Set appNames, + String... regexps) throws Exception { + return waitForConfigUpdateInLogUsingMark(appNames, false, regexps); + } + + /** + * Wait for completion of a configuration update and feature updates associated with it. + * If feature updates are started (CWWKF0007I) before the CWWKG0017I message (config updates completed), + * then this method waits for corresponding feature update completed messages (CWWKF0008I). If optionally + * specified that a feature update must happen, regardless of when CWWKG0017I appears, CWWKF0008I will + * be waited for. If a list of application names is supplied, this method waits for all of the apps to be started. + * The offset is incremented every time this method is called. + * + * @param appNames optional list of names of applications that should be started before returning from this method. + * @param waitForFeatureUpdateCompleted if true, this method will require a feature updated completed message + * before returning (if false, it will only wait for this message if a feature update is started + * before the config update is completed) + * @param regexps optional list of regular expressions that indicate additional messages to wait for. The list should NOT include + * the CWWKG0017I, CWWKG0018I, CWWKF0007I or CWWKF0007I messages, as those are implicitly handled by this method. + * + * @return list of lines containing relevant messages. + */ + public List waitForConfigUpdateInLogUsingMark(Set appNames, + boolean waitForFeatureUpdateCompleted, + String... regexps) throws Exception { + final String methodName = "waitForConfigUpdateInLogUsingMark"; + final long timeout = LOG_SEARCH_TIMEOUT; + + final List matchingLines = new LinkedList(); + final List watchFor = new LinkedList(); + if (regexps != null) + for (String regexp : regexps) + watchFor.add(regexp); + watchFor.add("CWWKG001[7-8]I"); // Always wait for the config update completed or no changes detected message + watchFor.add("CWWKF0007I:"); // Feature update started - as many times as we see this, we need to wait for a corresponding Feature update completed + + // If the calling test indicates that a feature update message is required, explicitly + // add it. Otherwise if a feature update starts (CWWKF0007I) before the config update + // finishes it will be added below. + if (waitForFeatureUpdateCompleted) { + watchFor.add("CWWKF0008I:"); + } + + if (appNames == null) + appNames = Collections.emptySet(); + String[] appNamesArray = appNames.toArray(new String[appNames.size()]); + + RemoteFile logFile = getDefaultLogFile(); + + Set startedAppNames = Collections.emptySet(); + + int count = 0; + final long startTime = System.currentTimeMillis(); + try { + long offset; + for (offset = getMarkOffset(logFile.getAbsolutePath()); System.currentTimeMillis() - startTime < timeout + && (!startedAppNames.containsAll(appNames) + || watchFor.size() > 1); startedAppNames = getInstalledAppNames(appNamesArray)) { + // Periodically print diagnostic info if waiting a long time + long waited = System.currentTimeMillis() - startTime; + if (++count % 10 == 0) + Log.info(LibertyClient.class, methodName, "waited " + waited + "ms" + + ", startedAppNames=" + startedAppNames + + ", appNames=" + appNames + + ", contains? " + startedAppNames.containsAll(appNames) + + ", watchFor=" + watchFor); + + LogSearchResult newOffsetAndMatches = LibertyFileManager.findStringsInFileCommon(watchFor, 1, logFile, offset); + offset = newOffsetAndMatches.getOffset(); + List matches = newOffsetAndMatches.getMatches(); + if (matches.isEmpty()) { + if (waited < count * WAIT_INCREMENT) + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + } else { + String line = matches.get(0); + matchingLines.add(line); + + // Indicates a feature updated was started. + if (line.contains("CWWKF0007I:")) { + // If we haven't already added the message id for the feature update to complete, + // do so now. + if (!waitForFeatureUpdateCompleted) { + watchFor.add("CWWKF0008I:"); // Feature update completed in X seconds. + } + } else + // Remove the corresponding regexp from the watchFor list + for (Iterator it = watchFor.iterator(); it.hasNext();) { + String regexp = it.next(); + if (Pattern.compile(regexp).matcher(line).find()) { + it.remove(); + break; + } + } + } + } + updateLogOffset(logFile.getAbsolutePath(), offset); + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(LibertyClient.class, methodName, "Started waiting for CWWKG001[7-8]I and messages matching regexps " + + Arrays.asList(regexps) + " at " + formatter.format(new Date(startTime)) + + " and finished at " + formatter.format(new Date(endTime)) + + ". Found: " + matchingLines); + } + + // Check if we timed out + watchFor.remove("CWWKF0007I:"); + List notStartedAppNames = new LinkedList(appNames); + notStartedAppNames.removeAll(startedAppNames); + if (watchFor.size() > 0 || notStartedAppNames.size() > 0) { + String message = "Timed out waiting for " + notStartedAppNames + + " and/or searching for " + watchFor + + " in log file: " + logFile.getAbsolutePath() + + ". Extra info: value of (watchFor.size() > 0): " + (watchFor.size() > 0) + + ", value of (notStartedAppNames.size() > 0): " + (notStartedAppNames.size() > 0); + Log.warning(c, message); + throw new RuntimeException(message); + } + + return matchingLines; + } + + /** + * This method will time out after a sensible period of + * time has elapsed. + * + * @param regexp a regular expression to search for + * @return the matching line in the log, or null if no matches + * appear before the timeout expires + */ + public String waitForStringInLog(String regexp) { + String methodName = "waitForStringInLog()"; + if (regexp.startsWith("CWWKZ0001I")) { + int index = 10; + if (regexp.length() > index && regexp.charAt(index) == ':') { + index++; + } + if (regexp.length() > index + 2 && regexp.charAt(index) == '.' && regexp.charAt(index + 1) == '*') { + index += 2; + String appName = regexp.substring(index).trim(); + if (appName.length() > 0) { + try { + validateAppLoaded(appName); + System.out.println(methodName + ": Application " + appName + " started"); + return "Application " + appName + " started"; + } catch (Exception ex) { + System.out.println(methodName + ": Application " + appName + " did not start"); + throw new RuntimeException(ex); + } + } + } + } + return waitForStringInLogUsingMark(regexp); + } + + /** + * This method will time out after a sensible period of + * time has elapsed. + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression to search for + * @return the number of matches in the log, or 0 if no matches + * appear before the timeout expires + */ + public int waitForMultipleStringsInLog(int numberOfMatches, String regexp) { + return waitForMultipleStringsInLog(numberOfMatches, regexp, LOG_SEARCH_TIMEOUT); + } + + /** + * Wait for the specified regex in the default logs from the last offset. + * The offset is incremented every time this method is called. + *

    + * This method will time out after a sensible period of + * time has elapsed. + * + * @param regexp a regular expression to search for + * @return the matching line in the log, or null if no matches + * appear before the timeout expires + */ + public String waitForStringInLogUsingLastOffset(String regexp) { + return waitForStringInLogUsingLastOffset(regexp, LOG_SEARCH_TIMEOUT); + } + + /** + * Wait for the specified regex in the default logs from the last mark. + *

    + * This method will time out after a sensible period of + * time has elapsed. + * + * @param regexp a regular expression to search for + * @return the matching line in the log, or null if no matches + * appear before the timeout expires + */ + public String waitForStringInLogUsingMark(String regexp) { + return waitForStringInLogUsingMark(regexp, LOG_SEARCH_TIMEOUT); + } + + /** + * Unless there's a strong functional requirement that + * your string appear super-quickly, or you know your string + * might take a ridiculously long time (like five minutes), + * consider using the method which takes a default timeout, {@link } + * + * @param regexp + * @param timeout a timeout, in milliseconds + * @return + */ + public String waitForStringInLog(String regexp, long timeout) { + return waitForStringInLogUsingMark(regexp, timeout); + } + + /** + * Unless there's a strong functional requirement that + * your string appear super-quickly, or you know your string + * might take a ridiculously long time (like five minutes), + * consider using the method which takes a default timeout. + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @return + */ + public int waitForMultipleStringsInLog(int numberOfMatches, String regexp, long timeout) { + try { + return waitForMultipleStringsInLog(numberOfMatches, regexp, timeout, getDefaultLogFile()); + } catch (Exception e) { + Log.warning(c, "Could not get default log file: " + e); + return 0; + } + } + + /** + * Wait for the specified regex in the default logs from the last offset. + * The offset is incremented every time this method is called. + *

    + * Unless there's a strong functional requirement that + * your string appear super-quickly, or you know your string + * might take a ridiculously long time (like five minutes), + * consider using the method which takes a default timeout, {@link } + * + * @param regexp + * @param timeout a timeout, in milliseconds + * @return + */ + public String waitForStringInLogUsingLastOffset(String regexp, long timeout) { + try { + return waitForStringInLogUsingLastOffset(regexp, timeout, getDefaultLogFile()); + } catch (Exception e) { + Log.warning(c, "Could not find string in default log file due to exception " + e); + return null; + } + } + + /** + * Wait for the specified regex in the default logs from the last mark. + *

    + * Unless there's a strong functional requirement that + * your string appear super-quickly, or you know your string + * might take a ridiculously long time (like five minutes), + * consider using the method which takes a default timeout, {@link } + * + * @param regexp + * @param timeout a timeout, in milliseconds + * @return + */ + public String waitForStringInLogUsingMark(String regexp, long timeout) { + try { + return waitForStringInLogUsingMark(regexp, timeout, getDefaultLogFile()); + } catch (Exception e) { + Log.warning(c, "Could not find string in default log file due to exception " + e); + return null; + } + } + + /** + * @param regexp + * @param ClientConfigurationFile + * @return + */ + public String waitForStringInCopiedLog(String regexp) { + return waitForStringInCopiedLog(regexp, LOG_SEARCH_TIMEOUT); + + } + + public String waitForStringInCopiedLog(String regexp, long timeout) { + String logFile = pathToAutoFVTOutputClientsFolder + "/" + clientToUse + "-" + logStamp + "/logs/messages.log"; + RemoteFile remoteLogFile = new RemoteFile(machine, logFile); + return waitForStringInLogUsingMark(regexp, timeout, remoteLogFile); + } + + /** + * @param regexp + * @param ClientConfigurationFile + * @return + */ + public String waitForStringInLog(String regexp, RemoteFile outputFile) { + return waitForStringInLogUsingMark(regexp, outputFile); + } + + /** + * Check for a number of strings in a potentially remote file + * + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @param outputFile file to check + * @return line that matched the regexp + */ + public String waitForStringInLog(String regexp, long timeout, RemoteFile outputFile) { + return waitForStringInLogUsingMark(regexp, timeout, outputFile); + } + + /** + * Check for a number of strings in a potentially remote file + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @param outputFile file to check + * @return number of matches found + */ + public int waitForMultipleStringsInLog(int numberOfMatches, String regexp, long timeout, RemoteFile outputFile) { + long startTime = System.currentTimeMillis(); + int waited = 0; + int count = 0; + //Ensure we always search for at least 1 occurrence + if (numberOfMatches <= 0) { + numberOfMatches = 1; + } + try { + while (count < numberOfMatches && waited <= timeout) { + + count = LibertyFileManager.findMultipleStringsInFile(numberOfMatches, regexp, outputFile); + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + waited += WAIT_INCREMENT; + } + } catch (Exception e) { + // I think we can assume if we can't read the file it doesn't contain our string + Log.warning(c, "Could not read log file: " + outputFile + " due to exception " + e.toString()); + e.printStackTrace(); + return 0; + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(LibertyClient.class, "waitForMultipleStringsInLog", + "Started waiting for " + numberOfMatches + " messages matching regexp [ " + regexp + "] at " + formatter.format(new Date(startTime)) + + " and finished at " + formatter.format(new Date(endTime))); + } + return count; + } + + /** + * Wait for the specified regex in the specified RemoteFile from the last + * mark. + * + * @param regexp + * @param outputFile + * @return + */ + public String waitForStringInLogUsingMark(String regexp, RemoteFile outputFile) { + return waitForStringInLogUsingMark(regexp, LOG_SEARCH_TIMEOUT, outputFile); + } + + /** + * Wait for the specified regexp in the default logs from the last offset. + * The offset is incremented every time this method is called. + * + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @param outputFile file to check + * @return line that matched the regexp + */ + protected String waitForStringInLogUsingLastOffset(String regexp, long intendedTimeout, RemoteFile outputFile) { + return waitForStringInLogUsingLastOffset(regexp, intendedTimeout, 2 * intendedTimeout, outputFile); + } + + /** + * Wait for the specified regexp in the default logs from the last offset. + * The offset is incremented every time this method is called. + * + * @param regexp a regular expression to search for + * @param intendedTimeout a timeout, in milliseconds, within which we expect the wait to complete. Missing this is a soft fail. + * @param extendedTimeout a timeout, in milliseconds, within which we insist the wait complete. Missing this is an error. + * @param outputFile file to check + * @return line that matched the regexp + */ + protected String waitForStringInLogUsingLastOffset(String regexp, long intendedTimeout, long extendedTimeout, RemoteFile outputFile) { + final String METHOD_NAME = "waitForStringInLogUsingLastOffset"; + long startTime = System.currentTimeMillis(); + int waited = 0; + + Long offset = getLogOffset(outputFile.getAbsolutePath()); + + try { + LogSearchResult newOffsetAndMatches; + while (waited <= extendedTimeout) { + if (waited > intendedTimeout) { // first time only + SOEHttpPostUtil.reportSoftLogTimeoutToSOE(CLASS_NAME, METHOD_NAME, 3906, intendedTimeout, regexp); + intendedTimeout = extendedTimeout + WAIT_INCREMENT; // don't report again + } + newOffsetAndMatches = LibertyFileManager.findStringInFile(regexp, outputFile, offset); + offset = newOffsetAndMatches.getOffset(); + List matches = newOffsetAndMatches.getMatches(); + if (matches.isEmpty()) { + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + waited += WAIT_INCREMENT; + } else { + updateLogOffset(outputFile.getAbsolutePath(), offset); + return matches.get(0); + } + } + Log.warning(c, "Timed out searching for " + regexp + " in log file: " + outputFile.getAbsolutePath()); + } catch (Exception e) { + // I think we can assume if we can't read the file it doesn't contain our string + Log.warning(c, "Could not read log file: " + outputFile + " due do exception " + e.toString()); + e.printStackTrace(); + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(LibertyClient.class, "waitForStringInLogUsingLastOffset", + "Started waiting for message matching regexp [ " + regexp + "] at " + formatter.format(new Date(startTime)) + + " and finished at " + formatter.format(new Date(endTime))); + } + // If we didn't find the string, we still want to mark the offest so + // we don't have to re-search the whole file on the next call. + updateLogOffset(outputFile.getAbsolutePath(), offset); + return null; + } + + /** + * Wait for the specified regexp in the default logs from the last mark. + * The offset is also incremented every time this method is called. + * + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @param outputFile file to check + * @return line that matched the regexp + */ + protected String waitForStringInLogUsingMark(String regexp, long intendedTimeout, RemoteFile outputFile) { + return waitForStringInLogUsingMark(regexp, intendedTimeout, 2 * intendedTimeout, outputFile); + } + + /** + * Wait for the specified regexp in the default logs from the last mark. + * The offset is also incremented every time this method is called. + * + * @param regexp a regular expression to search for + * @param intendedTimeout a timeout, in milliseconds, within which the wait should complete. Exceeding this is a soft fail. + * @param extendedTimeout a timeout, in milliseconds, within which the wait must complete. Exceeding this is a hard fail. + * @param outputFile file to check + * @return line that matched the regexp + */ + protected String waitForStringInLogUsingMark(String regexp, long intendedTimeout, long extendedTimeout, RemoteFile outputFile) { + final String METHOD_NAME = "waitForStringInLogUsingMark"; + long startTime = System.currentTimeMillis(); + int waited = 0; + + Long offset = getMarkOffset(outputFile.getAbsolutePath()); + + try { + LogSearchResult newOffsetAndMatches; + while (waited <= extendedTimeout) { + if (waited > intendedTimeout) { // first time only + SOEHttpPostUtil.reportSoftLogTimeoutToSOE(CLASS_NAME, METHOD_NAME, 3977, intendedTimeout, regexp); + intendedTimeout = extendedTimeout + WAIT_INCREMENT; // don't report again + } + newOffsetAndMatches = LibertyFileManager.findStringInFile(regexp, outputFile, offset); + offset = newOffsetAndMatches.getOffset(); + List matches = newOffsetAndMatches.getMatches(); + if (matches.isEmpty()) { + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + waited += WAIT_INCREMENT; + } else { + updateLogOffset(outputFile.getAbsolutePath(), offset); + return matches.get(0); + } + } + Log.warning(c, "Timed out searching for " + regexp + " in log file: " + outputFile.getAbsolutePath()); + } catch (Exception e) { + // I think we can assume if we can't read the file it doesn't contain our string + Log.warning(c, "Could not read log file: " + outputFile + " due do exception " + e.toString()); + e.printStackTrace(); + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(LibertyClient.class, "waitForStringInLogUsingMark", + "Started waiting for message matching regexp [ " + regexp + "] at " + formatter.format(new Date(startTime)) + + " and finished at " + formatter.format(new Date(endTime))); + } + return null; + } + + /** + * Check for multiple instances of the regex in log using mark + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression to search for + * @return number of matches found + */ + public int waitForMultipleStringsInLogUsingMark(int numberOfMatches, String regexp) { + try { + return waitForMultipleStringsInLogUsingMark(numberOfMatches, regexp, LOG_SEARCH_TIMEOUT, getDefaultLogFile()); + } catch (Exception e) { + Log.warning(c, "Could not find string in default log file due to exception " + e); + return 0; + } + } + + /** + * Check for multiple instances of the regex in log using mark + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @param outputFile file to check + * @return number of matches found + */ + public int waitForMultipleStringsInLogUsingMark(int numberOfMatches, String regexp, long timeout, RemoteFile outputFile) { + long startTime = System.currentTimeMillis(); + int waited = 0; + int count = 0; + + long extendedTimeout = 2 * timeout; + Long offset = getMarkOffset(outputFile.getAbsolutePath()); + + //Ensure we always search for at least 1 occurrence + if (numberOfMatches <= 0) { + numberOfMatches = 1; + } + + try { + LogSearchResult newOffsetAndMatches; + while (count < numberOfMatches && waited <= extendedTimeout) { + if (waited > timeout) { // first time only + SOEHttpPostUtil.reportSoftLogTimeoutToSOE(CLASS_NAME, "waitForMultipleStringsInLogUsingMark", 4319, timeout, regexp); + timeout = extendedTimeout + WAIT_INCREMENT; // don't report again + } + newOffsetAndMatches = LibertyFileManager.findStringInFile(regexp, outputFile, offset); + offset = newOffsetAndMatches.getOffset(); + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + waited += WAIT_INCREMENT; + updateLogOffset(outputFile.getAbsolutePath(), offset); + count += newOffsetAndMatches.getMatches().size(); + } + } catch (Exception e) { + // I think we can assume if we can't read the file it doesn't contain our string + Log.warning(c, "Could not read log file: " + outputFile + " due to exception " + e.toString()); + e.printStackTrace(); + return 0; + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(LibertyClient.class, "waitForMultipleStringsInLog", + "Started waiting for " + numberOfMatches + " messages matching regexp [ " + regexp + "] at " + formatter.format(new Date(startTime)) + + " and finished at " + formatter.format(new Date(endTime)) + " finding " + count + " matches."); + } + + return count; + } + + /** + * Wait for a regex in the most recent trace file + * + * @param regexp + * @return + */ + public String waitForStringInTrace(String regexp) { + return waitForStringInTrace(regexp, 0); + } + + /** + * Wait for a regex in the most recent trace file + * + * @param regexp + * @return + */ + public String waitForStringInTrace(String regexp, long timeout) { + RemoteFile f = null; + + try { + f = getMostRecentTraceFile(); + } catch (Exception e) { + e.printStackTrace(); + } + + Log.info(c, "waitForStringInTrace", "Waiting for " + regexp + " to be found in " + (f == null ? "null" : f.getAbsolutePath())); + + if (f != null) { + if (timeout > 0) { + return waitForStringInLog(regexp, timeout, f); + } else { + return waitForStringInLog(regexp, f); + } + } else { + return null; + } + } + + protected void searchForMessages(String message_code, String message_type, AtomicInteger counter) { + final String method = "searchForMessages"; + // Get a remote file whether it exists yet or not (thus don't use the LibertyFileManager API) + if (messageAbsPath == null) { + Log.info(c, method, "Messages file path is null - no check for message in logs"); + } else { + RemoteFile outputFile = new RemoteFile(machine, messageAbsPath); + int oldNumber = counter.getAndIncrement(); + int newNumber = oldNumber + 1; + int numberFound = waitForMultipleStringsInLog(newNumber, message_code, clientStartTimeout, outputFile); + //waitForStringInLog(REMOVE_APP_MESSAGE_CODE, clientStartTimeout, outputFile); + if (numberFound == newNumber) { + Log.info(c, method, message_type + " message appears in log " + numberFound + " time(s)"); + } else if (numberFound > counter.get()) { + //need to update stopApplicationMessages + Log.info(c, method, "Resetting the number of " + message_type + " messages that appear in the log"); + counter.set(numberFound); + } else { + Log.info(c, method, "Incorrect number of " + message_type + " messages in the log. An error may have occurred."); + } + } + } + + public void addInstalledAppForValidation(String app) { + final String method = "addInstalledAppForValidation"; + final String START_APP_MESSAGE_CODE = "CWWKZ0001I"; + Log.info(c, method, "Adding installed app: " + app + " for validation"); + installedApplications.add(app); + + if (isStarted) { + searchForMessages(START_APP_MESSAGE_CODE, "installApp", startApplicationMessages); + } + } + + public void removeInstalledAppForValidation(String app) { + final String method = "removeInstalledAppForValidation"; + final String REMOVE_APP_MESSAGE_CODE = "CWWKZ0009I"; + Log.info(c, method, "Removing installed app: " + app + " for validation"); + installedApplications.remove(app); + + if (isStarted) { + searchForMessages(REMOVE_APP_MESSAGE_CODE, "uninstallApp", stopApplicationMessages); + } + } + + /** + * Returns true if the client has been successfully started, and either + * hasn't been stopped or hit exceptions during client stop. + * + * @return + */ + public boolean isStarted() { + return isStarted; + } + + /** + * Sets the client's state to "started". The client has been started by some + * other means, and we are simply telling this class about it so that the client + * can be stopped later. + */ + public void setStarted() { + isStarted = true; + } + + /** + * Sets the client's state flag to the state specified by the isStarted parameter. + * The isStarted flag may not always be correct, if the client happens to be started + * external from this class. This method allows for management of the state externally. + * + * @param isStarted + */ + public void setStarted(boolean isStarted) { + this.isStarted = isStarted; + } + + /** + * This method will check the client state and reset the state based on the results of the + * status operation. + * + * @throws Exception + */ + public void resetStarted() throws Exception { + ProgramOutput clientStatusOutput = executeClientScript("status", null); + int rc = clientStatusOutput.getReturnCode(); + if (rc == 0) { + // Client is still running when rc == 0 + isStarted = true; + + //Setup the client logs assuming the default setting. + messageAbsPath = logsRoot + messageFileName; + consoleAbsPath = logsRoot + consoleFileName; + + } else { + // Client is stopped when rc == 1. Any other value means client + // is in a bad way, but we still will treat it as not started. + isStarted = false; + } + } + + public ProgramOutput start(String... args) throws Exception { + return startClientWithArgs(true, true, true, false, "run", Arrays.asList(args), true); + } + + /** + * Start the client. + * + * @throws Exception + */ + public ProgramOutput startClient() throws Exception { + return startClientAndValidate(true, true, true); + } + + /** + * Start the client. + * + * @param cleanStart if true, the client will be started with a clean start + * @param validateApps if true, block until all of the registered apps have started + * @throws Exception + */ + public ProgramOutput startClient(boolean cleanStart, boolean validateApps) throws Exception { + return startClientAndValidate(true, cleanStart, validateApps); + } + + /** + * "Restart" an applications in dropins by renaming it and putting it back. + * Very clever, eh? + *

    + * This will use {@link #waitForStringInLogUsingMark(String)} so ensure + * the offset is set to the correct point before invoking. + * + * @param fileName the file name of the application, e.g. snoop.war + * @return {@code true} if the application was restarted successfully, {@code false} otherwise. + * @throws Exception + */ + public boolean restartDropinsApplication(String fileName) throws Exception { + final String method = "restartDropinsApplication"; + + String appName = fileName.substring(0, fileName.lastIndexOf(".")); + String oldFilePath = clientRoot + "/dropins/" + fileName; + String newFilePath = clientRoot + "/" + fileName; + + String stopMsg, startMsg = null; + + // Move the file out of dropins... + if (LibertyFileManager.renameLibertyFile(machine, oldFilePath, newFilePath)) { + Log.info(c, method, fileName + " successfully moved out of dropins, waiting for message..."); + stopMsg = waitForStringInLogUsingMark("CWWKZ0009I:.*" + appName); + } else { + Log.info(c, method, "Unable to move " + fileName + " out of dropins, failing."); + return false; + } + + // Pause for 4 seconds + Thread.sleep(4000); + + // Move it back into dropins... + if (LibertyFileManager.renameLibertyFile(machine, newFilePath, oldFilePath)) { + Log.info(c, method, fileName + " successfully moved back into dropins, waiting for message..."); + startMsg = waitForStringInLogUsingMark("CWWKZ0001I:.*" + appName); + } else { + Log.info(c, method, "Unable to move " + fileName + " back into dropins, failing."); + return false; + } + + return stopMsg != null && startMsg != null; + } + + public void setLogsRoot(String root) { + this.logsRoot = root; + } + + public String getLogsRoot() { + return logsRoot; + } + + /** + * Start the client and validate that the client was started + * + * @param cleanStart if true, the client will be started with a clean start + * @param validateApps if true, block until all of the registered apps have started + * @param preCleanClient if true, the client directory will be reset before the client is started (reverted to vanilla backup). + * @throws Exception + * @return the output of the start command + */ + public ProgramOutput startClientAndValidate(boolean preClean, boolean cleanStart, boolean validateApps) throws Exception { + return startClientAndValidate(preClean, cleanStart, validateApps, false); + } + + /** + * Start the client and validate that the client was started + * + * @param cleanStart if true, the client will be started with a clean start + * @param validateApps if true, block until all of the registered apps have started + * @param preCleanClient if true, the client directory will be reset before the client is started (reverted to vanilla backup). + * @throws Exception + * @return the output of the start command + */ + public ProgramOutput startClientAndValidate(boolean preClean, boolean cleanStart, boolean validateApps, boolean expectStartFailure) throws Exception { + return startClientAndValidate(preClean, cleanStart, validateApps, expectStartFailure, true); + } + + /** + * Start the client and validate that the client was started + * + * @param preClean if true, the client directory will be reset before + * the client is started (reverted to vanilla backup). + * @param cleanStart if true, the client will be started with a clean start + * @param validateApps if true, block until all of the registered apps have started + * @param expectStartFailure if true, a the client is not expected to start + * due to a failure + * @param validateTimedExit if true, the client will make sure that timedexit-1.0 is enabled + * @throws Exception + */ + public ProgramOutput startClientAndValidate(boolean preClean, boolean cleanStart, + boolean validateApps, boolean expectStartFailure, + boolean validateTimedExit) throws Exception { + return startClientWithArgs(preClean, cleanStart, validateApps, expectStartFailure, "run", null, validateTimedExit); + } + + /** + * Issues a client script command against this client + * + * @param command command name + * @param optionalArgs any optional args needed by the command + * @throws Exception if the operation fails + * @return the output of the command + */ + public ProgramOutput executeClientScript(String command, String[] optionalArgs) throws Exception { + final String method = "executeClientScript"; + Log.info(c, method, "Running client script with command=" + command, optionalArgs); + + String cmd = installRoot + "/bin/client"; + + // organize parms properly - the command name comes first, followed by the client name, followed + // by an optional arguments + String[] parms; + if (optionalArgs == null) { + parms = new String[2]; + } else { + parms = new String[2 + optionalArgs.length]; + System.arraycopy(optionalArgs, 0, parms, 2, optionalArgs.length); + } + parms[0] = command; + parms[1] = clientToUse; + + //Need to ensure JAVA_HOME is set correctly - can't rely on user's environment to be set to the same Java as the build/runtime environment + Properties envVars = new Properties(); + envVars.setProperty("JAVA_HOME", machineJava); + Log.info(c, method, "Using additional env props: " + envVars.toString()); + + ProgramOutput output = machine.execute(cmd, parms, envVars); + String stdout = output.getStdout(); + Log.info(c, method, "Client script output: " + stdout); + Log.info(c, method, "Return code from script is: " + output.getReturnCode()); + return output; + } + + /** + * Set the list of errors to be ignored + * + * @param String .... list of expected errors + * @return void + */ + public void addIgnoreErrors(String... regex) { + if (regex != null && regex.length != 0) { + List expectedErrors = new ArrayList(regex.length); + for (String errmsg : regex) { + expectedErrors.add(errmsg); + } + + // Compile set of regex's + ignorePatterns = new ArrayList(regex.length); + if (expectedErrors != null && expectedErrors.size() != 0) + for (String ignoreRegEx : expectedErrors) { + ignorePatterns.add(Pattern.compile(ignoreRegEx)); + if (ignoreRegEx.equals(LibertyClient.DISABLE_FAILURE_CHECKING)) + checkingDisabled = true; + } + } else { + if (ignorePatterns != null) { + ignorePatterns.clear(); + ignorePatterns = null; + } + } + } + + /** + * Checks the current client to see if it is eligible + * for log checking. + * + * @param none + * + * @return boolean true - no need to check, false - check for errors + */ + protected boolean isClientExemptFromChecking() { + + String method = "isClientExemptFromChecking"; + Log.info(c, method, "Entering isClientExemptFromChecking"); + boolean result = true; + if (!checkingDisabled) { + try { + if (clientsExemptFromChecking == null) { + loadExemptClients(); + } + Log.info(c, method, "Checking Client Name " + getClientName()); + String foundClient = clientsExemptFromChecking.get(getClientName()); + if (foundClient == null) + result = false; + + } catch (Exception e) { + Log.info(c, "isClientExemptFromChecking", "Error determing Exempt Clients " + e.toString()); + } + } + + return result; + + } + + /** + * Reads a list of exempt servers into a HashMap for later searching. + * + * @param none + * + * @return none + */ + + protected void loadExemptClients() throws Exception { + String method = "loadExemptClients"; + BufferedReader br = null; + clientsExemptFromChecking = new HashMap(1000); + Log.info(c, method, "loading exempt client list"); + RemoteFile exempt = new RemoteFile(machine, clientRoot + "/exemptClientsList.txt"); + try { + br = new BufferedReader(new InputStreamReader(exempt.openForReading())); + for (String line; (line = br.readLine()) != null;) { + if (line.indexOf("#") < 0) { + clientsExemptFromChecking.put(line.trim(), line.trim()); + } + } + } catch (Exception e) { + Log.info(c, method, "Error loading Exempt Client list " + e.toString()); + clientsExemptFromChecking = null; + throw e; + } finally { + if (br != null) + br.close(); + } + + } + + /* + * Provide a method for setting default messages to ignore for all clients + * This mimics the implementation of the same function in LibertyServer. + */ + private void populateFixedListOfMessagesToIgnore() { + + // Added to stop iFix/testFix builds failing when listing warning message of testFix installed, + // of course there is a test fix installed ...it is a test fix build + fixedIgnoreErrorsList.add("CWWKF0014W:"); + + } + +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyClientFactory.java b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyClientFactory.java new file mode 100755 index 000000000000..6d8158c6f3c4 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyClientFactory.java @@ -0,0 +1,478 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import com.ibm.websphere.simplicity.LocalFile; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.exception.TopologyException; + +public class LibertyClientFactory { + //track the known Liberty clients by test class name, so that suites don't clean up clients from other test classes in the suite + private static Map> knownLibertyClients = new HashMap>(); + private static Class c = LibertyClientFactory.class; + private static final Boolean BACKUP_REQUIRED = shouldBackup(); + + private static final boolean DELETE_RUN_FATS = + Boolean.parseBoolean(AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + // Default is false if not set + //nb the default passed in is ${delete.run.fats} but + //parseBoolean does default that to false. + return System.getProperty("delete.run.fats", "false"); + } + })); + + /** + * This method will return a newly created LibertyClient instance with the specified client name + * + * @return A stopped Liberty Client instance + * @throws Exception + */ + public static LibertyClient getLibertyClient(String clientName) { + return getLibertyClient(clientName, null, false); + } + + /** + * This method will return a newly created LibertyClient instance with the specified client name + * + * @return A stopped Liberty Client instance + * @throws Exception + */ + public static LibertyClient getLibertyClient(String clientName, Bootstrap bootstrap, boolean ignoreCache) { + return getLibertyClient(clientName, bootstrap, ignoreCache, false); + } + + private static LibertyClient getLibertyClient(String clientName, Bootstrap bootstrap, boolean ignoreCache, boolean installClientFromSampleJar) { + try { + if (clientName == null) + throw new Exception("Liberty client name cannot be null."); + + LibertyClient lc = null; + + //Associate the LibertyClient with the calling test name + String testClassName = getCallerClassNameFromStack(); + Log.info(LibertyClientFactory.class, "getLibertyClient", "testClassName: " + testClassName); + + //synchronize while we look for an existing client with this name + //and create one if it doesn't exist yet + //hold the lock until we finish copying client information + //since we don't want to return while the client state is incomplete + synchronized (knownLibertyClients) { + Set knownClients = knownLibertyClients.get(testClassName); + if (knownClients == null) { + knownClients = new HashSet(); + knownLibertyClients.put(testClassName, knownClients); + } + + if (!ignoreCache) { + for (LibertyClient s : knownClients) { + if (s.getClientName().equals(clientName)) { + lc = s; + Log.info(LibertyClientFactory.class, "getLibertyClient", "found existing client for " + testClassName + ", reissuing"); + break; + } + } + } else { + Log.info(LibertyClientFactory.class, "getLibertyClient", "Ignoring cache for request for " + clientName); + } + + //if we haven't yet encountered this client, then create the instance and + //copy the autoFVT contents to the clients dir and backup if necessary etc + if (lc == null) { + if (bootstrap == null) { + Log.info(LibertyClientFactory.class, "getLibertyClient", "using default bootstrapping.properties"); + bootstrap = Bootstrap.getInstance(); + } else { + Log.info(LibertyClientFactory.class, "getLibertyClient", "using supplied bootstrapping.properties"); + } + lc = new LibertyClient(clientName, bootstrap); + + if (installClientFromSampleJar) { + if (!LibertyFileManager.libertyFileExists(lc.getMachine(), lc.getClientRoot())) { + //Samples don't overwrite, so only bother running it if the client directory isn't already there + lc.installSampleWithExternalDependencies(clientName); + } else { + Log.warning(LibertyClientFactory.class, "Client directory for sample " + clientName + " already exists - executing sample installer was SKIPPED."); + } + } else { + //copy the published FAT client content for the test + recursivelyCopyDirectory(lc.getMachine(), new LocalFile(lc.getPathToAutoFVTNamedClient()), new RemoteFile(lc.getMachine(), lc.getClientRoot())); + + } + + RemoteFile[] autoInstall = applicationsToVerify(lc); + + //Now we backup just before we install the applications ONLY if RTC Run + if (BACKUP_REQUIRED) { + preTestBackUp(lc); + } + if (autoInstall != null) { + //There are applications to install so we need to install them all :) + Log.info(c, "getLibertyClient", "Found dropins folder with applications to verify!"); + addAppsToVerificationList(autoInstall, lc); + } + } + + knownClients.add(lc); + + return lc; + } + } catch (Exception e) { + Log.error(c, "getLibertyClient", e); + throw new RuntimeException("Error getting client", e); + } + } + + /** + * This method will return a newly created LibertyClient instance with the specified client name + * + * @return A started Liberty Client instance + * @throws Exception + */ + public static LibertyClient getStartedLibertyClient(String clientName) { + try { + LibertyClient lc = getLibertyClient(clientName); + return lc; + } catch (Exception e) { + Log.error(c, "getStartedLibertyClient", e); + throw new RuntimeException("Error getting running client", e); + } + } + + /** + * This method will install a sample client and download any external dependencies defined in it. Once the client is installed the client.xml will be exchanged with a default + * client XML, that includes fatTestPorts.xml and the sample client.xml. The bootstrap.properties will be exchanged with a default properties file that includes the + * "../testports.properties" file and the sample properties file. The client will then be added to the list of known clients and returned. + * + * @param clientName The name of the client to install, must be matched by a local file named clientName.jar in the lib/LibertyFATTestFiles folder (populated from publish/files + * in a FAT test project) + * @param bootstrap The bootstrap to use on the client + * @param ignoreCache false if we should load a cached client if available + * @return The client + * + */ + public static LibertyClient installSampleClient(String clientName, Bootstrap bootstrap, boolean ignoreCache) { + return getLibertyClient(clientName, bootstrap, ignoreCache, true); + } + + public static LibertyClient installSampleClient(String clientName) { + return installSampleClient(clientName, null, false); + } + + /** + * This method should not be ran by the user, it is ran by the JUnit runner at the end of each test + * to recover the clients. + * + * @param testClassName the name of the FAT test class to recover known clients for + * @throws Exception + */ + public static void recoverAllclients(String testClassName) throws Exception { + Log.info(c, "recoverAllclients", "Now recovering all clients known to test class: " + testClassName); + + //If backups were required, so is recovery + if (BACKUP_REQUIRED) { + // Iteration through this data structure must be synchronized as + // so it can not be modified during iteration + synchronized (knownLibertyClients) { + for (LibertyClient lc : getKnownLibertyClients(testClassName)) { + postTestRecover(lc); + } + } + } else { + //we weren't backing up, if we're running with delete run fats in RTC + //we should delete the client to save space + if (DELETE_RUN_FATS) { + synchronized (knownLibertyClients) { + for (LibertyClient lc : getKnownLibertyClients(testClassName)) { + LibertyFileManager.deleteLibertyDirectoryAndContents(lc.getMachine(), lc.getClientRoot()); + } + } + } + } + } + + private static RemoteFile[] applicationsToVerify(LibertyClient lc) { + try { + LocalFile appFolder = new LocalFile(lc.getPathToAutoFVTNamedClient() + "dropins/"); + if (!!!appFolder.exists()) + return null; // The autoinstall folder doesn't exist so return false. + RemoteFile[] files = appFolder.list(false); + if (files.length > 0) + return files; + else + return null; + } catch (Exception e) { + Log.error(c, "", e); + return null; + } + } + + private static void addAppsToVerificationList(RemoteFile[] files, LibertyClient lc) throws Exception { + try { + for (RemoteFile f : files) { + try { + String onlyAppName = f.getName(); + if (onlyAppName.endsWith(".xml")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 4); + } + if (onlyAppName.endsWith(".ear") || onlyAppName.endsWith(".eba") || onlyAppName.endsWith(".war") || + onlyAppName.endsWith(".jar") || onlyAppName.endsWith(".rar") || onlyAppName.endsWith(".zip") || + onlyAppName.endsWith(".esa")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 4); + } + Log.info(c, "addAppsToVerificationList", "Adding " + onlyAppName + " to the startup verification list"); + lc.autoInstallApp(onlyAppName); + } catch (TopologyException e) { + //Most likely an error with installing a directory so log and carry on + Log.error(c, "installApplications", e); + } catch (Exception e) { + //Not a 'can't install a directory' Exception so throw + throw e; + } + } + } catch (Exception e) { + Log.error(c, "installApplications", e); + throw e; + } + } + + private static void recursivelyCopyDirectory(Machine machine, LocalFile localDirectory, RemoteFile destination) throws Exception { + String method = "recursivelyCopyDirectory"; + Log.entering(c, method); + destination.mkdir(); + ArrayList logs = new ArrayList(); + logs = listDirectoryContents(localDirectory); + for (String l : logs) { + Log.finer(c, "recursivelyCopyDirectory", "Getting: " + l); + LocalFile toCopy = new LocalFile(localDirectory, l); + RemoteFile toReceive = new RemoteFile(machine, destination, l); + if (toCopy.isDirectory()) { + // Recurse + recursivelyCopyDirectory(machine, toCopy, toReceive); + } else { + toReceive.copyFromSource(toCopy); + Log.finer(c, "recursivelyCopyDirectory", l + " copied to " + toReceive.getAbsolutePath()); + } + } + Log.exiting(c, method); + } + + @Deprecated + private static ArrayList listDirectoryContents(LocalFile clientDir) throws Exception { + final String method = "clientDirectoryContents"; + Log.entering(c, method); + if (!clientDir.isDirectory() || !clientDir.exists()) + throw new TopologyException("The specified directoryPath \'" + + clientDir.getAbsolutePath() + "\' was not a directory"); + + RemoteFile[] firstLevelFiles = clientDir.list(false); + ArrayList firstLevelFileNames = new ArrayList(); + + for (RemoteFile f : firstLevelFiles) { + firstLevelFileNames.add(f.getName()); + } + return firstLevelFileNames; + } + + private static LocalFile getClientBackupZip(LibertyClient client) throws Exception { + // Backup lives in the FAT project + LocalFile backupDir = new LocalFile("build/backup"); + if (!backupDir.exists()) + backupDir.mkdirs(); + + String backupFile = client.getClientName() + ".backup.zip"; + LocalFile backup = new LocalFile(backupDir, backupFile); + + return backup; + } + + /** + * This method is used to backup all the client's at the start. BEFORE anything is done to them. + * If they already exist. + */ + private static void preTestBackUp(LibertyClient client) throws Exception { + final String METHOD = "preTestBackUp"; + Machine m = client.getMachine(); + + LocalFile backup = getClientBackupZip(client); + + // Client is in the build.image/wlp/usr/clients dir + RemoteFile usrclientsDir = new RemoteFile(m, client.getClientRoot()).getParentFile(); //should be /wlp/usr/clients + + if (backup.exists()) { + Log.info(c, METHOD, "Backup file already exists... skipping backup"); + return; + } + Log.info(c, METHOD, "Backing up Client: " + client.getClientName() + " to zip file: " + backup.getAbsolutePath()); + + String workDir = usrclientsDir.getAbsolutePath(); + String command = client.getMachineJavaJarCommandPath(); + String[] param = { "cMf", backup.getAbsolutePath(), client.getClientName() }; + ProgramOutput o = m.execute(command, param, workDir); + if (o.getReturnCode() == 0) { + Log.info(c, METHOD, "Successfully backed up client: " + client.getClientName() + " to zip file: " + backup.getAbsolutePath()); + } else { + Log.warning(c, "Backup jar process failed with return code " + o.getReturnCode()); + Log.warning(c, "Backup jar process failed with error " + o.getStderr()); + Log.warning(c, "Backup jar process failed with output " + o.getStdout()); + } + } + + /** + * This method is used to return the tested client back to the state it was in before + * testing + */ + private static void postTestRecover(LibertyClient client) throws Exception { + final String METHOD = "postTestRecover"; + Machine m = client.getMachine(); + RemoteFile usrclientsDir = new RemoteFile(m, client.getClientRoot()).getParentFile(); //should be /wlp/usr/clients + + LocalFile backup = getClientBackupZip(client); + if (!backup.exists()) { + Log.info(c, METHOD, "Backup file doesn't exist... skipping recovery"); + return; + } + Log.info(c, METHOD, "Recovering Client: " + client.getClientName() + " from zip file: " + backup.getAbsolutePath()); + + RemoteFile clientFolder = new RemoteFile(m, client.getClientRoot()); + if (!!!clientFolder.delete()) { + Log.warning(c, "Unable to delete old clientFolder. Recovery failed!"); + // retry up to 5 seconds + for (int i = 0; i < 5; i++) { + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + // try again + } + if (!!!clientFolder.delete()) { + Log.warning(c, "Unable to delete old clientFolder. Retry failed!"); + } else { + break; + } + // on the last try, mark the client with the failed cleanup. + if (i == 4) { + Log.warning(c, "The clean client will not be restored."); + client.setClientCleanupProblem(true); + return; + } + } + } + + String workDir = usrclientsDir.getAbsolutePath(); + String command = client.getMachineJavaJarCommandPath(); + String[] param = { "xf", backup.getAbsolutePath() }; + ProgramOutput o = m.execute(command, param, workDir); + if (o.getReturnCode() == 0) { + Log.info(c, METHOD, "Successfully recovered client: " + client.getClientName() + " from zip file: " + backup.getAbsolutePath()); + } else { + Log.warning(c, "Recovery unjar process failed with return code " + o.getReturnCode()); + Log.warning(c, "Recovery unjar process failed with error " + o.getStderr()); + Log.warning(c, "Recovery unjar process failed with output " + o.getStdout()); + } + client.setClientCleanupProblem(false); + } + + /** + * Checks if we should backup existing clients with the same name + * and sets the flag. + * We backup if skip.backup is not set or false. + * We don't backup if we aren't running in a local workspace. + */ + private static boolean shouldBackup() { + try { + Bootstrap b = Bootstrap.getInstance(); + if (Boolean.parseBoolean(b.getValue("skip.backup"))) { + return false; + } + if (DELETE_RUN_FATS) { + //don't bother backing up if we're going to delete the run fats + return false; + } + return true; + } catch (Exception e) { + //if we couldn't figure out whether we should backup do it just in case + return true; + } + } + + /** + * @return the list of knownLibertyClients + */ + public static Collection getKnownLibertyClients(String testClassName) { + Log.finer(c, "getKnownLibertyClients", "Getting known liberty clients for test: " + testClassName); + Set clients = new HashSet(); + synchronized (knownLibertyClients) { + Set knownClients = knownLibertyClients.get(testClassName); + if (knownClients != null) + clients.addAll(knownClients); + //could be that the client is known to a super type of this test + //any clients defined (via getLibertyClient or getStartedLibertyClient) on a + //super could be used by a test, so they qualify as known to the test + try { + Class c = Class.forName(testClassName); + Class superClass = c.getSuperclass(); + while (superClass != null && !!!superClass.equals(Object.class)) { + Set superclients = knownLibertyClients.get(superClass.getName()); + if (superclients != null) + clients.addAll(superclients); + superClass = superClass.getSuperclass(); + } + } catch (ClassNotFoundException e) { + Log.error(c, "getKnownLibertyClients", e); + } + } + return clients; + } + + /** + * @return the list of FFDC logs + */ + public static ArrayList retrieveFFDCFile(LibertyClient client) throws Exception { + return client.listFFDCFiles(client.getClientName()); + + } + + /** + * Hack to get the calling test class name from the stack. + * + * @param methodName the name of the method that is being called + */ + private static String getCallerClassNameFromStack() { + String thisClassName = LibertyClientFactory.class.getName(); + String previousElementClass = null; + for (StackTraceElement element : Thread.currentThread().getStackTrace()) { + if (previousElementClass != null && previousElementClass.equals(thisClassName)) { + //the last thing in the stack before the current element was LibertyClientFactory + //if the current element is not also LibertyClientFactory then we found our caller + String currentClassName = element.getClassName(); + if (!!!currentClassName.equals(thisClassName)) + return currentClassName; + } + previousElementClass = element.getClassName(); + } + return null; + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyFileManager.java b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyFileManager.java new file mode 100755 index 000000000000..f93d1bc5763b --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyFileManager.java @@ -0,0 +1,596 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import java.io.BufferedInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.regex.Pattern; + +import com.ibm.websphere.simplicity.LocalFile; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.common.apiservices.Bootstrap; +import componenttest.exception.TopologyException; +import componenttest.topology.utils.LibertyServerUtils; + +/** + * + */ +public class LibertyFileManager { + + private static final Class c = LibertyFileManager.class; + + /** + * Container object to encapsulate the search results and last + * position within the searched file. + */ + public static class LogSearchResult { + private final Long offset; + private final List matches; + private final String firstSearchedLine; + private final String lastSearchedLine; + + LogSearchResult(Long offset, List matches, String firstSearchedLine, String lastSearchedLine) { + this.offset = offset; + this.matches = matches; + this.firstSearchedLine = firstSearchedLine; + this.lastSearchedLine = lastSearchedLine; + } + + @Override + public String toString() { + return super.toString() + "[matches=" + matches.size() + ", offset=" + offset + ']'; + } + + Long getOffset() { + return offset; + } + + List getMatches() { + return matches; + } + + String getFirstLine() { + return firstSearchedLine; + } + + String getLastLine() { + return lastSearchedLine; + } + } + + /** + * Searches the given file for multiple instances of the given regular expression. + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression (or just a text snippet) to search for + * @param fileToSearch the file to search + * @return Number of matches found + * @throws Exception + */ + static int findMultipleStringsInFile(int numberOfMatches, String regexp, + RemoteFile fileToSearch) throws Exception { + final String method = "findMultipleStringsInFile"; + Log.entering(c, method); + + List matches = Collections.emptyList(); + + LogSearchResult allMatches = findStringsInFileCommon(Collections.singletonList(regexp), numberOfMatches, fileToSearch, 0L); + if (allMatches != null) { + + // only get obj[1] since we only want the matches found for this method + matches = allMatches.getMatches(); + + //Produce some trace if user was interested in more than one match but didn't find enough + if (numberOfMatches > 1 && matches.size() < numberOfMatches) { + Log.finer(c, method, "Only found " + matches.size() + " matches"); + } + } + + Log.exiting(c, method); + return matches.size(); + } + + /** + * Searches the given file for the given regular expression. + * + * @param regexp a regular expression (or just a text snippet) to search for + * @param fileToSearch the file to search + * @return The first line which includes the pattern, or null if the pattern isn't found or if the file doesn't exist + * @throws Exception + */ + static String findStringInFile(String regexp, + RemoteFile fileToSearch) throws Exception { + final String method = "findStringInFile"; + Log.entering(c, method); + + String foundString = null; + + LogSearchResult allMatches = findStringsInFileCommon(Collections.singletonList(regexp), 1, fileToSearch, 0L); + if (allMatches != null) { + // only get obj[1] since we only want the matches found for this method + List matches = allMatches.getMatches(); + + if (matches != null && !matches.isEmpty()) { + foundString = matches.get(0); + } + } + + Log.exiting(c, method); + return foundString; + + } + + /** + * Searches the given file starting at the given offset for the given + * regular expression. Halts on the first match and returns the offset + * of the first match. + * + * @param regexp a regular expression (or just a text snippet) to search for + * @param fileToSearch the file to search + * @param offset the position to start the search + * @return LogSearchResult containing the new offset for the log and a {@code List} holding the matches found. + * The list is empty if no matches found. + * @throws Exception + */ + static LogSearchResult findStringInFile(String regexp, RemoteFile fileToSearch, Long offset) throws Exception { + final String method = "findStringInFile"; + Log.entering(c, method, new Object[] { regexp, fileToSearch.getAbsolutePath(), offset }); + + LogSearchResult offsetAndMatches = findStringsInFileCommon(Collections.singletonList(regexp), 1, fileToSearch, offset); + + Log.exiting(c, method); + return offsetAndMatches; + } + + /** + * Searches the given file for the given regular expression. + * + * @param regexp a regular expression (or just a text snippet) to search for + * @param fileToSearch the file to search + * @return List of Strings which match the pattern. No match results in an empty list. + * @throws Exception + */ + static List findStringsInFile(String regexp, + RemoteFile fileToSearch) throws Exception { + final String method = "findStringsInFile"; + Log.entering(c, method); + + List matches = null; + + LogSearchResult allMatches = findStringsInFileCommon(Collections.singletonList(regexp), Integer.MAX_VALUE, fileToSearch, 0L); + if (allMatches != null) { + // only get obj[1] since we only want the matches found for this method + matches = allMatches.getMatches(); + } + + Log.exiting(c, method); + return matches; + } + + /** + * Searches the given file starting at the given offset for the given regular expression. + * + * @param regexp a regular expression (or just a text snippet) to search for + * @param fileToSearch the file to search + * @param offset the position to start the search + * @return LogSearchResult containing the new offset for the log and a {@code List} holding the matches found. + * The list is empty if no matches found. + * @throws Exception + */ + static LogSearchResult findStringsInFile(String regexp, RemoteFile fileToSearch, Long offset) throws Exception { + final String method = "findStringsInFile"; + Log.entering(c, method, new Object[] { regexp, fileToSearch.getAbsolutePath(), offset }); + + LogSearchResult offsetAndMatches = findStringsInFileCommon(Collections.singletonList(regexp), Integer.MAX_VALUE, fileToSearch, offset); + + Log.exiting(c, method); + return offsetAndMatches; + } + + /** + * Searches the given file for the given regular expressions, starting at the given file offset. + * + * @param regexpList a list of regular expressions to search for + * @param fileToSearch the file to search + * @param offset the position in the file to start the search + * @return LogSearchResult containing the new offset for the log and a {@code List} holding the matches found. + * The list is empty if no matches found. + * @throws Exception + */ + static LogSearchResult findStringsInFile(List regexpList, RemoteFile fileToSearch, Long offset) throws Exception { + final String method = "findStringsInFile"; + Log.entering(c, method, new Object[] { regexpList, fileToSearch.getAbsolutePath(), offset }); + + LogSearchResult offsetAndMatches = findStringsInFileCommon(regexpList, Integer.MAX_VALUE, fileToSearch, offset); + + Log.exiting(c, method); + return offsetAndMatches; + } + + /** + * Searches the given file for the given regular expression. + * + * @param regexpList a list of regular expressions to search for + * @param searchLimit the maximum number of times the regexps will be searched for. + * @param fileToSearch the file to search + * @param offset the position to start the search + * @return LogSearchResult containing the new offset for the log and a {@code List} holding the matches found. + * The list is empty if no matches found. + * If the file does not exist, {@code null} is returned. + * @throws Exception + */ + static LogSearchResult findStringsInFileCommon(List regexpList, + int searchLimit, + RemoteFile fileToSearch, + Long offset) throws Exception { + final String method = "findStringsInFileCommon"; + Log.entering(c, method, new Object[] { regexpList, (searchLimit == Integer.MAX_VALUE ? "(all)" : searchLimit), fileToSearch.getAbsolutePath(), offset }); + + if (!fileToSearch.exists()) { + Log.info(c, method, "The file being validated doesn't exist: " + fileToSearch.getAbsolutePath()); + return null; + } + + InputStream rawInput = new BufferedInputStream(fileToSearch.openForReading()); + CountingInputStream input = new CountingInputStream(rawInput); + LineReader reader = null; + List matches = null; + Long newOffset; + String firstLine = null; + String lastLine = null; + + try { + + for (long totalSkipped = 0; totalSkipped < offset;) { + long skipped = input.skip(offset); + if (skipped == 0) { + Log.info(c, method, "The file might have been rotated: " + fileToSearch.getAbsolutePath()); + return null; + } + totalSkipped += skipped; + } + + UnbufferedInputStreamReader rawReader = new UnbufferedInputStreamReader(input, fileToSearch.getEncoding()); + reader = new LineReader(rawReader); + + Log.finer(c, method, "Now looking for strings " + regexpList + + " in the file " + fileToSearch.getName()); + + Pattern[] patterns = new Pattern[regexpList.size()]; + for (int i = 0; i < regexpList.size(); i++) { + patterns[i] = Pattern.compile(regexpList.get(i)); + } + + matches = new ArrayList(); + newOffset = offset; + + for (String line; (line = reader.readLine()) != null;) { + Log.finest(c, method, "offset " + newOffset + ": " + line); + + // We only want to match against complete lines. + if (!reader.eof()) { + if (firstLine == null) + firstLine = line; + lastLine = line; + + newOffset = input.count(); + + if (findAny(line, patterns)) { + matches.add(line); + Log.finer(c, method, "Match number " + matches.size() + " after reading " + input.count() + " bytes"); + if (matches.size() >= searchLimit) { + break; + } + } + } + } + } finally { + if (reader != null) { + reader.close(); + } else { + // if the reader is null, we might still have the input stream + // if there was an early return + if (input != null) { + input.close(); + } + + } + } + + LogSearchResult result = new LogSearchResult(newOffset, matches, firstLine, lastLine); + Log.exiting(c, method, result); + return result; + } + + private static boolean findAny(String line, Pattern[] patterns) { + for (Pattern pattern : patterns) { + if (pattern.matcher(line).find()) { + return true; + } + } + return false; + } + + public static RemoteFile getLibertyFile(Machine machine, String fileAbsPath) throws Exception { + RemoteFile file = createRemoteFile(machine, fileAbsPath); + if (!!!file.exists()) { + throw new FileNotFoundException("The Specified file \'" + + fileAbsPath + "\' does not exist"); + } else { + return file; + } + } + + public static boolean libertyFileExists(Machine machine, String fileAbsPath) throws Exception { + RemoteFile file = createRemoteFile(machine, fileAbsPath); + return file.exists(); + } + + public static RemoteFile createRemoteFile(Machine machine, String fileAbsPath) { + return new RemoteFile(machine, LibertyServerUtils.makeJavaCompatible(fileAbsPath, machine)); + } + + public static void deleteLibertyFile(Machine machine, String fileToDeleteAbsPath) throws Exception { + final String method = "deleteLibertyFile"; + Log.info(c, method, "Deleting file '" + fileToDeleteAbsPath + "\'"); + try { + RemoteFile fileToDelete = getLibertyFile(machine, fileToDeleteAbsPath); + if (fileToDelete.exists()) { + boolean deleted = fileToDelete.delete(); + if (!deleted) { + Log.info(c, method, "File \'" + fileToDeleteAbsPath + + "\' was not able to be deleted"); + } + } else { + Log.info(c, method, "File \'" + fileToDeleteAbsPath + + "\' does not exist so cannot be deleted"); + } + } catch (FileNotFoundException e) { + Log.info(c, method, "File \'" + fileToDeleteAbsPath + + "\' does not exist so cannot be deleted"); + } + + } + + public static void deleteLibertyDirectoryAndContents(Machine machine, String dirToDeleteAbsPath) throws Exception { + final String method = "deleteLibertyDirectoryAndContents"; + Log.info(c, method, "deleting Directory and Contents: " + dirToDeleteAbsPath); + try { + RemoteFile fileToDelete = getLibertyFile(machine, dirToDeleteAbsPath); + if (fileToDelete.exists()) { + recursivelyDeleteDirectory(machine, fileToDelete); + } else { + Log.info(c, method, "File \'" + dirToDeleteAbsPath + + "\' does not exist so cannot be deleted"); + } + } catch (FileNotFoundException e) { + Log.info(c, method, "File \'" + dirToDeleteAbsPath + + "\' does not exist so cannot be deleted"); + } + } + + private static void recursivelyDeleteDirectory(Machine machine, RemoteFile destinationToDelete) throws Exception { + ArrayList contents = new ArrayList(); + contents = listRemoteContents(destinationToDelete); + for (String l : contents) { + RemoteFile toDelete = new RemoteFile(machine, destinationToDelete, l); + if (toDelete.isDirectory()) { + //Recurse if a directory + recursivelyDeleteDirectory(machine, toDelete); + } else { + //else we can delete + toDelete.delete(); + } + } + //Delete directory once contents deleted + destinationToDelete.delete(); + } + + private static ArrayList listRemoteContents(RemoteFile remoteDir) throws Exception { + final String method = "listRemoteContents"; + Log.entering(c, method); + if (!!!remoteDir.isDirectory() || !!!remoteDir.exists()) + throw new FileNotFoundException("The specified directoryPath \'" + + remoteDir.getAbsolutePath() + "\' was not a directory or didn't exist"); + + RemoteFile[] firstLevelFiles = remoteDir.list(false); + ArrayList firstLevelFileNames = new ArrayList(); + + for (RemoteFile f : firstLevelFiles) { + firstLevelFileNames.add(f.getName()); + } + return firstLevelFileNames; + } + + /** + * This copies the named file into the liberty server and maintains the name of the file. This is equivalent to calling + * {@link #copyFileIntoLiberty(Machine, String, String, String)} with the file name set to the name part of the relPathTolocalFile parameter. + * + * @param machine The machine to copy the file to + * @param path The path to copy the file to + * @param relPathTolocalFile The path to the file being copied + * @return The path of the copied file + * @throws Exception + */ + public static String copyFileIntoLiberty(Machine machine, String path, String relPathTolocalFile) throws Exception { + LocalFile localFileToCopy = new LocalFile(LibertyServerUtils.makeJavaCompatible(relPathTolocalFile)); + return LibertyFileManager.copyFileIntoLiberty(machine, path, localFileToCopy.getName(), relPathTolocalFile); + } + + /** + * @param machine + * @param string + * @param string2 + * @throws Exception + */ + public static boolean renameLibertyFile(Machine machine, String oldFilePath, String newFilePath) throws Exception { + RemoteFile source = createRemoteFile(machine, oldFilePath); + RemoteFile target = createRemoteFile(machine, newFilePath); + if (source.exists()) { + return source.rename(target); + } + return false; + } + + /** + * This method will copy a file into the Liberty server using the file name provided, it will not copy the contents of the file if it is a directory. + * + * @param machine The machine to copy the file to + * @param path The path to copy the file to + * @param destinationFileName The name of the file in the destination, this needs to be Java compatible + * @param relPathTolocalFile The path to the file being copied + * @return The path of the copied file + * @see LibertyServerUtils#makeJavaCompatible(String) + * @throws Exception + */ + public static String copyFileIntoLiberty(Machine machine, String path, String destinationFileName, String relPathTolocalFile) throws Exception { + return copyFileIntoLiberty(machine, path, destinationFileName, relPathTolocalFile, false); + } + + /** + * This method will copy a file into the Liberty server using the file name provided. + * + * @param machine The machine to copy the file to + * @param path The path to copy the file to + * @param destinationFileName The name of the file in the destination, this needs to be Java compatible + * @param relPathTolocalFile The path to the file being copied + * @param recursivelyCopy true if child files should also be copied + * @return The path of the copied file + * @see LibertyServerUtils#makeJavaCompatible(String) + * @throws Exception + */ + public static String copyFileIntoLiberty(Machine machine, String path, String destinationFileName, String relPathTolocalFile, boolean recursivelyCopy) throws Exception { + return copyFileIntoLiberty(machine, path, destinationFileName, relPathTolocalFile, recursivelyCopy, null); + } + + /** + * This method will copy a file into the Liberty server using the file name provided. + * If a single file is being copied to a destination that does not exist and tmpDir + * is specified, then the file will be copied to a temporary file and then renamed + * into place, which avoids other processes reading a partially written file. + * + * @param machine The machine to copy the file to + * @param path The path to copy the file to + * @param destinationFileName The name of the file in the destination, this needs to be Java compatible + * @param relPathTolocalFile The path to the file being copied + * @param recursivelyCopy true if child files should also be copied + * @param tmpDir The temporary directory to use if atomically copying + * @return The path of the copied file + * @see LibertyServerUtils#makeJavaCompatible(String) + * @throws Exception + */ + public static String copyFileIntoLiberty(Machine machine, + String path, + String destinationFileName, + String relPathTolocalFile, + boolean recursivelyCopy, + String tmpDir) throws Exception { + LocalFile src = new LocalFile(LibertyServerUtils.makeJavaCompatible(relPathTolocalFile)); + RemoteFile dest = new RemoteFile(machine, path + "/" + destinationFileName); + RemoteFile destFile = dest.isDirectory() ? new RemoteFile(dest, src.getName()) : dest; + RemoteFile destDir = dest.isDirectory() ? dest : destFile.getParentFile(); + + // If possible, we would like to create the destination file atomically + // in order to avoid file monitoring issues. We atomically create by + // copying to a temporary file and then renaming to the actual + // destination, which can only succeed if the rename() will succeed: + // the destination must not exist. We could also allow if the destination + // exists as a file, but renameTo(...) fails on Windows. + if (tmpDir != null && src.isFile() && !destFile.exists()) { + // We choose the temporary filename by appending a timestamp to the + // destination filename in the temporary directory. We don't use + // Machine.getTempDir as that could be /tmp, which could be in a + // different file system (e.g., tmpfs on Linux), which would cause + // rename to fail. + RemoteFile tmpFile = new RemoteFile(machine, tmpDir + "/" + destFile.getName() + '.' + System.currentTimeMillis()); + Log.info(c, "copyFileIntoLiberty", "Copying: " + src.getAbsolutePath() + " to " + dest.getAbsolutePath() + " via " + tmpFile.getAbsolutePath()); + if (!src.copyToDest(tmpFile, recursivelyCopy, true)) { + throw new TopologyException("Failed to copy " + src.getAbsolutePath() + " to " + tmpFile.getAbsolutePath()); + } + + // Create the destination directory as RemoteFile.copyToDest would. + Log.finer(c, "copyFileIntoLiberty", "mkdirs " + destDir); + destDir.mkdirs(); + + if (!tmpFile.rename(destFile)) { + // Make a best effort to clean up the temp file. + String extraMessage = ""; + Throwable cause = null; + try { + if (!tmpFile.delete()) { + extraMessage = ", and failed to delete the temporary file"; + } + } catch (Exception e) { + extraMessage = ", and failed to delete the temporary file"; + cause = e; + } + + throw new TopologyException("Failed to rename " + tmpFile.getAbsolutePath() + " to " + destFile.getAbsolutePath() + extraMessage, cause); + } + Log.info(c, "copyFileIntoLiberty", "Done: copied " + destFile.length() + " / " + destFile.length() + " bytes"); + } else { + Log.info(c, "copyFileIntoLiberty", "Copying: " + src.getAbsolutePath() + " to " + dest.getAbsolutePath()); + if (!src.copyToDest(dest, recursivelyCopy, true)) { + throw new TopologyException("Failed to copy " + src.getAbsolutePath() + " to " + dest.getAbsolutePath()); + } + Log.info(c, "copyFileIntoLiberty", "Done: copied " + dest.length() + " / " + src.length() + " bytes"); + } + + Log.finer(c, "copyFileIntoLiberty", "Copy successfull!"); + return dest.getAbsolutePath(); + } + + public static String moveFileIntoLiberty(Machine machine, String path, String destinationFileName, String relPathTolocalFile) throws Exception { + LocalFile localFile = new LocalFile(LibertyServerUtils.makeJavaCompatible(relPathTolocalFile)); + RemoteFile remoteFileTmp = new RemoteFile(machine, path + "/" + destinationFileName + ".tmp"); + RemoteFile remoteFile = new RemoteFile(machine, path + "/" + destinationFileName); + + Log.info(c, "moveFileIntoLiberty", "Copying " + localFile.getAbsolutePath() + " to " + remoteFileTmp.getAbsolutePath()); + + if (!localFile.copyToDest(remoteFileTmp, false, true)) { + throw new TopologyException("The file \"" + localFile.getName() + "\" failed to copy"); + } + + moveLibertyFile(remoteFileTmp, remoteFile); + + return remoteFile.getAbsolutePath(); + } + + public static void moveLibertyFile(RemoteFile srcFile, RemoteFile dstFile) throws Exception { + Log.info(c, "moveLibertyFile", "Moving " + srcFile.getAbsolutePath() + " to " + dstFile.getAbsolutePath()); + if (srcFile.rename(dstFile)) { + Log.info(c, "moveLibertyFile", dstFile.getName() + " was successfully moved."); + } else { + // rename failed, let's copy + if (srcFile.copyToDest(dstFile)) { + srcFile.delete(); + Log.info(c, "moveLibertyFile", dstFile.getName() + " was successfully copied."); + } else { + srcFile.delete(); + throw new TopologyException("Failed to move " + srcFile.getAbsolutePath() + " to " + dstFile.getAbsolutePath()); + } + } + } + + public static String getInstallPath(Bootstrap bootstrap) throws Exception { + String installPath = bootstrap.getValue("libertyInstallPath"); + Machine machine = LibertyServerUtils.createMachine(bootstrap); + return getLibertyFile(machine, installPath).getAbsolutePath(); + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServer.java b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServer.java new file mode 100755 index 000000000000..9eeeed85e3e0 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServer.java @@ -0,0 +1,6208 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2015 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.StringReader; +import java.io.StringWriter; +import java.io.Writer; +import java.lang.reflect.Method; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.nio.charset.Charset; +import java.security.AccessController; +import java.security.KeyStore; +import java.security.PrivilegedAction; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Scanner; +import java.util.Set; +import java.util.TreeSet; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Pattern; + +import javax.management.MBeanServerConnection; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManagerFactory; + +import org.junit.Assert; + +import com.ibm.websphere.jmx.connector.rest.ConnectorSettings; +import com.ibm.websphere.simplicity.LocalFile; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.PortType; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.application.ApplicationManager; +import com.ibm.websphere.simplicity.application.ApplicationType; +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import com.ibm.websphere.simplicity.config.ServerConfigurationFactory; +import com.ibm.websphere.simplicity.exception.ApplicationNotInstalledException; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.websphere.soe_reporting.SOEHttpPostUtil; +import com.ibm.ws.fat.util.ACEScanner; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; + +import componenttest.common.apiservices.Bootstrap; +import componenttest.common.apiservices.LocalMachine; +import componenttest.exception.TopologyException; +import componenttest.topology.impl.LibertyFileManager.LogSearchResult; +import componenttest.topology.utils.CollectiveUtilities; +import componenttest.topology.utils.CollectiveUtilities.MaintenanceModeExpectedResult; +import componenttest.topology.utils.CollectiveUtilities.MaintenanceModeTargetType; +import componenttest.topology.utils.FileUtils; +import componenttest.topology.utils.LibertyServerUtils; + +public class LibertyServer implements LogMonitorClient { + protected static final Class c = LibertyServer.class; + protected static final String CLASS_NAME = c.getName(); + protected static Logger LOG = Logger.getLogger(CLASS_NAME); // why don't we always use the Logger directly? + /** How frequently we poll the logs when waiting for something to happen */ + protected static final int WAIT_INCREMENT = 300; + + boolean runAsAWindowService = false; + + protected static final String DEBUGGING_PORT = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("debugging.port"); + } + }); + + protected static final boolean DEFAULT_PRE_CLEAN = true; + + protected static final boolean DEFAULT_CLEANSTART = Boolean.parseBoolean(AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + // Default is true if not set. + return System.getProperty("default.clean.start", "true"); + } + })); + + protected static final boolean DEFAULT_VALIDATE_APPS = true; + public static boolean validateApps = DEFAULT_VALIDATE_APPS; + + protected static final String JAVA_VERSION = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("java.version"); + } + }); + + protected static final boolean JAVA_VERSION_6 = JAVA_VERSION.startsWith("1.6."); + protected static final boolean JAVA_VERSION_8 = JAVA_VERSION.startsWith("1.8"); + + protected static final boolean J9_JVM_RUN = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + boolean b; + String vm = System.getProperty("java.vm.name"); + Log.info(c, "", "java.vm.name=" + vm); + b = vm != null && vm.contains("J9"); + Log.info(c, "", "J9_JVM_RUN=" + b); + return b; + } + }); + + protected static final boolean HOTSPOT_JVM_RUN = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + String hotspotString = System.getProperty("fat.on.hotspot"); + boolean hotspot; + if (hotspotString != null) { + Log.info(c, "", "fat.on.hotspot=" + hotspotString); + hotspot = Boolean.parseBoolean(hotspotString); + } else { + String vm = System.getProperty("java.vm.name"); + Log.info(c, "", "java.vm.name=" + vm); + hotspot = vm.contains("HotSpot"); + } + + Log.info(c, "", "HOTSPOT_JVM_RUN=" + hotspot); + return hotspot; + } + }); + + protected static final String MAC_RUN = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("fat.on.mac"); + } + }); + + protected static final boolean IBM_JVM = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + String vendor = System.getProperty("java.vendor"); + + if (vendor != null) { + return vendor.toLowerCase().contains("ibm"); + } + return true; + } + }); + + protected static final boolean ORACLE_JVM = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + String vendor = System.getProperty("java.vendor"); + + if (vendor != null) { + return vendor.toLowerCase().contains("oracle"); + } + return true; + } + }); + + protected static final boolean SUN_JVM = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + String vendor = System.getProperty("java.vendor"); + + if (vendor != null) { + return vendor.toLowerCase().contains("sun"); + } + return true; + } + }); + + protected static final String GLOBAL_TRACE = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + String prop = System.getProperty("global.trace.spec"); + return prop == null ? "" : prop.trim(); + } + }); + + protected static final boolean GLOBAL_JAVA2SECURITY = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + String prop = System.getProperty("global.java2.sec"); + boolean java2security = false; + if (prop != null) { + Log.info(c, "", "global.java2.sec=" + prop); + java2security = Boolean.parseBoolean(prop); + } + Log.info(c, "", "GLOBAL_JAVA2SECURITY=" + java2security); + return java2security; + } + }); + + protected static final boolean GLOBAL_DEBUG_JAVA2SECURITY = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + String prop = System.getProperty("global.debug.java2.sec"); + boolean java2security = false; + if (prop != null) { + Log.info(c, "", "global.debug.java2.sec=" + prop); + java2security = Boolean.parseBoolean(prop); + } + return java2security; + } + }); + + protected static final String GLOBAL_JVM_ARGS = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + String prop = System.getProperty("global.jvm.args"); + return prop == null ? "" : prop.trim(); + } + }); + protected static final String TMP_DIR = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("java.io.tmpdir"); + } + }); + + protected static final boolean DO_COVERAGE = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + String fatCoverageString = System.getProperty("test.coverage"); + boolean fatcoverage = false; + if (fatCoverageString != null) { + Log.info(c, "", "test.coverage=" + fatCoverageString); + fatcoverage = Boolean.parseBoolean(fatCoverageString); + } + Log.info(c, "", "DO_COVERAGE=" + fatcoverage); + return fatcoverage; + } + }); + + protected static final String JAVA_AGENT_FOR_JACOCO = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + String agent = System.getProperty("javaagent.for.jacoco"); + Log.info(c, "", "JAVA_AGENT_FOR_JACOCO=" + agent); + return agent; + } + }); + + protected static final String RELEASE_MICRO_VERSION = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + String micro = System.getProperty("micro.version"); + Log.info(c, "", "RELEASE_MICRO_VERSION=" + micro); + return micro; + } + }); + + protected static final int SERVER_START_TIMEOUT = 30 * 1000; + protected static final int SERVER_STOP_TIMEOUT = 30 * 1000; + + // Increasing this from 50 seconds to 120 seconds to account for poorly performing code; + // this timeout should only pop in the event of an unexpected failure of apps to start. + protected static final int LOG_SEARCH_TIMEOUT = 120 * 1000; + + // Allow configuration updates to wait for messages in the log longer than other log + // searches. Configuration updates may take some time on slow test systems. + protected static final int LOG_SEARCH_TIMEOUT_CONFIG_UPDATE = 180 * 1000; + + protected ApplicationManager appmgr; + + protected List installedApplications; + + protected static final String DEFAULT_SERVER = "defaultServer"; + + protected static final String DEFAULT_MSG_FILE = "messages.log"; + protected static final String DEFAULT_CONSOLE_FILE = "console.log"; + + protected static final String DEFAULT_TRACE_FILE_PREFIX = "trace"; + + protected static final String SERVER_CONFIG_FILE_NAME = "server.xml"; + protected static final String JVM_OPTIONS_FILE_NAME = "jvm.options"; + + protected static final String EBCDIC_CHARSET_NAME = "IBM1047"; + + protected volatile boolean isStarted = false; + protected boolean isStartedConsoleLogLevelOff = false; + + protected int osgiConsolePort = 5678; // The port number of the OSGi Console + + // Use port 0 if the property can't be found, these should be picked up from a properties file + // if not then the test may create a liberty server and get the ports from a bootstrap port. + // If neither way obtains a port then port 0 will be used which will cause the tests to fail in + // an obvious way (rather than using a port which looks like it might be right, but isn't, e.g. 8000) + protected int httpDefaultPort = Integer.parseInt(System.getProperty("HTTP_default", "0")); + + protected int httpDefaultSecurePort = Integer.parseInt(System.getProperty("HTTP_default.secure", "0")); + + protected int httpSecondaryPort = Integer.parseInt(System.getProperty("HTTP_secondary", "0")); + protected int httpSecondarySecurePort = Integer.parseInt(System.getProperty("HTTP_secondary.secure", "0")); + + protected int iiopDefaultPort = Integer.parseInt(System.getProperty("IIOP", "0")); + + protected String hostName; + protected String installRoot; // The root of the Liberty Install + protected String userDir; // The WLP_USER_DIR for this server + protected boolean customUserDir = false; + + protected String installRootParent; // The parent directory of the Liberty Install + + protected final AtomicBoolean checkForRestConnector = new AtomicBoolean(false); + + // used by the saveServerConfiguration / restoreServerConfiguration methods to save the current server + // configuration at a specific point in time and then be able to restore it back in the future + protected RemoteFile savedServerXml = null; + + //list of servers exempt from log error and failure checking + protected HashMap serversExemptFromChecking = null; + + protected Set serversExemptFromJava2SecurityTesting = null; + + public static final String DISABLE_FAILURE_CHECKING = "DISABLE_CHECKING"; + + public boolean isJava2SecurityEnabled = false; + + private boolean isTidy = false; + + private boolean needsPostTestRecover = true; + + /** + * @return the installRoot + */ + public String getInstallRoot() { + return installRoot; + } + + /** + * @return the release micro version + */ + public String getMicroVersion() { + return RELEASE_MICRO_VERSION; + } + + public String getMicroSuffix() { + return "." + RELEASE_MICRO_VERSION; + } + + /** + * Returns the value of WLP_USER_DIR for the server. + * + * @return + */ + public String getUserDir() { + return userDir; + } + + public boolean isCustomUserDir() { + return customUserDir; + } + + protected String serverRoot; // The root of the server for Liberty + protected String serverOutputRoot; // The output root of the server + protected String logsRoot; // The root of the Logs Files + + protected long lastConfigUpdate = 0; // Time stamp (in millis) of the last configuration update + + protected String relativeLogsRoot = "/logs/"; // this will be appended to logsRoot in setUp + protected String consoleFileName = DEFAULT_CONSOLE_FILE; // Console log file name + protected String messageFileName = DEFAULT_MSG_FILE; // Messages log file name (optionally changed by the FAT) + protected String messageAbsPath = null; + protected String consoleAbsPath = null; + + protected String machineJava; // Path to Java 6 JDK on the Machine + + protected String machineJarPath; //Path to the jar command + + protected Machine machine; // Machine the server is on + + protected String serverToUse; // the server to use + + //An ID given to the server topology that will be used as a reference e.g. JPAFATTestServer + protected String serverTopologyID; + + protected OperatingSystem machineOS; + + //These aren't final as we have to massage them if they are used for tWAS FAT suites + public String pathToAutoFVTTestFiles = "lib/LibertyFATTestFiles/"; + protected String pathToAutoFVTOutputServersFolder = "output/servers"; + protected String pathToAutoFVTOutputFolder = "output/"; + + protected final String PATH_TO_AUTOFVT_SERVERS = "publish/servers/"; + protected static final String PATH_TO_AUTOFVT_SHARED = "publish/shared/"; + //Only need this at the moment as we only support single Liberty Servers + protected String pathToAutoFVTNamedServer = PATH_TO_AUTOFVT_SERVERS; + + protected long serverStartTimeout = SERVER_START_TIMEOUT; + + protected final AtomicInteger stopApplicationMessages = new AtomicInteger(0); + protected final AtomicInteger startApplicationMessages = new AtomicInteger(0); + + public String getPathToAutoFVTNamedServer() { + return pathToAutoFVTNamedServer; + } + + protected List originalFeatureSet = null; + + //Used for keeping track of offset positions of log files + protected final HashMap logOffsets = new HashMap(); + + protected boolean serverCleanupProblem = false; + + /** When we stopped searching for a string in the logs. */ + public long searchStopTime; + + private List ignoredErrors = null; + + /** + * Holds a fixed set error and warning messages to be ignored for those + * buckets that choose to care about error or warning messages when the server + * is stopped. See populateFixedListOfMessagesToIgnore() for more details. + */ + private final List fixedIgnoreErrorsList = new ArrayList(); + + /** + * Shared LogMonitor class is used to encapsulate some basic log search/wait logic + */ + private final LogMonitor logMonitor; + + /** + * @param serverCleanupProblem the serverCleanupProblem to set + */ + void setServerCleanupProblem(boolean serverCleanupProblem) { + this.serverCleanupProblem = serverCleanupProblem; + } + + public Machine getMachine() { + return machine; + } + + /** + * Protected - This constructor is default as users should use the + * LibertyServerFactory's static methods to get LibertyServer instances. + * + * @param serverName The name of the server that is going to used + * @param b The bootstrap properties for this server + * @throws Exception + */ + LibertyServer(String serverName, Bootstrap b) throws Exception { + this(serverName, b, false, false); + } + + LibertyServer(String serverName, Bootstrap b, boolean deleteServerDirIfExist, boolean usePreviouslyConfigured) throws Exception { + this(serverName, b, deleteServerDirIfExist, usePreviouslyConfigured, LibertyServerFactory.WinServiceOption.OFF); + } + + /** + * Protected - This constructor is default as users should use the + * LibertyServerFactory's static methods to get LibertyServer instances. + * + * @param serverName The name of the server that is going to used + * @param b The bootstrap properties for this server + * @param deleteServerDirIfExist If true and if the specified server name already exists on the file system, it will be deleted + * @param usePreviouslyConfigured If true do not tidy existing server + * @throws Exception + */ + LibertyServer(String serverName, Bootstrap b, boolean deleteServerDirIfExist, boolean usePreviouslyConfigured, + LibertyServerFactory.WinServiceOption winServiceOption) throws Exception { + final String method = "setup"; + Log.entering(c, method); + serverTopologyID = b.getValue("ServerTopologyID"); + hostName = b.getValue("hostName"); + machineJava = b.getValue(hostName + ".JavaHome"); + + if (serverName != null) { + serverToUse = serverName; + pathToAutoFVTNamedServer += serverToUse + "/"; + } else { + serverToUse = b.getValue("serverName"); + if (serverToUse == null || serverToUse.trim().equals("")) { + serverToUse = DEFAULT_SERVER; + } + } + + if (winServiceOption == LibertyServerFactory.WinServiceOption.ON) { + runAsAWindowService = true; + } else { + runAsAWindowService = false; + } + Log.info(c, method, "runAsAWindowService: " + runAsAWindowService); + + // This is the only case where we will allow the messages.log name to be changed + // by the fat framework -- because we want to look at messasges.log for start/stop/blah + // messags, we shouldn't be pointing it all over everywhere else. For those FAT tests + // that need a messages file in an alternate location, they should set the corresponding + // com.ibm.ws.logging.message.file.name property in bootstrap.properties + String nonDefaultLogFile = b.getValue("NonDefaultConsoleLogFileName"); + if (nonDefaultLogFile != null && nonDefaultLogFile.startsWith("SERVER_NAME/")) { + relativeLogsRoot = "/logs/" + serverToUse + "/"; + messageFileName = nonDefaultLogFile.substring(12); + } else { + relativeLogsRoot = "/logs/"; + messageFileName = DEFAULT_MSG_FILE; + } + + try { + osgiConsolePort = Integer.parseInt(b.getValue("osgi.console")); + } catch (Exception e) { + Log.debug(c, "No osgi.console set in bootstrap.properties. Will use default value: " + + osgiConsolePort); + } + + try { + httpDefaultPort = Integer.parseInt(b.getValue("http.Default.Port")); + } catch (Exception e) { + Log.debug(c, "No http.Default.Port set in bootstrap.properties. Will use default value: " + + httpDefaultPort); + } + + try { + httpDefaultSecurePort = Integer.parseInt(b.getValue("http.Default.Secure.Port")); + } catch (Exception e) { + Log.debug(c, "No http.Default.Secure.Port set in bootstrap.properties. Will use default value: " + + httpDefaultSecurePort); + } + + try { + iiopDefaultPort = Integer.parseInt(b.getValue("IIOP")); + } catch (Exception e) { + Log.debug(c, "No iiop.Default.Port set in bootstrap.properties. Will use default value: " + + iiopDefaultPort); + } + + if (machineJava == null) { + throw new IllegalArgumentException("No " + hostName + + ".JavaHome was set in " + b); + } + installRoot = b.getValue("libertyInstallPath"); + if (installRoot == null) { + throw new IllegalArgumentException("No installRoot was set in " + b); + } + + // Allow user directory name to be provided in bootstrap properties. + // It is optional and if it is not set, setup() will set it. + userDir = b.getValue("libertyUserDir"); + + // Populate the fixed set error and warning messages to be ignored for those + // buckets that choose to care about error or warning messages when the server + // is stopped. + populateFixedListOfMessagesToIgnore(); + + // In the multinode test environment, one of the hosts may be the local machine + // and therefore should be mapped to LocalMachine. Simplicity only does this + // mapping if the host name is "localhost". For now a check is added here + // to compare the host name to the local host name. This is guarded by a + // property "checkIfLocalHost" just in case someone doesn't want this behavior. + String checkIfLocalHost = b.getValue("checkIfLocalHost"); + if (checkIfLocalHost != null && hostName.equals(InetAddress.getLocalHost().getHostName())) { + Log.info(c, method, "returning local machine for " + hostName); + machine = Machine.getLocalMachine(); + // Do not update hostName because Machine will say localhost! + } else { + machine = LibertyServerUtils.createMachine(b); + // Update hostName to maintain old behavior of LibertyServer.getHostname() + // which asked the machine. + hostName = machine.getHostname(); + } + + //Initialize LogMonitor + logMonitor = new LogMonitor(this); + + setup(deleteServerDirIfExist, usePreviouslyConfigured); + Log.exiting(c, method); + } + + //This isn't that elegant but it works + //If this is a tWAS FAT suite the relative path to the autoFVT folder + //is different so we need to check and set variables to the autoFVT/output folder + //and autoFVT/lib/testFiles accordingly + protected void massageAutoFVTAbsolutePath() throws Exception { + final String METHOD = "massageAutoFVTAbsolutePath"; + Log.entering(c, METHOD); + + LocalFile testBuildFile = new LocalFile("TestBuild.xml"); + String localPropsLoc = System.getProperty("local.properties"); + if (!!!testBuildFile.exists() && localPropsLoc != null) { + Properties localProps = new Properties(); + FileInputStream in = new FileInputStream(localPropsLoc); + localProps.load(in); + in.close(); + + String bucketsDir = localProps.getProperty("buckets.dir"); + pathToAutoFVTTestFiles = bucketsDir + "/" + pathToAutoFVTTestFiles; + pathToAutoFVTNamedServer = bucketsDir + "/" + pathToAutoFVTNamedServer; + pathToAutoFVTOutputServersFolder = bucketsDir + "/" + "output/servers"; + pathToAutoFVTOutputFolder = bucketsDir + "/output"; + + Log.info(c, METHOD, "This seems to be a tWAS FAT suite so updating the path to the" + + "AutoFVTTestFiles to " + pathToAutoFVTTestFiles + " and the testOutputFolder to " + + pathToAutoFVTOutputServersFolder + " and the path to the AutoFVTNamedServer to " + + pathToAutoFVTNamedServer); + } + Log.exiting(c, METHOD); + } + + protected void setup(boolean deleteServerDirIfExist, boolean usePreviouslyConfigured) throws Exception { + installedApplications = new ArrayList(); + machine.connect(); + machine.setWorkDir(installRoot); + if (this.serverToUse == null) { + this.serverToUse = DEFAULT_SERVER; + } + + machineOS = machine.getOperatingSystem(); + this.installRoot = LibertyServerUtils.makeJavaCompatible(installRoot, machine); + // Set default usr directory if not already set. + if (this.userDir == null) + this.userDir = installRoot + "/usr"; + else + customUserDir = true; + this.serverRoot = this.userDir + "/servers/" + serverToUse; + this.serverOutputRoot = this.serverRoot; + this.logsRoot = serverOutputRoot + relativeLogsRoot; + this.messageAbsPath = logsRoot + messageFileName; + + // delete existing server directory if requested: + if (deleteServerDirIfExist) { + RemoteFile serverDir = new RemoteFile(machine, this.serverRoot); + if (serverDir.exists() && !serverDir.delete()) { + Exception ex = new TopologyException("Unable to delete pre-existing server directory: " + this.serverRoot); + Log.error(c, "setup - User requested that we delete pre-existing server directory, but this operation failed - " + this.serverRoot, ex); + throw ex; + } + } + + File installRootfile = new File(this.installRoot); + this.installRootParent = installRootfile.getParent(); + + // Now it sets all OS specific stuff + this.machineJava = LibertyServerUtils.makeJavaCompatible(machineJava, machine); + + Log.info(c, "setup", "Successfully obtained machine. Operating System is: " + machineOS.name()); + // Continues with setup, we now validate the Java used is a JDK by looking for java and jar files + String jar = "jar"; + String java = "java"; + if (machineOS == OperatingSystem.WINDOWS) { + jar += ".exe"; + java += ".exe"; + } + RemoteFile testJar = new RemoteFile(machine, machineJava + "/bin/" + jar); + RemoteFile testJava = new RemoteFile(machine, machineJava + "/bin/" + java); + machineJarPath = testJar.getAbsolutePath(); + if (!!!testJar.exists()) { + //if we come in here we might be pointing at a JRE instead of a JDK so we'll go up a level in hope it's there + testJar = new RemoteFile(machine, machineJava + "/../bin/" + jar); + machineJarPath = testJar.getAbsolutePath(); + if (!!!testJar.exists()) { + throw new TopologyException("cannot find a " + jar + " file in " + machineJava + "/bin. Please ensure you have set the machine javaHome to point to a JDK"); + } else { + Log.info(c, "setup", "Jar Home now set to: " + machineJarPath); + } + } + if (!!!testJava.exists()) + throw new TopologyException("cannot find a " + java + " file in " + machineJava + "/bin. Please ensure you have set the machine javaHome to point to a JDK"); + + Log.info(c, "setup", "machineJava: " + machineJava + " machineJarPath: " + machineJarPath); + + massageAutoFVTAbsolutePath(); + + if (!usePreviouslyConfigured) + preTestTidyup(); + } + + protected void preTestTidyup() { + //Deletes the logs and work area folder and the apps folder + try { + machine.getFile(logsRoot).delete(); + } catch (Exception e) { + // Ignore if doesn't exist + } + try { + machine.getFile(serverRoot + "/workarea").delete(); + } catch (Exception e) { + // Ignore if doesn't exist + } + try { + RemoteFile applicationsFolder = new RemoteFile(machine, userDir + "/shared/apps"); + applicationsFolder.delete(); + applicationsFolder.mkdir(); + } catch (Exception e) { + // Ignore if doesn't exist + } + } + + /** + * Set the feature list of the server.xml to the new features specified + * in the {@code List}. Each String should be the only feature + * name, e.g. servlet-3.0 + * + * @param newFeatures + * @throws Exception + */ + public void changeFeatures(List newFeatures) throws Exception { + RemoteFile serverXML = new RemoteFile(machine, serverRoot + "/" + SERVER_CONFIG_FILE_NAME); + LocalFile tempServerXML = new LocalFile(SERVER_CONFIG_FILE_NAME); + boolean createOriginalList; + if (originalFeatureSet == null) { + createOriginalList = true; + originalFeatureSet = new ArrayList(); + } else { + createOriginalList = false; + } + Writer w = new OutputStreamWriter(tempServerXML.openForWriting(false)); + InputStream originalOutput = serverXML.openForReading(); + InputStreamReader in2 = new InputStreamReader(originalOutput); + Scanner s2 = new Scanner(in2); + while (s2.hasNextLine()) { + String line = s2.nextLine(); + if (line.contains("")) {//So has reached featureSets + while (s2.hasNextLine()) { + line = s2.nextLine(); + if (line.contains("")) + break; + //Otherwise is a featureset and only if the original featureset list is null do we need to get + if (createOriginalList) { + line = line.replaceAll("", ""); + line = line.replaceAll("", ""); + line = line.trim(); + originalFeatureSet.add(line); + } + } + w.write(" "); + w.write("\n"); + for (String feature : newFeatures) { + w.write(" " + feature.trim() + ""); + w.write("\n"); + } + w.write(" "); + w.write("\n"); + } else { + w.write(line); + w.write("\n"); + } + } + s2.close(); + originalOutput.close(); + w.flush(); + w.close(); + //Now we need to copy file overwriting existing server.xml and delete the temp + tempServerXML.copyToDest(serverXML, false, true); + tempServerXML.delete(); + } + + public static void setValidateApps(boolean validateApp) { + validateApps = validateApp; + } + + public boolean getValidateApps() { + return validateApps; + } + + /** + * Start the server and validate that the server was started: + * prepares/cleans the server directory, then performs a clean start + * + * @throws Exception + * @return the output of the start command + */ + public ProgramOutput startServer() throws Exception { + return startServerAndValidate(DEFAULT_PRE_CLEAN, DEFAULT_CLEANSTART, validateApps); + } + + /** + * Start the server and validate that the server was started: + * prepares/cleans the server directory, then performs a clean start + * + * @param consoleLogFileName name that should be used for console log. It can be helpful + * to have a console log file name that is related to (or describes) the test + * case the server is used for. + * @throws Exception + * @return the output of the start command + */ + public ProgramOutput startServer(String consoleLogFileName) throws Exception { + this.consoleFileName = consoleLogFileName; + return startServerAndValidate(DEFAULT_PRE_CLEAN, DEFAULT_CLEANSTART, validateApps); + } + + /** + * Start the server and validate that the server was started: + * prepares/cleans the server directory, then starts the server + * + * @param cleanStart if true, the server will be started with a clean start + * @throws Exception + * @return the output of the start command + */ + public ProgramOutput startServer(boolean cleanStart) throws Exception { + return startServerAndValidate(DEFAULT_PRE_CLEAN, cleanStart, validateApps); + } + + /** + * Start the server and validate that the server was started: + * prepares/cleans the server directory, then starts the server + * + * @param consoleFileName name that should be used for console log. It can be helpful + * to have a console log file name that is related to (or describes) the test + * case the server is used for. + * @param cleanStart if true, the server will be started with a clean start + * @throws Exception + * @return the output of the start command + */ + public ProgramOutput startServer(String consoleFileNameLog, boolean cleanStart) throws Exception { + this.consoleFileName = consoleFileNameLog; + return startServerAndValidate(DEFAULT_PRE_CLEAN, cleanStart, validateApps); + } + + /** + * Start the server and validate that the server was started + * + * @param consoleFileName name that should be used for console log. It can be helpful + * to have a console log file name that is related to (or describes) the test + * case the server is used for. + * @param cleanStart if true, the server will be started with a clean start + * @param preCleanServer if true, the server directory will be reset before the server is started (reverted to vanilla backup). + * @throws Exception + * @return the output of the start command + */ + public ProgramOutput startServer(String consoleFileNameLog, boolean cleanStart, boolean preCleanServer) throws Exception { + this.consoleFileName = consoleFileNameLog; + return startServerAndValidate(preCleanServer, cleanStart, validateApps); + } + + /** + * Start the server and validate that the server was started + * + * @param consoleFileNameLog name that should be used for console log. It can be helpful + * to have a console log file name that is related to (or describes) the test + * case the server is used for. + * @param cleanStart if true, the server will be started with a clean start + * @param preCleanServer if true, the server directory will be reset before + * the server is started (reverted to vanilla backup). + * @param validateTimedExit if true, the server will make sure that timedexit-1.0 is enabled + * @throws Exception + */ + public void startServer(String consoleFileNameLog, + boolean cleanStart, + boolean preCleanServer, + boolean validateTimedExit) throws Exception { + this.consoleFileName = consoleFileNameLog; + startServerAndValidate(preCleanServer, cleanStart, validateApps, false, validateTimedExit); + } + + /** + * Start the server, but expect server start to fail + * + * @param consoleFileName name that should be used for console log. It can be helpful + * to have a console log file name that is related to (or describes) the test + * case the server is used for. + * @param cleanStart if true, the server will be started with a clean start + * @param preCleanServer if true, the server directory will be reset before the server is started (reverted to vanilla backup). + * @throws Exception + * @return the output of the start command + */ + public ProgramOutput startServerExpectFailure(String consoleFileNameLog, boolean preClean, boolean cleanStart) throws Exception { + this.consoleFileName = consoleFileNameLog; + return startServerAndValidate(preClean, cleanStart, false, true, true); + } + + protected void printProcessHoldingPort(int port) { + final String m = "printProcessHoldingPort"; + try { + PortDetectionUtil detector = PortDetectionUtil.getPortDetector(machine); + Log.info(c, m, detector.determineOwnerOfPort(port)); + } catch (Exception ex) { + Log.error(c, m, ex, "Caught exception while trying to detect the process holding port " + port); + } + } + + protected void checkPortsOpen(boolean retry) { + ServerSocket socket = null; + try { + // Create unbounded socket + socket = new ServerSocket(); + // This allows the socket to close and others to bind to it even if its in TIME_WAIT state + socket.setReuseAddress(true); + socket.bind(new InetSocketAddress(getHttpDefaultPort())); + } catch (Exception ex) { + Log.error(c, "checkPortsOpen", ex, "http default port is currently bound"); + printProcessHoldingPort(getHttpDefaultPort()); + if (retry) { + Log.info(c, "checkPortsOpen", "Waiting 5 seconds and trying again"); + try { + Thread.sleep(5000); + } catch (InterruptedException ie) { + // Not a lot to do + } + // Do this out of the try block, even if we are interrupted we want to try once more + checkPortsOpen(false); + } + } finally { + if (null != socket) { + try { + // With setReuseAddress set to true we should free up our socket and allow + // someone else to bind to it even if we are in TIME_WAIT state. + socket.close(); + } catch (IOException ioe) { + // not a lot to do + } + } + } + } + + /** + * Start the server and validate that the server was started + * + * @param cleanStart if true, the server will be started with a clean start + * @param validateApps if true, block until all of the registered apps have started + * @param preCleanServer if true, the server directory will be reset before the server is started (reverted to vanilla backup). + * @throws Exception + * @return the output of the start command + */ + public ProgramOutput startServerAndValidate(boolean preClean, boolean cleanStart, boolean validateApps) throws Exception { + return startServerAndValidate(preClean, cleanStart, validateApps, false); + } + + /** + * Start the server and validate that the server was started + * + * @param cleanStart if true, the server will be started with a clean start + * @param validateApps if true, block until all of the registered apps have started + * @param preCleanServer if true, the server directory will be reset before the server is started (reverted to vanilla backup). + * @throws Exception + * @return the output of the start command + */ + public ProgramOutput startServerAndValidate(boolean preClean, boolean cleanStart, boolean validateApps, boolean expectStartFailure) throws Exception { + return startServerAndValidate(preClean, cleanStart, validateApps, expectStartFailure, true); + } + + /** + * Start the server and validate that the server was started + * + * @param preClean if true, the server directory will be reset before + * the server is started (reverted to vanilla backup). + * @param cleanStart if true, the server will be started with a clean start + * @param validateApps if true, block until all of the registered apps have started + * @param expectStartFailure if true, a the server is not expected to start + * due to a failure + * @param validateTimedExit if true, the server will make sure that timedexit-1.0 is enabled + * @throws Exception + */ + public ProgramOutput startServerAndValidate(boolean preClean, boolean cleanStart, + boolean validateApps, boolean expectStartFailure, + boolean validateTimedExit) throws Exception { + return startServerWithArgs(preClean, cleanStart, validateApps, expectStartFailure, "start", null, validateTimedExit); + } + + public enum IncludeArg { + MINIFY, ALL, USR, RUNNABLE, MINIFYRUNNABLE; + public String getIncludeString() { + if (this.equals(MINIFYRUNNABLE)) { + return "--include=" + "minify,runnable"; + } else { + return "--include=" + this.toString().toLowerCase(); + } + } + } + + public void packageServer(final IncludeArg include, final String otherPackageArgs, final String osFilter) throws Exception { + final ArrayList args = setArgsExtended(include, otherPackageArgs, osFilter); + startServerWithArgs(true, false, false, false, "package", args, true); + } + + public void packageServer(final IncludeArg include, final String osFilter) throws Exception { + final ArrayList args = setArgs(include, osFilter); + startServerWithArgs(true, false, false, false, "package", args, true); + } + + public void packageServerWithCleanStart(final IncludeArg include, final String osFilter) throws Exception { + final ArrayList args = setArgs(include, osFilter); + startServerWithArgs(true, true, false, false, "package", args, true); + } + + protected ArrayList setArgs(final IncludeArg include, final String osFilter) { + ArrayList args = new ArrayList(); + + args.add(include.getIncludeString()); + + if (osFilter != null) { + args.add("--os=" + osFilter); + } + return args; + } + + protected ArrayList setArgsExtended(final IncludeArg include, final String otherPackageArgs, final String osFilter) { + ArrayList args = setArgs(include, osFilter); + args.add(otherPackageArgs); + + return args; + } + + protected ProgramOutput startServerWithArgs(boolean preClean, boolean cleanStart, + boolean validateApps, boolean expectStartFailure, + String serverCmd, List args, + boolean validateTimedExit) throws Exception { + final String method = "startServerAndValidate"; + Log.entering(c, method, "clean=" + cleanStart + ", validateApps=" + validateApps + ", expectStartFailure=" + expectStartFailure + ", cmd=" + serverCmd + ", args=" + args); + + if (serverCleanupProblem) { + throw new Exception("The server was not cleaned up on the previous test."); + } + + //if we're (re-)starting then we must be untidy! + this.isTidy = false; + + //Tidy up any pre-existing logs + if (preClean) + preStartServerLogsTidy(); + + final Properties envVars = new Properties(); + checkPortsOpen(true); + + final String cmd = installRoot + "/bin/server"; + ArrayList parametersList = new ArrayList(); + boolean executeAsync = false; + if ("start".equals(serverCmd) && DEBUGGING_PORT != null && !!!DEBUGGING_PORT.equalsIgnoreCase(Boolean.toString(false))) { + Log.info(c, method, "Setting up commands for debug"); + parametersList.add("debug"); + parametersList.add(serverToUse); + envVars.setProperty("DEBUG_PORT", DEBUGGING_PORT); + // set server time out to 15 minutes to give time to connect. Timed exit likely kicks in after that, so + // a larger value is worthless (and, since we multiply it by two later, will wrap if you use MAX_VALUE) + serverStartTimeout = 15 * 60 * 60 * 1000; + executeAsync = true; + } else { + parametersList.add(serverCmd); + parametersList.add(serverToUse); + } + + if (cleanStart) { + parametersList.add("--clean"); + } + + if (args != null) { + parametersList.addAll(args); + } + + //Setup the server logs assuming the default setting. + messageAbsPath = logsRoot + messageFileName; + consoleAbsPath = logsRoot + consoleFileName; + + Log.info(c, method, "Starting server, messages will go to file " + messageAbsPath); + + final String[] parameters = parametersList.toArray(new String[] {}); + + //Need to ensure JAVA_HOME is set correctly - can't rely on user's environment to be set to the same Java as the build/runtime environment + envVars.setProperty("JAVA_HOME", machineJava); + if (customUserDir) + envVars.setProperty("WLP_USER_DIR", userDir); + + // Pick up global JVM args (forced by build properties) + String JVM_ARGS = GLOBAL_JVM_ARGS; + + // Always set tmp dir. + JVM_ARGS += " -Djava.io.tmpdir=" + TMP_DIR; + + // 207555: A number of FAT buckets establish a lot of secure connections and drain the entropy pool of /dev/random on Linux when + // running Oracle/Sun JVMs - this results in buckets timing out as they wait for the entropy pool to be repopulated. Additionally, + // from Java 9 onwards, IBM JDKs will also exhibit the same behaviour as it will start to use /dev/random by default. + // The fix is thus to ensure we use the pseudorandom entropy pool (/dev/urandom) (which is also valid for Windows/zOS). + JVM_ARGS += " -Djava.security.egd=file:///dev/urandom"; + + // Avoid ClassLoader deadlocks on HotSpot Java 6. + if (HOTSPOT_JVM_RUN && JAVA_VERSION_6) { + JVM_ARGS += " -XX:+UnlockDiagnosticVMOptions" + + " -XX:+UnsyncloadClass" + + " -Dosgi.classloader.lock=classname"; + } + + // Debug for a Java 8 problem on IBM JVMs. This can be removed when defect 181046 is resolved. + if (IBM_JVM && JAVA_VERSION_8) { + JVM_ARGS += " -Xdump:system+java+snap:events=throw+systhrow,filter=\"java/lang/ClassCastException#ServiceFactoryUse.*\""; + JVM_ARGS += " -Xdump:system+java+snap:events=throw+systhrow,filter=\"java/lang/ClassCastException#org/eclipse/osgi/internal/serviceregistry/ServiceFactoryUse.*\""; + } + + // Add JaCoCo java agent to generate code coverage for FAT test run + if (DO_COVERAGE) { + JVM_ARGS += " " + JAVA_AGENT_FOR_JACOCO; + } + + //if we are on Mac then use the value of the perm gen arg that has been + //passed in via the system property + if (MAC_RUN != null && !!!MAC_RUN.equalsIgnoreCase(Boolean.toString(false))) { + JVM_ARGS += " " + MAC_RUN; + } + + //This works around a change in Oracle JKD 8 update 11 documented in 163555: Test Failure (20150216-1921 (tests for cl50520150215-1500, child-e0)): com.ibm.ws.fat.cdi.tests.JavaEightTests.testLambda + if (System.getProperty("java.vendor").contains("Oracle") && System.getProperty("java.version").startsWith("1.8")) { + JVM_ARGS += " -noverify"; + } + + // if we have java 2 security enabled, add java.security.manager and java.security.policy + if (GLOBAL_JAVA2SECURITY) { + RemoteFile f = getServerBootstrapPropertiesFile(); + Log.info(c, "startServerWithArgs", "remoteFile: " + f.getAbsolutePath()); + + if (serverNeedsToRunWithJava2Security()) { + addJava2SecurityPropertiesToBootstrapFile(f); + } else { + LOG.warning("The build is configured to run FAT tests with Java 2 Security enabled, but the FAT server " + getServerName() + + " is exempt from Java 2 Security regression testing."); + } + + Log.info(c, "", "JVM_ARGS = " + JVM_ARGS); + } else if (GLOBAL_DEBUG_JAVA2SECURITY) { + // update the bootstrap.properties file with the java 2 security property + RemoteFile f = getServerBootstrapPropertiesFile(); + Log.info(c, "startServerWithArgs", "remoteFile: " + f.getAbsolutePath()); + if (f.exists()) { + java.io.OutputStream w = f.openForWriting(true); + try { + w.write("\n".getBytes()); + w.write("websphere.java.security=true".getBytes()); + w.write("\n".getBytes()); + w.write("websphere.java.security.norethrow=true".getBytes()); + w.write("\n".getBytes()); + w.write("websphere.java.security.unique=true".getBytes()); + w.write("\n".getBytes()); + Log.info(c, "getServerBootstrapPropertiesFile", "Successfully updated bootstrap.properties file with Java 2 Security properties"); + } catch (Exception e) { + Log.info(c, "getServerBootstrapPropertiesFile", "caught exception updating bootstap.properties file with Java 2 Security properties, e: ", e.getMessage()); + } + w.flush(); + w.close(); + } + isJava2SecurityEnabled = true; + } + + // Look for forced server trace.. + if (!GLOBAL_TRACE.isEmpty()) { + RemoteFile f = getServerBootstrapPropertiesFile(); + Properties props = new Properties(); + + if (f.exists()) { + InputStream is = null; + try { + is = f.openForReading(); + props.load(is); + } catch (Exception e) { + LOG.warning("Error reading " + f + ": " + e.getMessage()); + } finally { + if (is != null) { + is.close(); + } + } + } + + // get configured trace string from bootstrap properties.. + // (have to take include into account, ugh.. + String configuredTrace = props.getProperty("com.ibm.ws.logging.trace.specification"); + if (configuredTrace == null) { + String includeFiles = props.getProperty("bootstrap.include"); + if (includeFiles != null) { + String[] files = includeFiles.split("\\s*,\\s*"); + for (String fileName : files) { + RemoteFile x = new RemoteFile(machine, serverRoot + "/" + fileName); + if (x.exists()) { + props.clear(); + InputStream is = null; + try { + is = x.openForReading(); + props.load(is); + configuredTrace = props.getProperty("com.ibm.ws.logging.trace.specification"); + if (configuredTrace != null) + break; + } catch (Exception e) { + LOG.warning("Error reading " + x + ": " + e.getMessage()); + } finally { + if (is != null) { + is.close(); + } + } + } + } + } + } + + if (configuredTrace != null && !configuredTrace.isEmpty()) { + configuredTrace = GLOBAL_TRACE + ":" + configuredTrace.trim(); + } else { + configuredTrace = GLOBAL_TRACE; + } + + JVM_ARGS += " -Dcom.ibm.ws.logging.trace.specification=" + configuredTrace; + } + + envVars.setProperty("JVM_ARGS", JVM_ARGS); + + // This takes the custom console file name used for tests into consideration + envVars.setProperty("LOG_DIR", logsRoot); + envVars.setProperty("LOG_FILE", consoleFileName); + + Log.info(c, method, "Using additional env props: " + envVars.toString()); + + Log.info(c, method, "Starting Server with command: " + cmd); + + // Create a marker file to indicate that we're trying to start a server + createServerMarkerFile(); + + ProgramOutput output; + if (executeAsync) { + if (!(machine instanceof LocalMachine)) { + throw new Exception(""); + } + + LocalMachine localMachine = (LocalMachine) machine; + File f = new File(logsRoot + File.separator + consoleFileName); + if (!f.exists()) + f.getParentFile().mkdirs(); + OutputStream redirect = new FileOutputStream(f); + String workDir = new File(this.serverOutputRoot).getAbsolutePath(); + localMachine.executeAsync(cmd, parameters, workDir, envVars, redirect); + Log.info(c, method, "Started server process in debug mode"); + output = null; + } else { + if (machine instanceof LocalMachine) { + // Running the server start asynchronously because it appears that the start + // process is hanging from time to time. We can probably remove this when we fix + // the issue causing the process to hang. + final BlockingQueue outputQueue = new LinkedBlockingQueue(); + + Runnable execServerCmd = null; + + if (this.runAsAWindowService == false) { + + execServerCmd = new Runnable() { + + @Override + public void run() { + try { + outputQueue.put(machine.execute(cmd, parameters, envVars)); + } catch (Exception e) { + Log.info(c, method, "Exception while attempting to start a server: " + e.getMessage()); + } + } + + }; + } else { + final ArrayList registerServiceParmList = makeParmList(parametersList, 0); + final ArrayList startServiceParmList = makeParmList(parametersList, 1); + + execServerCmd = new Runnable() { + @Override + public void run() { + try { + Log.info(c, method, "runAsAWindowService RegisterService parms: " + registerServiceParmList.toString()); + final String[] registerServiceparameters = registerServiceParmList.toArray(new String[] {}); + outputQueue.put(machine.execute(cmd, registerServiceparameters, envVars)); + + Log.info(c, method, "runAsAWindowService StartService parms: " + startServiceParmList.toString()); + final String[] startServiceparameters = startServiceParmList.toArray(new String[] {}); + outputQueue.put(machine.execute(cmd, startServiceparameters, envVars)); + } catch (Exception e) { + Log.info(c, method, "Exception while attempting to start a server: " + e.getMessage()); + } + } + }; + } + + Thread t = new Thread(execServerCmd); + + t.start(); + // Way more than we really need to wait -- in normal circumstances this will return immediately as + // we're just kicking off the server script. + final int SCRIPT_TIMEOUT_IN_MINUTES = 5; + output = outputQueue.poll(SCRIPT_TIMEOUT_IN_MINUTES, TimeUnit.MINUTES); + if (runAsAWindowService == true) { + // wait for "register" to complete first, and now wait for "start" to complete + output = outputQueue.poll(SCRIPT_TIMEOUT_IN_MINUTES, TimeUnit.MINUTES); + } + + if (output == null) { + Log.warning(c, "The process that runs the server script did not return. The server may or may not have actually started."); + if (IBM_JVM) { + // Use the IBM dump API if running on an appropriate JDK + // This is probably just going to tell us that we're waiting forever in Process.waitFor(), but + // at least we'll know that. + Class dump = Class.forName("com.ibm.jvm.Dump"); + Method javaDump = dump.getMethod("JavaDump", (Class[]) null); + javaDump.invoke(null, (Object[]) null); + } else { + // Otherwise, just dump the stack to figure out where things got hung + Thread.dumpStack(); + } + + // We didn't get a return value from the start script. Call resetStarted() to try to determine whether + // the server is actually running or not. + int rc = resetStarted(); + if (rc == 0) { + // The server is running, so proceed as if nothing went wrong. + return new ProgramOutput(cmd, rc, "No output buffer available", "No error buffer available"); + } else { + Log.info(c, method, "The server does not appear to be running. (rc=" + rc + "). Retrying server start now"); + // If at first you don't succeed... + Thread tryAgain = new Thread(cmd); + tryAgain.start(); + output = outputQueue.poll(SCRIPT_TIMEOUT_IN_MINUTES, TimeUnit.MINUTES); + if (runAsAWindowService == true) { + // wait for "register" to complete first, and now wait for "start" to complete + output = outputQueue.poll(SCRIPT_TIMEOUT_IN_MINUTES, TimeUnit.MINUTES); + } + if (output == null) { + Log.warning(c, "The second attempt to start the server also timed out. The server may or may not have actually started"); + return new ProgramOutput(cmd, -1, "No response from script", "No response from script"); + } + + } + + } + } else { + // If the machine is remote we can execute the command directly. + // RXA has its own timeouts in case the command "hangs". + output = machine.execute(cmd, parameters, envVars); + } + int rc = output.getReturnCode(); + Log.info(c, method, "Response from script is: " + output.getStdout()); + Log.info(c, method, "Return code from script is: " + rc); + + if (rc != 0 && expectStartFailure) { + Log.info(c, method, "EXPECTED: Server didn't start"); + deleteServerMarkerFile(); + Log.exiting(c, method); + return output; + } + } + + // Validate the server and apps started - if they didn't, that + // method will throw an appropriate exception + + if ("start".equals(serverCmd)) { + validateServerStarted(output, validateApps, expectStartFailure, validateTimedExit); + isStarted = true; + } + + Log.exiting(c, method); + return output; + } + + private ArrayList makeParmList(ArrayList oldParms, int type) { + // type 0 - Register, 1 - Start, 2 - Stop, 3 - Remove + + // parms list passed in is expected to describe the command parameters for the server.bat invocation. + + ArrayList newParms = new ArrayList(oldParms); + + // the first parameter should be either "start" or "stop" + String p1 = newParms.get(0); + + if ((type == 0) || (type == 1)) { + // The desire is for this method to build a registerWinService or a startWinService command + if (p1.compareToIgnoreCase("start") != 0) { + // first parameter was not "start", so we can not update this command for Windows service register or start + // so return the parameters as is. + return newParms; + } + + if (type == 0) { + // replace "start" parameter with "registerWinService", and get rid of other command line parameters. + newParms.set(0, "registerWinService"); + int size = newParms.size(); + for (int i = size; i > 2; i--) { + newParms.remove(i - 1); + } + } + + if (type == 1) { + // replace "start" parameter with "startWinService", and keep the other command line parameters. + newParms.set(0, "startWinService"); + } + + return newParms; + } + + if ((type == 2) || (type == 3)) { + // The desire is for this method to build a stopWinService or a unregisterWinService command + if (p1.compareToIgnoreCase("stop") != 0) { + // first parameter was not "stop", so we can not update this command for Windows service stop or unregister + // so return the parameters as is. + return newParms; + } + + if (type == 2) { + // replace "stop" parameter with "stopWinService", and keep the other command line parameters. + newParms.set(0, "stopWinService"); + } + + if (type == 3) { + // replace "stop" parameter with "unregisterWinService", and get rid of other command line parameters. + newParms.set(0, "unregisterWinService"); + int size = newParms.size(); + for (int i = size; i > 2; i--) { + newParms.remove(i - 1); + } + } + + return newParms; + } + return newParms; + } + + private boolean serverNeedsToRunWithJava2Security() { + String method = "serverNeedsToRunWithJava2Security"; + Log.info(c, method, "Entering serverNeedsToRunWithJava2Security"); + boolean result = true; + String serverName = getServerName(); + + try { + // Allow servers to opt-out of j2sec by setting + // websphere.java.security.exempt=true + // in their ${server.config.dir}/bootstrap.properties + if ("true".equalsIgnoreCase(getBootstrapProperties().getProperty("websphere.java.security.exempt"))) + return false; + + if (serversExemptFromJava2SecurityTesting == null) { + loadJava2SecurityExemptServers(); + } + Log.info(c, method, "Checking Server Name " + serverName); + return !serversExemptFromJava2SecurityTesting.contains(serverName); + } catch (Exception e) { + Log.info(c, "serverNeedsToRunWithJava2Security", "Error determining Exempt Servers " + e.toString()); + Log.info(c, method, "Skipping modification of the bootstrap.properties file to enable Java 2 Security on server " + serverName); + result = false; + } + return result; + } + + private void loadJava2SecurityExemptServers() throws Exception { + String method = "loadJava2SecurityExemptServers"; + BufferedReader br = null; + Log.info(c, method, "loading exempt server list"); + RemoteFile exempt = new RemoteFile(machine, serverRoot + "/java2SecurityExemptServersList.txt"); + try { + br = new BufferedReader(new InputStreamReader(exempt.openForReading())); + String line = br.readLine(); + serversExemptFromJava2SecurityTesting = new HashSet(1000); + while (line != null) { + if (line.startsWith("#") == false) { + serversExemptFromJava2SecurityTesting.add(line.trim()); + } + line = br.readLine(); + } + } catch (Exception e) { + Log.info(c, method, "Error loading Java 2 Security exempt server list " + e.toString()); + throw e; + } finally { + if (br != null) { + br.close(); + } + } + } + + private void addJava2SecurityPropertiesToBootstrapFile(RemoteFile f) throws Exception { + java.io.OutputStream w = f.openForWriting(true); + try { + w.write("\n".getBytes()); + w.write("websphere.java.security".getBytes()); + w.write("\n".getBytes()); + w.write("websphere.java.security.norethrow=false".getBytes()); + w.write("\n".getBytes()); + Log.info(c, "addJava2SecurityPropertiesToBootstrapFile", "Successfully updated bootstrap.properties file with Java 2 Security properties"); + } catch (Exception e) { + Log.info(c, "addJava2SecurityPropertiesToBootstrapFile", "Caught exception updating bootstap.properties file with Java 2 Security properties, e: ", e.getMessage()); + } + w.flush(); + w.close(); + + isJava2SecurityEnabled = true; + } + + /** + * Create a marker file for the server to indicate it is started. + * + * @throws IOException + */ + protected void createServerMarkerFile() throws Exception { + + File outputFolder = new File(pathToAutoFVTOutputFolder); + if (!outputFolder.exists()) + outputFolder.mkdirs(); + + String path = pathToAutoFVTOutputFolder + getServerName() + ".mrk"; + LocalFile serverRunningFile = new LocalFile(path); + Log.info(c, "createServerMarkerFile", "Server marker file: " + serverRunningFile.getAbsolutePath()); + File createFile = new File(serverRunningFile.getAbsolutePath()); + createFile.createNewFile(); + OutputStream os = serverRunningFile.openForWriting(true); + os.write(0); + os.flush(); + os.close(); + } + + /** + * Delete a marker file for the server (after stopped). + * + * @throws IOException + */ + protected void deleteServerMarkerFile() throws Exception { + + String path = pathToAutoFVTOutputFolder + getServerName() + ".mrk"; + LocalFile serverRunningFile = new LocalFile(path); + Log.info(c, "deleteServerMarkerFile", "Server marker file: " + serverRunningFile.getAbsolutePath()); + File deleteFile = new File(serverRunningFile.getAbsolutePath()); + if (deleteFile.exists()) { + deleteFile.delete(); + } + } + + public void validateAppLoaded(String appName) throws Exception { + String exceptionText = validateAppsLoaded(Collections.singletonList(appName), LOG_SEARCH_TIMEOUT, getDefaultLogFile()); + if (exceptionText != null) { + throw new TopologyException(exceptionText); + } + } + + protected void validateAppsLoaded(RemoteFile outputFile) throws Exception { + final String method = "validateAppsLoaded"; + + if (installedApplications.isEmpty()) { + Log.info(c, method, "No applications are installed so no need to validate they are loaded"); + return; + } + + String exceptionText = validateAppsLoaded(installedApplications, LOG_SEARCH_TIMEOUT, outputFile); + if (exceptionText != null) { + throw new TopologyException(exceptionText); + } + } + + protected String validateAppsLoaded(List appList, int timeout, RemoteFile outputFile) throws Exception { + // At time of writing, timeout argument was being ignored. Preserve that for now... + timeout = LOG_SEARCH_TIMEOUT; + return validateAppsLoaded(appList, timeout, 2 * timeout, outputFile); + } + + /** + * We are adding a "soft failure" mode, in an attempt to compensate for the fact that the Virtual Machines + * we're now running regression tests on have "bursty" performance and may introduce substantial delays with + * no warning, making the originally coded times fragile. + * + * With this change, if intendedTimeout is exceeded, we report this to the SOE server + * but do not consider it a test failure. Only if extendedTimeout is exceeded will we return a not-found indication. + * + * @param regexp a regular expression to search for + * @param intendedTimeout a timeout, in milliseconds, within which string was expected to occur + * @param extendedTimeout a timeout, in milliseconds, within which string may acceptably occur + * @param outputFile file to check + * @return line that matched the regexp, or null to indicate not found within acceptable (extended) timeout + */ + protected String validateAppsLoaded(List appList, int intendedTimeout, int extendedTimeout, RemoteFile outputFile) throws Exception { + final String method = "validateAppsLoaded"; + + final long startTime = System.currentTimeMillis(); + final long finalTime = startTime + extendedTimeout; + long slowTime = startTime + intendedTimeout; + try { + long offset = 0; + final List regexpList = Collections.singletonList("CWWKZ"); + Map unstartedApps = new HashMap(); + for (String appName : appList) { + // When reading the log file with some encodings the log entry has a new line character in, + // for example when reading the log files on Chinese CD open stream this won't match unless + // we force .* to include the new line character which we do by switching the option on by + // adding the (?s) part to the start of the pattern. + unstartedApps.put(appName, Pattern.compile("(?s).*\\b" + appName + "\\b.*")); + } + Map> failedApps = new HashMap>(); + boolean timedOut = false; + + Log.info(c, method, "Searching for app manager messages in " + outputFile.getAbsolutePath()); + for (;;) { + LogSearchResult allMatches = LibertyFileManager.findStringsInFileCommon(regexpList, Integer.MAX_VALUE, outputFile, offset); + if (allMatches != null && !!!allMatches.getMatches().isEmpty()) { + processAppManagerMessages(allMatches, unstartedApps, failedApps); + } + if (unstartedApps.isEmpty()) { + break; + } + if (System.currentTimeMillis() > finalTime) { + timedOut = true; + break; + } + if (System.currentTimeMillis() > slowTime) { + SOEHttpPostUtil.reportSoftLogTimeoutToSOE(CLASS_NAME, method, 1071, intendedTimeout, "Unstarted: " + unstartedApps); + SOEHttpPostUtil.reportSoftLogTimeoutToSOE(CLASS_NAME, method, 1072, intendedTimeout, "Failed: " + failedApps); + slowTime = finalTime + WAIT_INCREMENT; // don't report again + } + offset = allMatches == null ? 0 : allMatches.getOffset(); + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + } + if (timedOut) { + Log.warning(c, "Timed out searching for app manager messages in log file: " + outputFile.getAbsolutePath()); + } + String plural = unstartedApps.size() > 1 ? "s" : ""; + if (failedApps.isEmpty()) { + if (unstartedApps.isEmpty()) { + return null; + } + // Trigger a serverDump: this will contain the output of server introspectors, which can + // help pinpoint service resolution issues or missing dependencies. + serverDump(); + + // If apps failed to start, try to make sure the port opened so we correctly + // flag a port issue as the culprit. + validatePortStarted(); + + return "Timed out waiting for application" + plural + " " + unstartedApps.keySet() + " to start."; + + } + String exceptionText = "Failures occured while waiting for app" + plural + " to start:"; + for (Map.Entry> entry : failedApps.entrySet()) { + for (String failure : entry.getValue()) { + String text; + if (entry.getKey().equals("*")) { + text = "App Manager Failure: " + failure; + } else { + text = "Application " + entry.getKey() + " failure: " + failure; + } + Log.info(c, method, text); + exceptionText += "\n " + text; + } + } + return exceptionText; + } catch (Exception e) { + Log.error(c, method, e, "Exception thrown confirming apps are loaded when validating that " + + outputFile.getAbsolutePath() + " contains application install messages."); + throw e; + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(c, method, + "Started searching for app manager messages at " + + formatter.format(new Date(startTime)) + + " and finished at " + + formatter.format(new Date(endTime))); + } + } + +/* + * App Manager messages that tests wait for in the log: + * + * CWWKZ0001I - many + * CWWKZ0002E - none + * CWWKZ0003I - com.ibm.ws.app.manager_fat, com.ibm.ws.classloading_fat, com.ibm.ws.ejbcontainer.security_fat, + * com.ibm.ws.jpa_fat, com.ibm.ws.jsf_fat_lWAS, com.ibm.ws.management.repository.client_fat, + * com.ibm.ws.ssl_fat, com.ibm.ws.webcontainer-8.0_fat_lWAS + * CWWKZ0004E - none + * CWWKZ0005E - none + * CWWKZ0006E - none + * CWWKZ0007W - none + * CWWKZ0008E - none + * CWWKZ0009I - com.ibm.ws.app.manager_fat, com.ibm.ws.app.manager.eba_fat, com.ibm.ws.eba.bundle.repository_fat, + * com.ibm.ws.jaxws_fat, com.ibm.ws.jca_fat, com.ibm.ws.jsf_fat_lWAS, com.ibm.ws.management.repository.client_fat, + * com.ibm.ws.session-3.0_fat, com.ibm.ws.webcontainer-8.0_fat_lWAS, com.ibm.ws.webcontainer.security_fat + * CWWKZ0010E - none + * CWWKZ0011E - none + * CWWKZ0012I - com.ibm.ws.app.manager.eba_fat, com.ibm.ws.webcontainer-8.0_fat_lWAS + * CWWKZ0013E - com.ibm.ws.app.manager_fat, com.ibm.ws.security_fat + * CWWKZ0014W - com.ibm.ws.app.manager_fat + * CWWKZ0015E - none + * CWWKZ0016E - none + * CWWKZ0017E - none + * CWWKZ0018I - none + * CWWKZ0019I - none + * CWWKZ0020I - none + * CWWKZ0021E - none + * CWWKZ0022W - none + * CWWKZ0053E - none + * CWWKZ0054E - none + * CWWKZ0055E - none + * CWWKZ0056E - none + * CWWKZ0057E - none + * CWWKZ0058I - com.ibm.ws.app.manager_fat, javax.jaxb-2.2_fat + * CWWKZ0059E - com.ibm.ws.app.manager_fat + * CWWKZ0060E - none + * CWWKZ0060W - none + * CWWKZ0106E - none + * CWWKZ0107E - none + * CWWKZ0111E - none + * CWWKZ0112E - none + * CWWKZ0113E - none + * CWWKZ0114E - none + * CWWKZ0115E - none + * CWWKZ0116E - none + * CWWKZ0117E - none + * CWWKZ0118E - none + * CWWKZ0120E - none + * CWWKZ0121E - none + * CWWKZ0201E - none + * CWWKZ0202E - none + * CWWKZ0203E - none + * CWWKZ0204E - none + * CWWKZ0205E - none + * CWWKZ0206E - none + * CWWKZ0207E - none + * CWWKZ0301E - com.ibm.ws.app.manager.eba_fat?, com.ibm.ws.eba.fidelity_fat + * CWWKZ0302E - com.ibm.ws.app.manager.eba_fat + * CWWKZ0303E - none + * CWWKZ0304E - com.ibm.ws.app.manager.eba_fat, com.ibm.ws.eba.bundle.repository_fat + * CWWKZ0401E - none + * CWWKZ0402E - none + * CWWKZ0403E - none + * CWWKZ0404E - none + */ + protected enum Action { + REMOVE_APP_NAME_FROM_UNSTARTED_APPS, + ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS, + ADD_FAILURE_FOR_ALL_FAILED_APPS, + IGNORE + } + + protected enum AppManagerMessage { + // app.manager + // APPLICATION_START_SUCCESSFUL=CWWKZ0001I: Application {0} started in {1} seconds. + CWWKZ0001I(Action.REMOVE_APP_NAME_FROM_UNSTARTED_APPS), + // APPLICATION_START_FAILED=CWWKZ0002E: An exception occurred while starting the application {0}. The exception message was: {1} + CWWKZ0002E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // APPLICATION_UPDATE_SUCCESSFUL=CWWKZ0003I: The application {0} updated in {1} seconds. + CWWKZ0003I, + // APPLICATION_UPDATE_FAILED=CWWKZ0004E: An exception occurred while starting the application {0}. The exception message was: {1} + CWWKZ0004E, + // NO_APPLICATION_HANDLER=CWWKZ0005E: The application {0} cannot start because the server is not configured to handle applications of type {1}. + CWWKZ0005E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // CANNOT_CREATE_DIRECTORY=CWWKZ0006E: The server could not create a download location at {0} for the {1} application. + CWWKZ0006E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // DOWNLOAD_EXCEPTION_ENCOUNTERED=CWWKZ0007W: An exception occurred while downloading the file from {0}. The exception message was: {1} + CWWKZ0007W(Action.ADD_FAILURE_FOR_ALL_FAILED_APPS), + // LOCATION_SERVICE_NOT_FOUND=CWWKZ0008E: An internal error has occurred. The system could not get the location service that is required to resolve file locations. + CWWKZ0008E(Action.ADD_FAILURE_FOR_ALL_FAILED_APPS), + // APPLICATION_STOPPED=CWWKZ0009I: The application {0} has stopped successfully. + CWWKZ0009I, + // APPLICATION_STOP_FAILED=CWWKZ0010E: An exception occurred while stopping the application {0}. The exception message was: {1} + CWWKZ0010E, + // FIND_FILE_EXCEPTION_ENCOUNTERED=CWWKZ0011E: An exception occurred while searching for the file {0}. The exception message was: {1} + CWWKZ0011E, + // APPLICATION_NOT_STARTED=CWWKZ0012I: The application {0} was not started. + CWWKZ0012I(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // DUPLICATE_APPLICATION_NAME=CWWKZ0013E: It is not possible to start two applications called {0}. + CWWKZ0013E, + // APPLICATION_NOT_FOUND=CWWKZ0014W: The application {0} could not be started as it could not be found at location {1}. + CWWKZ0014W(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // APPLICATION_NO_LOCATION_NO_NAME=CWWKZ0015E: An application has been configured with no location or name. + CWWKZ0015E, + // APPLICATION_NO_LOCATION=CWWKZ0016E: The application {0} has not been configured with a location. + CWWKZ0016E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // APPLICATION_NO_TYPE=CWWKZ0017E: It was not possible to infer the application type for application {0} from the location {1}. + CWWKZ0017E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // STARTING_APPLICATION=CWWKZ0018I: Starting application {0}. + CWWKZ0018I, + // PARTIAL_START=CWWKZ0019I: Application {0} partly started in {1} seconds. + CWWKZ0019I, + // APPLICATION_NOT_UPDATED=CWWKZ0020I: Application {0} not updated. + CWWKZ0020I, + // APPLICATION_AT_LOCATION_NOT_VALID=CWWKZ0021E: Application {0} at location {1} is invalid. + CWWKZ0021E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // APPLICATION_SLOW_STARTUP=CWWKZ0022W: Application {0} has not started in {1} seconds. + CWWKZ0022W, + // + // MONITOR_APP_STOP_FAIL=CWWKZ0053E: An exception occurred while trying to stop the {0} application automatically. + CWWKZ0053E, + // INVALID_FILE_NAME=CWWKZ0054E: The application monitoring service could not find a suitable name for the {0} application. + CWWKZ0054E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // UNABLE_TO_DETERMINE_APPLICATION_TYPE=CWWKZ0055E: The application monitoring service could not determine the type of the {0} application. + CWWKZ0055E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // MONITOR_APP_START_FAIL=CWWKZ0056E: An exception occurred while trying to automatically start the {0} application. + CWWKZ0056E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // MONITOR_INVALID_CACHE_FILE_ENTRY=CWWKZ0057E: When reading the cached list of started applications from the application monitor ({0}), line number {1} was not valid. The line was: {2}. + CWWKZ0057E, + // APPLICATION_MONITOR_STARTED=CWWKZ0058I: Monitoring {0} for applications. + CWWKZ0058I, + // INVALID_DELETE_OF_APPLICATION=CWWKZ0059E: The {0} application installed from {1} has been deleted while it is still configured. + CWWKZ0059E, + // MONITOR_DIR_CLEANUP_FAIL=CWWKZ0060E: The server could not clean up the old monitored directory at {0}. + CWWKZ0060E, + // APPLICATION_MONITORING_FAIL=CWWKZ0060W: Unable to monitor the {0} application. + CWWKZ0060W, + // app.manager.eba + // eba.installer.resolver.fail=CWWKZ0301E: An exception occurred trying to resolve the application {0} into an OSGi framework. The error text is: {1} + CWWKZ0301E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // eba.installer.bundle.fail=CWWKZ0302E: A bundle exception was generated when trying to install the application {0} into an OSGi framework. The error text from the OSGi framework is: {1} + CWWKZ0302E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // eba.installer.aries.management.fail=CWWKZ0303E: A management exception was generated when trying to install the application {0} into an OSGi framework. The error text from the OSGi framework is: {1} + CWWKZ0303E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // eba.installer.aries.resolver.fail=CWWKZ0304E: An exception was generated when trying to resolve the contents of the application {0}. The exception text from the OSGi framework is: {1} + CWWKZ0304E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // app.manager.esa + // esa.installer.resolver.fail=CWWKZ0401E: An exception occurred trying to resolve the application {0} into an OSGi framework. The error text is: {1} + CWWKZ0401E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // esa.installer.bundle.fail=CWWKZ0402E: A bundle exception was generated when trying to install the application {0} into an OSGi framework. The error text from the OSGi framework is: {1} + CWWKZ0402E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // esa.installer.aries.management.fail=CWWKZ0403E: A management exception was generated when trying to install the application {0} into an OSGi framework. The error text from the OSGi framework is: {1} + CWWKZ0403E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // esa.installer.aries.resolver.fail=CWWKZ0404E: An exception was generated when trying to resolve the contents of the application {0}. The exception text from the OSGi framework is: {1} + CWWKZ0404E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // app.manager.module + // error.cache.adapt=CWWKZ0107E: An internal error occurred. Unable to adapt cache for web module {0}. + CWWKZ0107E, + // app.manager.wab + // bundle.tracker.init.fail=CWWKZ0201E: An error occurred initializing the WAB installer. + CWWKZ0201E, + // wab.install.fail=CWWKZ0202E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0202E, + // wab.install.fail.adapt=CWWKZ0203E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0203E, + // wab.install.fail.overlay=CWWKZ0204E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0204E, + // wab.install.fail.cache=CWWKZ0205E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0205E, + // wab.install.fail.container=CWWKZ0206E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0206E, + // wab.install.fail.wiring=CWWKZ0207E: Unable to install bundle {0} with context root {1} into the web container. + CWWKZ0207E, + // wab.install.fail.clash=CWWKZ0208E: Unable to install bundle {0} with context root {1} into the web container because that context root is already in use by {2} + CWWKZ0208E, + // app.manager.war + // error.not.installed=CWWKZ0106E: Could not start web application {0}. + CWWKZ0106E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.application.library.container=CWWKZ0111E: Application {0} encountered a error when accessing application library {1}: {2} + CWWKZ0111E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.application.libraries=CWWKZ0112E: Application {0} encountered an error when listing application libraries: {1} + CWWKZ0112E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.application.parse.descriptor=CWWKZ0113E: Application {0} encountered a parse error when processing application descriptor {1}: {2} + CWWKZ0113E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.container=CWWKZ0114E: Application {0} encountered an error when accessing the contents of module {1} of type {2}: {3} + CWWKZ0114E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.container.null=CWWKZ0115E: Application {0} obtained a null value when accessing the contents candidate module {1} of type {2} + CWWKZ0115E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.create=CWWKZ0116E: Application {0} failed to finish creation of module {1} of type {2}: {3} + CWWKZ0116E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.locate.failed=CWWKZ0117E: Application {0} failed to locate module {1} of type {2} + CWWKZ0117E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.parse.descriptor=CWWKZ0118E: Application {0} encountered a parse error when processing descriptor {1} of module {2} of type {3}: {4} + CWWKZ0118E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.class.source=CWWKZ0120E: Application {0} failed to access classes for module {1} of type {2}: {3} + CWWKZ0120E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS), + // error.module.annotation.targets=CWWKZ0121E: Application {0} failed to access annotations for module {1} of type {2}: {3} + CWWKZ0121E(Action.ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS); + + final Action action; + + AppManagerMessage() { + this(Action.IGNORE); + } + + AppManagerMessage(Action action) { + this.action = action; + } + + public void processMessage(String[] tokens, Map unstartedApps, Map> failedApps) { + String appName; + switch (action) { + case REMOVE_APP_NAME_FROM_UNSTARTED_APPS: + appName = findAppNameInTokens(unstartedApps, tokens); + if (appName != null) { + unstartedApps.remove(appName); + } + break; + case ADD_FAILURE_FOR_APP_NAME_TO_FAILED_APPS: + appName = findAppNameInTokens(unstartedApps, tokens); + if (appName != null) { + List failures = failedApps.get(appName); + if (failures == null) { + failures = new ArrayList(); + failedApps.put(appName, failures); + } + failures.add(tokensToString(tokens)); + unstartedApps.remove(appName); + } + break; + case ADD_FAILURE_FOR_ALL_FAILED_APPS: + addFailureToAllFailedApps(tokens, failedApps); + break; + case IGNORE: + break; + } + } + } + + protected static String tokensToString(String[] tokens) { + return tokens[0] + ":" + tokens[1]; + } + + protected static void addFailureToAllFailedApps(String[] tokens, Map> failedApps) { + List failures = failedApps.get("*"); + if (failures == null) { + failures = new ArrayList(); + failedApps.put("*", failures); + } + failures.add(tokensToString(tokens)); + } + + protected void processAppManagerMessages(LogSearchResult allMatches, Map unstartedApps, Map> failedApps) { + final String method = "processAppManagerMessages"; + + for (String line : allMatches.getMatches()) { + line = line.substring(line.indexOf("CWWKZ")); + Log.info(c, method, "line is " + line); + String[] tokens = line.split(":", 2); + Log.info(c, method, "tokens are (" + tokens[0] + ") (" + tokens[1] + ")"); + try { + AppManagerMessage matchedMessage = AppManagerMessage.valueOf(tokens[0]); + if (matchedMessage != null) { + matchedMessage.processMessage(tokens, unstartedApps, failedApps); + } + } catch (IllegalArgumentException ex) { + ex.getCause(); + if (tokens[0].endsWith("E")) { + addFailureToAllFailedApps(tokens, failedApps); + } + } + } + } + + protected static String findAppNameInTokens(Map unstartedApps, String[] tokens) { + final String method = "findAppNameInTokens"; + + for (Map.Entry entry : unstartedApps.entrySet()) { + Log.info(c, method, "looking for app " + entry.getKey() + " in " + tokens[1]); + if (entry.getValue().matcher(tokens[1]).matches()) { + Log.info(c, method, "matched app " + entry.getKey()); + return entry.getKey(); + } + } + Log.info(c, method, "no matches for apps found in " + tokens[1]); + return null; + } + + protected void validateServerStarted(ProgramOutput output, boolean validateApps, + boolean expectStartFailure, boolean validateTimedExit) throws Exception { + final String method = "validateServerStarted"; + + final String START_MESSAGE_CODE = "CWWKF0011I"; + + boolean serverStarted = false; + + if (checkForRestConnector.get()) { + //since this is going to connect to the secure port, that needs to be ready + //before an attempt to make the JMX connection + Log.info(c, method, "Checking that the JMX RestConnector is available and secured"); + assertNotNull("CWWKO0219I.*ssl not recieved", waitForStringInLogUsingMark("CWWKO0219I.*ssl")); + + assertNotNull("IBMJMXConnectorREST app did not report as ready", waitForStringInLogUsingMark("CWWKT0016I.*IBMJMXConnectorREST")); + + assertNotNull("Security service did not report it was ready", waitForStringInLogUsingMark("CWWKS0008I")); + + //backup the key file + copyFileToTempDir("resources/security/key.jks", "key.jks"); + } + + Log.info(c, method, "Waiting up to " + (serverStartTimeout / 1000) + + " seconds for server confirmation: " + + START_MESSAGE_CODE.toString() + " to be found in " + consoleAbsPath); + + RemoteFile messagesLog = new RemoteFile(machine, messageAbsPath); + RemoteFile consoleLog = getConsoleLogFile(); + + try { + RemoteFile f = getServerBootstrapPropertiesFile(); + Properties props = new Properties(); + + if (f.exists()) { + InputStream is = null; + try { + is = f.openForReading(); + props.load(is); + } catch (Exception e) { + LOG.warning("Error reading " + f + ": " + e.getMessage()); + } finally { + if (is != null) { + is.close(); + } + } + } + + // If log.level is set to off, look in messages.log for server.start verification + isStartedConsoleLogLevelOff = "off".equalsIgnoreCase(props.getProperty("com.ibm.ws.logging.console.log.level")); + String startMessage = waitForStringInLog(START_MESSAGE_CODE, serverStartTimeout, + isStartedConsoleLogLevelOff ? messagesLog : consoleLog); + serverStarted = (startMessage != null); + // If the server started successfully, we're started + // (but the opposite isn't true since the server could already have been running) + if (serverStarted) { + isStarted = true; + } + } catch (Exception e) { + Log.error(c, method, e, "Exception thrown confirming server started in " + consoleAbsPath); + postStopServerArchive(); + throw e; + } + + if (!!!serverStarted) { + if (expectStartFailure) { + Log.info(c, method, "EXPECTED: Server didn't start"); + return; + } else { + Log.info(c, method, "Server hasn't started successfully"); + // Didn't find kernel start up message so exception + String exMessage = "Start Server error: The server did not show kernel had started."; + String errMessage = "Server failed to start."; + if (output != null) { + exMessage += " The server did not show kernel had started. The standard error was: " + + output.getStderr() + ".\n Standard out was: " + + output.getStdout() + ".\n Return code was: " + output.getReturnCode() + + ".\n Message was not found in " + consoleLog.getAbsolutePath(); + errMessage += " Command used to start server was: " + output.getCommand(); + } + TopologyException serverStartException = new TopologyException(exMessage); + Log.error(c, method, serverStartException, errMessage); + postStopServerArchive(); + throw serverStartException; + } + } else if (expectStartFailure) { + Log.info(c, method, "ERROR: The server started successfully, but a start failure was expected."); + // Didn't find kernel start up message so exception + TopologyException serverStartException = new TopologyException("The server started successully, but a failure was expected"); + Log.error(c, method, serverStartException, "ERROR: The server started successfully, but a start failure was expected."); + throw serverStartException; + } + + if (validateApps || validateTimedExit) { + // App validation needs the info messages in messages.log + + if (!messagesLog.exists()) { + // NOTE: The HPEL FAT bucket has a strange mechanism to create messages.log for test purposes, which may get messed up + Log.info(c, method, "WARNING: messages.log does not exist-- trying app verification step with console.log"); + messagesLog = consoleLog; + } + + if (validateTimedExit) { + validateTimedExitEnabled(messagesLog); + } + if (validateApps) { + validateAppsLoaded(messagesLog); + } + } + } + + protected void validateTimedExitEnabled(RemoteFile messagesLog) throws Exception { + final String method = "validateTimedExitEnabled"; + // 20 second timeout + final long TIMEOUT = 20 * 1000; + final String TIMED_EXIT_ENABLED = "Timed Exit Enabled"; + + List message = findStringsInLogs(TIMED_EXIT_ENABLED, messagesLog); + + if (message == null || message.isEmpty()) { + // It's fairly unusual, but it's technically possible that timed exit is enabled and the message hasn't been issued yet. + // We use this backup rather than replacing the above findStringsInLogs because it's possible for the mark to be set to a location + // after the timed exit message + String takeTwo = waitForStringInLog("Timed Exit Enabled", TIMEOUT, messagesLog); + if (takeTwo != null) { + // Everything is OK now, log a message indicating that we got here + Log.info(c, method, "Found the timed exit string (late arrival)"); + return; + } + String errorMessage = "The necessary feature timedexit-1.0 was not enabled. " + + "Please include fatTestPorts.xml or fatTestCommon.xml in the server.xml for server " + serverToUse + "."; + Log.info(c, method, "ERROR: " + errorMessage); + + TopologyException serverStartException = new TopologyException(errorMessage); + Log.error(c, method, serverStartException, "ERROR: " + errorMessage); + + throw serverStartException; + } + } + + protected void validatePortStarted() throws Exception { + final String method = "validatePortStarted"; + + // App validation needs the info messages in messages.log + RemoteFile messagesLog = new RemoteFile(machine, messageAbsPath); + if (!messagesLog.exists()) { + String message = waitForStringInLog("CWWKO0219I", serverStartTimeout, messagesLog); + if (message == null || message.isEmpty()) { + String errorMessage = "A listening http or https port did not start. Please look at messages.log to figure out why..."; + Log.info(c, method, "ERROR: " + errorMessage); + + TopologyException serverStartException = new TopologyException(errorMessage); + Log.error(c, method, serverStartException, "ERROR: " + errorMessage); + throw serverStartException; + } + } + } + + public ProgramOutput stopServer(String... expectedFailuresRegExps) throws Exception { + final String method = "stopServer1"; + if (expectedFailuresRegExps != null) { + Log.info(c, method, "expectedFailuresRegExps length is " + expectedFailuresRegExps.length); + } else { + Log.info(c, method, "expectedFailuresRegExps is null."); + } + return this.stopServer(true, expectedFailuresRegExps); + } + + public static void stopMultipleServers(Collection servers) throws Exception { + Exception firstException = null; + boolean exceptionThrown = false; + if (servers != null) { + for (LibertyServer server : servers) { + try { + server.stopServer(); + } catch (Exception e) { + // catch the first exception and re-throw after attempting to stop all servers + if (!exceptionThrown) { + firstException = e; + exceptionThrown = true; + } + } + } + } + if (exceptionThrown) { + throw new RuntimeException("Exceptions occured while stopping " + servers.size() + " servers, re-throwing the first exception", firstException); + } + } + + public ProgramOutput stopServer(boolean postStopServerArchive, String... expectedFailuresRegExps) throws Exception { + final String method = "stopServer2"; + if (expectedFailuresRegExps != null) { + Log.info(c, method, "expectedFailuresRegExps length is " + expectedFailuresRegExps.length); + } else { + Log.info(c, method, "expectedFailuresRegExps is null."); + } + return this.stopServer(postStopServerArchive, false, expectedFailuresRegExps); + } + + /** + * Stops the server and checks for any warnings or errors that appeared in logs. + * If warnings/errors are found, an exception will be thrown after the server stops. + * + * @param postStopServerArchive true to collect server log files after the server is stopped; false to skip this step (sometimes, FATs back up log files on their own, so this + * would be redundant) + * @param forceStop Force the server to stop, skipping the quiesce (default/usual value should be false) + * @param regIgnore A list of reg expressions corresponding to warnings or errors that should be ignored. + * If regIgnore is null, logs will not be checked for warnings/errors + * @return the output of the stop command + * @throws Exception if the stop operation fails or there are warnings/errors found in server + * logs that were not in the list of ignored warnings/errors. + */ + public ProgramOutput stopServer(boolean postStopServerArchive, boolean forceStop, String... expectedFailuresRegExps) throws Exception { + + ProgramOutput output = null; + boolean commandPortEnabled = true; + try { + final String method = "stopServer"; + + if (!isStarted) { + Log.info(c, method, "Server " + serverToUse + " is not running (stop called previously)."); + postStopServerArchive = false; + return output; + } + + Log.info(c, method, "stoppingServer"); + String cmd = installRoot + "/bin/server"; + + String[] parameters; + if (forceStop) { + parameters = new String[] { "stop", serverToUse, "--force" }; + } else { + parameters = new String[] { "stop", serverToUse }; + } + + //Need to ensure JAVA_HOME is set correctly - can't rely on user's environment to be set to the same Java as the build/runtime environment + Properties envVars = new Properties(); + envVars.setProperty("JAVA_HOME", machineJava); + if (customUserDir) + envVars.setProperty("WLP_USER_DIR", userDir); + Log.info(c, method, "Using additional env props: " + envVars.toString()); + + if (runAsAWindowService == false) { + output = machine.execute(cmd, parameters, envVars); + } else { + ArrayList parametersList = new ArrayList(); + for (int i = 0; i < parameters.length; i++) { + parametersList.add(parameters[i]); + } + ArrayList stopServiceParmList = makeParmList(parametersList, 2); + ArrayList removeServiceParmList = makeParmList(parametersList, 3); + String[] stopServiceParameters = stopServiceParmList.toArray(new String[] {}); + String[] removeServiceParameters = removeServiceParmList.toArray(new String[] {}); + + Log.info(c, method, "runAsAWindowService StopService parms: " + stopServiceParmList.toString()); + output = machine.execute(cmd, stopServiceParameters, envVars); + Log.info(c, method, "runAsAWindowService RemoveService parms: " + removeServiceParmList.toString()); + output = machine.execute(cmd, removeServiceParameters, envVars); + + } + + String stdout = output.getStdout(); + Log.info(c, method, "Stop Server Response: " + stdout); + Log.info(c, method, "Return code from script is: " + output.getReturnCode()); + + isStarted = false; + if (stdout.contains("is not running")) { + return output; + } + + if (stdout.contains("command port is disabled")) { + // Mark that the command port is not enabled + commandPortEnabled = false; + throw new RuntimeException("Cannot stop server because command port is disabled."); + } + RemoteFile log = isStartedConsoleLogLevelOff ? new RemoteFile(machine, messageAbsPath) : getConsoleLogFile(); + // Actually waits for the stop message + waitForStringInLog("CWWKE0036I:", SERVER_STOP_TIMEOUT, log); + + // Now verify that the server is truly stopped by checking server status from the command line. + // This checks to see if the server lock file (/workarea/.sLock) is unlocked. + ProgramOutput serverStatusOutput = executeServerScript("status", null); + switch (serverStatusOutput.getReturnCode()) { + case 0: + Log.warning(c, method + " Server is still running - or server lock file is still locked."); + break; + case 1: + Log.info(c, method, "Server stopped successfully"); + break; + case 2: + Log.warning(c, method + " Unknown server - directory deleted? " + serverToUse); + break; + case 5: + Log.warning(c, method + " Unable to detect server status - workarea directory deleted? " + serverToUse); + break; + default: + Log.warning(c, method + " Unexpected failure occurred while checking server status"); + + } + + this.isTidy = true; + + checkLogsForErrorsAndWarnings(expectedFailuresRegExps); + + Log.info(c, method, "serverstopped"); + } finally { + if (commandPortEnabled) { + // If the command port is enabled we should reset the log offsets + // as we will get new logs on the next start. However, if the + // command port isn't disabled, we won't have shut down the + // server, so we don't need to reset the log marks + resetLogOffsets(); + clearMessageCounters(); + } + if (GLOBAL_DEBUG_JAVA2SECURITY) + new ACEScanner(this).run(); + if (postStopServerArchive) + postStopServerArchive(); + // Delete marker for stopped server + // deleteServerMarkerFile(); + } + + return output; + } + + /** + * Checks server logs for any lines containing errors or warnings that + * do not match any regular expressions provided in regIgnore. + * + * @param regIgnore A list of regex strings for errors/warnings that + * may be safely ignored. + * @return A list of lines containing errors/warnings from server logs + */ + protected void checkLogsForErrorsAndWarnings(String... regIgnore) throws Exception { + final String method = "checkLogsForErrorsAndWarnings"; + + if (!isServerExemptFromChecking(regIgnore)) { + // Get all warnings and errors in logs - default to an empty list + List errorsInLogs = new ArrayList(); + try { + errorsInLogs = this.findStringsInLogs(".*[EW] .*\\d{4}[EW]:.*"); + if (errorsInLogs != null && !errorsInLogs.isEmpty()) { + // There were unexpected errors in logs, print them + // and set an exception to return + StringBuffer sb = new StringBuffer("Errors/warnings were found in server "); + sb.append(getServerName()); + sb.append(" logs:"); + for (String errorInLog : errorsInLogs) { + sb.append("\n
    "); + sb.append(errorInLog); + Log.info(c, method, "Error/warning found in log ORIGINALLY: " + errorInLog); + } + } + } catch (Exception e) { + Log.warning(getClass(), "While checking for log errors and warnings, findStringsInLogs caused an exception: " + e.getMessage()); + } + + // Compile set of regex's using input list and universal ignore list + List ignorePatterns = new ArrayList(); + if (regIgnore != null && regIgnore.length != 0) { + Log.info(c, method, "regIgnore length is " + regIgnore.length); + for (String ignoreRegEx : regIgnore) { + ignorePatterns.add(Pattern.compile(ignoreRegEx)); + } + } + Log.info(c, method, "ignorePatterns is " + ignorePatterns.toString()); + // Add the regexes added via the instance method + if (ignoredErrors != null) { + Log.info(c, method, "ignoreErrors is " + ignoredErrors.toString()); + for (String regex : ignoredErrors) { + ignorePatterns.add(Pattern.compile(regex)); + } + ignoredErrors.clear(); + Log.info(c, method, "ignoreErrors NOW is " + ignoredErrors.toString()); + } + + // Add the global fixed list of regexes entries. + if (fixedIgnoreErrorsList != null) { + Log.info(c, method, "fixedIgnoreErrorsList is " + fixedIgnoreErrorsList.toString()); + for (String regex : fixedIgnoreErrorsList) { + ignorePatterns.add(Pattern.compile(regex)); + } + } + + // Do not blow up for any Java 2 security errors or warnings, we want + // the tests to continue on and run as much as possible + if (GLOBAL_DEBUG_JAVA2SECURITY) { + ignorePatterns.add(Pattern.compile("CWWKE09(21W|12W|13E|14W|15W|16W)")); + } + + Log.info(c, method, "ignorePatterns NOW is " + ignorePatterns.toString()); + // Remove any ignored warnings or patterns + for (Pattern ignorePattern : ignorePatterns) { + Iterator iter = errorsInLogs.iterator(); + while (iter.hasNext()) { + if (ignorePattern.matcher(iter.next()).find()) { + // this is an ignored warning/error, remove it from list + iter.remove(); + Log.info(c, method, "Error being removed is " + ignorePattern); + } + } + } + + Exception ex = null; + if (errorsInLogs != null && !errorsInLogs.isEmpty()) { + // There were unexpected errors in logs, print them + // and set an exception to return + StringBuffer sb = new StringBuffer("Errors/warnings were found in server "); + sb.append(getServerName()); + sb.append(" logs:"); + for (String errorInLog : errorsInLogs) { + sb.append("\n
    "); + sb.append(errorInLog); + Log.info(c, method, "Error/warning found: " + errorInLog); + } + ex = new Exception(sb.toString()); + } + + if (ex == null) + Log.info(c, method, "No unexpected errors or warnings found in server logs."); + else + throw ex; + } else { + Log.info(c, method, "Skipping log validation on server " + getServerName()); + } + } + + /** + * Checks the current server to see if it is eligible + * for log checking. + * + * @param none + * + * @return boolean true - no need to check, false - check for errors + */ + protected boolean isServerExemptFromChecking(String... regIgnore) { + + String method = "isServerExemptFromChecking"; + Log.info(c, method, "Entering isServerExemptFromChecking"); + boolean result = true; + if (!isCheckingDisabled(regIgnore)) { + try { + if (serversExemptFromChecking == null) { + loadExemptServers(); + } + Log.info(c, method, "Checking Server Name " + getServerName()); + String foundServer = serversExemptFromChecking.get(getServerName()); + if (foundServer == null) + result = false; + + } catch (Exception e) { + Log.info(c, "isServerValidation", "Error determing Exempt Servers " + e.toString()); + } + } + + return result; + + } + + /** + * Looks at the list of regular expressions to ignore + * in search of the disable checking flag. + * + * @param String... regularExpressions to ignore + * + * @return boolean true when disable flag found, false when disable flag not found. + */ + private boolean isCheckingDisabled(String... regIgnore) { + + boolean checkingDisabled = false; + if (regIgnore != null && regIgnore.length > 0) + for (String disableString : regIgnore) + if (disableString.equals(LibertyServer.DISABLE_FAILURE_CHECKING)) + checkingDisabled = true; + + return checkingDisabled; + + } + + /** + * Reads a list of exempt servers into a HashMap for later searching. + * + * @param none + * + * @return none + */ + + protected void loadExemptServers() throws Exception { + String method = "loadExemptServers"; + BufferedReader br = null; + serversExemptFromChecking = new HashMap(1000); + Log.info(c, method, "loading exempt server list"); + RemoteFile exempt = new RemoteFile(machine, serverRoot + "/exemptServersList.txt"); + try { + br = new BufferedReader(new InputStreamReader(exempt.openForReading())); + for (String line; (line = br.readLine()) != null;) { + if (line.indexOf("#") < 0) { + serversExemptFromChecking.put(line.trim(), line.trim()); + } + } + } catch (Exception e) { + Log.info(c, method, "Error loading ExemptServer list " + e.toString()); + serversExemptFromChecking = null; + throw e; + } finally { + if (br != null) + br.close(); + } + + } + + protected void clearMessageCounters() { + //this is because we will be getting a new log file + stopApplicationMessages.set(0); + startApplicationMessages.set(0); + } + + public void restartServer() throws Exception { + stopServer(); + startServer(); + } + + /** + * This method is protected as from now on the Custom + * JUnit runner will call this method at the end of the testing + * in order to ensure all server's are tidied. + */ + protected void postTestTidy() throws Exception { + if (!isTidy) { + stopServer(); + } + isTidy = true; + } + + /** + * This method is intended to be called from LibertyServerFactory + * only when a cached server instance which has previously been + * used and stopped is to be re-used. + */ + void unTidy() { + isTidy = false; + needsPostTestRecover = true; + } + + boolean isTidy() { + return isTidy; + } + + boolean needsPostTestRecover() { + return needsPostTestRecover; + } + + void setNeedsPostRecover(boolean b) { + needsPostTestRecover = b; + } + + /** + * This method is used to tidy away the server logs at the start. + */ + protected void preStartServerLogsTidy() throws Exception { + //should be .../alpine/usr/servers//logs + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, getServerRoot() + "/logs"); + + // Look for javacore/heapdump/snap. These are collected by stop/archive. We don't need + // to collect them in the archive of every subsequent server run. + List files = listLibertyServerRoot(null, null); + for (String name : files) { + if (name.startsWith("javacore*") || name.startsWith("heapdump*") || name.startsWith("Snap*") || name.startsWith(serverToUse + ".dump")) { + deleteFileFromLibertyInstallRoot(name); + } + } + } + + /** + * This method is used to archive server logs after a stopServer. + * This is particularly required for tWAS FAT buckets as it is not known + * when these finish, using this method will ensure logs are collected. + * Also, this will stop the server log contents being lost (over written) in a restart case. + */ + public void postStopServerArchive() throws Exception { + final String method = "postStopServerArchive"; + Log.entering(c, method); + + Log.info(c, method, "Moving logs to the output folder"); + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss"); + Date d = new Date(System.currentTimeMillis()); + + String logDirectoryName = pathToAutoFVTOutputServersFolder + "/" + serverToUse + "-" + sdf.format(d); + LocalFile logFolder = new LocalFile(logDirectoryName); + RemoteFile serverFolder = new RemoteFile(machine, serverRoot); + + runJextract(serverFolder); + + // Copy the log files: try to move them instead if we can + recursivelyCopyDirectory(serverFolder, logFolder, false, true, true); + + deleteServerMarkerFile(); + + Log.exiting(c, method); + } + + protected void runJextract(RemoteFile serverFolder) throws Exception { + RemoteFile[] files = serverFolder.list(false); + if (files != null) { + for (RemoteFile file : files) { + String filename = file.getAbsolutePath(); + if (filename.endsWith(".dmp")) { + + Properties envVars = new Properties(); + envVars.setProperty("JAVA_HOME", machineJava); + Log.info(c, "runJextract", "Running jextract on file: " + filename); + + String outputFilename = filename + ".zip.DMP"; //adding .DMP to ensure it is collected even when not collecting archives + String cmd = machineJava + "/bin/jextract"; + String[] parms = new String[] { filename, outputFilename }; + ProgramOutput output = machine.execute(cmd, parms, serverFolder.getAbsolutePath(), envVars); + Log.info(c, "runJextract stdout", output.getStdout()); + Log.info(c, "runJextract stderr", output.getStderr()); + Log.info(c, "runJextract", "rc = " + output.getReturnCode()); + } + } + } + } + + /** + * @param remoteFile + * @param logFolder + * @param b + * @param d + */ + protected void recursivelyCopyDirectory(RemoteFile remoteFile, LocalFile logFolder, boolean ignoreFailures) throws Exception { + recursivelyCopyDirectory(remoteFile, logFolder, ignoreFailures, false, false); + + } + + /** + * @param method + * @throws Exception + */ + protected void recursivelyCopyDirectory(RemoteFile remoteDirectory, LocalFile destination, boolean ignoreFailures, boolean skipArchives, boolean moveFile) throws Exception { + String method = "recursivelyCopyDirectory"; + destination.mkdirs(); + + ArrayList logs = new ArrayList(); + logs = listDirectoryContents(remoteDirectory); + for (String l : logs) { + if (remoteDirectory.getName().equals("workarea")) { + if (l.equals("org.eclipse.osgi") || l.startsWith(".s")) { + // skip the osgi framework cache, and runtime artifacts: too big / too racy + Log.finest(c, "recursivelyCopyDirectory", "Skipping workarea element " + l); + continue; + } + } + + if (remoteDirectory.getName().equals("messaging")) { + Log.finest(c, "recursivelyCopyDirectory", "Skipping message store element " + l); + continue; + } + + RemoteFile toCopy = new RemoteFile(machine, remoteDirectory, l); + LocalFile toReceive = new LocalFile(destination, l); + Log.finest(c, "recursivelyCopyDirectory", "Getting: " + toCopy.getAbsolutePath()); + + if (toCopy.isDirectory()) { + // Recurse + recursivelyCopyDirectory(toCopy, toReceive, ignoreFailures, skipArchives, moveFile); + } else { + try { + if (skipArchives + && (toCopy.getAbsolutePath().endsWith(".jar") + || toCopy.getAbsolutePath().endsWith(".war") + || toCopy.getAbsolutePath().endsWith(".ear") + || toCopy.getAbsolutePath().endsWith(".rar") + //If we're only getting logs, skip jars, wars, ears, zips, unless they are server dump zips + || (toCopy.getAbsolutePath().endsWith(".zip") && !toCopy.getName().contains(serverToUse + ".dump")))) { + Log.finest(c, "recursivelyCopyDirectory", "Skipping: " + toCopy.getAbsolutePath()); + continue; + } + + // We're only going to attempt to move log files. Because of ffdc log checking, we + // can't move those. But we should move other log files.. + boolean isLog = (toCopy.getAbsolutePath().contains("logs") && !toCopy.getAbsolutePath().contains("ffdc")) + || toCopy.getName().contains("javacore") + || toCopy.getName().contains("heapdump") + || toCopy.getName().contains("Snap") + || toCopy.getName().contains(serverToUse + ".dump"); + + if (moveFile && isLog) { + boolean copied = false; + + // If we're local, try to rename the file instead.. + if (machine.isLocal() && toCopy.rename(toReceive)) { + copied = true; // well, we moved it, but it counts. + Log.finest(c, "recursivelyCopyDirectory", "MOVE: " + l + " to " + toReceive.getAbsolutePath()); + } + + if (!copied && toReceive.copyFromSource(toCopy)) { + // copy was successful, clean up the source log + toCopy.delete(); + Log.finest(c, "recursivelyCopyDirectory", "MOVE: " + l + " to " + toReceive.getAbsolutePath()); + } + } else { + toReceive.copyFromSource(toCopy); + Log.finest(c, "recursivelyCopyDirectory", "COPY: " + l + " to " + toReceive.getAbsolutePath()); + } + } catch (Exception e) { + Log.finest(c, "recursivelyCopyDirectory", "unable to copy or move " + l + " to " + toReceive.getAbsolutePath()); + // Ignore on request and carry on copying the rest of the files + if (!ignoreFailures) { + throw e; + } + } + } + + } + } + + /** + * This method will copy a file from the server root into the AutoFVT {@link #pathToAutoFVTTestFiles}/tmp folder. + * If you are copying a directory and some of the files cannot be copied due to an error then these errors will + * be ignored, this can happen if the server is still active and the files are locked by another process. + * + * If copying a file the destination will be overwritten. + * + * @param pathInServerRoot The path to the file or directory in the server root, must not start with a "/" + * @param destination The place within the temp folder to store this file, must not start with a "/" + * @return the LocalFile of the copied RemoteFile + * @throws Exception + */ + public LocalFile copyFileToTempDir(String pathInServerRoot, String destination) throws Exception { + return copyFileToTempDir(new RemoteFile(machine, serverRoot + "/" + pathInServerRoot), destination); + } + + /** + * This method will copy a file from the install root into the AutoFVT {@link #pathToAutoFVTTestFiles}/tmp folder. + * If you are copying a directory and some of the files cannot be copied due to an error then these errors will + * be ignored, this can happen if the server is still active and the files are locked by another process. + * + * If copying a file the destination will be overwritten. + * + * @param pathInInstallRoot The path to the file or directory in the install root, must not start with a "/" + * @param destination The place within the temp folder to store this file, must not start with a "/" + * @return the LocalFile of the copied RemoteFile + * @throws Exception + */ + public LocalFile copyInstallRootFileToTempDir(String pathInInstallRoot, String destination) throws Exception { + return copyFileToTempDir(new RemoteFile(machine, installRoot + "/" + pathInInstallRoot), destination); + } + + protected LocalFile copyFileToTempDir(RemoteFile remoteToCopy, String destination) throws Exception { + // Make sure the tmp dir exists + LocalFile tmpDir = new LocalFile(pathToAutoFVTTestFiles + "/tmp"); + if (!tmpDir.exists()) { + tmpDir.mkdir(); + } + + LocalFile localCopy = new LocalFile(pathToAutoFVTTestFiles + "/tmp/" + destination); + + if (remoteToCopy.isDirectory()) { + recursivelyCopyDirectory(remoteToCopy, localCopy, true); + } else { + localCopy.copyFromSource(remoteToCopy, false, true); + } + + return localCopy; + } + + public String getServerRoot() { + return serverRoot; + } + + public String getServerSharedPath() { + return serverRoot + "/../../shared/"; + } + + /** + * Get the collective dir under the server resources dir. For instance, + * this is where the collective trust stores are located. + * + * @return the path + */ + public String getCollectiveResourcesPath() { + return serverRoot + "/resources/collective/"; + } + + public void setServerRoot(String serverRoot) { + this.serverRoot = serverRoot; + } + + public String getMachineJavaJDK() { + return machineJava; + } + + public String getMachineJavaJarCommandPath() { + return machineJarPath; + } + + /* not called */public void setMachineJava(String machineJava) { + this.machineJava = machineJava; + } + + public void copyFileToLibertyInstallRoot(String fileName) throws Exception { + LibertyFileManager.copyFileIntoLiberty(machine, installRoot, (pathToAutoFVTTestFiles + "/" + fileName)); + } + + public void copyFileToLibertyInstallRoot(String extendedPath, String fileName) throws Exception { + LibertyFileManager.copyFileIntoLiberty(machine, installRoot + "/" + extendedPath, (pathToAutoFVTTestFiles + "/" + fileName)); + } + + protected void copyFileToLibertyServerRootUsingTmp(String path, String relPathTolocalFile) throws Exception { + LocalFile localFileToCopy = new LocalFile(LibertyServerUtils.makeJavaCompatible(relPathTolocalFile, machine)); + LibertyFileManager.copyFileIntoLiberty(machine, path, localFileToCopy.getName(), relPathTolocalFile, false, serverRoot); + } + + public void copyApplicationToServer(String appName) throws Exception { + copyApplicationToServer("publish/files/apps", appName); + } + + public void copyApplicationToServer(String pathToApp, String appName) throws Exception { + copyFileToLibertyServerRootUsingTmp(serverRoot + "/apps", (pathToApp + "/" + appName)); + } + + public void copyFileToLibertyServerRoot(String fileName) throws Exception { + copyFileToLibertyServerRootUsingTmp(serverRoot, (pathToAutoFVTTestFiles + "/" + fileName)); + } + + public void copyFileToLibertyServerRoot(String extendedPath, String fileName) throws Exception { + copyFileToLibertyServerRootUsingTmp(serverRoot + "/" + extendedPath, (pathToAutoFVTTestFiles + "/" + fileName)); + } + + /** + * Copies a file into the ${server.config.dir} of a Liberty server. + * + * @param fromDir The directory of the file to copy. + * @param toDir Any extra path beyond ${server.config.dir} for the destination. + * For example, for a destination of ${server.config.dir}/test/ you would use toServerDir=test + * @param fileName The name of the file to copy. The file name will be unchanged form source to dest + */ + public void copyFileToLibertyServerRoot(String fromDir, String toDir, String fileName) throws Exception { + if (toDir == null) + toDir = ""; + copyFileToLibertyServerRootUsingTmp(serverRoot + "/" + toDir, (fromDir + "/" + fileName)); + } + + public void renameLibertyServerRootFile(String oldFileName, String newFileName) throws Exception { + LibertyFileManager.renameLibertyFile(machine, serverRoot + "/" + oldFileName, serverRoot + "/" + newFileName); + } + + public void renameLibertyInstallRootFile(String oldFileName, String newFileName) throws Exception { + LibertyFileManager.renameLibertyFile(machine, installRoot + "/" + oldFileName, installRoot + "/" + newFileName); + } + + public RemoteFile getFileFromLibertyInstallRoot(String filePath) throws Exception { + final String method = "getFileFromLibertyInstallRoot"; + Log.entering(c, method); + return getFileFromLiberty(installRoot + "/" + filePath); + } + + public RemoteFile getFileFromLibertyServerRoot(String filePath) throws Exception { + final String method = "getFileFromLibertyServerRoot"; + Log.entering(c, method); + return getFileFromLiberty(serverRoot + "/" + filePath); + } + + /* not called */public RemoteFile getFileFromLibertySharedDir(String filePath) throws Exception { + final String method = "getFileFromLibertySharedDir"; + Log.entering(c, method); + return getFileFromLiberty(getServerSharedPath() + filePath); + } + + protected RemoteFile getFileFromLiberty(String fullPath) throws Exception { + Log.info(c, "getFileFromLiberty", "Getting file: " + fullPath); + return LibertyFileManager.getLibertyFile(machine, fullPath); + } + + public boolean fileExistsInLibertyInstallRoot(String filePath) throws Exception { + final String method = "fileExistsInLibertyInstallRoot"; + Log.entering(c, method); + return libertyFileExists(installRoot + "/" + filePath); + } + + public boolean fileExistsInLibertyServerRoot(String filePath) throws Exception { + final String method = "fileExistsInLibertyServerRoot"; + Log.entering(c, method); + return libertyFileExists(serverRoot + "/" + filePath); + } + + /* not called */public boolean fileExistsInLibertySharedDir(String filePath) throws Exception { + final String method = "fileExistsInLibertySharedDir"; + Log.entering(c, method); + return libertyFileExists(getServerSharedPath() + filePath); + } + + protected boolean libertyFileExists(String fullPath) throws Exception { + boolean exists = LibertyFileManager.libertyFileExists(machine, fullPath); + Log.info(c, "libertyFileExists", "File: " + fullPath + " exists " + exists); + return exists; + } + + public String getServerName() { + return serverToUse; + } + + public void deleteFileFromLibertyInstallRoot(String filePath) throws Exception { + LibertyFileManager.deleteLibertyFile(machine, (installRoot + "/" + filePath)); + } + + public void deleteDirectoryFromLibertyInstallRoot(String directoryPath) throws Exception { + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, (installRoot + "/" + directoryPath)); + } + + public void deleteDirectoryFromLibertyServerRoot(String directoryPath) throws Exception { + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, (serverRoot + "/" + directoryPath)); + } + + public void deleteFileFromLibertyServerRoot(String filePath) throws Exception { + LibertyFileManager.deleteLibertyFile(machine, (serverRoot + "/" + filePath)); + } + + public RemoteFile getServerBootstrapPropertiesFile() throws Exception { + return new RemoteFile(machine, serverRoot + "/bootstrap.properties"); + } + + /** + * Non-recursively list the contents of the server install root directory, or if the relativePath + * parameter is non-null, the indicated directory (relative the the install root). If filter is + * non-null, return only those directory names or filenames that contain the filter string. + * + * @param relativeDir path to a directory relative to the install root directory, should not begin with path separator, may be null. + * @param filter string to filter the results by, returned file and directory names must contain this, may be null. + * @return a list of file and directory names indicating the contents of the specified directory. + * @throws Exception + */ + public List listLibertyInstallRoot(String relativeDir, String filter) throws Exception { + String path = installRoot; + if (relativeDir != null && !relativeDir.equals("")) { + path = path + "/" + relativeDir; + } + return listDirectoryContents(LibertyServerUtils.makeJavaCompatible(path, machine), filter); + } + + /** + * Non-recursively list the contents of the server install root directory, or if the relativePath + * parameter is non-null, the indicated directory (relative the the install root). If filter is + * non-null, return only those directory names or filenames that contain the filter string. + * + * @param relativeDir path to a directory relative to the install root directory, should not begin with path separator, may be null. + * @param filter string to filter the results by, returned file and directory names must contain this, may be null. + * @return a list of file and directory names indicating the contents of the specified directory. + * @throws Exception + */ + public ArrayList listLibertyServerRoot(String relativeDir, String filter) throws Exception { + String path = serverRoot; + if (relativeDir != null && !relativeDir.equals("")) { + path = path + "/" + relativeDir; + } + + path = LibertyServerUtils.makeJavaCompatible(path, machine); + + return listDirectoryContents(path, filter); + } + + /** + * Non-recursively list the contents of the autoFVT test directory, or if the relativePath + * parameter is non-null, the indicated directory (relative the the install root). If filter is + * non-null, return only those directory names or filenames that contain the filter string. + * + * @param relativeDir path to a directory relative to the autoFVT test directory, should not begin with path separator, may be null. + * @param filter string to filter the results by, returned file and directory names must contain this, may be null. + * @return a list of file and directory names indicating the contents of the specified directory. + * @throws Exception + */ + public ArrayList listAutoFVTTestFiles(Machine machine, String relativeDir, String filter) throws Exception { + String path = pathToAutoFVTTestFiles; + if (relativeDir != null && !relativeDir.equals("")) { + path = path + relativeDir; + } + + path = LibertyServerUtils.makeJavaCompatible(path, machine); + + RemoteFile serverDir = new RemoteFile(machine, path); + return listDirectoryContents(serverDir, filter); + } + + /** + * Method for returning the directory contents as a list of Strings representing first level file/dir names + * + * @return ArrayList of File/Directory names + * that exist at the first level i.e. it's not recursive. If it's a directory the String in the list is prefixed with a / + * @throws TopologyException + */ + protected ArrayList listDirectoryContents(RemoteFile serverDir) throws Exception { + return listDirectoryContents(serverDir, null); + + } + + protected ArrayList listDirectoryContents(String path, String fileName) throws Exception { + + RemoteFile serverDir = new RemoteFile(machine, path); + return listDirectoryContents(serverDir, fileName); + + } + + protected ArrayList listDirectoryContents(RemoteFile serverDir, String fileName) throws Exception { + + final String method = "serverDirectoryContents"; + Log.entering(c, method); + if (!serverDir.isDirectory() || !serverDir.exists()) + throw new TopologyException("The specified directoryPath \'" + + serverDir.getAbsolutePath() + "\' was not a directory"); + + RemoteFile[] firstLevelFiles = serverDir.list(false); + ArrayList firstLevelFileNames = new ArrayList(); + + for (RemoteFile f : firstLevelFiles) { + + if (fileName == null) { + firstLevelFileNames.add(f.getName()); + } else if (f.getName().contains(fileName)) { + firstLevelFileNames.add(f.getName()); + + } + } + + return firstLevelFileNames; + } + + public RemoteFile getMostRecentTraceFile() throws Exception { + List files = listDirectoryContents(logsRoot, DEFAULT_TRACE_FILE_PREFIX); + + if (files == null || files.isEmpty()) { + return null; + } + + RemoteFile rf = null; + long maxLastModified = 0; + for (int i = 0; i < files.size(); i++) { + final RemoteFile f = getTraceFile(files.get(i)); + if (f.lastModified() > maxLastModified) { + maxLastModified = f.lastModified(); + rf = f; + } + } + + return rf; + } + + public ArrayList listFFDCFiles(String server) throws Exception { + return listDirectoryContents(LibertyServerUtils.makeJavaCompatible(serverRoot + "/logs/ffdc", machine), "ffdc"); + } + + public ArrayList listFFDCSummaryFiles(String server) throws Exception { + return listDirectoryContents(LibertyServerUtils.makeJavaCompatible(serverRoot + "/logs/ffdc", machine), "exception_summary"); + } + + /* not called */public int getOsgiConsolePort() { + return osgiConsolePort; + } + + /** + * @return the httpDefaultPort + */ + public int getHttpDefaultPort() { + return httpDefaultPort; + } + + /** + * @param httpDefaultPort + * the httpDefaultPort to set + */ + public void setHttpDefaultPort(int httpDefaultPort) { + this.httpDefaultPort = httpDefaultPort; + } + + /** + * @return the httpDefaultSecurePort + */ + public int getHttpDefaultSecurePort() { + return httpDefaultSecurePort; + } + + /** + * @param httpDefaultSecurePort + * the httpDefaultSecurePort to set + */ + public void setHttpDefaultSecurePort(int httpDefaultSecurePort) { + this.httpDefaultSecurePort = httpDefaultSecurePort; + } + + /** + * @return the iiopDefaultPort + */ + /* not called */public int getIiopDefaultPort() { + return iiopDefaultPort; + } + + /** + * @param iiopDefaultPort + * the iiopDefaultPort to set + */ + /* not called */public void setIiopDefaultPort(int iiopDefaultPort) { + this.iiopDefaultPort = iiopDefaultPort; + } + + public int getPort(PortType port) throws Exception { + Log.entering(c, "getPort", port); + int ret = 0; + switch (port) { + case OSGi: + ret = getOsgiConsolePort(); + break; + case WC_defaulthost: + ret = getHttpDefaultPort(); + break; + case WC_defaulthost_secure: + ret = getHttpDefaultSecurePort(); + break; + case IIOP: + ret = getIiopDefaultPort(); + case JMX_REST: + // ret = getPort("com.ibm.ws.admin.core.endpoint.JMXREST_defaultEP", + // 8880); + break; + default: + Exception e = new IllegalArgumentException("The specified PortType is not supported for Liberty: " + port); + Log.error(c, "getPort", e); + throw e; + } + Log.exiting(c, "getPort", ret); + return ret; + } + + public void setServerStartTimeout(long timeout) { + serverStartTimeout = timeout; + } + + /* not called */public long getServerStartTimeout() { + return serverStartTimeout; + } + + public String getBootstrapKey() { + return serverTopologyID; + } + + protected ApplicationManager getApplicationManager() throws Exception { + if (appmgr == null) + appmgr = new ApplicationManager(this); + return appmgr; + } + + /** + * Method used to autoinstall apps in + * publish/servers//dropins folder found in the FAT project + * Under the covers this will not use the install functionality found in the + * ApplicationManager but use the Application Csar which is part of Liberty. + * + * @param appName The name of the application + * @throws Exception + */ + protected void autoInstallApp(String appName) throws Exception { + Log.info(c, "InstallApp", "Adding app " + appName + " to startup verification list"); + this.addInstalledAppForValidation(appName); + } + + /** + * Shortcut for new FATTests to install apps assuming the app is + * located in the publish/servers//apps folder of the FAT project + * + * @param appName The name of the application + * @throws Exception + */ + public void installApp(String appName) throws Exception { + Log.info(c, "InstallApp", "Installing from: " + pathToAutoFVTNamedServer + "apps/" + appName); + finalInstallApp(pathToAutoFVTNamedServer + "apps/" + appName); + } + + /** + * Shortcut for new FATTests to install apps located anywhere on the file system + * + * @param path The absolute path to the application + * @param appName The name of the application + * @throws Exception + */ + public void installApp(String path, String appName) throws Exception { + Log.info(c, "InstallApp", "Installing from: " + path + "/" + appName); + finalInstallApp(path + "/" + appName); + } + + /** + * Install a bundle. + * + * @deprecated Build bundles from ${project}/test-bundles and invoke {@link #installSystemBundle(String)} instead to install them from the built location. + */ + @Deprecated + public void installBundle(String name) throws Exception { + Log.info(c, "installBundle", "Installing bundle '" + name + "'"); + String path; + if (name.contains("/") || name.contains("\\")) { + path = name; + } else { + path = "publish/bundles/" + name + ".jar"; + } + + Assert.assertFalse("Server should not be started when installing a bundle", isStarted()); + copyFileToLibertyInstallRoot("lib/", path); + } + + /** + * Install a feature. + * + * @deprecated Place feature manifests in S{project}/publish/features and invoke {@link #installSystemFeature(String)} instead. + */ + @Deprecated + public void installFeature(String name) throws Exception { + Log.info(c, "installFeature", "Installing feature '" + name + "'"); + String path; + if (name.contains("/") || name.contains("\\")) { + path = name; + } else { + path = "publish/features/" + name + ".mf"; + } + + Assert.assertFalse("Server should not be started when installing a bundle", isStarted()); + copyFileToLibertyInstallRoot("lib/features/", path); + } + + /** + * Uninstall a bundle + * + * @deprecated Use {@link #uninstallSystemBundle(String)} instead. + */ + @Deprecated + public void uninstallBundle(String name) throws Exception { + Log.info(c, "uninstallBundle", "Uninstalling bundle '" + name + "'"); + Assert.assertFalse("Server should not be started when uninstalling a bundle", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRoot + "/lib/" + name + ".jar"); + } + + /** + * Uninstall a feature + * + * @deprecated Use {@link #uninstallSystemFeature(String)} instead. + */ + @Deprecated + public void uninstallFeature(String name) throws Exception { + Log.info(c, "uninstallFeature", "Uninstalling feature '" + name + "'"); + Assert.assertFalse("Server should not be started when uninstalling a feature", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRoot + "/lib/features/" + name + ".mf"); + } + + /** + * Install a bundle as a system bundle, assuming the bundle is + * to be found in publish/bundles/<name>.jar + *

    + * To use this most effectively, place your bundle code under test-bundles/bundle.symbolic.name/. + * The structure under here reflects the structure of a bundle project and uses the same ant + * logic to create the bundle. Look at the mxbeans fat project for an example. + * + * @param name the name of the bundle, without the .jar suffix + */ + public void installSystemBundle(String name) throws Exception { + Log.info(c, "installSystemBundle", "Installing system bundle '" + name + "'"); + Assert.assertFalse("Server should not be started when installing a bundle", isStarted()); + LibertyFileManager.copyFileIntoLiberty(machine, installRoot + "/lib", "publish/bundles/" + name + ".jar"); + } + + /** + * Install a feature as a system feature, assuming the feature is + * to be found in publish/features/<name>.mf + * + * @param name the name of the feature, without the .mf suffix + */ + public void installSystemFeature(String name) throws Exception { + Log.info(c, "installSystemFeature", "Installing system feature '" + name + "'"); + Assert.assertFalse("Server should not be started when installing a feature", isStarted()); + LibertyFileManager.copyFileIntoLiberty(machine, installRoot + "/lib/features", "publish/features/" + name + ".mf"); + } + + /** + * Install a feature translation file to the system feature directory, + * assuming the feature translation file is to be found in publish/features/l10n/<name>.mf + * + * @param name the name of the feature translation properties, without the .properties suffix. + * The file name should be the subsystem symbolic name of the feature. + */ + public void installSystemFeatureL10N(String name) throws Exception { + Log.info(c, "installSystemFeatureL10N", "Installing system feature translation '" + name + "'"); + Assert.assertFalse("Server should not be started when installing a feature translation", isStarted()); + LibertyFileManager.copyFileIntoLiberty(machine, installRoot + "/lib/features/l10n", "publish/features/l10n/" + name + ".properties"); + } + + /** + * Uninstall a system bundle. + * + * @param name the name of the bundle, without the .jar suffix + */ + public void uninstallSystemBundle(String name) throws Exception { + Log.info(c, "uninstallSystemBundle", "Uninstalling system bundle '" + name + "'"); + Assert.assertFalse("Server should not be started when uninstalling a bundle", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRoot + "/lib/" + name + ".jar"); + } + + /** + * Uninstall a system feature. + * + * @param name the name of the feature, without the .mf suffix + */ + public void uninstallSystemFeature(String name) throws Exception { + Log.info(c, "uninstallSystemFeature", "Uninstalling system feature '" + name + "'"); + Assert.assertFalse("Server should not be started when uninstalling a feature", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRoot + "/lib/features/" + name + ".mf"); + } + + /** + * Uninstall a system feature translation file. + * + * @param name the name of the feature translation properties, without the .properties suffix. + * The file name should be the subsystem symbolic name of the feature. + */ + public void uninstallSystemFeatureL10N(String name) throws Exception { + Log.info(c, "uninstallSystemFeatureL10N", "Uninstalling system feature translation '" + name + "'"); + Assert.assertFalse("Server should not be started when uninstalling a feature translation", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRoot + "/lib/features/l10n/" + name + ".properties"); + } + + /** + * Install a bundle as a user extension bundle, assuming the bundle is + * to be found in publish/bundles/<name>.jar + *

    + * To use this most effectively, place your bundle code under test-bundles/bundle.symbolic.name/. + * The structure under here reflects the structure of a bundle project and uses the same ant + * logic to create the bundle. Look at the mxbeans fat project for an example. + * + * @param name the name of the bundle, without the .jar suffix + */ + public void installUserBundle(String name) throws Exception { + Log.info(c, "installUserBundle", "Installing user bundle '" + name + "'"); + Assert.assertFalse("Server should not be started when installing a bundle", isStarted()); + LibertyFileManager.copyFileIntoLiberty(machine, installRoot + "/usr/extension/lib", "publish/bundles/" + name + ".jar"); + } + + /** + * Install a feature as a user extension feature, assuming the feature is + * to be found in publish/features/<name>.mf + * + * @param name the name of the feature, without the .mf suffix + */ + public void installUserFeature(String name) throws Exception { + Log.info(c, "installUserFeature", "Installing user feature '" + name + "'"); + Assert.assertFalse("Server should not be started when installing a feature", isStarted()); + LibertyFileManager.copyFileIntoLiberty(machine, installRoot + "/usr/extension/lib/features", "publish/features/" + name + ".mf"); + } + + /** + * Install a feature translation to the user extension feature directory, + * assuming the feature translation file is to be found in publish/features/l10n/<name>.mf + * + * @param name the name of the feature translation properties, without the .properties suffix. + * The file name should be the subsystem symbolic name of the feature. + */ + public void installUserFeatureL10N(String name) throws Exception { + Log.info(c, "installUserFeatureL10N", "Installing user feature translation '" + name + "'"); + Assert.assertFalse("Server should not be started when installing a feature translation", isStarted()); + LibertyFileManager.copyFileIntoLiberty(machine, installRoot + "/usr/extension/lib/features/l10n", "publish/features/l10n/" + name + ".properties"); + } + + /** + * Install a feature packaged as an ESA into the server runtime. + * + * @param loc the name of the product extension. If set to null then "usr" is assumed + * @param esa the name of the feature. + * @param additionalFeatureFiles - More ESA files that need to be copied to the machine prior to running the install + * @throws Exception + */ + public ProgramOutput installFeature(String loc, String feature, String... additionalFeatureFiles) throws Exception { + return installFeatureWithProgramArgs(loc, feature, new String[0], additionalFeatureFiles); + } + + /** + * Install a feature packaged as an ESA into the server runtime. + * + * @param loc the name of the product extension. If set to null then "usr" is assumed + * @param esa the name of the feature. + * @param additionalProgramArgs - extra args to pass into the program when running + * @param additionalFeatureFiles - More ESA files that need to be copied to the machine prior to running the install + * @throws Exception + */ + public ProgramOutput installFeatureWithProgramArgs(String loc, String feature, String[] additionalProgramArgs, String... additionalFeatureFiles) throws Exception { + if (loc == null) { + loc = "usr"; + } + Log.info(c, "installFeatureWithProgramArgs", "Installing feature '" + feature + "' to '" + loc + "'"); + + List pathsToDelete = new ArrayList(); + String featureFileName = feature + ".esa"; + String featurePathName = installRoot + "/" + featureFileName; + LibertyFileManager.copyFileIntoLiberty(machine, installRoot, "publish/features/" + featureFileName); + pathsToDelete.add(featurePathName); + + for (String featureName : additionalFeatureFiles) { + String fileName = featureName + ".esa"; + String pathName = installRoot + "/" + fileName; + pathsToDelete.add(pathName); + LibertyFileManager.copyFileIntoLiberty(machine, installRoot, "publish/features/" + fileName); + } + + ProgramOutput po = doInstallFeature(featurePathName, loc, additionalProgramArgs); + + for (String pathName : pathsToDelete) { + LibertyFileManager.deleteLibertyFile(machine, pathName); + } + + return po; + } + + /** + * Installs a feature from a remote file (ESA). + * + * @param feature The ESA file + * @return The output from the {@link Machine#execute(String, String[], String)} call + * @throws Exception + */ + public ProgramOutput installFeature(RemoteFile feature) throws Exception { + Log.info(c, "installFeatureWithProgramArgs", "Installing feature '" + feature.getAbsolutePath() + "'"); + return installFeature(feature, new String[0]); + } + + /** + * Installs a feature from a remote file (ESA). + * + * @param feature The ESA file + * @param args arguments to pass when installing the feature + * @return The output from the {@link Machine#execute(String, String[], String)} call + * @throws Exception + */ + public ProgramOutput installFeature(RemoteFile feature, String[] args) throws Exception { + Log.info(c, "installFeatureWithProgramArgs", "Installing feature '" + feature.getAbsolutePath() + "'"); + return doInstallFeature(feature.getAbsolutePath(), "usr", args); + } + + /** + * Actually run the install command on the remote machine + * + * @param featurePathName The path to the feature ESA file + * @param loc The loc to use + * @param additionalProgramArgs Any additonal program args to include + * @return The output from the {@link Machine#execute(String, String[], String)} call + * @throws Exception + */ + protected ProgramOutput doInstallFeature(String featurePathName, String loc, String[] additionalProgramArgs) throws Exception { + // Always have the accept license header as we do not run the command in an interactive way. + // This is ok from a testing point of view as the interactive code is re-used from the + // self extracting JAR file where it is already being well tested + String[] args = new String[4 + additionalProgramArgs.length]; + args[0] = "install"; + args[1] = "--to=" + loc; + args[2] = "--acceptLicense"; + for (int pos = 0; pos < additionalProgramArgs.length; pos++) { + args[pos + 3] = additionalProgramArgs[pos]; + } + args[3 + additionalProgramArgs.length] = featurePathName; + Log.info(c, "installUserFeature", "Using args " + Arrays.toString(args)); + ProgramOutput po = machine.execute(installRoot + "/bin/featureManager", args, installRoot); + return po; + } + + /** + * Given a sample name that corresponds to a sample in a jar named .jar in + * the FAT files directory, runs the self extractor with the --downloadDependencies and + * --acceptLicense flag in order to create a working copy of the sample server for test. + * + * @param sample + * @return + * @throws Exception + */ + public ProgramOutput installSampleWithExternalDependencies(String sample) throws Exception { + Log.info(c, "installSampleWithExternalDependencies", "Installing sample '" + sample); + + List pathsToDelete = new ArrayList(); + + String sampleJarFileName = sample + ".jar"; + String sampleJarFilePath = installRoot + "/" + sampleJarFileName; + String javaFilePath = machineJava + "/bin/java"; + + LibertyFileManager.copyFileIntoLiberty(machine, installRoot, "lib/LibertyFATTestFiles/" + sampleJarFileName); + pathsToDelete.add(sampleJarFilePath); + + // Always have the accept license and download dependencies headers as we do not run the + // command in an interactive way. This is ok from a testing point of view as the interactive + // code is re-used from the self extracting JAR file where it is already being well tested + String[] args = new String[] { "-jar", sampleJarFilePath, "--downloadDependencies", "--acceptLicense", installRoot }; + + Log.info(c, "installSampleWithExternalDependencies", "Using args " + Arrays.toString(args)); + ProgramOutput po = machine.execute(javaFilePath, args); + + if (po.getReturnCode() == 0) { + Log.info(c, "installSampleWithExternalDependencies", "Successfully installed sample: " + sample); + } else { + Log.warning(c, "Sample install process failed with return code " + po.getReturnCode()); + Log.warning(c, "Sample install process failed with error " + po.getStderr()); + Log.warning(c, "Sample install process failed with output " + po.getStdout()); + throw new Exception("Could not install sample server - return code " + po.getReturnCode()); + } + + //Move the test server xml into sample.xml + RemoteFile sampleServerFile = LibertyFileManager.createRemoteFile(machine, getServerRoot() + "/sample.xml"); + LibertyFileManager.moveLibertyFile(getServerConfigurationFile(), sampleServerFile); + //And upload the FAT server XML that will include sample.xml + LibertyFileManager.copyFileIntoLiberty(machine, getServerRoot(), "server.xml", "productSampleServer.xml"); + + //Move the test server bootstrap.properties into sample.properties if it exists + RemoteFile serverBootStrapProps = new RemoteFile(machine, getServerRoot() + "/bootstrap.properties"); + if (serverBootStrapProps.exists()) { + //This is optional + RemoteFile samplePropertiesFile = LibertyFileManager.createRemoteFile(machine, getServerRoot() + "/sample.properties"); + LibertyFileManager.moveLibertyFile(serverBootStrapProps, samplePropertiesFile); + //And upload the FAT server properties that will include the sample properties + LibertyFileManager.copyFileIntoLiberty(machine, getServerRoot(), "bootstrap.properties", "productSample.properties"); + } else { + //Just take the testports, no include of existing config needed + LibertyFileManager.copyFileIntoLiberty(machine, getServerRoot(), "bootstrap.properties", "productSample_noBootstrap.properties"); + } + + for (String pathName : pathsToDelete) { + LibertyFileManager.deleteLibertyFile(machine, pathName); + } + + return po; + } + + /** + * Uninstall a user extension bundle + * + * @param name the name of the bundle, without the .jar suffix + */ + public void uninstallUserBundle(String name) throws Exception { + Log.info(c, "uninstallUserBundle", "Uninstalling user bundle '" + name + "'"); + Assert.assertFalse("Server should not be started when uninstalling a bundle", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRoot + "/usr/extension/lib/" + name + ".jar"); + } + + /** + * Uninstall a user extension feature + * + * @param name the name of the feature, without the .mf suffix + */ + public void uninstallUserFeature(String name) throws Exception { + Log.info(c, "uninstallUserFeature", "Uninstalling user feature '" + name + "'"); + Assert.assertFalse("Server should not be started when uninstalling a feature", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRoot + "/usr/extension/lib/features/" + name + ".mf"); + } + + /** + * Uninstall a user feature translation file. + * + * @param name the name of the feature translation properties, without the .properties suffix. + * The file name should be the subsystem symbolic name of the feature. + */ + public void uninstallUserFeatureL10N(String name) throws Exception { + Log.info(c, "uninstallUserFeatureL10N", "Uninstalling user feature translation '" + name + "'"); + Assert.assertFalse("Server should not be started when uninstalling a feature translation", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRoot + "/usr/extension/lib/features/l10n/" + name + ".properties"); + } + + /** + * Install a bundle as a product extension bundle, assuming the bundle is + * to be found in publish/productbundles/<name>.jar + * + * @param productName the name of the product the bundle belongs to + * @param name the name of the bundle, without the .jar suffix + */ + public void installProductBundle(String productName, String name) throws Exception { + Log.info(c, "installProductBundle", "Installing product '" + productName + "' bundle '" + name + "'"); + Assert.assertFalse("Server should not be started when installing a bundle", isStarted()); + LibertyFileManager.copyFileIntoLiberty(machine, installRootParent + "/" + productName + "/lib", "publish/productbundles/" + name + ".jar"); + } + + /** + * Install a feature as a product extension feature, assuming the feature is + * to be found in publish/productfeatures/<name>.mf + * + * @param productName the name of the product the feature belongs to + * @param name the name of the feature, without the .mf suffix + */ + public void installProductFeature(String productName, String name) throws Exception { + Log.info(c, "installProductFeature", "Installing product '" + productName + "' feature '" + name + "'"); + Assert.assertFalse("Server should not be started when installing a feature", isStarted()); + LibertyFileManager.copyFileIntoLiberty(machine, installRootParent + "/" + productName + "/lib/features", "publish/productfeatures/" + name + ".mf"); + } + + /** + * Install a feature translation file to the product extension feature directory, + * assuming the feature translation file is to be found in publish/features/l10n/<name>.mf + * + * @param name the name of the feature translation properties, without the .properties suffix. + * The file name should be the subsystem symbolic name of the feature. + */ + public void installProductFeatureL10N(String productName, String name) throws Exception { + Log.info(c, "installProductFeatureL10N", "Installing product '" + productName + "' feature translation '" + name + "'"); + Assert.assertFalse("Server should not be started when installing a feature translation", isStarted()); + LibertyFileManager.copyFileIntoLiberty(machine, installRootParent + "/" + productName + "/lib/features/l10n", "publish/productfeatures/l10n/" + name + ".properties"); + } + + /** + * Create a product extension, assuming the properties file is + * to be found in publish/productproperties/<productName>.properties + * + * @param productName the name of the product + */ + public void installProductExtension(String productName) throws Exception { + Log.info(c, "installProductExtension", "Installing product '" + productName + "'"); + Assert.assertFalse("Server should not be started when installing an extension", isStarted()); + LibertyFileManager.copyFileIntoLiberty(machine, installRoot + "/etc/extensions", "publish/productproperties/" + productName + ".properties"); + } + + /** + * Uninstall a product extension bundle + * + * @param productName the name of the product the bundle belongs to + * @param name the name of the bundle, without the .jar suffix + */ + public void uninstallProductBundle(String productName, String name) throws Exception { + Log.info(c, "uninstallProductBundle", "Uninstalling product '" + productName + "'bundle '" + name + "'"); + Assert.assertFalse("Server should not be started when uninstalling a bundle", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRootParent + "/" + productName + "/lib/" + name + ".jar"); + } + + /** + * Uninstall a product extension feature + * + * @param productName the name of the product the feature belongs to + * @param name the name of the feature, without the .mf suffix + */ + public void uninstallProductFeature(String productName, String name) throws Exception { + Log.info(c, "uninstallProductFeature", "Uninstalling product '" + productName + "', feature '" + name + "'"); + Assert.assertFalse("Server should not be started when uninstalling a feature", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRootParent + "/" + productName + "/lib/features/" + name + ".mf"); + } + + /** + * Uninstall a product feature translation file. + * + * @param name the name of the feature translation properties, without the .properties suffix. + * The file name should be the subsystem symbolic name of the feature. + */ + public void uninstallProductFeatureL10N(String productName, String name) throws Exception { + Log.info(c, "uninstallProductFeatureL10N", "Uninstalling product '" + productName + "' feature translation '" + name + "'"); + Assert.assertFalse("Server should not be started when uninstalling a feature translation", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRootParent + "/" + productName + "/lib/features/l10n/" + name + ".properties"); + } + + /** + * Uninstall a product extension. This will delete the wlp/etc/extensions/productName.properties file, + * and all contents under the productName directory (where productName is a peer of wlp) + * + * @param productName the name of the product the feature belongs to + * @param name the name of the product. + */ + public void uninstallProductExtension(String productName) throws Exception { + Log.info(c, "uninstallProductExtension", "Uninstalling product '" + productName + "'"); + Assert.assertFalse("Server should not be started when uninstalling a product extension", isStarted()); + LibertyFileManager.deleteLibertyFile(machine, installRoot + "/etc/extensions/" + productName + ".properties"); + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, (installRootParent + "/" + productName)); + } + + /** + * Install the extended content image jar into this existing server. + * + * @return true, if the install was successful + * @throws Exception + */ + public boolean installExtendedImage() throws Exception { + Log.info(c, "installExtendedImage", "Looking for extended image to install..."); + String jarName = null; + + // Find the extended image under the autoFVT/publish/images location + LocalFile imagesDirectory = new LocalFile("publish/images"); + RemoteFile[] imageFiles = imagesDirectory.list(false); + for (RemoteFile imageFile : imageFiles) { + String imageName = imageFile.getName(); + if (imageName.endsWith("jar") && imageName.contains("extended")) { + jarName = imageName; + Log.info(c, "installExtendedImage", "Using the following file as the extended image to install: " + jarName); + break; + } + } + + // If the extended image was found, copy it to the server machine and + // extract it over this server. + if (jarName != null) { + String jarPath = LibertyFileManager.copyFileIntoLiberty(machine, installRoot + "/tmp", "publish/images/" + jarName); + RemoteFile jarFile = new RemoteFile(machine, jarPath); + + Log.info(c, "installExtendedImage", "Issuing the command to install the extended content."); + ProgramOutput po = machine.execute(machineJava + "/bin/java", new String[] { "-jar", jarFile.getAbsolutePath(), "--acceptLicense", "install", installRoot }); + assertEquals("Installing Liberty extended edition should have worked. Program output:\n" + po.getStdout() + "\nErr output:\n" + po.getStderr(), + 0, po.getReturnCode()); + return true; + } else { + Log.warning(c, "Didn't find a file to use as an extended image..."); + return false; + } + } + + /** + * Method used by exposed installApp methods that calls into the ApplicationManager + * to actually install the required application + * + * @param appPath Absoulte path to application (includes app name) + * @throws Exception + */ + protected void finalInstallApp(String appPath) throws Exception { + ApplicationType type = null; + String onlyAppName = appPath; //for getting only the name if appName given is actually a path i.e. autoinstall/acme.zip + if (appPath.contains("/")) { + String[] s = appPath.split("/"); + onlyAppName = s[s.length - 1]; //get the last one as this will be the filename only + } else if (appPath.contains("\\\\")) { + String[] s = appPath.split("\\\\"); + onlyAppName = s[s.length - 1]; //get the last one as this will be the filename only + } + + if (onlyAppName.endsWith(".xml")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 4); + } + type = getApplictionType(onlyAppName); + if (onlyAppName.endsWith(".ear") || onlyAppName.endsWith(".eba") || onlyAppName.endsWith(".war") || + onlyAppName.endsWith(".jar") || onlyAppName.endsWith(".rar") || onlyAppName.endsWith(".zip")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 4); + } + if (onlyAppName.endsWith(".js")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 3); + } + if (onlyAppName.endsWith(".jsar")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 5); + } + Log.finer(c, "InstallApp", "Application name is: " + onlyAppName); + + this.getApplicationManager().installApplication(onlyAppName, new LocalFile(appPath), type); + } + + public String getHostname() { + return hostName; + } + + /** + * Shortcut for new FATTests to uninstall apps + * + * @param appName The name of the application + * @throws Exception + */ + public void uninstallApp(String appName) throws Exception { + ApplicationType type = this.getApplictionType(appName); + if (type.equals(ApplicationType.ZIP)) { + appName = appName.substring(0, (appName.length() - 4)); + } + + if (type.equals(ApplicationType.EAR) || type.equals(ApplicationType.WAR)) { + //do the same thing as above + appName = appName.substring(0, (appName.length() - 4)); + } + + if (!this.getApplicationManager().isInstalled(appName)) { + throw new ApplicationNotInstalledException(appName); + } + + boolean restartServerAfterUninstall = false; + this.getApplicationManager().uninstallApplication(appName, type, restartServerAfterUninstall); + } + + protected ApplicationType getApplictionType(String appName) throws Exception { + ApplicationType type = null; + if (appName.endsWith("zip") || appName.endsWith("ZIP")) { + type = ApplicationType.ZIP; + } else if (appName.endsWith("ear") || appName.endsWith("EAR")) { + type = ApplicationType.EAR; + } else if (appName.endsWith("war") || appName.endsWith("WAR")) { + type = ApplicationType.WAR; + } else if (appName.endsWith("eba") || appName.endsWith("EBA")) { + type = ApplicationType.EBA; + } else if (appName.endsWith("js") || appName.endsWith("js")) { + type = ApplicationType.JS; + } else if (appName.endsWith("e") || appName.endsWith("jsar")) { + type = ApplicationType.JS; + } + + if (type == null) { + //Application type not recognised + throw new TopologyException("Can't install the application " + appName + + " as the application type is not recognised. We only support WAR, EAR, ZIP or EBA"); + } + return type; + } + + protected String getJvmOptionsFilePath() { + return this.getServerRoot() + "/" + JVM_OPTIONS_FILE_NAME; + } + + protected RemoteFile getJvmOptionsFile() throws Exception { + return LibertyFileManager.createRemoteFile(this.machine, this.getJvmOptionsFilePath()); + } + + /** + * Reads the current jvm.options file into memory and returns the result. + * Lines with a '=' in the middle are treated as key-value mappings, + * and lines without a '=' character are treated as a key with an empty value. + * + * @return key/value pairs from the jvm.options file + * @throws Exception if the file can't be read + */ + public Map getJvmOptionsAsMap() throws Exception { + Map result = new LinkedHashMap(); + List options = this.getJvmOptions(); + for (String option : options) { + int equals = option.indexOf('='); + // if '=' is not the first or last character + if (equals > 0 && equals < (option.length() - 1)) { + String key = option.substring(0, equals); + String value = option.substring(equals + 1); + result.put(key, value); + } else { + result.put(option, ""); + } + } + return result; + } + + /** + * Reads the current jvm.options file into memory and returns the result. + * + * @return key/value pairs from the jvm.options file + * @throws Exception if the file can't be read + */ + protected List getJvmOptions() throws Exception { + ArrayList result = new ArrayList(); + RemoteFile file = this.getJvmOptionsFile(); + if (file == null || !file.exists()) { + return result; + } + LOG.info("Reading " + JVM_OPTIONS_FILE_NAME + " file: " + file); + BufferedReader in = null; + try { + in = new BufferedReader(new InputStreamReader(file.openForReading(), "UTF-8")); + String line = null; + while ((line = in.readLine()) != null) { + line = line.trim(); + if (line.isEmpty() || line.startsWith("#")) { + continue; + } + result.add(line); + } + } catch (Exception e) { + throw new IOException("Failed to read JVM options file: " + file, e); + } finally { + if (in != null) { + try { + in.close(); + } catch (Exception e) { + LOG.info("Failed to close InputStream for " + file + ". Exception: " + e.getMessage()); + } + } + } + LOG.info(JVM_OPTIONS_FILE_NAME + ": " + result); // tell the user which properties you're reading + return result; + } + + /** + *

    Writes a mapping of options to the jvm.options file. + * Note that all existing mappings will be overwritten. + * If this is not the desired behavior, call {@link #getJvmOptions()} to retrieve the existing mappings first, + * and then pass the updated map into this method.

    + *
      + *
    • Null or empty keys will be ignored.
    • + *
    • Non-empty keys mapped to a null or empty value will be added to jvm.options without a value (no '=' suffix).
    • + *
    • Non-empty keys mapped to a non-empty value will be added to jvm.options in the format: key=value.
    • + *
    + * + * @param options key/value pairs to set in the jvm.options file + * @throws Exception if the jvm.options file can't be written to. Note that this exception may indicate that the file is no longer formatted correctly. + * @see #getJvmOptions() + */ + public void setJvmOptions(Map options) throws Exception { + ArrayList optionList = new ArrayList(); + if (options != null) { + for (Map.Entry entry : options.entrySet()) { + String key = entry.getKey(); + if (key == null) { + continue; + } + key = key.trim(); + if (key.isEmpty()) { + continue; + } + StringBuilder option = new StringBuilder(key); + String value = entry.getValue(); + if (value != null) { + value = value.trim(); + if (!value.isEmpty()) { + option.append("="); + option.append(value); + } + } + optionList.add(option.toString()); + } + } + this.setJvmOptions(optionList); + } + + public void setJvmOptions(List options) throws Exception { + // Step 1: Write options to local temporary file + File tmpFile = File.createTempFile("jvm", "options"); + LOG.info("Writing temporary " + JVM_OPTIONS_FILE_NAME + " file: " + tmpFile); + LOG.info(JVM_OPTIONS_FILE_NAME + ": " + options); // tell the user which properties you're setting + BufferedWriter out = null; + try { + out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tmpFile), "UTF-8")); + out.write("#Updated by " + this.getClass().getName() + " on " + DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(new Date())); + out.newLine(); + if (options != null) { + for (String option : options) { + if (option == null) { + continue; + } + String line = option.trim(); + if (line.isEmpty()) { + continue; + } + out.write(line); + out.newLine(); + } + } + } catch (Exception e) { + tmpFile.delete(); + throw new IOException("Failed to write JVM options to local temporary file " + tmpFile, e); + } finally { + if (out != null) { + try { + out.close(); + } catch (Exception e) { + LOG.info("Failed to close OutputStream for " + tmpFile + ". Exception: " + e.getMessage()); + } + } + } + + // Step 3: Copy temporary file to remote machine, and delete temporary file + RemoteFile remoteFile = null; + try { + remoteFile = this.getJvmOptionsFile(); // won't return null + LibertyFileManager.copyFileIntoLiberty(machine, remoteFile.getParent(), remoteFile.getName(), tmpFile.getAbsolutePath(), false); + } catch (Exception e) { + throw new IOException("Failed to write JVM options to " + remoteFile, e); + } finally { + tmpFile.delete(); + } + } + + protected Properties getBootstrapProperties() throws Exception { + Properties props = new Properties(); + + try { + String serverEnv = FileUtils.readFile(getServerRoot() + "/bootstrap.properties"); + props.load(new StringReader(serverEnv.replace("\\", "\\\\"))); + } catch (IOException ignore) { + } + + return props; + } + + public Properties getServerEnv() { + Properties props = new Properties(); + + props.put("JAVA_HOME", getMachineJavaJDK()); + + // First load ${wlp.install.dir}/etc/server.env + try { + String serverEnv = FileUtils.readFile(getInstallRoot() + "/etc/server.env"); + props.load(new StringReader(serverEnv.replace("\\", "\\\\"))); + } catch (IOException ignore) { + } + + // Then load ${server.config.dir}/server.env + try { + String serverEnv = FileUtils.readFile(getServerRoot() + "/server.env"); + props.load(new StringReader(serverEnv.replace("\\", "\\\\"))); + } catch (IOException ignore) { + } + + return props; + } + + public void deleteDropinDefaultConfiguration(String fileName) throws Exception { + deleteDropinConfiguration(fileName, true); + } + + public void deleteDropinOverrideConfiguration(String fileName) throws Exception { + deleteDropinConfiguration(fileName, false); + } + + private void deleteDropinConfiguration(String fileName, boolean isDefault) throws Exception { + String location = getServerRoot() + "/configDropins/defaults/" + fileName; + if (!isDefault) + location = getServerRoot() + "/configDropins/overrides/" + fileName; + + LibertyFileManager.deleteLibertyFile(machine, location); + } + + public void deleteAllDropinConfigurations() throws Exception { + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, getServerRoot() + "/configDropins"); + } + + public void addDropinDefaultConfiguration(String fileName) throws Exception { + addDropinConfiguration(fileName, true); + } + + public void addDropinOverrideConfiguration(String fileName) throws Exception { + addDropinConfiguration(fileName, false); + } + + private void addDropinConfiguration(String fileName, boolean isDefault) throws Exception { + String location = getServerRoot() + "/configDropins"; + if (isDefault) + location += "/defaults"; + else + location += "/overrides"; + + waitIfNeeded(); + LibertyFileManager.moveFileIntoLiberty(machine, location, new File(fileName).getName(), pathToAutoFVTTestFiles + "/" + fileName); + + lastConfigUpdate = System.currentTimeMillis(); + } + + private void waitIfNeeded() throws Exception { + String osName = System.getProperty("os.name"); + boolean isUnix = !(osName.startsWith("win") || osName.startsWith("Win")); + boolean lastConfigLessThanOneSecAgo = (System.currentTimeMillis() - lastConfigUpdate) < 1000; + + Log.finer(c, "replaceServerConfiguration", "isUnix=" + isUnix + " lastConfigLessThanOneSecAgo=" + lastConfigLessThanOneSecAgo); + if (lastConfigLessThanOneSecAgo && isUnix) { + // Due to a java limitation on Unix, we need to wait at least + // 1 second between config updates so the server can see it. + // See https://www-01.ibm.com/support/docview.wss?uid=swg21446506 + // Note that the above page says that it affects versions up to 1.6, but if you look at the sun bug it is not fixed until java 8. + Log.finer(c, "replaceServerConfiguration", "Sleeping for 1 second to work around Unix / JDK limitation fixed in Java 8"); + Thread.sleep(1000); + } + } + + /** + * Replaces the server configuration. This encapsulates the necessary logic + * to deal with system / JDK idiosyncrasies. + * + * @param fileName + * @throws Exception + */ + protected void replaceServerConfiguration(String fileName) throws Exception { + waitIfNeeded(); + + LibertyFileManager.moveFileIntoLiberty(machine, getServerRoot(), "server.xml", fileName); + lastConfigUpdate = System.currentTimeMillis(); + } + + /** + * Replaces the server admin-metadata configuration. This encapsulates the necessary logic + * to deal with system / JDK idiosyncrasies. + * + * @param fileName + * @throws Exception + */ + public void replaceAdminMetadataConfiguration(String fileName) throws Exception { + waitIfNeeded(); + + LibertyFileManager.moveFileIntoLiberty(machine, getServerRoot(), "admin-metadata.xml", pathToAutoFVTTestFiles + "/" + fileName); + lastConfigUpdate = System.currentTimeMillis(); + } + + /** + * Replaces the server configuration. This encapsulates the necessary logic + * to deal with system / JDK idiosyncrasies. + * + * @param fileName + * @throws Exception + */ + public void replaceAdminMetadataServerConfiguration(String fileName) throws Exception { + waitIfNeeded(); + + LibertyFileManager.moveFileIntoLiberty(machine, getServerRoot(), "server.xml", pathToAutoFVTTestFiles + "/" + fileName); + lastConfigUpdate = System.currentTimeMillis(); + } + + /** + * This will put the named file into the root directory of the server and name it server.xml. As the file name is changed if you want to copy files for use in an include + * statement or if the location of the config file is being changed using the was.configroot.uri property or --config-root command line then you should use the + * {@link #copyFileToLibertyInstallRoot(String)} method. + * + * @param fileName The name of the file from the FVT test suite + * @throws Exception + */ + public void setServerConfigurationFile(String fileName) throws Exception { + replaceServerConfiguration(pathToAutoFVTTestFiles + "/" + fileName); + Thread.sleep(200); // Sleep for 200ms to ensure we do not process the file "too quickly" by a subsequent call + } + + /** + * This will save the current server configuration, so that it can be restored later on via the + * restoreServerConfiguration method. + * + * @throws Exception + */ + public void saveServerConfiguration() throws Exception { + try { + savedServerXml = new RemoteFile(machine, serverRoot + "/savedServerXml" + System.currentTimeMillis() + ".xml"); + getServerConfigurationFile().copyToDest(savedServerXml); + } catch (Exception e) { + savedServerXml = null; + throw e; + } + } + + /** + * This will restore the server configuration that was saved by a prior call to the + * saveServerConfiguration method. + * + * @throws Exception + */ + public void restoreServerConfiguration() throws Exception { + if (savedServerXml == null) { + throw new RuntimeException("The server configuration cannot be restored because it was never saved via the saveServerConfiguration method."); + } + getServerConfigurationFile().copyFromSource(savedServerXml); + } + + public String getServerConfigurationPath() { + return this.getServerRoot() + "/" + SERVER_CONFIG_FILE_NAME; + } + + public RemoteFile getServerConfigurationFile() throws Exception { + return LibertyFileManager.getLibertyFile(machine, getServerConfigurationPath()); + } + + /** + * This will load the {@link ServerConfiguration} from the default config file returned from {@link #getServerConfigurationFile()}. + * + * @return The loaded {@link ServerConfiguration} + * @throws Exception + */ + public ServerConfiguration getServerConfiguration() throws Exception { + RemoteFile file = getServerConfigurationFile(); + return getServerConfiguration(file); + } + + /** + * This gets the {@link ServerConfiguration} for the supplied XML file. + * + * @param file The file to load the server configuration from + * @return The loaded {@link ServerConfiguration} + * @throws Exception + */ + public ServerConfiguration getServerConfiguration(RemoteFile file) throws Exception { + return ServerConfigurationFactory.getInstance().unmarshal(file.openForReading()); + } + + public void updateServerConfiguration(File serverConfig) throws Exception { + replaceServerConfiguration(serverConfig.getAbsolutePath()); + + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Server configuration updated from: " + serverConfig); + logServerConfiguration(Level.INFO, false); + } + } + + /** + * This updates the supplied file with the supplied config. + * + * @param serverConfig The config to store to the file + * @param file The file to store the config to + * @throws Exception + */ + public void updateServerConfiguration(ServerConfiguration serverConfig, RemoteFile file) throws Exception { + // write contents to a temporary file + RemoteFile newServerFile = LibertyFileManager.createRemoteFile(machine, getServerConfigurationPath() + ".tmp"); + OutputStream os = newServerFile.openForWriting(false); + ServerConfigurationFactory.getInstance().marshal(serverConfig, os); + + if (newServerFile.length() == file.length()) { + serverConfig.setDescription(serverConfig.getDescription() + " (this is some random text to make the file size bigger)"); + os = newServerFile.openForWriting(false); + ServerConfigurationFactory.getInstance().marshal(serverConfig, os); + } + + // replace the file + // This logic does not need to be time protected (as we do in method + // replaceServerConfiguration) because of the "extra random text" logic + // above. Even if the timestamp would not be changed, the size out be. + LibertyFileManager.moveLibertyFile(newServerFile, file); + + if (LOG.isLoggable(Level.INFO)) { + LOG.info("Server configuration updated:"); + logServerConfiguration(Level.INFO, false); + } + } + + /** + * This stores the supplied content to the default server XML file returned from {@link #getServerConfigurationFile()}. + * + * @param serverConfig The configuration to store + * @throws Exception + */ + public void updateServerConfiguration(ServerConfiguration serverConfig) throws Exception { + updateServerConfiguration(serverConfig, getServerConfigurationFile()); + } + + /** + * Logs the contents of a File. If singleLine=true, then the + * whole File will be logged as one single message. Otherwise, each + * individual line in the file will be logged separately. Some logging + * formatters look prettier with single line log messages; others look + * better with multiple-line log messages. + * + * @param file + * the file whose contents you want to log. + * @param singleLine + * true to log the whole file in one message, false to log each + * individual line + */ + protected void logServerConfiguration(Level level, boolean singleLine) { + String method = "logServerConfiguration"; + BufferedReader reader = null; + try { + StringWriter stringWriter = null; + PrintWriter printWriter = null; + reader = new BufferedReader(new InputStreamReader(this.getServerConfigurationFile().openForReading())); + if (singleLine) { + stringWriter = new StringWriter(); + printWriter = new PrintWriter(stringWriter); + } + String line; + while ((line = reader.readLine()) != null) { + if (singleLine) { + printWriter.println(line); + } else { + LOG.logp(level, CLASS_NAME, method, line); + } + } + if (singleLine) { + LOG.logp(level, CLASS_NAME, method, stringWriter.toString()); + } + } catch (Exception e) { + LOG.logp(level, CLASS_NAME, method, "Failed to read " + this.getServerConfigurationPath() + ". Exception: " + e.getMessage()); + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + LOG.logp(level, CLASS_NAME, method, "Failed to close reader for " + this.getServerConfigurationPath() + ". Exception: " + e.getMessage()); + } + } + } + } + + public RemoteFile getConsoleLogFile() throws Exception { + // Find the currently configured/in-use console log file. + final RemoteFile remoteFile; + if (machineOS == OperatingSystem.ZOS) { + remoteFile = new RemoteFile(machine, consoleAbsPath, Charset.forName(EBCDIC_CHARSET_NAME)); + } else { + remoteFile = new RemoteFile(machine, consoleAbsPath); + } + return remoteFile; + } + + public RemoteFile getDefaultLogFile() throws Exception { + //Set path to server log assuming the default setting. + // ALWAYS RETURN messages.log -- tests assume they can look for INFO+ messages. + RemoteFile file = LibertyFileManager.getLibertyFile(machine, messageAbsPath); + if (file == null) { + throw new IllegalStateException("Unable to find default log file, path=" + messageAbsPath); + } + return file; + } + + protected String getDefaultLogPath() { + try { + RemoteFile file = getDefaultLogFile(); + return file.getAbsolutePath(); + } catch (Exception ex) { + return "DefaultLogFile"; + } + } + + protected RemoteFile getTraceFile(String fileName) throws Exception { + String fileAbsPath = logsRoot + fileName; + return LibertyFileManager.getLibertyFile(machine, fileAbsPath); + } + + public RemoteFile getFFDCLogFile(String ffdcName) throws Exception { + return LibertyFileManager.getLibertyFile(machine, (logsRoot + "ffdc/" + ffdcName)); + } + + public RemoteFile getFFDCSummaryFile(String ffdcSummary) throws Exception { + return LibertyFileManager.getLibertyFile(machine, (logsRoot + "ffdc/" + ffdcSummary)); + } + + /** + * Search for a file matching the given regex in the logs location. + * This is just a utility, primarily for pulling out a trace file without + * worrying about the timestamp, it isn't very clever and just returns + * the first match it finds. + * + * @param regex + * @return a matching RemoteFile, or null if no match was found + */ + public RemoteFile getMatchingLogFile(String regex) throws Exception { + Log.info(c, "getMatchingLogFile", "Looking for file matching regex: " + regex + " in " + logsRoot + " on " + machine); + RemoteFile logsDir = LibertyFileManager.getLibertyFile(machine, logsRoot); + RemoteFile[] logFiles = logsDir.list(false); + for (RemoteFile r : logFiles) { + if (r.isFile()) { + if (Pattern.matches(regex, r.getName())) { + Log.info(c, "getMatchingLogFile", "Matched log file: " + r.getName()); + return r; + } + } + } + Log.info(c, "getMatchingLogFile", "No matching log file found."); + return null; + } + + /** + * This method will search the given file on this server for the specified expression. + * The path given is relative to the install root directory. + * + * @param regexp pattern to search for. + * @param filePath the pathname relative to the install root directory. + * @return A list of the lines in the file that contains the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + /* not called */public List findStringsInFileInLibertyInstallRoot(String regexp, String filePath) throws Exception { + RemoteFile remoteFile = LibertyFileManager.getLibertyFile(machine, (installRoot + "/" + filePath)); + List strings = LibertyFileManager.findStringsInFile(regexp, remoteFile); + return strings; + } + + /** + * This method will search the given file on this server for the specified expression. + * The path given is relative to the server root directory. + * + * @param regexp pattern to search for. + * @param filePath the pathname relative to the server root directory. + * @return A list of the lines in the file that contains the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + public List findStringsInFileInLibertyServerRoot(String regexp, String filePath) throws Exception { + + /* + * On z/os, the console log will be produced in EBCDIC. We know other logs are ASCII, and + * so we can comfortably special case the console. + */ + final RemoteFile remoteFile; + String absolutePath = serverRoot + "/" + filePath; + if (machineOS == OperatingSystem.ZOS && absolutePath.equalsIgnoreCase(consoleAbsPath)) { + remoteFile = new RemoteFile(machine, absolutePath, Charset.forName(EBCDIC_CHARSET_NAME)); + } else { + remoteFile = LibertyFileManager.getLibertyFile(machine, absolutePath); + } + List strings = LibertyFileManager.findStringsInFile(regexp, remoteFile); + return strings; + } + + /** + * This method will search the output and trace files for this server + * for the specified expression. The default trace prefix is assumed. + * + * @param regexp pattern to search for + * @return A list of the lines in the trace files which contain the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + public List findStringsInLogs(String regexp) throws Exception { + return findStringsInLogs(regexp, getDefaultLogFile()); + } + + /** + * This method will search the output and trace files for this server + * for the specified expression. The default trace prefix is assumed. + * + * @param regexp pattern to search for + * @return A list of the lines in the trace files which contain the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + public List findStringsInLogs(String regexp, RemoteFile logFile) throws Exception { + List matches = new ArrayList(); + + List lines = LibertyFileManager.findStringsInFile(regexp, logFile); + if (!lines.isEmpty()) { + matches.addAll(lines); + } + return matches; + } + + /** + * This method will search the output and trace files for this server + * for the specified expression. The default trace prefix is assumed. + * + * @param regexp pattern to search for + * @return A list of the lines in the trace files which contain the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + public List findStringsInLogsAndTrace(String regexp) throws Exception { + return findStringsInLogsAndTrace(regexp, DEFAULT_TRACE_FILE_PREFIX); + } + + /** + * This method will search the output and trace files for this server + * for the specified expression. + * + * @param regexp pattern to search for + * @param traceFileNamePrefix trace file prefix if the trace file name is not default + * @return A list of the lines in the trace files which contain the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + /* not called */public List findStringsInLogsAndTrace(String regexp, String traceFileNamePrefix) throws Exception { + List matches = new ArrayList(); + + List lines = LibertyFileManager.findStringsInFile(regexp, getDefaultLogFile()); + if (!lines.isEmpty()) { + matches.addAll(lines); + } + + List traceLogsBaseNames = listDirectoryContents(logsRoot, traceFileNamePrefix); + for (String logBaseName : traceLogsBaseNames) { + RemoteFile logFile = getTraceFile(logBaseName); + lines = LibertyFileManager.findStringsInFile(regexp, logFile); + if (!lines.isEmpty()) { + matches.addAll(lines); + } + } + return matches; + } + + /** + * This method will search the trace files for this server + * for the specified expression. + * + * @param regexp pattern to search for + * @param traceFileNamePrefix trace file prefix if the trace file name is not default + * @return A list of the lines in the trace files which contain the matching + * pattern. No match results in an empty list. + * @throws Exception + */ + public List findStringsInTrace(String regexp) throws Exception { + List matches = new ArrayList(); + + List traceLogsBaseNames = listDirectoryContents(logsRoot, DEFAULT_TRACE_FILE_PREFIX); + + System.out.println("traceLogsBaseNames: " + traceLogsBaseNames == null ? "null" : traceLogsBaseNames.size()); + for (String logBaseName : traceLogsBaseNames) { + RemoteFile logFile = getTraceFile(logBaseName); + System.out.println("Looking in " + logBaseName); + List lines = LibertyFileManager.findStringsInFile(regexp, logFile); + if (!lines.isEmpty()) { + matches.addAll(lines); + } + } + return matches; + } + + /** + * This method will search for the provided expression in the log and trace files + * on an incremental basis using the default trace prefix. It starts with reading + * the file at the offset where the last mark was set (or the beginning of the file + * if no mark has been set) and reads until the end of the file. + * + * @param regexp pattern to search for + * @return A list of the lines in the trace files which contain the matching + * pattern. No matches result in an empty list. + * @throws Exception + */ + public List findStringsInLogsAndTraceUsingMark(String regexp) throws Exception { + return findStringsInLogsAndTraceUsingMark(regexp, DEFAULT_TRACE_FILE_PREFIX); + } + + /** + * This method will search for the provided expression in the log and trace files + * on an incremental basis using a custom trace prefix. It starts with reading the + * file at the offset where the last mark was set (or the beginning of the file + * if no mark has been set) and reads until the end of the file. + * + * @param regexp pattern to search for + * @param traceFileNamePrefix trace file prefix if the trace file name is not default + * @return A list of the lines in the trace files which contain the matching + * pattern. No matches result in an empty list. + * @throws Exception + */ + protected List findStringsInLogsAndTraceUsingMark(String regexp, String traceFileNamePrefix) throws Exception { + + List matches = new ArrayList(); + LogSearchResult newOffsetAndMatches; + + Long offset = getMarkOffset(getDefaultLogPath()); + newOffsetAndMatches = LibertyFileManager.findStringsInFile(regexp, getDefaultLogFile(), offset); + matches.addAll(newOffsetAndMatches.getMatches()); // get the list of matches found + + List traceLogBaseNames = listDirectoryContents(logsRoot, traceFileNamePrefix); + for (String name : traceLogBaseNames) { + + offset = getMarkOffset(logsRoot + name); + newOffsetAndMatches = LibertyFileManager.findStringsInFile(regexp, getTraceFile(name), offset); + + matches.addAll(newOffsetAndMatches.getMatches()); // get the list of matches found + } + + return matches; + } + + /** + * This method will search for the provided expressions in the log and trace files + * on an incremental basis using the default trace prefix. It starts with reading the file + * at the offset where the last mark was set (or the beginning of the file + * if no mark has been set) and reads until the end of the file. + * + * @param regexpList a list of expressions to search for + * @return a List<String> containing the matches + * @throws Exception + */ + public List findStringsInLogsAndTraceUsingMarkMultiRegexp(List regexpList) throws Exception { + return findStringsInLogsAndTraceUsingMarkMultiRegexp(regexpList, DEFAULT_TRACE_FILE_PREFIX); + } + + /** + * This method will search for the provided expressions in the log and trace files + * on an incremental basis using a custom trace prefix. It starts with reading the file + * at the offset where the last mark was set (or the beginning of the file + * if no mark has been set) and reads until the end of the file. + * + * @param regexpList a list of expressions to search for + * @param traceFileNamePrefix trace file prefix if the trace file name is not default + * @return a List<String> contains the matches + * @throws Exception + */ + protected List findStringsInLogsAndTraceUsingMarkMultiRegexp(List regexpList, String traceFileNamePrefix) throws Exception { + + List matches = new ArrayList(); + LogSearchResult newOffsetAndMatches; + + Long offset = getMarkOffset(getDefaultLogPath()); + newOffsetAndMatches = LibertyFileManager.findStringsInFile(regexpList, getDefaultLogFile(), offset); + matches.addAll(newOffsetAndMatches.getMatches()); // get the list of matches found + + List traceLogBaseNames = listDirectoryContents(logsRoot, traceFileNamePrefix); + for (String name : traceLogBaseNames) { + + offset = getMarkOffset(logsRoot + name); + newOffsetAndMatches = LibertyFileManager.findStringsInFile(regexpList, getTraceFile(name), offset); + + matches.addAll(newOffsetAndMatches.getMatches()); // get the list of matches found + } + + return matches; + + } + + /** + * Reset the mark and offset values for logs back to the start of the file. + *

    + * Note: This method doesn't set the offset values to the beginning of the file per se, + * rather this method sets the list of logs and their offset values to null. When one + * of the findStringsInLogsAndTrace...(...) methods are called, it will recreate the + * list of logs and set each offset value to 0L - the start of the file. + */ + public void resetLogMarks() { + logMonitor.resetLogMarks(); + } + + /** + * Reset the marks and offset values for the logs back to the start of the file. + * + * @deprecated Using log offsets is deprecated in favor of using log marks. + * For all new test code, use the following methods: {@link #resetLogMarks()}, {@link #setMarkToEndOfLog(RemoteFile...)}, + * {@link #waitForStringInLogUsingMark(String)} and {@link #getMarkOffset(String)}. + */ + @Deprecated + public void resetLogOffsets() { + resetLogMarks(); + } + + /** + * Set the mark offset to the end of the log file. + * + * @param log files to mark. If none are specified, the default log file is marked. + */ + public void setMarkToEndOfLog(RemoteFile... logFiles) throws Exception { + logMonitor.setMarkToEndOfLog(logFiles); + } + + /** + * Get the mark offset for the specified log file. + */ + protected Long getMarkOffset(String logFile) { + return logMonitor.getMarkOffset(logFile); + } + + /** + * Get the offset into a log or trace file of the last message inspected. + * + * If the file name does not exist in the offsets, then create an entry for it and + * set the offset for that file to '0'. + * + * @param String value of the file name + * @return Long containing the offset into the file of the last message inspected + * @deprecated Using log offsets is deprecated in favor of using log marks. + * For all new test code, use the following methods: {@link #resetLogMarks()}, {@link #setMarkToEndOfLog(RemoteFile...)}, + * {@link #waitForStringInLogUsingMark(String)} and {@link #getMarkOffset(String)}. + */ + @Deprecated + protected Long getLogOffset(String logFile) { + + String method = "getLogOffset"; + Log.finer(c, "getLogOffset", logFile); + + if (!logOffsets.containsKey(logFile)) { + Log.finer(c, method, "file does not exist in logOffsets, set initial offset"); + logOffsets.put(logFile, 0L); + } + + Log.info(LibertyServer.class, "getLogOffset", "log offset=" + logOffsets.get(logFile)); + return logOffsets.get(logFile); + } + + /** + * Update the log offset for the specified log file to the offset provided. + * + * @deprecated Using log offsets is deprecated in favor of using log marks. + * For all new test code, use the following methods: {@link #resetLogMarks()}, {@link #setMarkToEndOfLog(RemoteFile...)}, + * {@link #waitForStringInLogUsingMark(String)} and {@link #getMarkOffset(String)}. + */ + @Deprecated + public void updateLogOffset(String logFile, Long newLogOffset) { + Long oldLogOffset = logOffsets.put(logFile, newLogOffset); + Log.info(LibertyServer.class, "updateLogOffset", "old log offset=" + oldLogOffset + ", new log offset=" + newLogOffset); + } + + /** + * Returns a subset of the supplied application names that appear to be installed based on the presence of messages in messages.log. + * + * @param possiblyInstalledAppNames list of application names to check if installed. The names should be sufficiently unique (not substrings of other names). + * @return a subset of the supplied application names that appear to be installed based on the presence of messages in messages.log. + * @throws Exception if an error occurs. + */ + public Set getInstalledAppNames(String... possiblyInstalledAppNames) throws Exception { + // Messages for installed/updated: + // CWWKZ0001I: Application [name] started in 0.456 seconds. + // CWWKZ0003I: The application [name] updated in 0.258 seconds. + // J2CA7001I: Resource adapter [name] installed in 0.613 seconds. + // J2CA7003I: The resource adapter [name] updated in 0.120 seconds. + + // Messages for uninstalled: + // CWWKZ0009I: The application [name] has stopped successfully. + // J2CA7009I: The resource adapter [name] has uninstalled successfully. + + Set subset = new TreeSet(); + + if (possiblyInstalledAppNames.length > 0) { + Map counters = new HashMap(); + for (String name : possiblyInstalledAppNames) + counters.put(name, 0); + + for (String line : findStringsInFileInLibertyServerRoot(".*((CWWKZ0)|(J2CA7))00[139]I: .*", "logs/messages.log")) + for (String name : possiblyInstalledAppNames) + if (line.contains(name)) + counters.put(name, counters.get(name) + (line.contains("009I: ") ? -1 : 1)); + + for (Map.Entry entry : counters.entrySet()) + if (entry.getValue() > 0) + subset.add(entry.getKey()); + } + + return subset; + } + + /** + * Wait for completion of a configuration update and feature updates associated with it. + * If feature updates are started (CWWKF0007I) before the CWWKG0017I message (config updates completed), + * then this method waits for corresponding feature update completed messages (CWWKF0008I). + * If a list of application names is supplied, this method waits for all of the apps to be started. + * The offset is incremented every time this method is called. + * + * @param appNames optional list of names of applications that should be started before returning from this method. + * @param regexps optional list of regular expressions that indicate additional messages to wait for. The list should NOT include + * the CWWKG0017I, CWWKG0018I, CWWKF0007I or CWWKF0007I messages, as those are implicitly handled by this method. + * + * @return list of lines containing relevant messages. + */ + public List waitForConfigUpdateInLogUsingMark(Set appNames, + String... regexps) throws Exception { + return waitForConfigUpdateInLogUsingMark(appNames, false, regexps); + } + + /** + * Wait for completion of a configuration update and feature updates associated with it. + * If feature updates are started (CWWKF0007I) before the CWWKG0017I message (config updates completed), + * then this method waits for corresponding feature update completed messages (CWWKF0008I). If optionally + * specified that a feature update must happen, regardless of when CWWKG0017I appears, CWWKF0008I will + * be waited for. If a list of application names is supplied, this method waits for all of the apps to be started. + * The offset is incremented every time this method is called. + * + * @param appNames optional list of names of applications that should be started before returning from this method. + * @param waitForFeatureUpdateCompleted if true, this method will require a feature updated completed message + * before returning (if false, it will only wait for this message if a feature update is started + * before the config update is completed) + * @param regexps optional list of regular expressions that indicate additional messages to wait for. The list should NOT include + * the CWWKG0017I, CWWKG0018I, CWWKF0007I or CWWKF0007I messages, as those are implicitly handled by this method. + * + * @return list of lines containing relevant messages. + */ + public List waitForConfigUpdateInLogUsingMark(Set appNames, + boolean waitForFeatureUpdateCompleted, + String... regexps) throws Exception { + final String methodName = "waitForConfigUpdateInLogUsingMark"; + final long timeout = LOG_SEARCH_TIMEOUT_CONFIG_UPDATE; + + final List matchingLines = new LinkedList(); + final List watchFor = new LinkedList(); + String firstLine = null; + String lastLine = null; + boolean hitEof = false; + if (regexps != null) + for (String regexp : regexps) + watchFor.add(regexp); + watchFor.add("CWWKG001[7-8]I"); // Always wait for the config update completed or no changes detected message + watchFor.add("CWWKF0007I:"); // Feature update started - as many times as we see this, we need to wait for a corresponding Feature update completed + + // If the calling test indicates that a feature update message is required, explicitly + // add it. Otherwise if a feature update starts (CWWKF0007I) before the config update + // finishes it will be added below. + if (waitForFeatureUpdateCompleted) { + watchFor.add("CWWKF0008I:"); + } + + if (appNames == null) + appNames = Collections.emptySet(); + String[] appNamesArray = appNames.toArray(new String[appNames.size()]); + + RemoteFile logFile = getDefaultLogFile(); + + Set startedAppNames = Collections.emptySet(); + + int count = 0; + final long startTime = System.currentTimeMillis(); + try { + long offset; + for (offset = getMarkOffset(logFile.getAbsolutePath()); System.currentTimeMillis() - startTime < timeout + && (!startedAppNames.containsAll(appNames) + || watchFor.size() > 1); startedAppNames = getInstalledAppNames(appNamesArray)) { + // Periodically print diagnostic info if waiting a long time + long waited = System.currentTimeMillis() - startTime; + if (++count % 10 == 0) + Log.info(LibertyServer.class, methodName, "waited " + waited + "ms" + + ", startedAppNames=" + startedAppNames + + ", appNames=" + appNames + + ", contains? " + startedAppNames.containsAll(appNames) + + ", watchFor=" + watchFor); + + LogSearchResult newOffsetAndMatches = LibertyFileManager.findStringsInFileCommon(watchFor, 1, logFile, offset); + + if (firstLine == null) + firstLine = newOffsetAndMatches.getFirstLine(); + + //Make the last-line sticky so we see the actual text searched last. + //If we get an EOF return (null) note it, but don't remove the last text seen. + if (newOffsetAndMatches.getLastLine() == null) + hitEof = true; + else + lastLine = newOffsetAndMatches.getLastLine(); + offset = newOffsetAndMatches.getOffset(); + List matches = newOffsetAndMatches.getMatches(); + if (matches.isEmpty()) { + if (waited < count * WAIT_INCREMENT) + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + } else { + String line = matches.get(0); + matchingLines.add(line); + + // Indicates a feature updated was started. + if (line.contains("CWWKF0007I:")) { + // If we haven't already added the message id for the feature update to complete, + // do so now. + if (!waitForFeatureUpdateCompleted) { + watchFor.add("CWWKF0008I:"); // Feature update completed in X seconds. + } + } else + // Remove the corresponding regexp from the watchFor list + for (Iterator it = watchFor.iterator(); it.hasNext();) { + String regexp = it.next(); + if (Pattern.compile(regexp).matcher(line).find()) { + it.remove(); + break; + } + } + } + } + updateLogOffset(logFile.getAbsolutePath(), offset); + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(LibertyServer.class, methodName, "Started waiting for CWWKG001[7-8]I and messages matching regexps " + + Arrays.asList(regexps) + " at " + formatter.format(new Date(startTime)) + + " and finished at " + formatter.format(new Date(endTime)) + + ". Found: " + matchingLines); + + Log.info(LibertyServer.class, methodName, "First line searched: [ " + firstLine + " ]"); + Log.info(LibertyServer.class, methodName, "Last line searched: [ " + lastLine + " ]"); + if (hitEof) + Log.info(LibertyServer.class, methodName, "Last line searching reached end of file, preceding last line was the last line of text seen."); + } + + // Check if we timed out + watchFor.remove("CWWKF0007I:"); + List notStartedAppNames = new LinkedList(appNames); + notStartedAppNames.removeAll(startedAppNames); + if (watchFor.size() > 0 || notStartedAppNames.size() > 0) { + String message = "Timed out waiting for " + notStartedAppNames + + " and/or searching for " + watchFor + + " in log file: " + logFile.getAbsolutePath() + + ". Extra info: value of (watchFor.size() > 0): " + (watchFor.size() > 0) + + ", value of (notStartedAppNames.size() > 0): " + (notStartedAppNames.size() > 0); + Log.warning(c, message); + throw new RuntimeException(message); + } + + return matchingLines; + } + + /** + * This method will time out after a sensible period of + * time has elapsed. + * + * @param regexp a regular expression to search for + * @return the matching line in the log, or null if no matches + * appear before the timeout expires + */ + public String waitForStringInLog(String regexp) { + String methodName = "waitForStringInLog()"; + if (regexp.startsWith("CWWKZ0001I")) { + int index = 10; + if (regexp.length() > index && regexp.charAt(index) == ':') { + index++; + } + if (regexp.length() > index + 2 && regexp.charAt(index) == '.' && regexp.charAt(index + 1) == '*') { + index += 2; + String appName = regexp.substring(index).trim(); + if (appName.length() > 0) { + try { + validateAppLoaded(appName); + System.out.println(methodName + ": Application " + appName + " started"); + return "Application " + appName + " started"; + } catch (Exception ex) { + System.out.println(methodName + ": Application " + appName + " did not start"); + throw new RuntimeException(ex); + } + } + } + } + return waitForStringInLogUsingMark(regexp); + } + + /** + * This method will time out after a sensible period of + * time has elapsed. + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression to search for + * @return the number of matches in the log, or 0 if no matches + * appear before the timeout expires + */ + public int waitForMultipleStringsInLog(int numberOfMatches, String regexp) { + return waitForMultipleStringsInLog(numberOfMatches, regexp, LOG_SEARCH_TIMEOUT); + } + + /** + * Wait for the specified regex in the default logs from the last offset. + * The offset is incremented every time this method is called. + *

    + * This method will time out after a sensible period of + * time has elapsed. + * + * @param regexp a regular expression to search for + * @return the matching line in the log, or null if no matches + * appear before the timeout expires + */ + public String waitForStringInLogUsingLastOffset(String regexp) { + return waitForStringInLogUsingLastOffset(regexp, LOG_SEARCH_TIMEOUT); + } + + /** + * Wait for the specified regex in the default logs from the last mark. + *

    + * This method will time out after a sensible period of + * time has elapsed. + *

    The best practice for this method is as follows: + *

    + * // Set the mark to the current end of log
    + * server.setMarkToEndOfLog();
    + * // Do something, e.g. config change
    + * server.setServerConfigurationFile("newServer.xml");
    + * // Wait for message that was a result of the config change
    + * server.waitForStringInLogUsingMark("CWWKZ0009I");
    + *

    + * + * @param regexp a regular expression to search for + * @return the matching line in the log, or null if no matches + * appear before the timeout expires + */ + public String waitForStringInLogUsingMark(String regexp) { + return waitForStringInLogUsingMark(regexp, LOG_SEARCH_TIMEOUT); + } + + /** + * Unless there's a strong functional requirement that + * your string appear super-quickly, or you know your string + * might take a ridiculously long time (like five minutes), + * consider using the method which takes a default timeout, {@link } + * + * @param regexp + * @param timeout a timeout, in milliseconds + * @return + */ + public String waitForStringInLog(String regexp, long timeout) { + return waitForStringInLogUsingMark(regexp, timeout); + } + + /** + * Unless there's a strong functional requirement that + * your string appear super-quickly, or you know your string + * might take a ridiculously long time (like five minutes), + * consider using the method which takes a default timeout. + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @return + */ + public int waitForMultipleStringsInLog(int numberOfMatches, String regexp, long timeout) { + try { + return waitForMultipleStringsInLog(numberOfMatches, regexp, timeout, getDefaultLogFile()); + } catch (Exception e) { + Log.warning(c, "Could not get default log file: " + e); + return 0; + } + } + + /** + * Wait for the specified regex in the default logs from the last offset. + * The offset is incremented every time this method is called. + *

    + * Unless there's a strong functional requirement that + * your string appear super-quickly, or you know your string + * might take a ridiculously long time (like five minutes), + * consider using the method which takes a default timeout, {@link } + * + * @param regexp + * @param timeout a timeout, in milliseconds + * @return + */ + public String waitForStringInLogUsingLastOffset(String regexp, long timeout) { + try { + return waitForStringInLogUsingLastOffset(regexp, timeout, getDefaultLogFile()); + } catch (Exception e) { + Log.warning(c, "Could not find string in default log file due to exception " + e); + return null; + } + } + + /** + * Wait for the specified regex in the default logs from the last mark. + *

    + * Unless there's a strong functional requirement that + * your string appear super-quickly, or you know your string + * might take a ridiculously long time (like five minutes), + * consider using the method which takes a default timeout, {@link } + * + * @param regexp + * @param timeout a timeout, in milliseconds + * @return + */ + public String waitForStringInLogUsingMark(String regexp, long timeout) { + return logMonitor.waitForStringInLogUsingMark(regexp, timeout); + } + + /** + * @param regexp + * @param serverConfigurationFile + * @return + */ + public String waitForStringInLog(String regexp, RemoteFile outputFile) { + return waitForStringInLogUsingMark(regexp, outputFile); + } + + /** + * Check for a number of strings in a potentially remote file + * + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @param outputFile file to check + * @return line that matched the regexp + */ + public String waitForStringInLog(String regexp, long timeout, RemoteFile outputFile) { + return waitForStringInLogUsingMark(regexp, timeout, outputFile); + } + + /** + * Check for a number of strings in a potentially remote file + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @param outputFile file to check + * @return number of matches found + */ + public int waitForMultipleStringsInLog(int numberOfMatches, String regexp, long timeout, RemoteFile outputFile) { + long startTime = System.currentTimeMillis(); + int waited = 0; + int count = 0; + //Ensure we always search for at least 1 occurrence + if (numberOfMatches <= 0) { + numberOfMatches = 1; + } + try { + while (count < numberOfMatches && waited <= timeout) { + + count = LibertyFileManager.findMultipleStringsInFile(numberOfMatches, regexp, outputFile); + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + waited += WAIT_INCREMENT; + } + } catch (Exception e) { + // I think we can assume if we can't read the file it doesn't contain our string + Log.warning(c, "Could not read log file: " + outputFile + " due to exception " + e.toString()); + e.printStackTrace(); + return 0; + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(LibertyServer.class, "waitForMultipleStringsInLog", + "Started waiting for " + numberOfMatches + " messages matching regexp [ " + regexp + "] at " + formatter.format(new Date(startTime)) + + " and finished at " + formatter.format(new Date(endTime))); + } + return count; + } + + /** + * Wait for the specified regex in the specified RemoteFile from the last + * mark. + * + * @param regexp + * @param outputFile + * @return + */ + public String waitForStringInLogUsingMark(String regexp, RemoteFile outputFile) { + return waitForStringInLogUsingMark(regexp, LOG_SEARCH_TIMEOUT, outputFile); + } + + /** + * Wait for the specified regexp in the default logs from the last offset. + * The offset is incremented every time this method is called. + * + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @param outputFile file to check + * @return line that matched the regexp + */ + protected String waitForStringInLogUsingLastOffset(String regexp, long intendedTimeout, RemoteFile outputFile) { + return waitForStringInLogUsingLastOffset(regexp, intendedTimeout, 2 * intendedTimeout, outputFile); + } + + /** + * Wait for the specified regexp in the default logs from the last offset. + * The offset is incremented every time this method is called. + * + * @param regexp a regular expression to search for + * @param intendedTimeout a timeout, in milliseconds, within which we expect the wait to complete. Missing this is a soft fail. + * @param extendedTimeout a timeout, in milliseconds, within which we insist the wait complete. Missing this is an error. + * @param outputFile file to check + * @return line that matched the regexp + */ + protected String waitForStringInLogUsingLastOffset(String regexp, long intendedTimeout, long extendedTimeout, RemoteFile outputFile) { + final String METHOD_NAME = "waitForStringInLogUsingLastOffset"; + long startTime = System.currentTimeMillis(); + int waited = 0; + + Long offset = getLogOffset(outputFile.getAbsolutePath()); + + try { + LogSearchResult newOffsetAndMatches; + while (waited <= extendedTimeout) { + if (waited > intendedTimeout) { // first time only + SOEHttpPostUtil.reportSoftLogTimeoutToSOE(CLASS_NAME, METHOD_NAME, 3906, intendedTimeout, regexp); + intendedTimeout = extendedTimeout + WAIT_INCREMENT; // don't report again + } + newOffsetAndMatches = LibertyFileManager.findStringInFile(regexp, outputFile, offset); + offset = newOffsetAndMatches.getOffset(); + List matches = newOffsetAndMatches.getMatches(); + if (matches.isEmpty()) { + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + waited += WAIT_INCREMENT; + } else { + updateLogOffset(outputFile.getAbsolutePath(), offset); + return matches.get(0); + } + } + Log.warning(c, "Timed out searching for " + regexp + " in log file: " + outputFile.getAbsolutePath()); + } catch (Exception e) { + // I think we can assume if we can't read the file it doesn't contain our string + Log.warning(c, "Could not read log file: " + outputFile + " due do exception " + e.toString()); + e.printStackTrace(); + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(LibertyServer.class, "waitForStringInLogUsingLastOffset", + "Started waiting for message matching regexp [ " + regexp + "] at " + formatter.format(new Date(startTime)) + + " and finished at " + formatter.format(new Date(endTime))); + } + // If we didn't find the string, we still want to mark the offest so + // we don't have to re-search the whole file on the next call. + updateLogOffset(outputFile.getAbsolutePath(), offset); + return null; + } + + /** + * Wait for the specified regexp in the default logs from the last mark. + * The offset is also incremented every time this method is called. + * + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @param outputFile file to check + * @return line that matched the regexp + */ + protected String waitForStringInLogUsingMark(String regexp, long intendedTimeout, RemoteFile outputFile) { + return waitForStringInLogUsingMark(regexp, intendedTimeout, 2 * intendedTimeout, outputFile); + } + + /** + * Wait for the specified regexp in the default logs from the last mark. + * The offset is also incremented every time this method is called. + * + * @param regexp a regular expression to search for + * @param intendedTimeout a timeout, in milliseconds, within which the wait should complete. Exceeding this is a soft fail. + * @param extendedTimeout a timeout, in milliseconds, within which the wait must complete. Exceeding this is a hard fail. + * @param outputFile file to check + * @return line that matched the regexp + */ + protected String waitForStringInLogUsingMark(String regexp, long intendedTimeout, long extendedTimeout, RemoteFile outputFile) { + return logMonitor.waitForStringInLogUsingMark(regexp, intendedTimeout, extendedTimeout, outputFile); + } + + /** + * Wait for the specified regexp in the default logs from the last mark + * and verify that the regex does not show up in the logs during the + * specfied duration. + * + * @param regexp a regular expression to search for + * @param intendedTimeout a timeout, in milliseconds, within which the wait should complete. Exceeding this is a soft fail. + * @param extendedTimeout a timeout, in milliseconds, within which the wait must complete. Exceeding this is a hard fail. + * @param outputFile file to check + * @return line that matched the regexp + */ + public boolean verifyStringNotInLogUsingMark(String regexp, long timeout) { + return logMonitor.verifyStringNotInLogUsingMark(regexp, timeout); + } + + /** + * Wait for the specified regexp in the default logs from the last mark. + * The offset is also incremented every time this method is called. + * + * TODO: This is a temporary version of this method that will be used for negative + * checks. Remove this method and update the verifyStringNotInLogUsingMark method to use + * the waitForStringInLogUsingMark method eventually. + * + * @param regexp a regular expression to search for + * @param intendedTimeout a timeout, in milliseconds, within which the wait should complete. Exceeding this is a soft fail. + * @param extendedTimeout a timeout, in milliseconds, within which the wait must complete. Exceeding this is a hard fail. + * @param outputFile file to check + * @return line that matched the regexp + */ + protected String waitForStringInLogUsingMarkWithException(String regexp, long intendedTimeout, long extendedTimeout, RemoteFile outputFile) { + return logMonitor.waitForStringInLogUsingMarkWithException(regexp, intendedTimeout, extendedTimeout, outputFile); + } + + /** + * Check for multiple instances of the regex in log using mark + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression to search for + * @return number of matches found + */ + public int waitForMultipleStringsInLogUsingMark(int numberOfMatches, String regexp) { + try { + return waitForMultipleStringsInLogUsingMark(numberOfMatches, regexp, LOG_SEARCH_TIMEOUT, getDefaultLogFile()); + } catch (Exception e) { + Log.warning(c, "Could not find string in default log file due to exception " + e); + return 0; + } + } + + /** + * Check for multiple instances of the regex in log using mark + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @param outputFile file to check + * @return number of matches found + */ + public int waitForMultipleStringsInLogUsingMark(int numberOfMatches, String regexp, long timeout, RemoteFile outputFile) { + return logMonitor.waitForMultipleStringsInLogUsingMark(numberOfMatches, regexp, timeout, outputFile); + } + + /** + * Wait for a regex in the most recent trace file + * + * @param regexp + * @return + */ + public String waitForStringInTrace(String regexp) { + return waitForStringInTrace(regexp, 0); + } + + /** + * Wait for a regex in the most recent trace file + * + * @param regexp + * @return + */ + public String waitForStringInTrace(String regexp, long timeout) { + RemoteFile f = null; + + try { + f = getMostRecentTraceFile(); + } catch (Exception e) { + e.printStackTrace(); + } + + Log.info(c, "waitForStringInTrace", "Waiting for " + regexp + " to be found in " + (f == null ? "null" : f.getAbsolutePath())); + + if (f != null) { + if (timeout > 0) { + return waitForStringInLog(regexp, timeout, f); + } else { + return waitForStringInLog(regexp, f); + } + } else { + return null; + } + } + + protected void searchForMessages(String message_code, String message_type, AtomicInteger counter) { + final String method = "searchForMessages"; + // Get a remote file whether it exists yet or not (thus don't use the LibertyFileManager API) + if (messageAbsPath == null) { + Log.info(c, method, "Messages file path is null - no check for message in logs"); + } else { + RemoteFile outputFile = new RemoteFile(machine, messageAbsPath); + int oldNumber = counter.getAndIncrement(); + int newNumber = oldNumber + 1; + int numberFound = waitForMultipleStringsInLog(newNumber, message_code, serverStartTimeout, outputFile); + //waitForStringInLog(REMOVE_APP_MESSAGE_CODE, serverStartTimeout, outputFile); + if (numberFound == newNumber) { + Log.info(c, method, message_type + " message appears in log " + numberFound + " time(s)"); + } else if (numberFound > counter.get()) { + //need to update stopApplicationMessages + Log.info(c, method, "Resetting the number of " + message_type + " messages that appear in the log"); + counter.set(numberFound); + } else { + Log.info(c, method, "Incorrect number of " + message_type + " messages in the log. An error may have occurred."); + } + } + } + + public void addInstalledAppForValidation(String app) { + final String method = "addInstalledAppForValidation"; + final String START_APP_MESSAGE_CODE = "CWWKZ0001I"; + Log.info(c, method, "Adding installed app: " + app + " for validation"); + installedApplications.add(app); + + if (isStarted) { + searchForMessages(START_APP_MESSAGE_CODE, "installApp", startApplicationMessages); + } + } + + public void removeInstalledAppForValidation(String app) { + final String method = "removeInstalledAppForValidation"; + final String REMOVE_APP_MESSAGE_CODE = "CWWKZ0009I"; + Log.info(c, method, "Removing installed app: " + app + " for validation"); + installedApplications.remove(app); + + if (isStarted) { + searchForMessages(REMOVE_APP_MESSAGE_CODE, "uninstallApp", stopApplicationMessages); + } + } + + public void removeAllInstalledAppsForValidation() { + final String method = "removeInstalledAppForValidation"; + final String REMOVE_APP_MESSAGE_CODE = "CWWKZ0009I"; + Log.info(c, method, "Removing following list of installed application for validation"); + for (String app : installedApplications) { + Log.info(c, method, " -" + app); + } + installedApplications.clear(); + + if (isStarted) { + searchForMessages(REMOVE_APP_MESSAGE_CODE, "uninstallApp", stopApplicationMessages); + } + } + + public List listAllInstalledAppsForValidation() { + final String method = "listAllInstalledAppsForValidation"; + Log.info(c, method, "Returning list of installed application for validation"); + for (String app : installedApplications) { + Log.info(c, method, " -" + app); + } + return installedApplications; + } + + /** + * Returns true if the server has been successfully started, and either + * hasn't been stopped or hit exceptions during server stop. + * + * @return + */ + public boolean isStarted() { + return isStarted; + } + + /** + * Sets the server's state to "started". The server has been started by some + * other means, and we are simply telling this class about it so that the server + * can be stopped later. + */ + public void setStarted() { + isStarted = true; + } + + /** + * Sets the server's state flag to the state specified by the isStarted parameter. + * The isStarted flag may not always be correct, if the server happens to be started + * external from this class. This method allows for management of the state externally. + * + * @param isStarted + */ + public void setStarted(boolean isStarted) { + this.isStarted = isStarted; + } + + /** + * This method will check the server state and reset the state based on the results of the + * status operation. + * + * @throws Exception + */ + public int resetStarted() throws Exception { + ProgramOutput serverStatusOutput = executeServerScript("status", null); + int rc = serverStatusOutput.getReturnCode(); + if (rc == 0) { + // Server is still running when rc == 0 + isStarted = true; + + //Setup the server logs assuming the default setting. + messageAbsPath = logsRoot + messageFileName; + consoleAbsPath = logsRoot + consoleFileName; + + } else { + // Server is stopped when rc == 1. Any other value means server + // is in a bad way, but we still will treat it as not started. + isStarted = false; + } + + return rc; + } + + /** + * Start the server. + * + * @param cleanStart if true, the server will be started with a clean start + * @param validateApps if true, block until all of the registered apps have started + * @throws Exception + */ + public void startServer(boolean cleanStart, boolean validateApps) throws Exception { + startServerAndValidate(true, cleanStart, validateApps); + } + + /** + * "Restart" an applications in dropins by renaming it and putting it back. + * Very clever, eh? + *

    + * This will use {@link #waitForStringInLogUsingMark(String)} so ensure + * the offset is set to the correct point before invoking. + * + * @param fileName the file name of the application, e.g. snoop.war + * @return {@code true} if the application was restarted successfully, {@code false} otherwise. + * @throws Exception + */ + public boolean restartDropinsApplication(String fileName) throws Exception { + final String method = "restartDropinsApplication"; + + String appName = fileName.substring(0, fileName.lastIndexOf(".")); + String oldFilePath = serverRoot + "/dropins/" + fileName; + String newFilePath = serverRoot + "/" + fileName; + + String stopMsg, startMsg = null; + + // Move the file out of dropins... + if (LibertyFileManager.renameLibertyFile(machine, oldFilePath, newFilePath)) { + Log.info(c, method, fileName + " successfully moved out of dropins, waiting for message..."); + stopMsg = waitForStringInLogUsingMark("CWWKZ0009I:.*" + appName); + } else { + Log.info(c, method, "Unable to move " + fileName + " out of dropins, failing."); + return false; + } + + // Pause for 4 seconds + Thread.sleep(4000); + + // Move it back into dropins... + if (LibertyFileManager.renameLibertyFile(machine, newFilePath, oldFilePath)) { + Log.info(c, method, fileName + " successfully moved back into dropins, waiting for message..."); + startMsg = waitForStringInLogUsingMark("CWWKZ0001I:.*" + appName); + } else { + Log.info(c, method, "Unable to move " + fileName + " back into dropins, failing."); + return false; + } + + return stopMsg != null && startMsg != null; + } + + /** + * + * Removes one or more applications from dropins. + * + * This does no clever testing using log files, it assumes you're using it before the server starts + * + * @param fileNames the file name or names of the application, e.g. snoop.war + * @return {@code true} if the applications were moved successfully, {@code false} otherwise. + * @throws Exception + */ + public boolean removeDropinsApplications(String... fileNames) throws Exception { + + boolean allSucceeded = true; + + for (String fileName : fileNames) { + + String dropinsFilePath = serverRoot + "/dropins/" + fileName; + String nonDropinsFilePath = serverRoot + "/" + fileName; + + allSucceeded = allSucceeded && LibertyFileManager.renameLibertyFile(machine, dropinsFilePath, nonDropinsFilePath); + } + + return allSucceeded; + } + + /** + * Restores one or more applications to dropins that has been removed by removeDropinsApplication. + * + * This assumes that the server is now running and checks waits for the app to startup + * in the logs. + * + * @param fileNames the file name or names of the application, e.g. snoop.war + * @return {@code true} if the applications were started successfully, {@code false} otherwise. + * @throws Exception + */ + public boolean restoreDropinsApplications(String... fileNames) throws Exception { + final String method = "restartDropinsApplication"; + + boolean allSucceeded = true; + + for (String fileName : fileNames) { + String appName = fileName.substring(0, fileName.lastIndexOf(".")); + String dropinsFilePath = serverRoot + "/dropins/" + fileName; + String nonDropinsFilePath = serverRoot + "/" + fileName; + + String startMsg = null; + + if (LibertyFileManager.renameLibertyFile(machine, nonDropinsFilePath, dropinsFilePath)) { + Log.info(c, method, fileName + " successfully moved back into dropins, waiting for message..."); + startMsg = waitForStringInLogUsingMark("CWWKZ0001I:.*" + appName); + allSucceeded = allSucceeded && (startMsg != null); + } else { + Log.info(c, method, "Unable to move " + fileName + " back into dropins, failing."); + allSucceeded = false; + } + } + return allSucceeded; + } + + public void setLogsRoot(String root) { + this.logsRoot = root; + } + + public String getLogsRoot() { + return logsRoot; + } + + /** + * Creates the collective controller configuration for the specified server. + * + * @param keystorePassword + * @param optArgs optional arguments to pass ex: --collectiveName, --createConfigFile, etc. + * @throws Exception + */ + public void createCollectiveController(String keystorePassword, String... optArgs) throws Exception { + CollectiveUtilities.create(machine, this, keystorePassword, optArgs); + } + + /** + * Creates the collective controller configuration for the specified server. + * + * @param keystorePassword + * @throws Exception + */ + public void createCollectiveController(String keystorePassword) throws Exception { + CollectiveUtilities.create(machine, this, keystorePassword); + } + + /** + * Joins the server to the collective managed by the specified controller. + * + * @param controllerHost + * @param controllerPort + * @param controllerUser + * @param controllerPassword + * @param keystorePassword + * @throws Exception + */ + public void joinCollective(String controllerHost, int controllerPort, String controllerUser, + String controllerPassword, String keystorePassword) throws Exception { + CollectiveUtilities.join(machine, this, controllerHost, controllerPort, + controllerUser, controllerPassword, keystorePassword); + } + + /** + * Replicates the collective configuration of the target controller. + * + * @param controllerHost + * @param controllerPort + * @param controllerUser + * @param controllerPassword + * @param keystorePassword + * @throws Exception + */ + public void replicateController(String controllerHost, int controllerPort, String controllerUser, + String controllerPassword, String keystorePassword) throws Exception { + CollectiveUtilities.replicate(machine, this, controllerHost, controllerPort, + controllerUser, controllerPassword, keystorePassword); + } + + /** + * Run the addReplica command. + * + * @param localReplicaHostPort + * @param controllerHost + * @param controllerPort + * @param controllerUser + * @param controllerPassword + * @throws Exception + */ + public void addReplica(String localReplicaHostPort, String controllerHost, int controllerPort, String controllerUser, + String controllerPassword) throws Exception { + CollectiveUtilities.addReplica(machine, this, localReplicaHostPort, controllerHost, controllerPort, + controllerUser, controllerPassword); + } + + /** + * Removes the server from the collective managed by the specified controller. + * + * @param controllerHost + * @param controllerPort + * @param controllerUser + * @param controllerPassword + * @throws Exception + */ + public void removeFromCollective(String controllerHost, int controllerPort, + String controllerUser, String controllerPassword) throws Exception { + CollectiveUtilities.remove(machine, this, controllerHost, controllerPort, + controllerUser, controllerPassword, true, true); + } + + /** + * @see #removeFromCollective(String, int, String, String) + * @param controllerHost + * @param controllerPort + * @param controllerUser + * @param controllerPassword + * @param shouldUnregister set to {@code true} if the action should unregister + * @param shouldRemoveFiles set to {@code true} if the action should remove files + * @throws Exception + */ + public void removeFromCollective(String controllerHost, int controllerPort, + String controllerUser, String controllerPassword, + boolean shouldUnregister, boolean shouldRemoveFiles) throws Exception { + CollectiveUtilities.remove(machine, this, controllerHost, controllerPort, + controllerUser, controllerPassword, + shouldUnregister, shouldRemoveFiles); + } + + /** + * Unregisters a host to the controller. Note this command can be run even if the host isn't real + * + * @param hostName The hostname to register. Doesn't need to be real + * @param controllerHost The hostname where the controller is located + * @param controllerPort The port that the controller is listening on + * @param controllerUser The User ID required to perform admin commands on the controller + * @param controllerPassword The password of the User ID required to perform admin commands on the controller + * @throws Exception if the CollectiveUtilities method throws an Exception + */ + public int unregisterHostToController(String hostName, String controllerHost, int controllerPort, String controllerUser, String controllerPassword) throws Exception { + return CollectiveUtilities.unregisterHost(machine, this, hostName, controllerHost, controllerPort, controllerUser, controllerPassword); + } + + /** + * Registers host level host (without servers) via MBean invocation + * + * @param connection MBean server connection to the collective controller. + * @param hostAuthMap The host authorization map with credentials. + * @return Object The return Object of MBean operation "registerHost". + * @throws Exception + */ + public Object registerHost(MBeanServerConnection connection, String controllerHostName, Map hostAuthMap) throws Exception { + return CollectiveUtilities.registerHost(connection, controllerHostName, hostAuthMap); + } + + /** + * Registers a host to the controller with user/password authentication. Note this command can be run even if the host isn't real + * + * @param hostName The hostname to register. Doesn't need to be real + * @param controllerHost The hostname where the controller is located + * @param controllerPort The port that the controller is listening on + * @param controllerUser The User ID required to perform admin commands on the controller + * @param controllerPassword The password of the User ID required to perform admin commands on the controller + * @param remoteUser The remote user, needed for issuing remote commands + * @param remotePassword The remote users password + * @throws Exception if the CollectiveUtilities method throws an Exception + */ + public int registerHostToController(String hostName, String controllerHost, int controllerPort, String controllerUser, String controllerPassword, + String remoteUser, String remotePassword) throws Exception { + return CollectiveUtilities.registerHost(machine, this, hostName, controllerHost, controllerPort, controllerUser, controllerPassword, remoteUser, remotePassword); + } + + /** + * Registers a host to the controller with SSH authentication. Note this command can be run even if the host isn't real + * + * @param hostName The hostname to register. Doesn't need to be real + * @param controllerHost The hostname where the controller is located + * @param controllerPort The port that the controller is listening on + * @param controllerUser The User ID required to perform admin commands on the controller + * @param controllerPassword The password of the User ID required to perform admin commands on the controller + * @param sshPrivateKey The path of the controller's private key file. + * @throws Exception if the CollectiveUtilities method throws an Exception + */ + public int registerHostToControllerWithSSH(String hostName, String controllerHost, int controllerPort, String controllerUser, String controllerPassword, + String sshPrivateKey) throws Exception { + return CollectiveUtilities.registerHostWithSSH(machine, this, hostName, controllerHost, controllerPort, controllerUser, controllerPassword, sshPrivateKey); + } + + /** + * Updates host information. Note this command can be run even if the host isn't real + * + * @param keystorePassword The keystore password to provide + * @param hostName The hostname to register. Doesn't need to be real + * @param controllerHost The hostname where the controller is located + * @param controllerPort The port that the controller is listening on + * @param controllerUser The User ID required to perform admin commands on the controller + * @param controllerPassword The password of the User ID required to perform admin commands on the controller + * @param remoteUser The remote user, needed for issuing remote commands + * @param remotePassword The remote users password + * @throws Exception if the CollectiveUtilities method throws an Exception + */ + public int updateHostToController(String keystorePassword, String hostName, String controllerHost, int controllerPort, String controllerUser, String controllerPassword, + String remoteUser, String remotePassword) throws Exception { + return CollectiveUtilities.updateHost(machine, this, hostName, controllerHost, controllerPort, controllerUser, controllerPassword, remoteUser, remotePassword); + } + + /** + * Updates host information. Note this command can be run even if the host isn't real + * + * @param hostName The hostname to register. Doesn't need to be real + * @param controllerHost The hostname where the controller is located + * @param controllerPort The port that the controller is listening on + * @param controllerUser The User ID required to perform admin commands on the controller + * @param controllerPassword The password of the User ID required to perform admin commands on the controller + * @param sshPrivateKey The new SSH private key of the user used to authenticate to the remote host + * @throws Exception if the CollectiveUtilities method throws an Exception + */ + public int updateHostToControllerWithSSH(String hostName, String controllerHost, int controllerPort, String controllerUser, String controllerPassword, + String sshPrivateKey) throws Exception { + return CollectiveUtilities.updateHostSSHPrivateKey(machine, this, hostName, controllerHost, controllerPort, controllerUser, controllerPassword, sshPrivateKey); + } + + /** + * Runs the collective enterMaintenanceMode command. + * + * To put a host and its servers into maintenance mode, targetHost must + * be non-null and targetUserDir and targetServer must be null. + * + * To put a server into maintenance mode, targetHost, targetUserDir and + * targetServer must be non-null. + * + * @param targetHost The target host name + * @param targetUserDir The target WLP user directory + * @param targetServer The target server name + * @param breakAffinity Break session affinity + * @param force Set maintenance mode even if it causes autoScaling policy to be violated + * @param controllerHost The hostname where the controller is located + * @param controllerPort The port that the controller is listening on + * @param controllerUser The User ID required to perform admin commands on the controller + * @param controllerPassword The password of the User ID required to perform admin commands on the controller + * @param expectedResults A map of host/server names to expected results. + * @throws Exception + */ + public void enterMaintenanceMode(String targetHost, String targetUserDir, String targetServer, + boolean breakAffinity, boolean force, + String controllerHost, int controllerPort, + String controllerUser, String controllerPassword, + Map expectedResults) throws Exception { + CollectiveUtilities.enterMaintenanceMode(machine, this, targetHost, targetUserDir, targetServer, + breakAffinity, force, controllerHost, controllerPort, + controllerUser, controllerPassword, expectedResults); + } + + /** + * Runs the collective exitMaintenanceMode command. + * + * To take a host and its servers out of maintenance mode, targetHost must + * be non-null and targetUserDir and targetServer must be null. + * + * To take a server out of maintenance mode, targetHost, targetUserDir and + * targetServer must be non-null. + * + * @param targetHost The target host name + * @param targetUserDir The target WLP user directory + * @param targetServer The target server name + * @param controllerHost The hostname where the controller is located + * @param controllerPort The port that the controller is listening on + * @param controllerUser The User ID required to perform admin commands on the controller + * @param controllerPassword The password of the User ID required to perform admin commands on the controller + * @param expectedResults A map of host/server names to expected results. + * @throws Exception + */ + public void exitMaintenanceMode(String targetHost, String targetUserDir, String targetServer, + String controllerHost, int controllerPort, + String controllerUser, String controllerPassword, + Map expectedResults) throws Exception { + CollectiveUtilities.exitMaintenanceMode(machine, this, targetHost, targetUserDir, targetServer, + controllerHost, controllerPort, controllerUser, controllerPassword, expectedResults); + } + + /** + * Runs the collective getMaintenanceMode command. + * + * To get the maintenance mode of a host and its servers, targetHost must + * be non-null and targetUserDir and targetServer must be null. + * + * To get the maintenance mode of a server, targetHost, targetUserDir and + * targetServer must be non-null. + * + * @param targetHost The target host name + * @param targetUserDir The target WLP user directory + * @param targetServer The target server name + * @param controllerHost The hostname where the controller is located + * @param controllerPort The port that the controller is listening on + * @param controllerUser The User ID required to perform admin commands on the controller + * @param controllerPassword The password of the User ID required to perform admin commands on the controller + * @param expectedResults A map of host/server names to expected results. + * @throws Exception + */ + public void getMaintenanceMode(String targetHost, String targetUserDir, String targetServer, + String controllerHost, int controllerPort, + String controllerUser, String controllerPassword, + Map expectedResults) throws Exception { + CollectiveUtilities.getMaintenanceMode(machine, this, targetHost, targetUserDir, targetServer, + controllerHost, controllerPort, controllerUser, controllerPassword, expectedResults); + } + + /** + * Sets maintenance mode using the MBean rather than the command line interface. + * The MBean supports multiple targets unlike the command line interface. + * + * @param connection MBeanServerConnection + * @param targets List of targets + * @param breakAffinity Break session affinity + * @param force Set maintenance mode even if it causes autoScaling policy to be violated + * @param expectedResultsList Expected results + * @throws Exception + */ + public void enterMaintenanceModeUsingMBean(MBeanServerConnection connection, + List targets, + MaintenanceModeTargetType targetType, + boolean breakAffinity, boolean force, + List> expectedResultsList) throws Exception { + CollectiveUtilities.enterMaintenanceModeUsingMBean(connection, targets, targetType, breakAffinity, force, expectedResultsList); + } + + /** + * Resets maintenance mode using the MBean rather than the command line interface. + * The MBean supports multiple targets unlike the command line interface. + * + * @param connection MBeanServerConnection + * @param targets List of targets + * @param expectedResultsList Expected results + * @throws Exception + */ + public void exitMaintenanceModeUsingMBean(MBeanServerConnection connection, + List targets, + MaintenanceModeTargetType targetType, + List> expectedResultsList) throws Exception { + CollectiveUtilities.exitMaintenanceModeUsingMBean(connection, targets, targetType, expectedResultsList); + } + + /** + * Gets maintenance mode using the MBean rather than the command line interface. + * The MBean supports multiple targets unlike the command line interface. + * + * @param connection MBeanServerConnection + * @param targets List of targets + * @param expectedResultsList Expected results + * @throws Exception + */ + public void getMaintenanceModeUsingMBean(MBeanServerConnection connection, + List targets, + MaintenanceModeTargetType targetType, + List> expectedResultsList) throws Exception { + CollectiveUtilities.getMaintenanceModeUsingMBean(connection, targets, targetType, expectedResultsList); + } + + /** + * Issues a server script command against this server + * + * @param command command name + * @param optionalArgs any optional args needed by the command + * @throws Exception if the operation fails + * @return the output of the command + */ + public ProgramOutput executeServerScript(String command, String[] optionalArgs) throws Exception { + final String method = "executeServerScript"; + Log.info(c, method, "Running server script with command=" + command, optionalArgs); + + String cmd = installRoot + "/bin/server"; + + // organize parms properly - the command name comes first, followed by the server name, followed + // by an optional arguments + String[] parms; + if (optionalArgs == null) { + parms = new String[2]; + } else { + parms = new String[2 + optionalArgs.length]; + System.arraycopy(optionalArgs, 0, parms, 2, optionalArgs.length); + } + parms[0] = command; + parms[1] = serverToUse; + + Properties envVars = null; + if (customUserDir) { + envVars = new Properties(); + envVars.setProperty("WLP_USER_DIR", userDir); + } + + return LibertyServerUtils.execute(machine, machineJava, envVars, cmd, parms); + } + + /** + * If the server is running, this will execute: + * WLP/bin/server javadump SERVERNAME + * + * which should generate a javacore / thread dump + */ + public ProgramOutput javadumpThreads() throws Exception { + final String method = "javadumpThreads"; + Log.info(c, method, "Acquiring thread dump"); + + String cmd = installRoot + "/bin/server"; + String[] parms = { "javadump", serverToUse }; + + Properties envVars = new Properties(); + envVars.setProperty("JAVA_HOME", machineJava); + if (customUserDir) + envVars.setProperty("WLP_USER_DIR", userDir); + Log.info(c, method, "Using additional env props: " + envVars.toString()); + + ProgramOutput output = machine.execute(cmd, parms, envVars); + String stdout = output.getStdout(); + Log.info(c, method, "Server javadump output: " + stdout); + Log.info(c, method, "Return code from javadump is: " + output.getReturnCode()); + + return output; + } + + /** + * If the server is running, this will execute: + * WLP/bin/server dump SERVERNAME + * + * which should generate a zip file with contents from the + * server's directory and introspectors (includes threads). This will contain + * information about registered services, etc. Which can help identify missing + * dependencies. + */ + public ProgramOutput serverDump() throws Exception { + return serverDump(null); + } + + /** + * If the server is running, this will execute: + * WLP/bin/server dump SERVERNAME --include=<includeParameter> + * + * which should generate a zip file with contents from the + * server's directory and introspectors (includes threads). This will contain + * information about registered services, etc. Which can help identify missing + * dependencies. + * + * @param includeParameter server dump parameter -include=value + */ + public ProgramOutput serverDump(String includeParameter) throws Exception { + + final String method = "serverDump"; + Log.info(c, method, "Acquiring full dump"); + + String cmd = installRoot + "/bin/server"; + String[] parms; + if (includeParameter == null) + parms = new String[] { "dump", serverToUse }; + else + parms = new String[] { "dump", serverToUse, "--include=" + includeParameter }; + + Properties envVars = new Properties(); + envVars.setProperty("JAVA_HOME", machineJava); + if (customUserDir) + envVars.setProperty("WLP_USER_DIR", userDir); + Log.info(c, method, "Using additional env props: " + envVars.toString()); + + ProgramOutput output = machine.execute(cmd, parms, envVars); + String stdout = output.getStdout(); + Log.info(c, method, "Server dump output: " + stdout); + Log.info(c, method, "Return code from dump is: " + output.getReturnCode()); + + return output; + } + + public void setupForRestConnectorAccess() throws Exception { + if (isStarted) { + throw new IllegalStateException("Must call setupForRestConnectorAccess BEFORE starting the server"); + } + + //if the key file was generated by another test using the same server then it will be backed up in tmp + //copy it back to the server... + LocalFile keyFile = new LocalFile(pathToAutoFVTTestFiles + "/tmp/key.jks"); + if (keyFile.exists()) + keyFile.copyToDest(new RemoteFile(getMachine(), getServerRoot() + "/resources/security/key.jks")); + + // Set up the trust store + //System.setProperty("javax.net.ssl.trustStore", getServerRoot() + "/resources/security/key.jks"); + //System.setProperty("javax.net.ssl.trustStorePassword", "Liberty"); + + checkForRestConnector.set(true); + } + + /** + * Creates a JMX rest connection to the server using the following user name, password and keystore password: + * "theUser", "thePassword", "Liberty". + * + * If you need to connect with different values, use {@link #getJMXRestConnector(String, String, String)}. + * + * @return JMXConnector connected to the server + * @throws Exception If anything goes wrong! + */ + public JMXConnector getJMXRestConnector() throws Exception { + final String userName = "theUser"; + final String password = "thePassword"; + final String keystorePassword = "Liberty"; + + return getJMXRestConnector(userName, password, keystorePassword); + } + + /** + * Creates a JMX rest connection to the server. + * + * @param userName The admin user + * @param password The admin user password + * @param keystorePassword The keystore password used to open the server's key.jks + * @return JMXConnector connected to the server + * @throws Exception If anything goes wrong! + */ + public JMXConnector getJMXRestConnector(String userName, String password, String keystorePassword) throws Exception { + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { userName, password }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + + KeyStore keyStore = KeyStore.getInstance("JKS"); + FileInputStream is = new FileInputStream(getServerRoot() + "/resources/security/key.jks"); + keyStore.load(is, keystorePassword.toCharArray()); + is.close(); + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + trustManagerFactory.init(keyStore); + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(null, trustManagerFactory.getTrustManagers(), null); + environment.put(ConnectorSettings.CUSTOM_SSLSOCKETFACTORY, sslContext.getSocketFactory()); + + JMXServiceURL url = new JMXServiceURL("REST", getHostname(), getHttpDefaultSecurePort(), "/IBMJMXConnectorREST"); + + JMXConnector jmxConnector = JMXConnectorFactory.connect(url, environment); + Log.info(c, "getJMXRestConnector", "Created JMX connector to server with URL: " + url + " Connector: " + jmxConnector); + + return jmxConnector; + } + + /** + * Wait for the specified regex in the default logs from the last offset. + * The offset is incremented every time this method is called. + *

    + * This method will time out after a sensible period of + * time has elapsed. + * + * @param regexp a regular expression to search for + * @return the matching line in the log, or null if no matches + * appear before the timeout expires + */ + public String waitForStringInTraceUsingLastOffset(String regexp) { + return waitForStringInTraceUsingLastOffset(regexp, LOG_SEARCH_TIMEOUT); + } + + /** + * Wait for the specified regex in the default logs from the last offset. + * The offset is incremented every time this method is called. + *

    + * Unless there's a strong functional requirement that + * your string appear super-quickly, or you know your string + * might take a ridiculously long time (like five minutes), + * consider using the method which takes a default timeout, {@link } + * + * @param regexp + * @param timeout a timeout, in milliseconds + * @return + */ + public String waitForStringInTraceUsingLastOffset(String regexp, long timeout) { + try { + return waitForStringInLogUsingLastOffset(regexp, timeout, getMostRecentTraceFile()); + } catch (Exception e) { + Log.warning(c, "Could not find string in default log file due to exception " + e); + return null; + } + } + + /** + * Wait for the specified regex in the most recent trace log from the last mark. + *

    + * This method will time out after a sensible period of + * time has elapsed. + * + * @param regexp a regular expression to search for + * @return the matching line in the log, or null if no matches + * appear before the timeout expires + */ + public String waitForStringInTraceUsingMark(String regexp) { + return waitForStringInTraceUsingMark(regexp, LOG_SEARCH_TIMEOUT); + } + + /** + * Wait for the specified regex in the most recent trace log from the last mark. + *

    + * Unless there's a strong functional requirement that + * your string appear super-quickly, or you know your string + * might take a ridiculously long time (like five minutes), + * consider using the method which takes a default timeout, {@link } + * + * @param regexp + * @param timeout a timeout, in milliseconds + * @return + */ + public String waitForStringInTraceUsingMark(String regexp, long timeout) { + try { + return waitForStringInLogUsingMark(regexp, timeout, getMostRecentTraceFile()); + } catch (Exception e) { + Log.warning(c, "Could not find string in trace log file due to exception " + e); + return null; + } + } + + public int getHttpSecondaryPort() { + return httpSecondaryPort; + } + + public void setHttpSecondaryPort(int httpSecondaryPort) { + this.httpSecondaryPort = httpSecondaryPort; + } + + public int getHttpSecondarySecurePort() { + return httpSecondarySecurePort; + } + + public void setHttpSecondarySecurePort(int httpSecondarySecurePort) { + this.httpSecondarySecurePort = httpSecondarySecurePort; + } + + /** + * Add to a list of strings that will be ignored when the server logs are + * checked for errors on shutdown. The list is cleared every time the server + * is stopped. + * + * @param regexes + */ + public void addIgnoredErrors(List regexes) { + if (ignoredErrors == null) { + ignoredErrors = new ArrayList(); + } + ignoredErrors.addAll(regexes); + } + + /** + * Populates a list with a fixed set error and warning messages to be ignored for + * those buckets that choose to care about error or warning messages when the server + * is stopped. + * + * Some history: + * Starting in 2Q15, the default behavior was made for buckets to + * care about waring/error messages. Buckets prior to 2Q15 and those that did not + * care about those messages were excluded from the default behavior by being listed + * under ant_build\resources\configuration\exemptServersList.txt. + * + * Issue: + * Buckets that care about error/warning messages now fail sporadically because + * of messages that show in the logs for reasons completely external to the FAT + * being run. + * + * Workaround: + * Create a new global list to account for failures that are proven to be + * not test case specific and could apply to all buckets that are sensitive to + * error/warning messages. It is true that this list could become really long + * as unforseen and unrelated issues take place, but the expectation is that if + * error/warning messages are seen, the first course of action would be to + * report/fix the issue being exposed by the message. In certain cases; however, + * the errors reported could be unpredictable and could not be prevented reliably. + * It is only then that you may concider adding it to the list. + */ + private void populateFixedListOfMessagesToIgnore() { + + // Added to stop iFix/testFix builds failing when listing warning message of testFix installed, + // of course there is a test fix installed ...it is a test fix build + fixedIgnoreErrorsList.add("CWWKF0014W:"); + // Added due to build break defect 168264. See defect for more details. + fixedIgnoreErrorsList.add("CWWKF0017E.*cik.ext.product1.properties"); + // Added due to build break defect 221453. + fixedIgnoreErrorsList.add("CWWKG0011W"); + if (isJavaVersion6()) { + fixedIgnoreErrorsList.add("CWWKE0109W"); + } + } + + public boolean isJava2SecurityEnabled() { + return isJava2SecurityEnabled; + } + + public void configureForAnyDatabase() throws Exception { + ServerConfiguration config = this.getServerConfiguration(); + config.updateDatabaseArtifacts(); + this.updateServerConfiguration(config); + } + + public boolean isJavaVersion6() { + return JAVA_VERSION_6; + } + + public boolean isJavaVersion8() { + return JAVA_VERSION_8; + } + + public boolean isIBMJVM() { + return IBM_JVM; + } + + public boolean isOracleJVM() { + return ORACLE_JVM; + } + + public void useSecondaryHTTPPort() { + setHttpDefaultPort(getHttpSecondaryPort()); + setHttpDefaultSecurePort(getHttpSecondarySecurePort()); + } + + public void setConsoleLogName(String consoleLogName) { + this.consoleFileName = consoleLogName; + } + + /* + * (non-Javadoc) + * + * @see componenttest.topology.impl.LogMonitorClient#lmcGetDefaultLogFile() + */ + @Override + public RemoteFile lmcGetDefaultLogFile() throws Exception { + return getDefaultLogFile(); + } + + /* + * (non-Javadoc) + * + * @see componenttest.topology.impl.LogMonitorClient#lmcClearLogOffsets() + */ + @Override + public void lmcClearLogOffsets() { + logOffsets.clear(); + } + + /* + * (non-Javadoc) + * + * @see componenttest.topology.impl.LogMonitorClient#lmcUpdateLogOffset(java.lang.String, java.lang.Long) + */ + @Override + public void lmcUpdateLogOffset(String logFile, Long newLogOffset) { + updateLogOffset(logFile, newLogOffset); + } +} \ No newline at end of file diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServerFactory.java b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServerFactory.java new file mode 100755 index 000000000000..78ee06e41035 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServerFactory.java @@ -0,0 +1,670 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.prefs.Preferences; + +import com.ibm.websphere.simplicity.LocalFile; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.exception.TopologyException; + +public class LibertyServerFactory { + //track the known Liberty servers by test class name, so that suites don't clean up servers from other test classes in the suite + private static Map> knownLibertyServers = new HashMap>(); + private static Class c = LibertyServerFactory.class; + private static final Boolean BACKUP_REQUIRED = shouldBackup(); + + // To enable running Liberty as a Windows Service. + public static enum WinServiceOption { + ON, + OFF + } + + private static final boolean DELETE_RUN_FATS = + Boolean.parseBoolean(AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + // Default is false if not set + //nb the default passed in is ${delete.run.fats} but + //parseBoolean does default that to false. + return System.getProperty("delete.run.fats", "false"); + } + })); + + /** + * This method will return a newly created LibertyServer instance with the specified server name + * + * @return A stopped Liberty Server instance + * @throws Exception + */ + public static LibertyServer getLibertyServer(String serverName) { + return getLibertyServer(serverName, null, true); + } + + /** + * This method will return a newly created LibertyServer instance with the specified server name + * + * @param serverName The name of the server + * @param testClassName The name of the class to associate with the server. + * @return A stopped Liberty Server instance + */ + public static LibertyServer getLibertyServer(String serverName, Class testClass) { + return getLibertyServer(serverName, null, true, false, false, testClass.getCanonicalName()); + } + + /** + * This method will return a newly created LibertyServer instance with the specified server name. + * Note if the ignoreCache parameter is set to false, then the returned LibertyServer instance may + * not be newly-created. + * + * @return A stopped Liberty Server instance + * @throws Exception + */ + public static LibertyServer getLibertyServer(String serverName, Bootstrap bootstrap, boolean ignoreCache) { + return getLibertyServer(serverName, bootstrap, ignoreCache, false, false, null); + } + + public static LibertyServer getExistingLibertyServer(String serverName) { + return getLibertyServer(serverName, null, false, false, true, null); + } + + public static LibertyServer getExistingLibertyServer(String serverName, Bootstrap bootstrap) { + return getLibertyServer(serverName, bootstrap, false, false, true, null); + } + + public static LibertyServer getLibertyServer(String serverName, WinServiceOption wsOpt) { + return getLibertyServer(serverName, null, true, false, false, null, wsOpt); + } + + private static LibertyServer getLibertyServer(String serverName, Bootstrap bootstrap, boolean ignoreCache, boolean installServerFromSampleJar, boolean usePreviouslyConfigured, + String testClassName) { + + return getLibertyServer(serverName, bootstrap, ignoreCache, installServerFromSampleJar, usePreviouslyConfigured, testClassName, + WinServiceOption.OFF); + } + + private static LibertyServer getLibertyServer(String serverName, Bootstrap bootstrap, boolean ignoreCache, boolean installServerFromSampleJar, boolean usePreviouslyConfigured, + String testClassName, WinServiceOption winServiceOpt) { + try { + if (serverName == null) + throw new Exception("Liberty server name cannot be null."); + + LibertyServer ls = null; + + WinServiceOption windowsServiceOption = winServiceOpt; + if (windowsServiceOption == WinServiceOption.ON) { + if (hasWinAdminRights() == false) { + windowsServiceOption = WinServiceOption.OFF; + } + } + + //Associate the LibertyServer with the calling test name + if (testClassName == null) + testClassName = getCallerClassNameFromStack(); + Log.info(LibertyServerFactory.class, "getLibertyServer", "testClassName: " + testClassName + ", server: " + serverName); + + //synchronize while we look for an existing server with this name + //and create one if it doesn't exist yet + //hold the lock until we finish copying server information + //since we don't want to return while the server state is incomplete + synchronized (knownLibertyServers) { + Set knownServers = knownLibertyServers.get(testClassName); + if (knownServers == null) { + knownServers = new HashSet(); + knownLibertyServers.put(testClassName, knownServers); + } + + if (!ignoreCache) { + String userDir = (bootstrap == null) ? null : bootstrap.getValue("libertyUserDir"); // usually null + for (LibertyServer s : knownServers) { + if (s.getServerName().equals(serverName)) { + // If the server we're getting has a custom user directory + // then make sure the known server has the same one. + // If not it's a different server with the same name. + if (userDir != null && !userDir.equals(s.getUserDir())) + continue; + ls = s; + ls.unTidy(); // mark this server as unTidy so that tidyAllKnownServers will stop it after the next test runs + Log.info(LibertyServerFactory.class, "getLibertyServer", "found existing server for " + testClassName + ", reissuing"); + break; + } + } + } else { + Log.info(LibertyServerFactory.class, "getLibertyServer", "Ignoring cache for request for " + serverName); + } + + //if we haven't yet encountered this server, then create the instance and + //copy the autoFVT contents to the servers dir and backup if necessary etc + if (ls == null) { + if (bootstrap == null) { + Log.info(LibertyServerFactory.class, "getLibertyServer", "using default bootstrapping.properties"); + bootstrap = Bootstrap.getInstance(); + } else { + Log.info(LibertyServerFactory.class, "getLibertyServer", "using supplied bootstrapping.properties"); + } + ls = new LibertyServer(serverName, bootstrap, ignoreCache, usePreviouslyConfigured, windowsServiceOption); + + if (!usePreviouslyConfigured) + { + if (installServerFromSampleJar) { + if (!LibertyFileManager.libertyFileExists(ls.getMachine(), ls.getServerRoot())) { + //Samples don't overwrite, so only bother running it if the server directory isn't already there + ls.installSampleWithExternalDependencies(serverName); + } else { + Log.warning(LibertyServerFactory.class, "Server directory for sample " + serverName + " already exists - executing sample installer was SKIPPED."); + } + } else { + //copy the published FAT server content for the test + recursivelyCopyDirectory(ls.getMachine(), new LocalFile(ls.getPathToAutoFVTNamedServer()), new RemoteFile(ls.getMachine(), ls.getServerRoot())); + + //copy any shared content + LocalFile sharedFolder = new LocalFile(LibertyServer.PATH_TO_AUTOFVT_SHARED); + if (sharedFolder.exists()) + recursivelyCopyDirectory(ls.getMachine(), sharedFolder, new RemoteFile(ls.getMachine(), ls.getServerSharedPath())); + } + + RemoteFile[] autoInstall = applicationsToVerify(ls); + + if (ls.getJvmOptionsAsMap().containsKey("-Ddelay.start.applications")) { + removeHeldApplicationsFromDropins(ls, ls.getJvmOptionsAsMap().get("-Ddelay.start.applications")); + } + + //Now we backup just before we install the applications ONLY if RTC Run + if (BACKUP_REQUIRED) { + preTestBackUp(ls); + } + if (autoInstall != null) { + //There are applications to install so we need to install them all :) + Log.info(c, "getLibertyServer", "Found dropins folder with applications to verify!"); + addAppsToVerificationList(autoInstall, ls); + } + } + } + + knownServers.add(ls); + + return ls; + } + } catch (Exception e) { + Log.error(c, "getLibertyServer", e); + throw new RuntimeException("Error getting server", e); + } + } + + public static boolean hasWinAdminRights() { + + boolean isWindows = System.getProperty("os.name").toLowerCase().startsWith("win"); + + if (!isWindows) { + return false; + } + + PrintStream systemErr = System.err; + synchronized (systemErr) { + System.setErr(new PrintStream(new OutputStream() { + @Override + public void write(int i) throws IOException {} + })); + try { + Long time = new Long(System.currentTimeMillis()); + String unique = time.toString(); + Preferences prefs = Preferences.systemRoot(); + + prefs.put(unique, "RemoveMe"); // SecurityException on Windows if code is not running with admin rights. + + prefs.remove(unique); + prefs.flush(); + + return true; + + } catch (Exception e) { + return false; + + } finally { + System.setErr(systemErr); + } + } + } + + /** + * @param ls + * @param appNames + * @param bootstrap + */ + private static void removeHeldApplicationsFromDropins(LibertyServer ls, String appNames) { + + for (String appName : appNames.split(",")) { + + try { + ls.removeDropinsApplications(appName); + Log.info(c, "removeHeldApplicationsFromDropins", "moved app {0} out of dropins folder", appName); + } catch (Exception e) { + Log.error(c, "removeHeldApplicationsFromDropins", e); + } + + } + + } + + /** + * This method will return a newly created LibertyServer instance with the specified server name + * + * @return A started Liberty Server instance + * @throws Exception + */ + public static LibertyServer getStartedLibertyServer(String serverName) { + try { + LibertyServer ls = getLibertyServer(serverName); + ls.startServer(); + return ls; + } catch (Exception e) { + Log.error(c, "getStartedLibertyServer", e); + throw new RuntimeException("Error getting running server", e); + } + } + + /** + * This method will install a sample server and download any external dependencies defined in it. Once the server is installed the server.xml will be exchanged with a default + * server XML, that includes fatTestPorts.xml and the sample server.xml. The bootstrap.properties will be exchanged with a default properties file that includes the + * "../testports.properties" file and the sample properties file. The server will then be added to the list of known servers and returned. + * + * @param serverName The name of the server to install, must be matched by a local file named serverName.jar in the lib/LibertyFATTestFiles folder (populated from publish/files + * in a FAT test project) + * @param bootstrap The bootstrap to use on the server + * @param ignoreCache false if we should load a cached server if available + * @return The server + * + */ + public static LibertyServer installSampleServer(String serverName, Bootstrap bootstrap, boolean ignoreCache) { + return getLibertyServer(serverName, bootstrap, ignoreCache, true, false, null); + } + + public static LibertyServer installSampleServer(String serverName) { + return installSampleServer(serverName, null, false); + } + + /** + * This method should not be ran by the user, it is ran by the JUnit + * runner at the end of each test to ensure that post test tidying is + * done. + * + * Once a server has under gone the tidy action, it needs to be removed + * from the list of known servers, or subsequent cleanups will fail. + * This will happen in the case of FATSuite being the entry point with + * multiple test classes. + * + * @param testClassName, the name of the test class for which servers should be tidied + * @throws Exception + */ + public static void tidyAllKnownServers(String testClassName) throws Exception { + Log.info(c, "tidyAllKnownServers", "Now post-test-tidying all servers known to test: " + testClassName); + Exception unexpectedException = null; + // Iteration through this data structure must be synchronized as + // so it can not be modified during iteration + synchronized (knownLibertyServers) { + Collection knownServers = getKnownLibertyServers(testClassName); + if (knownServers != null) { + Iterator itr = knownServers.iterator(); + while (itr.hasNext()) { + LibertyServer ls = itr.next(); + Log.info(c, "tidyAllKnownServers", "Tidying server: " + ls.getServerName() + " hash:" + ls.hashCode()); + try { + if (!ls.isTidy()) { + ls.postTestTidy(); + } + } catch (Exception e) { + if (unexpectedException == null) + unexpectedException = e; + } + } + } + } + + if (unexpectedException != null) { + throw unexpectedException; + } + } + + /** + * This method should not be ran by the user, it is ran by the JUnit runner at the end of each test + * to recover the servers. + * + * @param testClassName the name of the FAT test class to recover known servers for + * @throws Exception + */ + public static void recoverAllServers(String testClassName) throws Exception { + Log.info(c, "recoverAllServers", "Now recovering all servers known to test class: " + testClassName); + + //If backups were required, so is recovery + if (BACKUP_REQUIRED) { + // Iteration through this data structure must be synchronized as + // so it can not be modified during iteration + synchronized (knownLibertyServers) { + for (LibertyServer ls : getKnownLibertyServers(testClassName)) { + if (ls.needsPostTestRecover()) { + postTestRecover(ls); + ls.setNeedsPostRecover(false); + } + } + } + } else { + //we weren't backing up, if we're running with delete run fats in RTC + //we should delete the server to save space + if (DELETE_RUN_FATS) { + synchronized (knownLibertyServers) { + for (LibertyServer ls : getKnownLibertyServers(testClassName)) { + LibertyFileManager.deleteLibertyDirectoryAndContents(ls.getMachine(), ls.getServerRoot()); + } + } + } + } + } + + private static RemoteFile[] applicationsToVerify(LibertyServer ls) { + return applicationsToVerify(ls, ls.getPathToAutoFVTNamedServer()); + } + + private static RemoteFile[] applicationsToVerify(LibertyServer ls, String s) { + int appCount = 0; + try { + LocalFile appFolder = new LocalFile(s + "dropins/"); + if (!!!appFolder.exists()) { + return null; // The autoinstall folder doesn't exist so return false. + } + RemoteFile[] files = appFolder.list(false); + if (files.length > 0) { + return files; + } else { + return null; + } + } catch (Exception e) { + Log.error(c, "", e); + return null; + } finally { + Log.info(c, "applicationsToVerify", appCount + " on server " + ls.getServerName()); + } + } + + // For dynamically created servers + public static void addAppsToVerificationList(LibertyServer ls) throws Exception { + addAppsToVerificationList(applicationsToVerify(ls, ls.getServerRoot() + "/"), ls); + } + + private static void addAppsToVerificationList(RemoteFile[] files, LibertyServer ls) throws Exception { + try { + for (RemoteFile f : files) { + try { + String onlyAppName = f.getName(); + if (onlyAppName.endsWith(".xml")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 4); + } + if (onlyAppName.endsWith(".ear") || onlyAppName.endsWith(".eba") || onlyAppName.endsWith(".war") || + onlyAppName.endsWith(".jar") || onlyAppName.endsWith(".rar") || onlyAppName.endsWith(".zip") || + onlyAppName.endsWith(".esa")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 4); + } + if (onlyAppName.endsWith(".js")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 3); + } + if (onlyAppName.endsWith(".jsar")) { + onlyAppName = onlyAppName.substring(0, onlyAppName.length() - 5); + } + Log.info(c, "addAppsToVerificationList", "Adding " + onlyAppName + " to the startup verification list for server " + ls.getServerName()); + ls.autoInstallApp(onlyAppName); + } catch (TopologyException e) { + //Most likely an error with installing a directory so log and carry on + Log.error(c, "installApplications", e); + } catch (Exception e) { + //Not a 'can't install a directory' Exception so throw + throw e; + } + } + } catch (Exception e) { + Log.error(c, "installApplications", e); + throw e; + } + } + + public static void recursivelyCopyDirectory(Machine machine, LocalFile localDirectory, RemoteFile destination) throws Exception { + String method = "recursivelyCopyDirectory"; + Log.entering(c, method); + destination.mkdir(); + ArrayList logs = new ArrayList(); + logs = listDirectoryContents(localDirectory); + for (String l : logs) { + Log.finer(c, "recursivelyCopyDirectory", "Getting: " + l); + LocalFile toCopy = new LocalFile(localDirectory, l); + RemoteFile toReceive = new RemoteFile(machine, destination, l); + if (toCopy.isDirectory()) { + // Recurse + recursivelyCopyDirectory(machine, toCopy, toReceive); + } else { + toReceive.copyFromSource(toCopy); + Log.finer(c, "recursivelyCopyDirectory", l + " copied to " + toReceive.getAbsolutePath()); + } + } + Log.exiting(c, method); + } + + @Deprecated + private static ArrayList listDirectoryContents(LocalFile serverDir) throws Exception { + final String method = "serverDirectoryContents"; + Log.entering(c, method); + if (!serverDir.isDirectory() || !serverDir.exists()) + throw new TopologyException("The specified directoryPath \'" + + serverDir.getAbsolutePath() + "\' was not a directory"); + + RemoteFile[] firstLevelFiles = serverDir.list(false); + ArrayList firstLevelFileNames = new ArrayList(); + + for (RemoteFile f : firstLevelFiles) { + firstLevelFileNames.add(f.getName()); + } + return firstLevelFileNames; + } + + private static LocalFile getServerBackupZip(LibertyServer server) throws Exception { + // Backup lives in the FAT project + LocalFile backupDir = new LocalFile("build/backup"); + if (!backupDir.exists()) + backupDir.mkdirs(); + + String backupFile = server.getServerName() + ".backup.zip"; + LocalFile backup = new LocalFile(backupDir, backupFile); + + return backup; + } + + /** + * This method is used to backup all the server's at the start. BEFORE anything is done to them. + * If they already exist. + */ + private static void preTestBackUp(LibertyServer server) throws Exception { + final String METHOD = "preTestBackUp"; + Machine m = server.getMachine(); + + LocalFile backup = getServerBackupZip(server); + + // Server is in the build.image/wlp/usr/servers dir + RemoteFile usrServersDir = new RemoteFile(m, server.getServerRoot()).getParentFile(); //should be /wlp/usr/servers + + if (backup.exists()) { + Log.info(c, METHOD, "Backup file already exists... skipping backup"); + return; + } + Log.info(c, METHOD, "Backing up Server: " + server.getServerName() + " to zip file: " + backup.getAbsolutePath()); + + String workDir = usrServersDir.getAbsolutePath(); + String command = server.getMachineJavaJarCommandPath(); + String[] param = { "cMf", backup.getAbsolutePath(), server.getServerName() }; + ProgramOutput o = m.execute(command, param, workDir); + if (o.getReturnCode() == 0) { + Log.info(c, METHOD, "Successfully backed up server: " + server.getServerName() + " to zip file: " + backup.getAbsolutePath()); + } else { + Log.warning(c, "Backup jar process failed with return code " + o.getReturnCode()); + Log.warning(c, "Backup jar process failed with error " + o.getStderr()); + Log.warning(c, "Backup jar process failed with output " + o.getStdout()); + } + } + + /** + * This method is used to return the tested server back to the state it was in before + * testing + */ + private static void postTestRecover(LibertyServer server) throws Exception { + final String METHOD = "postTestRecover"; + Machine m = server.getMachine(); + RemoteFile usrServersDir = new RemoteFile(m, server.getServerRoot()).getParentFile(); //should be /wlp/usr/servers + + LocalFile backup = getServerBackupZip(server); + if (!backup.exists()) { + Log.info(c, METHOD, "Backup file doesn't exist... skipping recovery"); + return; + } + Log.info(c, METHOD, "Recovering Server: " + server.getServerName() + " from zip file: " + backup.getAbsolutePath()); + + RemoteFile serverFolder = new RemoteFile(m, server.getServerRoot()); + if (!!!serverFolder.delete()) { + Log.warning(c, "Unable to delete old serverFolder. Recovery failed!"); + // retry up to 5 seconds + for (int i = 0; i < 5; i++) { + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + // try again + } + if (!!!serverFolder.delete()) { + Log.warning(c, "Unable to delete old serverFolder. Retry failed!"); + } else { + break; + } + // on the last try, mark the server with the failed cleanup. + if (i == 4) { + Log.warning(c, "The clean server will not be restored."); + server.setServerCleanupProblem(true); + return; + } + } + } + + String workDir = usrServersDir.getAbsolutePath(); + String command = server.getMachineJavaJarCommandPath(); + String[] param = { "xf", backup.getAbsolutePath() }; + ProgramOutput o = m.execute(command, param, workDir); + if (o.getReturnCode() == 0) { + Log.info(c, METHOD, "Successfully recovered server: " + server.getServerName() + " from zip file: " + backup.getAbsolutePath()); + } else { + Log.warning(c, "Recovery unjar process failed with return code " + o.getReturnCode()); + Log.warning(c, "Recovery unjar process failed with error " + o.getStderr()); + Log.warning(c, "Recovery unjar process failed with output " + o.getStdout()); + } + server.setServerCleanupProblem(false); + } + + /** + * Checks if we should backup existing servers with the same name + * and sets the flag. + * We backup if skip.backup is not set or false. + * We don't backup if we aren't running in a local workspace. + */ + private static boolean shouldBackup() { + try { + Bootstrap b = Bootstrap.getInstance(); + if (Boolean.parseBoolean(b.getValue("skip.backup"))) { + return false; + } + if (DELETE_RUN_FATS) { + //don't bother backing up if we're going to delete the run fats + return false; + } + return true; + } catch (Exception e) { + //if we couldn't figure out whether we should backup do it just in case + return true; + } + } + + /** + * @return the list of knownLibertyServers + */ + public static Collection getKnownLibertyServers(String testClassName) { + Log.finer(c, "getKnownLibertyServers", "Getting known liberty servers for test: " + testClassName); + Set servers = new HashSet(); + synchronized (knownLibertyServers) { + Set knownServers = knownLibertyServers.get(testClassName); + if (knownServers != null) + servers.addAll(knownServers); + //could be that the server is known to a super type of this test + //any servers defined (via getLibertyServer or getStartedLibertyServer) on a + //super could be used by a test, so they qualify as known to the test + try { + Class c = Class.forName(testClassName); + Class superClass = c.getSuperclass(); + while (superClass != null && !!!superClass.equals(Object.class)) { + Set superServers = knownLibertyServers.get(superClass.getName()); + if (superServers != null) + servers.addAll(superServers); + superClass = superClass.getSuperclass(); + } + } catch (ClassNotFoundException e) { + Log.error(c, "getKnownLibertyServers", e); + } + } + return servers; + } + + /** + * @return the list of FFDC logs + */ + public static ArrayList retrieveFFDCFile(LibertyServer server) throws Exception { + return server.listFFDCFiles(server.getServerName()); + + } + + /** + * Hack to get the calling test class name from the stack. + * + * @param methodName the name of the method that is being called + */ + private static String getCallerClassNameFromStack() { + String thisClassName = LibertyServerFactory.class.getName(); + String previousElementClass = null; + for (StackTraceElement element : Thread.currentThread().getStackTrace()) { + if (previousElementClass != null && previousElementClass.equals(thisClassName)) { + //the last thing in the stack before the current element was LibertyServerFactory + //if the current element is not also LibertyServerFactory then we found our caller + String currentClassName = element.getClassName(); + if (!!!currentClassName.equals(thisClassName)) + return currentClassName; + } + previousElementClass = element.getClassName(); + } + return null; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServerWrapper.java b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServerWrapper.java new file mode 100755 index 000000000000..350cd7849f38 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServerWrapper.java @@ -0,0 +1,26 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface LibertyServerWrapper { + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/LineReader.java b/dev/fattest.simplicity/src/componenttest/topology/impl/LineReader.java new file mode 100755 index 000000000000..463f9953ee64 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/LineReader.java @@ -0,0 +1,141 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; + +class LineReader { + private final Reader reader; + private final StringBuilder builder = new StringBuilder(); + private boolean cr; + private boolean eof; + + LineReader(Reader reader) { + this.reader = reader; + } + + /** + * Returns the next line from the reader, or null if there are no more + * lines. {@link #eof} will return true after the last line is returned. + */ + public String readLine() throws IOException { + if (eof) { + return null; + } + + for (;;) { + int c = reader.read(); + if (c == -1) { + eof = true; + String line = builder.toString(); + builder.setLength(0); + return line; + } + + if (c == '\r' || (c == '\n' && !cr)) { + cr = c == '\r'; + String line = builder.toString(); + builder.setLength(0); + return line; + } + + cr = false; + if (c != '\n') { + builder.append((char) c); + } + } + } + + /** + * Returns true if the last line was truncated at EOF. + */ + public boolean eof() { + return eof; + } + + public void close() throws IOException { + reader.close(); + } + + // Unit test. + public static void main(String[] args) throws Exception { + { + LineReader r = new LineReader(new StringReader("")); + assertEquals("", r.readLine()); + assertEquals(true, r.eof()); + assertEquals(null, r.readLine()); + } + { + LineReader r = new LineReader(new StringReader("a")); + assertEquals("a", r.readLine()); + assertEquals(true, r.eof()); + assertEquals(null, r.readLine()); + } + { + LineReader r = new LineReader(new StringReader("a\r")); + assertEquals("a", r.readLine()); + assertEquals(false, r.eof()); + assertEquals("", r.readLine()); + assertEquals(true, r.eof()); + assertEquals(null, r.readLine()); + } + { + LineReader r = new LineReader(new StringReader("a\rb")); + assertEquals("a", r.readLine()); + assertEquals(false, r.eof()); + assertEquals("b", r.readLine()); + assertEquals(true, r.eof()); + assertEquals(null, r.readLine()); + } + { + LineReader r = new LineReader(new StringReader("a\n")); + assertEquals("a", r.readLine()); + assertEquals(false, r.eof()); + assertEquals("", r.readLine()); + assertEquals(true, r.eof()); + assertEquals(null, r.readLine()); + } + { + LineReader r = new LineReader(new StringReader("a\nb")); + assertEquals("a", r.readLine()); + assertEquals(false, r.eof()); + assertEquals("b", r.readLine()); + assertEquals(true, r.eof()); + assertEquals(null, r.readLine()); + } + { + LineReader r = new LineReader(new StringReader("a\r\n")); + assertEquals("a", r.readLine()); + assertEquals(false, r.eof()); + assertEquals("", r.readLine()); + assertEquals(true, r.eof()); + assertEquals(null, r.readLine()); + } + { + LineReader r = new LineReader(new StringReader("a\r\nb")); + assertEquals("a", r.readLine()); + assertEquals(false, r.eof()); + assertEquals("b", r.readLine()); + assertEquals(true, r.eof()); + assertEquals(null, r.readLine()); + } + System.out.println("PASS"); + } + + private static void assertEquals(Object expected, Object actual) { + if (!(expected == null ? actual == null : expected.equals(actual))) { + throw new AssertionError("expected=" + expected + ", actual=" + actual); + } + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/LogMonitor.java b/dev/fattest.simplicity/src/componenttest/topology/impl/LogMonitor.java new file mode 100755 index 000000000000..d12b015e36f2 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/LogMonitor.java @@ -0,0 +1,381 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* WLP Copyright IBM Corp. 2016 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package componenttest.topology.impl; + +import java.io.BufferedInputStream; +import java.text.DateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.websphere.soe_reporting.SOEHttpPostUtil; + +import componenttest.exception.NoStringFoundInLogException; +import componenttest.topology.impl.LibertyFileManager.LogSearchResult; + +/** + * This class was initial created as an extraction of methods and members from the LibertyServer class. + * The intent here is to provide some basic log wait/search capability to server types beyond LibertyServer. + * Users of this class will need to implement the LogMonitorClient interface. Over time, it is hoped, perhaps, + * more of the log wait/search logic can be migrated to this class. + */ +public class LogMonitor { + private static final Class c = LogMonitor.class; + + /** How frequently we poll the logs when waiting for something to happen */ + protected static final int WAIT_INCREMENT = 300; //milliseconds + + /** Default wait period for log search requests **/ + protected static final long LOG_SEARCH_TIMEOUT = TimeUnit.MILLISECONDS.convert(2, TimeUnit.MINUTES); + + //Used for keeping track of mark positions of log files + protected final HashMap logMarks = new HashMap(); + + //The sole client for this LogMonitor instance. The LogMonitorClient provides a means of hiding + //the underlying server class for which this class providing log monitoring services. + private final LogMonitorClient client; + + public LogMonitor(LogMonitorClient client) { + this.client = client; + } + + /** + * Reset the mark and offset values for logs back to the start of the file. + *

    + * Note: This method doesn't set the offset values to the beginning of the file per se, + * rather this method sets the list of logs and their offset values to null. When one + * of the findStringsInLogsAndTrace...(...) methods are called, it will recreate the + * list of logs and set each offset value to 0L - the start of the file. + */ + public void resetLogMarks() { + client.lmcClearLogOffsets();//logOffsets.clear(); + logMarks.clear(); + Log.info(c, "resetLogOffsets", "cleared log and mark offsets"); + } + + /** + * Set the mark offset to the end of the log file. + * + * @param log files to mark. If none are specified, the default log file is marked. + */ + public void setMarkToEndOfLog(RemoteFile... logFiles) throws Exception { + if (logFiles == null || logFiles.length == 0) + logFiles = new RemoteFile[] { client.lmcGetDefaultLogFile() }; + + for (RemoteFile logFile : logFiles) { + String path = logFile.getAbsolutePath(); + + long offset = 0; + BufferedInputStream input = new BufferedInputStream(logFile.openForReading()); + try { + int available = input.available(); + offset = input.skip(available); + while (input.read() != -1) { + offset++; + } + } finally { + input.close(); + } + + Long oldMarkOffset = logMarks.put(path, offset); + Log.info(c, "setMarkToEndOfLog", path + ", old mark offset=" + oldMarkOffset + ", new mark offset=" + offset); + } + } + + /** + * Get the mark offset for the specified log file. + */ + protected Long getMarkOffset(String logFile) { + + String method = "getMarkOffset"; + Log.finer(c, method, logFile); + + if (!logMarks.containsKey(logFile)) { + Log.finer(c, method, "file does not exist in logMarks, set initial offset"); + logMarks.put(logFile, 0L); + } + + Log.info(c, "getMarkOffset", "mark offset=" + logMarks.get(logFile)); + return logMarks.get(logFile); + } + + /** + * Wait for the specified regex in the default logs from the last mark. + *

    + * This method will time out after a sensible period of + * time has elapsed. + *

    The best practice for this method is as follows: + *

    + * // Set the mark to the current end of log
    + * server.setMarkToEndOfLog();
    + * // Do something, e.g. config change
    + * server.setServerConfigurationFile("newServer.xml");
    + * // Wait for message that was a result of the config change
    + * server.waitForStringInLogUsingMark("CWWKZ0009I");
    + *

    + * + * @param regexp a regular expression to search for + * @return the matching line in the log, or null if no matches + * appear before the timeout expires + */ + public String waitForStringInLogUsingMark(String regexp) { + return waitForStringInLogUsingMark(regexp, LOG_SEARCH_TIMEOUT); + } + + /** + * Wait for the specified regex in the default logs from the last mark. + *

    + * Unless there's a strong functional requirement that + * your string appear super-quickly, or you know your string + * might take a ridiculously long time (like five minutes), + * consider using the method which takes a default timeout, {@link } + * + * @param regexp + * @param timeout a timeout, in milliseconds + * @return + */ + public String waitForStringInLogUsingMark(String regexp, long timeout) { + try { + return waitForStringInLogUsingMark(regexp, timeout, timeout * 2, client.lmcGetDefaultLogFile()); + } catch (Exception e) { + Log.warning(c, "Could not find string in trace log file due to exception " + e); + return null; + } + } + + /** + * Wait for the specified regexp in the default logs from the last mark. + * The offset is also incremented every time this method is called. + * + * @param regexp a regular expression to search for + * @param intendedTimeout a timeout, in milliseconds, within which the wait should complete. Exceeding this is a soft fail. + * @param extendedTimeout a timeout, in milliseconds, within which the wait must complete. Exceeding this is a hard fail. + * @param outputFile file to check + * @return line that matched the regexp + */ + protected String waitForStringInLogUsingMark(String regexp, long intendedTimeout, long extendedTimeout, RemoteFile outputFile) { + final String METHOD_NAME = "waitForStringInLogUsingMark"; + long startTime = System.currentTimeMillis(); + int waited = 0; + String firstLine = null; + String lastLine = null; + boolean hitEof = false; + Long offset = getMarkOffset(outputFile.getAbsolutePath()); + + try { + LogSearchResult newOffsetAndMatches; + while (waited <= extendedTimeout) { + if (waited > intendedTimeout) { // first time only + SOEHttpPostUtil.reportSoftLogTimeoutToSOE(c.getName(), METHOD_NAME, 3977, intendedTimeout, regexp); + intendedTimeout = extendedTimeout + WAIT_INCREMENT; // don't report again + } + newOffsetAndMatches = LibertyFileManager.findStringInFile(regexp, outputFile, offset); + if (firstLine == null) + firstLine = newOffsetAndMatches.getFirstLine(); + if (newOffsetAndMatches.getLastLine() == null) + hitEof = true; + else + lastLine = newOffsetAndMatches.getLastLine(); + offset = newOffsetAndMatches.getOffset(); + List matches = newOffsetAndMatches.getMatches(); + if (matches.isEmpty()) { + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + waited += WAIT_INCREMENT; + } else { + client.lmcUpdateLogOffset(outputFile.getAbsolutePath(), offset); + return matches.get(0); + } + } + Log.warning(c, "Timed out searching for " + regexp + " in log file: " + outputFile.getAbsolutePath()); + } catch (Exception e) { + // I think we can assume if we can't read the file it doesn't contain our string + Log.warning(c, "Could not read log file: " + outputFile + " due do exception " + e.toString()); + e.printStackTrace(); + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(c, "waitForStringInLogUsingMark", + "Started waiting for message matching regexp [ " + regexp + "] at " + formatter.format(new Date(startTime)) + + " and finished at " + formatter.format(new Date(endTime))); + Log.info(c, "waitForStringInLogUsingMark", "First line searched: [ " + firstLine + " ]"); + Log.info(c, "waitForStringInLogUsingMark", "Last line searched: [ " + lastLine + " ]"); + if (hitEof) + Log.info(c, "waitForStringInLogUsingMark", "Last line searching reached end of file, preceding last line was the last line of text seen."); + } + return null; + } + + /** + * Wait for the specified regexp in the default logs from the last mark + * and verify that the regex does not show up in the logs during the + * specfied duration. + * + * @param regexp a regular expression to search for + * @param intendedTimeout a timeout, in milliseconds, within which the wait should complete. Exceeding this is a soft fail. + * @param extendedTimeout a timeout, in milliseconds, within which the wait must complete. Exceeding this is a hard fail. + * @param outputFile file to check + * @return line that matched the regexp + */ + public boolean verifyStringNotInLogUsingMark(String regexp, long timeout) { + try { + String result = waitForStringInLogUsingMarkWithException(regexp, timeout, timeout * 2, client.lmcGetDefaultLogFile()); + if (result != null) + return false; + else + return true; + } catch (Exception ex) { + if (ex instanceof NoStringFoundInLogException) { + return true; + } else { + throw new RuntimeException(ex); + } + } + } + + /** + * Wait for the specified regexp in the default logs from the last mark. + * The offset is also incremented every time this method is called. + * + * TODO: This is a temporary version of this method that will be used for negative + * checks. Remove this method and update the verifyStringNotInLogUsingMark method to use + * the waitForStringInLogUsingMark method eventually. + * + * @param regexp a regular expression to search for + * @param intendedTimeout a timeout, in milliseconds, within which the wait should complete. Exceeding this is a soft fail. + * @param extendedTimeout a timeout, in milliseconds, within which the wait must complete. Exceeding this is a hard fail. + * @param outputFile file to check + * @return line that matched the regexp + */ + protected String waitForStringInLogUsingMarkWithException(String regexp, long intendedTimeout, long extendedTimeout, RemoteFile outputFile) { + final String METHOD_NAME = "waitForStringInLogUsingMarkWithException"; + long startTime = System.currentTimeMillis(); + int waited = 0; + String firstLine = null; + String lastLine = null; + boolean hitEof = false; + Long offset = getMarkOffset(outputFile.getAbsolutePath()); + try { + LogSearchResult newOffsetAndMatches; + while (waited <= extendedTimeout) { + if (waited > intendedTimeout) { // first time only + SOEHttpPostUtil.reportSoftLogTimeoutToSOE(c.getName(), METHOD_NAME, 3977, intendedTimeout, regexp); + intendedTimeout = extendedTimeout + WAIT_INCREMENT; // don't report again + } + newOffsetAndMatches = LibertyFileManager.findStringInFile(regexp, outputFile, offset); + if (firstLine == null) + firstLine = newOffsetAndMatches.getFirstLine(); + if (newOffsetAndMatches.getLastLine() == null) + hitEof = true; + else + lastLine = newOffsetAndMatches.getLastLine(); + offset = newOffsetAndMatches.getOffset(); + List matches = newOffsetAndMatches.getMatches(); + if (matches.isEmpty()) { + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + waited += WAIT_INCREMENT; + } else { + client.lmcUpdateLogOffset(outputFile.getAbsolutePath(), offset); + return matches.get(0); + } + } + //Log.warning(c, "Timed out searching for " + regexp + " in log file: " + outputFile.getAbsolutePath()); + NoStringFoundInLogException ex = new NoStringFoundInLogException("Timed out searching for " + regexp + " in log file: " + outputFile.getAbsolutePath()); + throw ex; + } catch (Exception e) { + // I think we can assume if we can't read the file it doesn't contain our string + if (e instanceof NoStringFoundInLogException) { + throw (NoStringFoundInLogException) e; + } + Log.warning(c, "Could not read log file: " + outputFile + " due do exception " + e.toString()); + e.printStackTrace(); + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(LibertyServer.class, "waitForStringInLogUsingMark", + "Started waiting for message matching regexp [ " + regexp + "] at " + formatter.format(new Date(startTime)) + + " and finished at " + formatter.format(new Date(endTime))); + Log.info(LibertyServer.class, "waitForStringInLogUsingMark", "First line searched: [ " + firstLine + " ]"); + Log.info(LibertyServer.class, "waitForStringInLogUsingMark", "Last line searched: [ " + lastLine + " ]"); + if (hitEof) + Log.info(LibertyServer.class, "waitForStringInLogUsingMark", "Last line searching reached end of file, preceding last line was the last line of text seen."); + } + return null; + } + + /** + * Check for multiple instances of the regex in log using mark + * + * @param numberOfMatches number of matches required + * @param regexp a regular expression to search for + * @param timeout a timeout, in milliseconds + * @param outputFile file to check + * @return number of matches found + */ + public int waitForMultipleStringsInLogUsingMark(int numberOfMatches, String regexp, long timeout, RemoteFile outputFile) { + long startTime = System.currentTimeMillis(); + int waited = 0; + int count = 0; + + long extendedTimeout = 2 * timeout; + Long offset = getMarkOffset(outputFile.getAbsolutePath()); + + //Ensure we always search for at least 1 occurrence + if (numberOfMatches <= 0) { + numberOfMatches = 1; + } + + try { + LogSearchResult newOffsetAndMatches; + while (count < numberOfMatches && waited <= extendedTimeout) { + if (waited > timeout) { // first time only + SOEHttpPostUtil.reportSoftLogTimeoutToSOE(c.getName(), "waitForMultipleStringsInLogUsingMark", 4319, timeout, regexp); + timeout = extendedTimeout + WAIT_INCREMENT; // don't report again + } + newOffsetAndMatches = LibertyFileManager.findStringInFile(regexp, outputFile, offset); + offset = newOffsetAndMatches.getOffset(); + try { + Thread.sleep(WAIT_INCREMENT); + } catch (InterruptedException e) { + // Ignore and carry on + } + waited += WAIT_INCREMENT; + client.lmcUpdateLogOffset(outputFile.getAbsolutePath(), offset); + count += newOffsetAndMatches.getMatches().size(); + } + } catch (Exception e) { + // I think we can assume if we can't read the file it doesn't contain our string + Log.warning(c, "Could not read log file: " + outputFile + " due to exception " + e.toString()); + e.printStackTrace(); + return 0; + } finally { + long endTime = System.currentTimeMillis(); + DateFormat formatter = DateFormat.getTimeInstance(DateFormat.LONG); + Log.info(LibertyServer.class, "waitForMultipleStringsInLog", + "Started waiting for " + numberOfMatches + " messages matching regexp [ " + regexp + "] at " + formatter.format(new Date(startTime)) + + " and finished at " + formatter.format(new Date(endTime)) + " finding " + count + " matches."); + } + + return count; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/LogMonitorClient.java b/dev/fattest.simplicity/src/componenttest/topology/impl/LogMonitorClient.java new file mode 100755 index 000000000000..c236d62e8eeb --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/LogMonitorClient.java @@ -0,0 +1,45 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* WLP Copyright IBM Corp. 2016 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package componenttest.topology.impl; + +import com.ibm.websphere.simplicity.RemoteFile; + +/** + * This interface may be used to provides services to the LogMonitor class for the purpose of + * abstracting the server type that is using the LogMonitor services for the purpose of log wait/search. + */ +public interface LogMonitorClient { + /** + * This method returns the default log file for the server being monitored. + * Typically, in a LibertyServer instance, this would be the 'messages.log' file. + * + * @return + * @throws Exception + */ + public RemoteFile lmcGetDefaultLogFile() throws Exception; + + /** + * This method clears the log offset for the server instance. Log offset style + * tracking has been deprecated. This method has been provided to enable backward + * compatibility with logic that was moved into the LogMonitor class. For new implementations, + * this method can be a 'no op'. + */ + public void lmcClearLogOffsets(); + + /** + * This method updates the log offset for the server instance. Log offset style + * tracking has been deprecated. This method has been provided to enable backward + * compatibility with logic that was moved into the LogMonitor class. For new implementations, + * this method can be a 'no op'. + */ + public void lmcUpdateLogOffset(String logFile, Long newLogOffset); +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/NodeServer.java b/dev/fattest.simplicity/src/componenttest/topology/impl/NodeServer.java new file mode 100755 index 000000000000..4b00c3f1f013 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/NodeServer.java @@ -0,0 +1,745 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import java.io.File; +import java.net.UnknownHostException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ConnectionInfo; +import com.ibm.websphere.simplicity.LocalFile; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.exception.TopologyException; +import componenttest.topology.utils.LibertyServerUtils; + +/** + * + */ +public class NodeServer { + public static final Class c = NodeServer.class; + public static final String CLASS_NAME = c.getName(); + public static Logger LOG = Logger.getLogger(CLASS_NAME); + + protected static final String SERVER_LOG = "server.log"; + protected static final String ERROR_LOG = "error.log"; + protected static final String DEFAULT_SERVER = "defaultServer"; + protected static final String STOPPED = "is not running"; + protected static final String STARTED = "is running"; + + protected String serverName; + protected String hostName; + protected String password; + protected String user; + protected String installRoot; // The root of the install + protected String serverRoot; // The root of the node server + protected String logsRoot; // The root of the Logs Files + + protected int serverLogMark = 0; + protected int errorLogMark = 0; + + private final Machine machine; // Machine the server is on + protected String serverToUse; // the server to use + protected OperatingSystem machineOS; + + protected String pathToAutoFVTOutputServersFolder = "output/servers"; + public String pathToAutoFVTTestFiles = "lib/LibertyFATTestFiles/"; + protected String packageFilePath = null; + + // How frequently we poll the logs when waiting for something to happen + protected static final int WAIT_INCREMENT = 300; + + // Increasing this from 50 seconds to 120 seconds to account for poorly performing code; + // this timeout should only pop in the event of an unexpected failure of apps to start. + protected static final int LOG_SEARCH_TIMEOUT = 120 * 1000; + + //Used for keeping track of offset positions of log files + protected final HashMap logOffsets = new HashMap(); + + //Used for keeping track of mark positions of log files + protected final HashMap logMarks = new HashMap(); + + /** + * @return the installRoot + */ + public String getInstallRoot() { + return installRoot; + } + + /** + * @return the machine + */ + public Machine getMachine() { + return machine; + } + + /** + * @return the server name + */ + public String getServerName() { + return serverName; + } + + /** + * @return whether or not the server is started + */ + public boolean isServerStarted() { + return (getServerStatus().equals(STARTED)); + } + + /** + * @return whether or not the server is stopped + */ + public boolean isServerStopped() { + return (getServerStatus().equals(STOPPED)); + } + + public NodeServer(String name, Bootstrap b, String nodePackageFile) throws UnknownHostException, Exception { + final String method = "NodeServer constructor"; + Log.info(c, method, "Entering " + method); + + this.serverName = name; + + if (b == null) { + Log.info(c, "NodeServer()", "using default bootstrapping.properties"); + b = Bootstrap.getInstance(); + } + + hostName = b.getValue("hostName"); + + if (serverName != null) { + serverToUse = serverName; + } else { + serverToUse = b.getValue("serverName"); + if (serverToUse == null || serverToUse.trim().equals("")) { + serverToUse = DEFAULT_SERVER; + } + } + //Set install root as where we operate from; this will be where the unpacked server resides under + installRoot = "./"; + + user = b.getValue(hostName + ".user"); + password = b.getValue(hostName + ".password"); + String keystore = b.getValue("keystore"); + + Log.info(c, method, "Creating Machine"); + Log.info(c, method, "Connecting to machine " + hostName + " with User " + user + "."); + ConnectionInfo machineDetails = new ConnectionInfo(hostName, user, password); + + if ((password == null || password.length() == 0) && keystore != null && keystore.length() != 0) { + File keyfile = new File(keystore); + machineDetails = new ConnectionInfo(hostName, keyfile, user, password); + } + + machine = Machine.getMachine(machineDetails); + setup(nodePackageFile); + + Log.info(c, method, "Exiting " + method); + } + + /** + * Node server setup + * + * Unpack the given node server and set variables + */ + public void setup(String nodePackageFile) throws Exception { + final String method = "setup()"; + Log.info(c, method, "Entering " + method); + + machine.connect(); + machine.setWorkDir(installRoot); + if (this.serverToUse == null) { + this.serverToUse = DEFAULT_SERVER; + } + + machineOS = machine.getOperatingSystem(); + this.installRoot = LibertyServerUtils.makeJavaCompatible(installRoot, machine); + + /* + * The following steps assume the PATH to node has been set, a la + * "export PATH=$PATH:/home/ibmadmin/node-v4.3.1-linux-x64/bin" + */ + + //Copy over node package file + LibertyFileManager.copyFileIntoLiberty(machine, "./", pathToAutoFVTTestFiles + nodePackageFile); + /* + * Run command wlpn-server unpack server_name tgz_file_name + * The command expands the .tgz file at ${wlpn.usr.dir}/server_name, which defaults to the /home/user_name/wlpn directory. + * If the wlpn directory does not already exist, the command creates the wlpn directory. + */ + + String cmd = "wlpn-server"; + List args = new ArrayList(); + args.add("unpack"); + args.add(serverName); + args.add(nodePackageFile); + + final String[] parameters = args.toArray(new String[] {}); + + ProgramOutput po = machine.execute(cmd, parameters); + Log.info(c, method, "Output results are (stdout): " + po.getStdout()); + Log.info(c, method, "Output results are (stderr): " + po.getStderr()); + + this.serverRoot = "wlpn/" + serverName; + this.logsRoot = serverRoot + "/log"; + this.packageFilePath = "./" + nodePackageFile; + + Log.info(c, method, "Exiting " + method); + } + + /** + * Delete the package and its exploded directory + */ + public void deleteNodeServerDir() { + String dirPath = "./" + serverRoot; + try { + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, dirPath); + //Delete package file + if (packageFilePath != null) { + LibertyFileManager.deleteLibertyFile(machine, packageFilePath); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Join node server to collective. Command takes the following parameters; most controller values will + * be found in the server.xml of the collective controller: + * + * @param controllerHost: host to join the server to + * @param controllerPort: Controller port + * @param controllerUser: Controller user + * @param controllerPassword: Controller password + * @param keystorePassword: Keystore password + * @param rpcUserPassword: Password for the machine + * @throws Exception + */ + public void joinCollective(String controllerHost, int controllerPort, String controllerUser, String controllerPassword, String memberKSPassword) throws Exception { + final String method = "joinCollective()"; + Log.info(c, method, "Entering " + method); + + String cmd = "wlpn-collective"; + List args = new ArrayList(); + args.add("join"); + args.add(serverName); + args.add("--host=" + controllerHost); + args.add("--port=" + controllerPort); + args.add("--user=" + controllerUser); + args.add("--password=" + controllerPassword); + args.add("--keystorePassword=" + memberKSPassword); + args.add("--autoAcceptCertificates"); + args.add("--hostName=" + this.hostName); + + final String[] parameters = args.toArray(new String[] {}); + + ProgramOutput po = machine.execute(cmd, parameters); + Log.info(c, method, "PO stdout: " + po.getStdout()); + Log.info(c, method, "PO stderr: " + po.getStderr()); + Log.info(c, method, "Exiting " + method); + } + + /** + * Remove a node server from a collective. + * Command takes the following parameters; most controller values will + * be found in the server.xml of the collective controller: + * + * @param controllerHost: Controller host + * @param controllerPort: Controller port + * @param controllerUser: Controller user + * @param controllerPassword: Controller password + * @throws Exception + */ + public void removeFromCollective(String controllerHost, String controllerPort, String controllerUser, + String controllerPassword) throws Exception { + final String method = "removeFromCollective()"; + Log.info(c, method, "Entering " + method); + + String cmd = "wlpn-collective"; + List args = new ArrayList(); + args.add("remove"); + args.add(serverName); + args.add("--host=" + controllerHost); + args.add("--port=" + controllerPort); + args.add("--user=" + controllerUser); + args.add("--password=" + controllerPassword); + args.add("--autoAcceptCertificates"); + + final String[] parameters = args.toArray(new String[] {}); + + ProgramOutput po = machine.execute(cmd, parameters); + Log.info(c, method, "PO stdout: " + po.getStdout()); + Log.info(c, method, "PO stderr: " + po.getStderr()); + Log.info(c, method, "Exiting " + method); + } + + /** + * Update a host to a collective. + * Command takes the following parameters; most controller values will + * be found in the server.xml of the collective controller: + * + * @param controllerHost: Controller host + * @param controllerPort: Controller port + * @param controllerUser: Controller user + * @param controllerPassword: Controller password + * @param rpcUser: rpc User of the host + * @param rpcUserPassword: rpc password of the host + * @throws Exception + */ + public void updateHost(String controllerHost, int controllerPort, String controllerUser, String controllerPassword, + String rpcUser, String rpcUserPassword) throws Exception { + final String method = "updateHost()"; + Log.info(c, method, "Entering " + method); + + String cmd = "wlpn-collective"; + List args = new ArrayList(); + args.add("updateHost"); + args.add(this.hostName); + args.add("--host=" + controllerHost); + args.add("--port=" + controllerPort); + args.add("--user=" + controllerUser); + args.add("--password=" + controllerPassword); + args.add("--rpcUser=" + rpcUser); + args.add("--rpcUserPassword=" + rpcUserPassword); + args.add("--autoAcceptCertificates"); + + final String[] parameters = args.toArray(new String[] {}); + + ProgramOutput po = machine.execute(cmd, parameters); + Log.info(c, method, "PO stdout: " + po.getStdout()); + Log.info(c, method, "PO stderr: " + po.getStderr()); + Log.info(c, method, "Exiting " + method); + } + + /** + * Start server + * Command is: wlpn-server start + * + * @return Returns ProgramOutpu of the wlpn-server start command + * @throws Exception + */ + public ProgramOutput startServer() throws Exception { + final String method = "startServer()"; + Log.info(c, method, "Entering " + method); + + String cmd = "wlpn-server"; + + List args = new ArrayList(); + args.add("start"); + args.add(serverName); + final String[] parameters = args.toArray(new String[] {}); + + ProgramOutput output; + output = machine.execute(cmd, parameters); + Log.info(c, method, "Output results are (stdout): " + output.getStdout()); + Log.info(c, method, "Output results are (stderr): " + output.getStderr()); + Thread.sleep(1000); + + Log.info(c, method, "Exiting " + method); + return output; + } + + /** + * Stop server + * Command is: wlpn-server stop + * + * @return Returns ProgramOutpu of the wlpn-server stop command + * @throws Exception + */ + public ProgramOutput stopServer() throws Exception { + final String method = "stopServer()"; + Log.info(c, method, "Entering " + method); + + String cmd = "wlpn-server"; + + List args = new ArrayList(); + args.add("stop"); + args.add(serverName); + final String[] parameters = args.toArray(new String[] {}); + + ProgramOutput output; + output = machine.execute(cmd, parameters); + Log.info(c, method, "Output results are (stdout): " + output.getStdout()); + Log.info(c, method, "Output results are (stderr): " + output.getStderr()); + Thread.sleep(1000); + + Log.info(c, method, "Exiting " + method); + return null; + } + + /** + * Restart the server, using the stop and start methods + * + * @throws Exception + */ + public void restartServer() throws Exception { + final String method = "restartServer()"; + Log.info(c, method, "Entering " + method); + stopServer(); + startServer(); + + Log.info(c, method, "Exiting " + method); + } + + /** + * Query and return server status + * Command is: wlpn-server status + * + * @return String representing the server status + */ + public String getServerStatus() { + final String method = "getServerStatus()"; + Log.info(c, method, "Entering " + method); + + String cmd = "wlpn-server"; + + List args = new ArrayList(); + args.add("status"); + args.add(serverName); + final String[] parameters = args.toArray(new String[] {}); + + ProgramOutput output; + String serverState = ""; + try { + output = machine.execute(cmd, parameters); + + Log.info(c, method, output.getStdout()); + //"Server is not running." + String result = output.getStdout(); + if (result.contains(STOPPED)) { + serverState = STOPPED; + } + //"Server is running with process ID 14443" + if (result.contains(STARTED)) { + serverState = STARTED; + } + } catch (Exception e) { + //server does not exist in this case + Log.info(c, method, "Failed to get server state, error message follows"); + Log.error(c, method, e); + } + + Log.info(c, method, "Exiting " + method); + return serverState; + } + + /** + * Copy log files over after a run into a folder for the node server + * + * @throws Exception + */ + public void postStopServerArchive() throws Exception { + final String method = "postStopServerArchive()"; + Log.info(c, method, "Entering " + method); + + //zip and copy over files post run + Log.info(c, method, "Moving logs to the output folder"); + + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss"); + Date d = new Date(System.currentTimeMillis()); + + String logDirectoryName = pathToAutoFVTOutputServersFolder + "/" + serverToUse + "-" + sdf.format(d); + LocalFile logFolder = new LocalFile(logDirectoryName); + RemoteFile serverFolder = new RemoteFile(machine, logsRoot); + + // Copy the log files: try to move them instead if we can + try { + copyNodeLogs(serverFolder, logFolder, true, true); + } catch (Exception e) { + Log.info(c, method, "Failed to copy node logs, likely because directory does not exist, error message follows"); + Log.error(c, method, e); + } + + Log.info(c, method, "Exiting " + method); + } + + /** + * Copy node logs over + * + * @param remoteDirectory - Remote server log directory + * @param destination - Destination to copy files to + * @param ignoreFailures - Boolean flag to ignore failures + * @param moveFile - Boolean to move files instead of copy + * @throws Exception + */ + protected void copyNodeLogs(RemoteFile remoteDirectory, LocalFile destination, boolean ignoreFailures, boolean moveFile) throws Exception { + String method = "copyNodeLogs"; + Log.entering(c, method); + destination.mkdirs(); + + ArrayList logs = new ArrayList(); + logs = listDirectoryContents(remoteDirectory); + for (String l : logs) { + if (remoteDirectory.getName().equals("workarea")) { + if (l.equals("org.eclipse.osgi") || l.startsWith(".s")) { + // skip the osgi framework cache, and runtime artifacts: too big / too racy + Log.info(c, "recursivelyCopyDirectory", "Skipping workarea element " + l); + continue; + } + } + + RemoteFile toCopy = new RemoteFile(machine, remoteDirectory, l); + LocalFile toReceive = new LocalFile(destination, l); + Log.info(c, "recursivelyCopyDirectory", "Getting: " + toCopy.getAbsolutePath()); + + try { + if (moveFile) { + boolean copied = false; + + // If we're local, try to rename the file instead.. + if (machine.isLocal() && toCopy.rename(toReceive)) { + copied = true; // well, we moved it, but it counts. + Log.info(c, "recursivelyCopyDirectory", "MOVE: " + l + " to " + toReceive.getAbsolutePath()); + } + + if (!copied && toReceive.copyFromSource(toCopy)) { + // copy was successful, clean up the source log + toCopy.delete(); + Log.info(c, "recursivelyCopyDirectory", "MOVE: " + l + " to " + toReceive.getAbsolutePath()); + } + } else { + toReceive.copyFromSource(toCopy); + Log.info(c, "recursivelyCopyDirectory", "COPY: " + l + " to " + toReceive.getAbsolutePath()); + } + } catch (Exception e) { + Log.info(c, "recursivelyCopyDirectory", "unable to copy or move " + l + " to " + toReceive.getAbsolutePath()); + // Ignore on request and carry on copying the rest of the files + if (!ignoreFailures) { + throw e; + } + } + } + + Log.exiting(c, method); + } + + /** + * Method for returning the directory contents as a list of Strings representing first level file/dir names + * + * @return ArrayList of File/Directory names + * that exist at the first level i.e. it's not recursive. If it's a directory the String in the list is prefixed with a / + * @throws TopologyException + */ + protected ArrayList listDirectoryContents(RemoteFile serverDir) throws Exception { + return listDirectoryContents(serverDir, null); + + } + + protected ArrayList listDirectoryContents(String path, String fileName) throws Exception { + + RemoteFile serverDir = new RemoteFile(machine, path); + return listDirectoryContents(serverDir, fileName); + + } + + protected ArrayList listDirectoryContents(RemoteFile serverDir, String fileName) throws Exception { + + final String method = "serverDirectoryContents"; + Log.entering(c, method); + if (!serverDir.isDirectory() || !serverDir.exists()) + throw new TopologyException("The specified directoryPath \'" + + serverDir.getAbsolutePath() + "\' was not a directory"); + + RemoteFile[] firstLevelFiles = serverDir.list(false); + ArrayList firstLevelFileNames = new ArrayList(); + + for (RemoteFile f : firstLevelFiles) { + + if (fileName == null) { + firstLevelFileNames.add(f.getName()); + } else if (f.getName().contains(fileName)) { + firstLevelFileNames.add(f.getName()); + + } + } + + return firstLevelFileNames; + } + + /** + * Update the last log mark for a file + * + * @param logName Name of the log file + */ + protected void updateLogMark(String logName) { + final String method = "updateLogMark()"; + Log.info(c, method, "Entering " + method); + //To update #lines in a file use sed -n '$=' error.log + //This will give us the # of lines in the file + + String cmd = "sed"; + String logLocation = logsRoot + "/" + logName; + + List args = new ArrayList(); + args.add("-n"); + args.add("'$='"); + args.add(logLocation); + final String[] parameters = args.toArray(new String[] {}); + + ProgramOutput output; + try { + output = machine.execute(cmd, parameters); + Log.info(c, method, "Output is: " + output.getStdout()); + //Convert stdout to number, save as last log mark + if (logName.equals(SERVER_LOG)) { + try { + serverLogMark = Integer.parseInt(output.getStdout().trim()); + } catch (NumberFormatException e) { + //Number format error; file is empty. Do nothing, leave mark at 0 + } + } + else if (logName.equals(ERROR_LOG)) { + try { + errorLogMark = Integer.parseInt(output.getStdout().trim()); + } catch (NumberFormatException e) { + //Number format error; file is empty. Do nothing, leave mark at 0 + } + } + } catch (Exception e) { + Log.error(c, method, e); + } + Log.info(c, method, "Exiting " + method); + } + + /** + * Wait for a search string in the server log + * + * @param regexp - String to match + * @param timeout - Time to wait for a string match + * @return String log line that matched the regex + */ + public String waitForStringInServerLog(String regexp, long timeout) { + final String method = "waitForStringInLogGrep()"; + Log.info(c, method, "Entering " + method); + long initialTime = System.currentTimeMillis(); + long timeElapsed = 0; + + String result = null; + try { + while (result == null && timeElapsed < timeout) { + result = grepNodeLog(regexp, timeout, ERROR_LOG); + timeElapsed = System.currentTimeMillis() - initialTime; + Thread.sleep(1000); + } + } catch (Exception e) { + Log.warning(c, "Could not find string in default log file due to exception " + e); + } + + //Update log mark + updateLogMark(SERVER_LOG); + Log.info(c, method, "Exiting " + method); + return result; + } + + /** + * Wait for a search string in the error log + * + * @param regexp - String to match + * @param timeout - Time to wait for a string match in ms + * @return String log line that matched the regex + */ + public String waitForStringInErrorLog(String regexp, long timeout) { + final String method = "waitForStringInLogGrep()"; + Log.info(c, method, "Entering " + method); + long initialTime = System.currentTimeMillis(); + long timeElapsed = 0; + + String result = null; + try { + while (result == null && timeElapsed < timeout) { + result = grepNodeLog(regexp, timeout, ERROR_LOG); + timeElapsed = System.currentTimeMillis() - initialTime; + } + } catch (Exception e) { + Log.warning(c, "Could not find string in default log file due to exception " + e); + } + + //Update log mark + updateLogMark(ERROR_LOG); + Log.info(c, method, "Exiting " + method); + return result; + } + + /** + * Use grep to search for the regexp in the log file + * + * @param regexp - string to match + * @param timeout - time to wait for the string in the log + * @param fileName - log to be searched + * @return String matching the regexp, or null if not found + */ + protected String grepNodeLog(String regexp, long timeout, String logName) { + final String method = "grepNodeLog()"; + Log.info(c, method, "Entering " + method); + //Use grep -nr to find the search string in the file + + String cmd = "grep"; + String logLocation = logsRoot + "/" + logName; + + List args = new ArrayList(); + args.add("-nr"); + args.add("'" + regexp + "'"); + args.add(logLocation); + final String[] parameters = args.toArray(new String[] {}); + + ProgramOutput output; + try { + output = machine.execute(cmd, parameters); + //If anything was found, the return code will be 0 + if (output.getReturnCode() == 0) { + //Stdout will contain the results of grep along with line numbers + String grepResults = output.getStdout(); + + //Get last mark line + int lastMark = 0; + if (logName.equals(SERVER_LOG)) { + lastMark = serverLogMark; + } + else if (logName.equals(ERROR_LOG)) { + lastMark = errorLogMark; + } + + //Go through the grep results to see if we have a match with a line number + //greater than the last log mark for this file + String lines[] = grepResults.split("\\r?\\n"); + for (String line : lines) { + //Delimit on the first space and turn that token into a number + String tokens[] = line.split(":"); + int number = Integer.parseInt(tokens[0]); + + if (number > lastMark) { + Log.info(c, method, "Matched search string " + regexp + " with line " + line); + Log.info(c, method, "Exiting " + method); + return line; + } + } + + } else { + Log.info(c, method, "Search string " + regexp + " not found in log file " + logName); + } + } catch (Exception e) { + //Ignore; we didn't find the string + } + Log.info(c, method, "Exiting " + method); + return null; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/PortDetectionUtil.java b/dev/fattest.simplicity/src/componenttest/topology/impl/PortDetectionUtil.java new file mode 100755 index 000000000000..24abb388e217 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/PortDetectionUtil.java @@ -0,0 +1,320 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import java.io.IOException; +import java.util.Arrays; +import java.util.StringTokenizer; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; + +/** + * + */ +public abstract class PortDetectionUtil { + private final static Class c = PortDetectionUtil.class; + private final static String LS = System.getProperty("line.separator"); + + private static class NoopDetector extends PortDetectionUtil { + + /* + * (non-Javadoc) + * + * @see componenttest.topology.impl.PortDetectionUtil#determineOwnerOfPort(int) + */ + @Override + public String determineOwnerOfPort(int port) throws UnsupportedOperationException { + return ""; + } + } + + private static class LinuxDetector extends PortDetectionUtil { + private final static Class c = LinuxDetector.class; + private final Machine machine; + private final String NETSTAT_CMD = "netstat"; + private final String[] NETSTAT_PARMS = new String[] { "-tulpn" }; + private final String PS_CMD = "ps"; + private final String[] PS_PARMS = new String[] { "-fp" }; + + private LinuxDetector(Machine machine) { + this.machine = machine; + } + + /* + * (non-Javadoc) + * + * @see componenttest.topology.impl.PortDetectionUtil#determineOwnerOfPort(int) + */ + @Override + public String determineOwnerOfPort(final int port) throws IOException { + final String m = "determineOwnerOfPort"; + String pidInfo = ""; + try { + ProgramOutput po = machine.execute(NETSTAT_CMD, NETSTAT_PARMS); + String cmdOutput = po.getStdout(); + //Output should resemble: +// Active Internet connections (only servers) +// Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name +// tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN - +// tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN - +// tcp 0 0 127.0.0.1:8979 0.0.0.0:* LISTEN - +// tcp 0 0 0.0.0.0:48500 0.0.0.0:* LISTEN - +// tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN - +// tcp 0 0 ::ffff:127.0.0.1:65341 :::* LISTEN 5124/sametime +// tcp 0 0 :::445 :::* LISTEN - +// tcp 0 0 ::ffff:127.0.0.1:38848 :::* LISTEN 4823/java +// tcp 0 0 ::ffff:127.0.0.1:57248 :::* LISTEN 3944/symphony + StringTokenizer st = new StringTokenizer(cmdOutput, "/-" + LS); + int pid = -1; + while (st.hasMoreTokens()) { + String s = st.nextToken().trim(); + if (s.startsWith("tcp") && s.contains(":" + port + " ") && s.contains("LISTEN")) { + String pidString = s.substring(s.lastIndexOf(' ')).trim(); + pid = Integer.parseInt(pidString); + break; + } + } + + if (pid < 0) { + // we did not find the port in the netstat cmd output + String msg = "Could not find port (" + port + ") listed in netstat output"; + Log.info(c, m, msg + ":" + LS + cmdOutput); + throw new Exception(msg); + } + + String[] parms = Arrays.copyOf(PS_PARMS, PS_PARMS.length + 1); + parms[PS_PARMS.length] = "" + pid; + po = machine.execute(PS_CMD, parms); + pidInfo = po.getStdout(); + + if ("".equals(pidInfo)) { + // we didn't find the pid in the list of processes... + // possibly whatever process was listening on that port has exited... + String msg = "Could not find PID, " + pid + " in PID list - possibly that process already exited"; + Log.info(c, m, msg + ":" + cmdOutput); + throw new Exception(msg); + } + } catch (Exception ex) { + throw new IOException("Failed to determine owner of port " + port, ex); + } + return pidInfo; + } + } + + private static class MacDetector extends PortDetectionUtil { + private final static Class c = MacDetector.class; + private final Machine machine; + private final String LSOF_CMD = "lsof"; + private final String[] LSOF_PARMS = new String[] { "-F", "p", "-i" }; + private final String PS_CMD = "ps"; + private final String[] PS_PARMS = new String[] { "-fp" }; + + private MacDetector(Machine machine) { + this.machine = machine; + } + + /* + * (non-Javadoc) + * + * @see componenttest.topology.impl.PortDetectionUtil#determineOwnerOfPort(int) + */ + @Override + public String determineOwnerOfPort(final int port) throws IOException { + final String m = "determineOwnerOfPort"; + String pidInfo = ""; + try { + String[] parms = Arrays.copyOf(LSOF_PARMS, LSOF_PARMS.length + 1); + parms[LSOF_PARMS.length] = "tcp:" + port; + ProgramOutput po = machine.execute(LSOF_CMD, parms); + String cmdOutput = po.getStdout(); + if (cmdOutput == null) { + cmdOutput = "-1"; + } else { + // on Mac, the lsof command with the -F parm will generate output like this: + // lsof -F p -i tcp:49961 + // p3069 + // Note the "p" in front of the PID number, the code below handles that + cmdOutput = cmdOutput.trim(); + if (cmdOutput.startsWith("p")) { + cmdOutput = cmdOutput.substring(1); + } + } + // Output should contain only the PID + int pid = Integer.parseInt(cmdOutput); + + if (pid < 0) { + // we did not find the port in the lsof cmd output + String msg = "lsof did not show any processes bound to tcp port: " + port; + Log.info(c, m, msg + ":" + LS + cmdOutput); + throw new Exception(msg); + } + + parms = Arrays.copyOf(PS_PARMS, PS_PARMS.length + 1); + parms[PS_PARMS.length] = "" + pid; + po = machine.execute(PS_CMD, parms); + pidInfo = po.getStdout(); + + if ("".equals(pidInfo)) { + // we didn't find the pid in the list of processes... + // possibly whatever process was listening on that port has exited... + String msg = "Could not find PID, " + pid + " in PID list - possibly that process already exited"; + Log.info(c, m, msg + ":" + cmdOutput); + throw new Exception(msg); + } + } catch (Exception ex) { + throw new IOException("Failed to determine owner of port " + port, ex); + } + return pidInfo; + } + } + + //TODO: once we have more data on the output of these commands on AIX, Solaris, etc. + // we will need to create new detectors for each one (or re-use existing) so + // that we can better tailor the output. + private static class GenericNixDetector extends PortDetectionUtil { + private final Machine machine; + private final String NETSTAT_CMD = "netstat"; + private final String[] NETSTAT_PARMS = new String[] { "-tulpn" }; + private final String PS_CMD = "ps"; + private final String[] PS_PARMS = new String[] { "-ef" }; + + private GenericNixDetector(Machine machine) { + this.machine = machine; + } + + /* + * (non-Javadoc) + * + * @see componenttest.topology.impl.PortDetectionUtil#determineOwnerOfPort(int) + */ + @Override + public String determineOwnerOfPort(int port) throws UnsupportedOperationException, IOException { + String pidInfo = LS; + try { + ProgramOutput po = machine.execute(NETSTAT_CMD, NETSTAT_PARMS); + String cmdOutput = po.getStdout(); + //Output type may depend on OS - so just print it all for now + pidInfo += cmdOutput; + + // Next get a list of all running processes on the box + po = machine.execute(PS_CMD, PS_PARMS); + cmdOutput = po.getStdout(); + pidInfo += LS + LS + LS + cmdOutput; + + } catch (Exception ex) { + throw new IOException("Failed to determine owner of port " + port, ex); + } + return pidInfo; + } + } + + private static class ZOSDetector extends PortDetectionUtil { + private final static Class c = ZOSDetector.class; + private final Machine machine; + private final String NETSTAT_CMD = "netstat"; + private final String[] NETSTAT_PARMS = new String[] { "-P" }; + private final String PS_CMD = "ps"; + private final String[] PS_PARMS = new String[] { "-ef -o jobname,pid,xasid" }; + + private ZOSDetector(Machine machine) { + this.machine = machine; + } + + /* + * (non-Javadoc) + * + * @see componenttest.topology.impl.PortDetectionUtil#determineOwnerOfPort(int) + */ + @Override + public String determineOwnerOfPort(final int port) throws IOException { + final String m = "determineOwnerOfPort"; + String pidInfo = ""; + String[] parms = Arrays.copyOf(NETSTAT_PARMS, NETSTAT_PARMS.length + 1); + parms[NETSTAT_PARMS.length] = Integer.toString(port); + try { + ProgramOutput po = machine.execute(NETSTAT_CMD, parms); + String cmdOutput = po.getStdout(); + //Output should resemble: +// Active Internet connections (only servers) +// MVS TCP/IP NETSTAT CS V1R10 TCPIP Name: TCPIP 13:47:39 +// User Id Conn State +// ------- ---- ----- +// BBON001 000014F6 Establsh +// Local Socket: ::ffff:9.57.165.181..9355 +// Foreign Socket: ::ffff:9.57.165.181..4681 +// BBON001 000012D9 Listen +// Local Socket: ::..9355 +// Foreign Socket: ::..0 +// BBOS001 000014F5 Establsh +// Local Socket: ::ffff:9.57.165.181..4681 +// Foreign Socket: ::ffff:9.57.165.181..9355 + if (!!!cmdOutput.contains("Listen")) { + // we did not find the port in the netstat cmd output + String msg = "Could not find port (" + port + ") listed in netstat output"; + Log.info(c, m, msg + ":" + LS + cmdOutput); + throw new Exception(msg); + } + + // Just print it all for now + pidInfo += cmdOutput; + + // Next get a list of all running processes on the box +// BBON001 16842943 +// BBON001 50397376 +// BBOS001 50397397 +// BBOS001 16842966 + po = machine.execute(PS_CMD, PS_PARMS); + cmdOutput = po.getStdout(); + pidInfo += LS + LS + LS + cmdOutput; + } catch (Exception ex) { + throw new IOException("Failed to determine owner of port " + port, ex); + } + return pidInfo; + } + } + + public static PortDetectionUtil getPortDetector(Machine machine) { + try { + switch (machine.getOperatingSystem()) { + case LINUX: + return new LinuxDetector(machine); + case MAC: + return new MacDetector(machine); + case AIX: + case HP: + case SOLARIS: + return new GenericNixDetector(machine); + case ZOS: + return new ZOSDetector(machine); + default: // Windows and ISeries + return new NoopDetector(); + } + } catch (Exception e) { + // caught exception in getOperatingSystem().... just ignore and return the NoopDetector + Log.info(c, "getPortDetector", "Caught exception while trying to determing host operating system: " + machine); + return new NoopDetector(); + } + } + + /** + * Determine the process who is listening on the specified port. + * + * @param port - the port to check - valid entries are 1-64535 + * @return a string that should include OS-specific info about the process + * that is listening on the specified port - or an empty string if + * no data could be collected. + * @throws IOException - if a failure occurs while trying to detect the process + */ + public abstract String determineOwnerOfPort(int port) throws IOException; +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/UnbufferedInputStreamReader.java b/dev/fattest.simplicity/src/componenttest/topology/impl/UnbufferedInputStreamReader.java new file mode 100755 index 000000000000..b06624e53968 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/UnbufferedInputStreamReader.java @@ -0,0 +1,117 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CoderResult; + +/** + * A reader similar to InputStreamReader but that does not buffer (only consumes + * bytes from the underlying input stream as needed). + */ +class UnbufferedInputStreamReader extends Reader { + /** + * The input stream to read. + */ + private final InputStream in; + + /** + * The decoder used to transform bytes to chars. + */ + private final CharsetDecoder decoder; + + /** + * The input buffer to pass to the decoder. Because we only read one byte + * at a time, this only needs to be one byte. + */ + private final ByteBuffer inb = ByteBuffer.allocate(1); + + /** + * The output buffer to pass to the decoder. The {@link #read(char[], int, int)} implementation + * currently depends on this being of size 1, though in theory it could be + * larger, which might improve performance for encodings that translate a + * single input byte into multiple output chars (should be rare anyway). + */ + private final CharBuffer outb = CharBuffer.allocate(1); + + /** + * True if end the end of the input stream has been reached. + */ + private boolean eof; + + UnbufferedInputStreamReader(InputStream in, Charset charset) { + this.in = in; + this.decoder = charset.newDecoder(); + inb.position(inb.limit()); + } + + @Override + public int read(char[] cbuf, int off, int len) throws IOException { + if (len == 0) { + return 0; + } + + for (;;) { + CoderResult result = eof ? decoder.flush(outb) : decoder.decode(inb, outb, false); + + if (outb.position() == outb.limit()) { + outb.position(0); + cbuf[off] = outb.get(); + outb.position(0); + return 1; + } + + if (eof && result == CoderResult.UNDERFLOW) { + return -1; + } + + int b = in.read(); + if (b == -1) { + decoder.decode(inb, outb, true); + eof = true; + } else { + inb.position(0); + inb.put((byte) b); + inb.position(0); + } + } + } + + @Override + public void close() throws IOException { + in.close(); + } + + // Unit test. + public static void main(String[] args) throws Exception { + Reader r = new UnbufferedInputStreamReader(new ByteArrayInputStream("abcd".getBytes()), Charset.forName("UTF-8")); + assertEquals((int) 'a', r.read()); + assertEquals((int) 'b', r.read()); + assertEquals((int) 'c', r.read()); + assertEquals((int) 'd', r.read()); + assertEquals(-1, r.read()); + System.out.println("PASS"); + } + + private static void assertEquals(Object expected, Object actual) { + if (!(expected == null ? actual == null : expected.equals(actual))) { + throw new AssertionError("expected=" + expected + ", actual=" + actual); + } + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/WebServer.java b/dev/fattest.simplicity/src/componenttest/topology/impl/WebServer.java new file mode 100755 index 000000000000..eddb018d3739 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/WebServer.java @@ -0,0 +1,424 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.impl; + +import com.ibm.websphere.simplicity.Cell; +import com.ibm.websphere.simplicity.ConnectorType; +import com.ibm.websphere.simplicity.Dmgr; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.PortType; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.Server; +import com.ibm.websphere.simplicity.ServerType; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.websphere.simplicity.runtime.ProcessStatus; +import com.ibm.websphere.simplicity.server.WebServerCreationOptions; + +/** + * This class represents Server of type WebServer in liberty + */ +public class WebServer extends Server implements LogMonitorClient { + + private static final Class c = WebServer.class; + private String pluginInstallRoot; + private String installRoot; + private int portNumber; + private String userName; + private String password; + private String hostName; + private String tempDir; + private WebServerCreationOptions webServerProperties; + private ProcessStatus serverStatus = ProcessStatus.STOPPED; + private boolean pluginSetUpSuccessfull; + private Machine machine; + private String pathSeparator = "/"; // This value is reset once the machine is specified - it is set according to the host type. + private final LogMonitor logMonitor; + private final String LOG_FILE = "http_plugin.log"; + private RemoteFile pluginLogFile = null; + + /** + * @param options + * @throws Exception + */ + public WebServer(String name, WebServerCreationOptions webServerProperties) throws Exception { + super(null, null, null, ServerType.WEB_SERVER); + this.logMonitor = new LogMonitor(this); + this.webServerProperties = webServerProperties; + setName(name); + // TODO Auto-generated constructor stub + } + + /** + * @return the tempDir + */ + public String getTempDir() { + return tempDir; + } + + /** + * @param tempDir the tempDir to set + */ + public void setTempDir(String tempDir) { + this.tempDir = tempDir; + } + + /** + * @return the portNumber + */ + public int getPortNumber() { + return this.portNumber; + } + + /** + * @param portNumber the portNumber to set + */ + public void setPortNumber(int portNumber) { + this.portNumber = portNumber; + this.webServerProperties.getServerConfig().setWebPort(portNumber); + } + + /** + * @return the userName + */ + public String getUserName() { + return this.userName; + } + + /** + * @param userName the userName to set + */ + public void setUserName(String userName) { + this.userName = userName; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the hostName + */ + public String getHostName() { + return hostName; + } + + /** + * @param hostName the hostName to set + */ + public void setHostName(String hostName) { + this.hostName = hostName; + } + + /** + * @param serverStatus the serverStatus to set + */ + public void setWebServerStatus(ProcessStatus serverStatus) { + this.serverStatus = serverStatus; + } + + /** + * @param serverStatus the serverStatus to set + */ + + public ProcessStatus getWebServerStatus() { + return this.serverStatus; + } + + /** + * @return the webServerProperties + */ + public WebServerCreationOptions getWebServerProperties() { + return webServerProperties; + } + + /** + * @param webServerProperties the webServerProperties to set + */ + public void setWebServerProperties(WebServerCreationOptions webServerProperties) { + this.webServerProperties = webServerProperties; + } + + /** + * @return the installRoot + */ + public String getInstallRoot() { + return installRoot; + } + + /** + * @param installRoot the installRoot to set + */ + public void setInstallRoot(String installRoot) { + this.installRoot = installRoot; + this.webServerProperties.getServerConfig().setWebInstallRoot(installRoot); + } + + /** + * Returns the {@link Machine} that this server is installed on. + * + * @return the machine + */ + public Machine getMachine() { + return machine; + + } + + /** + * Sets the {@link Machine} that this server is installed on. + * + * @param machine the machine to set + */ + public void setMachine(Machine machine) { + this.machine = machine; + + try { + if (machine != null && OperatingSystem.WINDOWS.equals(machine.getOperatingSystem())) { + pathSeparator = "\\"; + } + } catch (Exception e) { + Log.error(c, "setMachine", e); + } + + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.Server#start() + */ + @Override + public void start() throws Exception { +// this.instance.startServer(); wont work in web server + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.Server#start(int) + */ + @Override + public void start(int mbeanWaitDuration) throws Exception { +// this.instance.startServer(); will not work in web server + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.Server#stop() + */ + @Override + public void stop() throws Exception { +// this.instance.stopServer(); + + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.Server#stop(long) + */ + @Override + public void stop(long timeout) throws Exception { +// this.instance.stopServer(); + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.Server#getServerStatus() + */ + @Override + public ProcessStatus getServerStatus() throws Exception { + return this.serverStatus; + } + + /** + * Get the {@link ServerType} of this Server. The server type determines the capibilities of the + * Server. For example, a {@link Dmgr} server manages the nodes within a {@link Cell}. + * + * @return The type of this Server + */ + @Override + public ServerType getServerType() { + return ServerType.WEB_SERVER; + } + + /** + * Get the port number value for a {@link ConnectorType} for this Server + * + * @param connectorType The {@link ConnectorType} port value to get + * @return An Integer representation of the port value + * @throws Exception + */ + @Override + public Integer getPortNumber(ConnectorType connectorType) throws Exception { + final String method = "getPortNumber"; + Log.entering(c, method, connectorType); + Log.finer(c, method, "server is " + this.getNodeName() + ", " + this.getName()); + //PortType port = PortType.valueOf(connectorType.getEndpointName()); + Integer portNumber = getPortNumber(PortType.OSGi); // there is no RMI, SOAP, IPC, etc port in alpine (yet?), so assume OSGi + Log.exiting(c, method, portNumber); + return portNumber; + } + + /** + * Get a port value for a port for this Server + * + * @param port The port to get + * @return An Integer representation of the port value + * @throws Exception + */ + @Override + public Integer getPortNumber(PortType port) throws Exception { + return this.portNumber; + } + + /** + * @return + */ + public String getPluginInstallRoot() { + return this.pluginInstallRoot; + } + + public void setPluginInstallRoot(String pluginInstallRoot) { + this.pluginInstallRoot = pluginInstallRoot;; + this.webServerProperties.getServerConfig().setPluginInstallRoot(pluginInstallRoot); + } + + /** + * @param setUpSuccessfull + */ + public void setPluginSetupSuccessfull(boolean pluginSetUpSuccessfull) { + this.pluginSetUpSuccessfull = pluginSetUpSuccessfull; + + } + + /** + * @param setUpSuccessfull + */ + public boolean getPluginSetupSuccessfull() { + return this.pluginSetUpSuccessfull; + + } + + /** Returns the dummy node name for this webserver, as Liberty has no concept of nodes. */ + @Override + public String getNodeName() { + return this.getName() + "Node"; + } + + public String getPathSeparator() { + return pathSeparator; + } + + public boolean isStarted() { + return (ProcessStatus.RUNNING.equals(getWebServerStatus())); + } + + //******************************************************************************************************* + //*** Start of log monitoring methods + //******************************************************************************************************* + + /** + * Reset the mark and offset values for logs back to the start of the file. + *

    + * Note: This method doesn't set the offset values to the beginning of the file per se, + * rather this method sets the list of logs and their offset values to null. When one + * of the findStringsInLogsAndTrace...(...) methods are called, it will recreate the + * list of logs and set each offset value to 0L - the start of the file. + */ + public void resetLogMarks() { + logMonitor.resetLogMarks(); + } + + /** + * Set the mark offset to the end of the log file. + * + * @param log files to mark. If none are specified, the default log file is marked. + */ + public void setMarkToEndOfLog(RemoteFile... logFiles) throws Exception { + logMonitor.setMarkToEndOfLog(logFiles); + } + + /** + * Wait for the specified regex in the default logs from the last mark. + *

    + * This method will time out after a sensible period of + * time has elapsed. + *

    The best practice for this method is as follows: + *

    + * // Set the mark to the current end of log
    + * server.setMarkToEndOfLog();
    + * // Do something, e.g. config change
    + * server.setServerConfigurationFile("newServer.xml");
    + * // Wait for message that was a result of the config change
    + * server.waitForStringInLogUsingMark("CWWKZ0009I");
    + *

    + * + * @param regexp a regular expression to search for + * @return the matching line in the log, or null if no matches + * appear before the timeout expires + */ + public String waitForStringInLogUsingMark(String regexp) { + return logMonitor.waitForStringInLogUsingMark(regexp); + } + + /* + * (non-Javadoc) + * + * @see componenttest.topology.impl.LogMonitorClient#lmcGetDefaultLogFile() + */ + @Override + public RemoteFile lmcGetDefaultLogFile() throws Exception { + if (pluginLogFile == null) { + String filePath = pluginInstallRoot + pathSeparator + "logs" + pathSeparator + getName() + pathSeparator + LOG_FILE; + pluginLogFile = new RemoteFile(getMachine(), filePath); + } + return pluginLogFile; + } + + /* + * (non-Javadoc) + * + * @see componenttest.topology.impl.LogMonitorClient#lmcClearLogOffsets() + */ + @Override + public void lmcClearLogOffsets() { + // Do nothing, the use of offsets is not supported in this server type + } + + /* + * (non-Javadoc) + * + * @see componenttest.topology.impl.LogMonitorClient#lmcUpdateLogOffset(java.lang.String, java.lang.Long) + */ + @Override + public void lmcUpdateLogOffset(String logFile, Long newLogOffset) { + // Do nothing, the use of offsets is not supported in this server type + } + + //******************************************************************************************************* + //*** End of log monitoring methods + //******************************************************************************************************* + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/ldap/LocalLDAPServerSuite.java b/dev/fattest.simplicity/src/componenttest/topology/ldap/LocalLDAPServerSuite.java new file mode 100755 index 000000000000..c2f02695b322 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/ldap/LocalLDAPServerSuite.java @@ -0,0 +1,327 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.ldap; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Set; + +import org.junit.AfterClass; +import org.junit.BeforeClass; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.utils.LDAPUtils; + +public class LocalLDAPServerSuite { + + private static final Class c = LocalLDAPServerSuite.class; + static LocalLdapServer tdsInstance = new LocalLdapServer("TDS"); + static LocalLdapServer adInstance = new LocalLdapServer("AD"); + static LocalLdapServer sunoneInstance = new LocalLdapServer("SunOne"); + + private static final String KEY_DELIMITER = ":"; + private static final int KEY_SEGMENT_HOSTNAME = 0; + private static final int KEY_SEGMENT_PORT = 1; + private static final int KEY_SEGMENT_BIND_DN = 2; + private static final int KEY_SEGMENT_BIND_PWD = 3; + private static boolean isInMemoryAllowed = true; + private static boolean throwNoPhysicalLDAPServerException = false; + + static HashMap> testServers = new HashMap>(); + static ArrayList sslServers = new ArrayList(); + + @BeforeClass + public static void setUp() throws Exception { + String method = "setUp"; + Log.entering(c, method); + + // Check if physical LDAP servers are up, if not then use in-memory LDAP + if (!LDAPUtils.USE_LOCAL_LDAP_SERVER || !isInMemoryAllowed) { + boolean isLdapServersAvailable = false; + if (testServers != null) { + Set primaryServers = testServers.keySet(); + if (!primaryServers.isEmpty()) { + isLdapServersAvailable = true; + for (String primaryServer : primaryServers) { + + // Every primary server must be up, or at least one failover must be available for every primary server that is unavailable + String primaryHost = getHostname(primaryServer); + String primaryPort = getPort(primaryServer); + String primaryBindDn = getBindDn(primaryServer); + String primaryBindPwd = getBindPwd(primaryServer); + boolean checkFailover = false; + boolean useSsl = sslServers.contains(primaryServer); + try { + if (!LDAPUtils.isLdapServerAvailable(primaryHost, primaryPort, useSsl, primaryBindDn, primaryBindPwd)) { + checkFailover = true; + } + } catch (Exception e) { + Log.info(c, method, "Exception while checking availability of server " + primaryServer + ": " + e); + checkFailover = true; + } + if (checkFailover) { + // Primary LDAP server is unavailable; check if failover server is available instead + Log.info(c, method, "Server " + primaryServer + " was unavailable. Checking for available failovers."); + if (!isFailoverServerAvailable(primaryHost, primaryPort, primaryBindDn, primaryBindPwd)) { + isLdapServersAvailable = false; + break; + } + } + } + } + } + + Log.info(c, "", "isLdapServersAvailable : " + isLdapServersAvailable); + if (!isLdapServersAvailable && !("z/os".equalsIgnoreCase(System.getProperty("os.name")))) { + if (!isInMemoryAllowed && throwNoPhysicalLDAPServerException) { + throw new Exception("No physical LDAP servers are available"); + } + LDAPUtils.USE_LOCAL_LDAP_SERVER = true; + Log.info(c, "", "USE_LOCAL_LDAP_SERVER set to true as physical LDAP server(s) are not available"); + } else { + Log.info(c, "", "Using physical LDAP server"); + } + } + + if (LDAPUtils.USE_LOCAL_LDAP_SERVER && isInMemoryAllowed) { + Log.info(c, method, "Using in-memory LDAP"); + + // Start all 3 instances of apache DS + tdsInstance.start(); + adInstance.start(); + sunoneInstance.start(); + + } else { + Log.info(c, method, "Setup result: Either physical LDAP servers will be used or in-memory LDAP was requested but is not allowed"); + } + + Log.exiting(c, method); + } + + @AfterClass + public static void tearDown() throws InterruptedException { + String method = "tearDown"; + Log.entering(c, method); + // Stop the 3 ApacheDS instances started above + if (LDAPUtils.USE_LOCAL_LDAP_SERVER && isInMemoryAllowed) { + Log.info(c, method, "Stopping in-memory LDAP instances"); + tdsInstance.stop(); + adInstance.stop(); + sunoneInstance.stop(); + } + Log.exiting(c, method); + } + + /** + * Performs the usual setup, but only check the availability of the specified servers and failovers as needed. + * + * @param servers + * @throws Exception + */ + public static void setUpUsingServers(HashMap> servers) throws Exception { + setUpUsingServers(servers, true); + } + + /** + * Performs the usual setup, but only check the availability of the specified servers and failovers as needed. + * If {@code isInMemoryLdapAllowed} is false, no in-memory LDAP server instances will be started. + * + * @param servers + * @param isInMemoryLdapAllowed + * @throws Exception + */ + public static void setUpUsingServers(HashMap> servers, boolean isInMemoryLdapAllowed) throws Exception { + setUpUsingServers(servers, true, false); + } + + /** + * Performs the usual setup, but only check the availability of the specified servers and failovers as needed. + * If {@code isInMemoryLdapAllowed} is false, no in-memory LDAP server instances will be started. + * + * @param servers + * @param isInMemoryLdapAllowed + * @throws Exception + */ + public static void setUpUsingServers(HashMap> servers, boolean isInMemoryLdapAllowed, boolean noPhysicalLDAPServerExceptionAllowed) throws Exception { + + String method = "setUpUsingServers"; + Log.entering(c, method); + testServers = servers; + isInMemoryAllowed = isInMemoryLdapAllowed; + throwNoPhysicalLDAPServerException = noPhysicalLDAPServerExceptionAllowed; + setUp(); + Log.exiting(c, method); + } + + /** + * Adds a primary test server and failover to the list of LDAP servers to be used during testing. If the primary server specified + * is already included in {@code existingServerMap}, the failover server specified will be added to the list of failovers for that + * primary server. This method assumes that neither the primary nor the failover server requires SSL. + * + * @param primaryHost + * @param primaryPort + * @param failoverHost + * @param failoverPort + * @param existingServerMap If {@code null}, a new server map will be created and returned by this method + * @return + */ + public static HashMap> addTestServer(String primaryHost, String primaryPort, String failoverHost, String failoverPort, + HashMap> existingServerMap) { + return addTestServer(primaryHost, primaryPort, false, null, null, failoverHost, failoverPort, false, null, null, existingServerMap); + } + + /** + * Adds a primary test server and failover to the list of LDAP servers to be used during testing. If the primary server specified + * is already included in {@code existingServerMap}, the failover server specified will be added to the list of failovers for that + * primary server. + * + * @param primaryHost + * @param primaryPort + * @param primaryUseSsl + * @param failoverHost + * @param failoverPort + * @param failoverUseSsl + * @param existingServerMap If {@code null}, a new server map will be created and returned by this method + * @return + */ + public static HashMap> addTestServer(String primaryHost, String primaryPort, boolean primaryUseSsl, String primaryBindDn, + String primaryBindPwd, + String failoverHost, String failoverPort, boolean failoverUseSsl, String failoverBindDn, + String failoverBindPwd, + HashMap> existingServerMap) { + String method = "addFailoverServer"; + Log.entering(c, method); + String primary = createKey(primaryHost, primaryPort, primaryBindDn, primaryBindPwd); + if (primary == null) { + Log.info(c, method, "Null/empty primary host or port specified, so no new primary or failover test server entry was created."); + return existingServerMap; + } + String failover = createKey(failoverHost, failoverPort, failoverBindDn, failoverBindPwd); + if (failover == null) { + Log.info(c, method, "Null/empty failover host or port specified, so no failover server entry will be created for primary test server " + primary); + } + + if (primaryUseSsl && !sslServers.contains(primary)) { + Log.info(c, method, "Tracking new primary LDAP server that requires SSL: " + primary); + sslServers.add(primary); + } + if (failoverUseSsl && !sslServers.contains(failover)) { + Log.info(c, method, "Tracking new failover LDAP server that requires SSL: " + failover); + sslServers.add(failover); + } + + if (existingServerMap == null) { + existingServerMap = new HashMap>(); + } + + ArrayList failoverList = null; + if (existingServerMap.containsKey(primary)) { + failoverList = existingServerMap.get(primary); + if (failover != null && !failoverList.contains(failover)) { + Log.info(c, method, "Adding failover server " + failover + " for primary server " + primary); + failoverList.add(failover); + } else { + Log.info(c, method, "Specified failover server " + failover + " was null or was already specified as a failover for primary server " + primary); + } + } else { + Log.info(c, method, "Adding primary server " + primary + ((failover == null) ? "" : " and failover server " + failover)); + failoverList = new ArrayList(); + if (failover != null) { + failoverList.add(failover); + } + existingServerMap.put(primary, failoverList); + } + + Log.exiting(c, method); + return existingServerMap; + } + + /** + * Check each of the failover servers specified for the given host and port and return true if there is an available + * failover server. + * + * @param host + * @param port + * @return + * @throws Exception + */ + private static boolean isFailoverServerAvailable(String host, String port, String bindDn, String bindPwd) { + String method = "isFailoverServerAvailable"; + Log.entering(c, method); + + String primary = createKey(host, port, bindDn, bindPwd); + if (testServers != null && primary != null) { + ArrayList failovers = testServers.get(primary); + if (failovers != null) { + for (String failover : failovers) { + + String serverHost = getHostname(failover); + String serverPort = getPort(failover); + String serverBindDn = getBindDn(failover); + String serverBindPwd = getBindPwd(failover); + try { + Log.info(c, method, "Checking availability of failover server " + failover); + boolean useSsl = sslServers.contains(failover); + if (LDAPUtils.isLdapServerAvailable(serverHost, serverPort, useSsl, serverBindDn, serverBindPwd)) { + Log.info(c, method, "Available failover server " + failover + " found for primary server " + primary); + Log.exiting(c, method); + return true; + } + } catch (Exception e) { + Log.info(c, method, "Error while checking availability of failover server " + failover + ": " + e); + } + } + } + } + Log.info(c, method, "No available failover server found for primary server " + primary); + Log.exiting(c, method); + return false; + } + + private static String createKey(String host, String port, String bindDn, String bindPwd) { + if (host == null || port == null || host.isEmpty() || port.isEmpty()) { + return null; + } + if (bindDn == null) { + bindDn = "null"; + } + if (bindPwd == null) { + bindPwd = "null"; + } + return host + KEY_DELIMITER + port + KEY_DELIMITER + bindDn + KEY_DELIMITER + bindPwd; + } + + private static String getHostname(String server) { + return getKeyComponent(KEY_SEGMENT_HOSTNAME, server); + } + + private static String getPort(String server) { + return getKeyComponent(KEY_SEGMENT_PORT, server); + } + + private static String getBindDn(String server) { + return getKeyComponent(KEY_SEGMENT_BIND_DN, server); + } + + private static String getBindPwd(String server) { + return getKeyComponent(KEY_SEGMENT_BIND_PWD, server); + } + + private static String getKeyComponent(int keySegment, String key) { + String[] tokens = key.split(KEY_DELIMITER); + if (tokens.length == 0 || keySegment >= tokens.length) { + return key; + } else { + return tokens[keySegment]; + } + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/ldap/LocalLdapServer.java b/dev/fattest.simplicity/src/componenttest/topology/ldap/LocalLdapServer.java new file mode 100755 index 000000000000..7719f227f5da --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/ldap/LocalLdapServer.java @@ -0,0 +1,167 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.ldap; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.List; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; + +/** + * + */ +public class LocalLdapServer { + + private final String instanceName; + private Process localLdapInstance; + private BufferedReader in; + + private static final Class c = LocalLdapServer.class; + private static final String APACHE_DS_HOME = + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("apache.ds.home"); + } + }); + + private static final String OS_NAME = + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty("os.name"); + } + }); + + /** + * Sets the name of the instance + */ + public LocalLdapServer(String instanceName) { + this.instanceName = instanceName; + } + + /** + * Starts the local Ldap instance + */ + public void start() { + String method = "start"; + Log.entering(c, method); + Log.info(c, method, "Using in-Memory LDAP"); + Log.info(c, method, "Starting the " + instanceName + " instance of Apache DS"); + + // Get machine java.home using bootstrap + Bootstrap b = null; + try { + b = Bootstrap.getInstance(); + } catch (Exception e1) { + Log.error(c, method, e1, "Error while Getting the ootstrap instance"); + } + String hostName = b.getValue("hostName"); + String machineJavaHome = b.getValue(hostName + ".JavaHome"); + Log.info(c, method, "machineJavaHome from Bootstrap : " + machineJavaHome); + + String JAVA_COMMAND = machineJavaHome + "/bin/java"; + + String ADS_CONTROLS = "-Dapacheds.controls=org.apache.directory.api.ldap.codec.controls.cascade.CascadeFactory,org.apache.directory.api.ldap.codec.controls.manageDsaIT.ManageDsaITFactory,org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeFactory,org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsFactory,org.apache.directory.api.ldap.codec.controls.search.persistentSearch.PersistentSearchFactory,org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesFactory,org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyFactory,org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncDoneValueFactory,org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncInfoValueFactory,org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueFactory,org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncStateValueFactory"; + String ADS_EXTENDED_OPERATIONS = "-Dapacheds.extendedOperations=org.apache.directory.api.ldap.extras.extended.ads_impl.cancel.CancelFactory,org.apache.directory.api.ldap.extras.extended.ads_impl.certGeneration.CertGenerationFactory,org.apache.directory.api.ldap.extras.extended.ads_impl.gracefulShutdown.GracefulShutdownFactory,org.apache.directory.api.ldap.extras.extended.ads_impl.storedProcedure.StoredProcedureFactory,org.apache.directory.api.ldap.extras.extended.ads_impl.gracefulDisconnect.GracefulDisconnectFactory"; + String ADS_CLASSPATH = APACHE_DS_HOME + "/lib/apacheds-service-2.0.0-M15.jar"; + + String ADS_TDS_LOG4J_CONFIG = "-Dlog4j.configuration=file:" + APACHE_DS_HOME + "/instances/" + instanceName + "/conf/log4j.properties"; + String ADS_TDS_LOG_DIR = "-Dapacheds.log.dir=" + APACHE_DS_HOME + "/instances/" + instanceName + "/log"; + String ADS_TDS_INSTANCE_HOME = APACHE_DS_HOME + "/instances/" + instanceName; + + // Add "" to directory inputs if OS is windows + if (OS_NAME.toLowerCase().startsWith("win")) { + ADS_CLASSPATH = "\"" + APACHE_DS_HOME + "/lib/apacheds-service-2.0.0-M15.jar\""; + ADS_TDS_LOG4J_CONFIG = "-Dlog4j.configuration=file:\"" + APACHE_DS_HOME + "/instances/" + instanceName + "/conf/log4j.properties\""; + ADS_TDS_LOG_DIR = "-Dapacheds.log.dir=\"" + APACHE_DS_HOME + "/instances/" + instanceName + "/log\""; + ADS_TDS_INSTANCE_HOME = "\"" + APACHE_DS_HOME + "/instances/" + instanceName + "\""; + } + List params = java.util.Arrays.asList(JAVA_COMMAND, ADS_CONTROLS, ADS_EXTENDED_OPERATIONS, ADS_TDS_LOG4J_CONFIG, ADS_TDS_LOG_DIR, "-cp", ADS_CLASSPATH, + "org.apache.directory.server.UberjarMain", ADS_TDS_INSTANCE_HOME); + Log.info(c, method, instanceName + " params : " + params.toString()); + + // Start the Apache DS instance + try { + ProcessBuilder pb = new ProcessBuilder(params); + pb.redirectErrorStream(true); + localLdapInstance = pb.start(); + } catch (IOException e3) { + Log.error(c, method, e3, "Error while starting the " + instanceName + " instance of apache DS"); + try { + throw new Exception("Error while starting the " + instanceName + " instance of apache DS"); + } catch (Exception e) { + Log.error(c, method, e3, "Error while throwing new exception"); + } + } + + in = new BufferedReader( + new InputStreamReader(localLdapInstance.getInputStream())); + + try { + String line = null; + long time = System.currentTimeMillis(); + long timeout = time + 120000; //wait max two minutes for Apache DS to start + while (System.currentTimeMillis() <= timeout) { + line = in.readLine(); + if (line != null) { + Log.info(c, method, line); + //check if we had the last line of Apache DS output + if (line.trim().equals("|_|")) { + //started, break the loop + break; + } + else { + //wasn't the output we expected, but wasn't end of stream + //so just continue + continue; + } + } + else { + //reached the end of the stream, wait 1 second before trying again + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + Log.error(c, "start", e, "Error occored while Thread.sleep()"); + } + } + } + } catch (IOException e2) { + Log.error(c, "start", e2, "Error occored while reading the buffered reader"); + } finally { + try { + in.close(); + } catch (IOException e) { + Log.error(c, "start", e, "Error occored while closing the buffered reader"); + } + } + + Log.exiting(c, method); + } + + /** + * Stops the local Ldap instance + */ + public void stop() { + String method = "stop"; + Log.entering(c, method); + // Stop the ldap instance started. + Log.info(c, method, "Stopping the " + instanceName + " instance of Apache DS"); + localLdapInstance.destroy(); + Log.exiting(c, method); + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/CollectiveUtilities.java b/dev/fattest.simplicity/src/componenttest/topology/utils/CollectiveUtilities.java new file mode 100755 index 000000000000..d8878caecbde --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/CollectiveUtilities.java @@ -0,0 +1,1368 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.utils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.regex.Pattern; + +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; + +/** + * + */ +public class CollectiveUtilities { + private static final Class c = CollectiveUtilities.class; + + private static boolean findMatchingLine(String output, String regex) { + Pattern pattern = Pattern.compile(regex); + for (String line : output.split("\\n")) { + // Need to trim the output because pattern matcher does weird things with newlines + if (pattern.matcher(line.trim()).matches()) { + Log.info(c, "findMatchingLine", "Found line matching regex " + regex + ": " + line); + return true; + } + } + + Log.info(c, "findMatchingLine", "Did not find line matching " + regex); + return false; + } + + /** + * Creates the initial collective controller configuration. + * + * @param machine + * @param server + * @param keystorePassword + * @throws Exception + */ + public static void create(Machine machine, LibertyServer server, String keystorePassword) throws Exception { + create(machine, server, keystorePassword, (String[]) null); + } + + /** + * Creates the initial collective controller configuration + * + * @param machine + * @param server + * @param keystorePassword + * @param optArgs optional arguments that can be passed + * @throws Exception + */ + public static void create(Machine machine, LibertyServer server, String keystorePassword, String... optArgs) throws Exception { + String serverName = server.getServerName(); + String installRoot = server.getInstallRoot(); + + boolean hasConfigArg = hasCreateConfigArg(optArgs); + cleanupStaleFiles(machine, server); + + Log.info(c, "createCollectiveController", "Running collective create " + serverName); + Properties env = new Properties(); + String hostname = machine.getHostname(); + + String[] args = buildCreateArgs(serverName, keystorePassword, hostname, optArgs); + + env.put("JAVA_HOME", server.getMachineJavaJDK()); + ProgramOutput po = machine.execute(installRoot + "/bin/collective", + args, + installRoot, + env); + checkForSuccess(po, hasConfigArg); + + } + + private static void checkForSuccess(ProgramOutput output, boolean hasConfigArg) { + String stdout = output.getStdout(); + int rc = output.getReturnCode(); + String stderr = output.getStderr(); + + Log.info(c, "createCollectiveController", "Command Result (getCommand):" + output.getCommand()); + Log.info(c, "createCollectiveController", "Command Result (getReturnCode):" + rc); + Log.info(c, "createCollectiveController", "Command Result (stdout):\n" + stdout); + Log.info(c, "createCollectiveController", "Command Result (stderr):\n" + stderr); + + if (hasConfigArg) { + assertEquals("Error creating the collective configuration. A return code of '0' was expected but return code" + rc + " was received instead\n" + + "STOP. CHECK THE LOGS FOR MORE DETAILS. THIS IS A TOP-LEVEL FAILURE AND DOES NOT ACCURATELY REFLECT WHY SOMETHING FAILED.\n" + + "Here is some hopefully useful information from the script. But this is a best effort and investigating the server logs and result.txt may be required\n" + + "stdout:\n" + stdout + "\n" + + "stderr:\n" + stderr, 0, rc); + assertTrue("Error creating the collective configuration. Expected to find the string 'Successfully set up collective controller configuration' \n" + + "STOP. CHECK THE LOGS FOR MORE DETAILS. THIS IS A TOP-LEVEL FAILURE AND DOES NOT ACCURATELY REFLECT WHY SOMETHING FAILED.\n" + + "Here is some hopefully useful information from the script. But this is a best effort and investigating the server logs and result.txt may be required\n" + + "stdout:\n" + stdout + "\n" + + "stderr:\n" + stderr, stdout.contains("Successfully set up collective controller configuration")); + } else { + assertTrue("Error creating the collective configuration. create should report server.xml config but none was found.\n" + + "STOP. CHECK THE LOGS FOR MORE DETAILS. THIS IS A TOP-LEVEL FAILURE AND DOES NOT ACCURATELY REFLECT WHY SOMETHING FAILED.\n" + + "Here is some hopefully useful information from the script. But this is a best effort and investigating the server logs and result.txt may be required\n" + + "stdout:\n" + stdout + "\n" + + "stderr:\n" + stderr, + findMatchingLine(stdout, ".*id=\"serverIdentity\".*")); + + assertTrue("Error creating the collective configuration. create should produce sample but none was found.\n" + + "STOP. CHECK THE LOGS FOR MORE DETAILS. THIS IS A TOP-LEVEL FAILURE AND DOES NOT ACCURATELY REFLECT WHY SOMETHING FAILED.\n" + + "Here is some hopefully useful information from the script. But this is a best effort and investigating the server logs and result.txt may be required\n" + + "stdout:\n" + stdout + "\n" + + "stderr:\n" + stderr, + findMatchingLine(stdout, ".* args = new ArrayList(); + args.add("join"); + args.add(serverName); + args.add("--host=" + controllerHost); + args.add("--port=" + controllerPort); + args.add("--user=" + controllerUser); + args.add("--password=" + controllerPassword); + args.add("--keystorePassword=" + keystorePassword); + args.add("--hostName=" + server.getHostname()); + if (genDeployVars) { + args.add("--genDeployVariables"); + } + + String arglist = ""; + for (String arg : args) { + arglist += arg + " "; + } + String command = installRoot + "/bin/collective "; + Log.info(c, "join", "The command line used is approximately: " + command + " " + arglist); + + int rc = -1; + ProgramOutput po = machine.execute(installRoot + "/bin/collective", + args.toArray(new String[] {}), + installRoot, + env); + + String stdout = po.getStdout(); + rc = po.getReturnCode(); + Log.info(c, "join", "Command Result (getCommand):" + po.getCommand()); // too bad it doesn't have the arguments. + Log.info(c, "join", "Command Result (getReturnCode):" + rc); + Log.info(c, "join", "Command Result (stdout):\n" + stdout); + Log.info(c, "join", "Command Result (stderr):\n" + po.getStderr()); + + if (stdout.contains("IOException while invoking the MBean: java.net.SocketTimeoutException: Read timed out")) { + int retryCount = 5; + boolean commandSuccess = false; + for (int i = 0; i < retryCount; i++) { + if (commandSuccess) + break; + // re do it again for 5 times if keep failing then something really bad going on with the machine/network + Log.info(c, "join", "Sleeping for half minute after getting SocketTimeoutException"); + Thread.sleep(10000); + Log.info(c, "join", "Retry number " + i + " for join as it was failing with SocketTimeoutException"); + po = machine.execute(installRoot + "/bin/collective", + args.toArray(new String[] {}), + installRoot, + env); + + stdout = po.getStdout(); + Log.info(c, "join", "Command Result (getCommand):" + po.getCommand()); // too bad it doesn't have the arguments. + Log.info(c, "join", "Command Result (getReturnCode):" + po.getReturnCode()); + Log.info(c, "join", "Command Result (stdout):\n" + stdout); + Log.info(c, "join", "Command Result (stderr):\n" + po.getStderr()); + + if (!stdout.contains("IOException while invoking the MBean: java.net.SocketTimeoutException: Read timed out")) { + commandSuccess = true; + } + } + + // if already retry and not getting SocketTimeoutException but getting already member, that means join is successful + if (stdout.contains("The specified server .* already appears to be a member.")) { + rc = 0; + //If the server is already a member, we're not going to get the stdout that's checked for below, so + //return the result + return rc; + } + } + + if (shouldSucceed) { + assertTrue("Error joining the collective. join should report server.xml config but none was found.\n" + + "STOP. CHECK THE LOGS FOR MORE DETAILS. THIS IS A TOP-LEVEL FAILURE AND DOES NOT ACCURATELY REFLECT WHY SOMETHING FAILED.\n" + + "Here is some hopefully useful information from the script. But this is a best effort and investigating the server logs and result.txt may be required\n" + + "stdout:\n" + stdout + "\n" + + "stderr:\n" + po.getStderr(), + findMatchingLine(stdout, ".*id=\"serverIdentity\".*")); + + assertTrue("Error joining the collective. join should produce sample but none was found.\n" + + "STOP. CHECK THE LOGS FOR MORE DETAILS. THIS IS A TOP-LEVEL FAILURE AND DOES NOT ACCURATELY REFLECT WHY SOMETHING FAILED.\n" + + "Here is some hopefully useful information from the script. But this is a best effort and investigating the server logs and result.txt may be required\n" + + "stdout:\n" + stdout + "\n" + + "stderr:\n" + po.getStderr(), + findMatchingLine(stdout, ".* sample but none was found.\n" + + "STOP. CHECK THE LOGS FOR MORE DETAILS. THIS IS A TOP-LEVEL FAILURE AND DOES NOT ACCURATELY REFLECT WHY SOMETHING FAILED.\n" + + "Here is some hopefully useful information from the script. But this is a best effort and investigating the server logs and result.txt may be required\n" + + "stdout:\n" + stdout + "\n" + + "stderr:\n" + po.getStderr(), + findMatchingLine(stdout, ".* hostWritePaths, List hostReadPaths, + String javaHome) throws Exception { + return hostCommand("updateHost", machine, server, hostName, controllerHost, controllerPort, controllerUser, controllerPassword, null, null, sshPrivateKey, hostWritePaths, + hostReadPaths, javaHome); + + } + + public static int updateHostRPC(Machine machine, LibertyServer server, String hostName, String controllerHost, int controllerPort, String controllerUser, + String controllerPassword, String remoteUser, String remotePassword, List hostWritePaths, List hostReadPaths, + String javaHome) throws Exception { + return hostCommand("updateHost", machine, server, hostName, controllerHost, controllerPort, controllerUser, controllerPassword, remoteUser, remotePassword, null, + hostWritePaths, hostReadPaths, javaHome); + + } + + /** + * Registers host level host (without servers) via MBean invocation + * + * @param connection MBean server connection to the collective controller. + * @param hostAuthMap The host authorization map with credentials. + * @return Object The return Object of MBean operation "registerHost". + * @throws Exception + */ + public static Object registerHost(MBeanServerConnection connection, String controllerHostName, Map hostAuthMap) throws Exception { + + //Call registerHost MBean to register our host + ObjectName registrationName = new ObjectName("WebSphere:feature=collectiveController,type=CollectiveRegistration,name=CollectiveRegistration"); + return connection.invoke(registrationName, "registerHost", + new Object[] { controllerHostName, hostAuthMap }, + new String[] { "java.lang.String", "java.util.Map" }); + + } + + /** + * Register a remote host. Assumes the SSL certificates can be accepted. + * + * @param command The host related command to run. Currently, registerHost, unregisterHost and updateHost are supported. + * @param machine The Machine to run the command on + * @param server The LibertyServer to run the command from + * @param hostName The host name to register + * @param controllerHost The hostname where the controller is running + * @param controllerPort The port the controller is listening on + * @param controllerUser The User ID that performs Admin operations on the controller + * @param controllerPassword The password of the User ID that performs Admin operations on the controller + * @param remoteUser The remote User who will be used when performing remote commands to the host being registered + * @param remotePassword The password of the remote User who will be used when performing remote commands to the host being registered + * @param sshPrivateKey The path of the controller's private key file. + * @return Returns the return code of specified command. Please refer to the command's return code for details + * @throws Exception If the command being executed throws an Exception + */ + protected static int hostCommand(String command, Machine machine, LibertyServer server, String hostName, String controllerHost, int controllerPort, String controllerUser, + String controllerPassword, String remoteUser, String remotePassword, String sshPrivateKey) throws Exception { + return hostCommand(command, machine, server, hostName, controllerHost, controllerPort, controllerUser, controllerPassword, remoteUser, remotePassword, sshPrivateKey, null, + null, null); + } + + /** + * Register a remote host. Assumes the SSL certificates can be accepted. + * + * @param command The host related command to run. Currently, registerHost, unregisterHost and updateHost are supported. + * @param machine The Machine to run the command on + * @param server The LibertyServer to run the command from + * @param hostName The host name to register + * @param controllerHost The hostname where the controller is running + * @param controllerPort The port the controller is listening on + * @param controllerUser The User ID that performs Admin operations on the controller + * @param controllerPassword The password of the User ID that performs Admin operations on the controller + * @param remoteUser The remote User who will be used when performing remote commands to the host being registered + * @param remotePassword The password of the remote User who will be used when performing remote commands to the host being registered + * @param sshPrivateKey The path of the controller's private key file. + * @param hostWritePath The list of hostWritePaths to set for the host (empty lists or list entries will be ignored) + * @param hostReadPath The list of hostReadPaths to set for the host (empty lists or list entries will be ignored) + * @param javaHome The value of the system property java.home + * @return Returns the return code of specified command. Please refer to the command's return code for details + * @throws Exception If the command being executed throws an Exception + */ + protected static int hostCommand(String command, Machine machine, LibertyServer server, String hostName, String controllerHost, int controllerPort, String controllerUser, + String controllerPassword, String remoteUser, String remotePassword, String sshPrivateKey, List hostWritePaths, + List hostReadPaths, String javaHome) throws Exception { + String installRoot = server.getInstallRoot(); + Properties env = new Properties(); + + List alCmdArgs = new ArrayList(); + alCmdArgs.add(command); + alCmdArgs.add(hostName); + alCmdArgs.add("--host=" + controllerHost); + alCmdArgs.add("--port=" + controllerPort); + alCmdArgs.add("--user=" + controllerUser); + alCmdArgs.add("--password=" + controllerPassword); + if (command.equals("unregisterHost") == false) { + if (sshPrivateKey != null) + alCmdArgs.add("--sshPrivateKey=" + sshPrivateKey); + else { + alCmdArgs.add("--rpcUser=" + remoteUser); + alCmdArgs.add("--rpcUserPassword=" + remotePassword); + } + } + if (hostWritePaths != null && !hostWritePaths.isEmpty()) { + for (String hostWritePath : hostWritePaths) { + if (!hostWritePath.isEmpty()) { + alCmdArgs.add("--hostWritePath=" + hostWritePath); + } + } + } + if (hostReadPaths != null && !hostReadPaths.isEmpty()) { + for (String hostReadPath : hostReadPaths) { + if (!hostReadPath.isEmpty()) { + alCmdArgs.add("--hostReadPath=" + hostReadPath); + } + } + } + if (javaHome != null) { + alCmdArgs.add("--hostJavaHome=" + javaHome); + } + + String[] cmdArgs = new String[alCmdArgs.size()]; + alCmdArgs.toArray(cmdArgs); + Log.info(c, "hostCommand", "Command: " + cmdArgs); + + env.put("JVM_ARGS", "-Dcom.ibm.websphere.collective.utility.autoAcceptCertificates=true"); + // env.put("JAVA_HOME", server.getMachineJavaJDK()); + + ProgramOutput po = machine.execute(installRoot + "/bin/collective", + cmdArgs, + installRoot, + env); + + String stdout = po.getStdout(); + Log.info(c, command, "Command Result (getCommand):" + po.getCommand()); + Log.info(c, command, "Command Result (getReturnCode):" + po.getReturnCode()); + Log.info(c, command, "Command Result (stdout):\n" + stdout); + Log.info(c, command, "Command Result (stderr):\n" + po.getStderr()); + return po.getReturnCode(); + } + + /** + * Joins the server to the collective as a member. + * + * @param machine + * @param server The Liberty server from which to get the install. Is not a target of the command execution. + * @param controllerHost + * @param controllerPort + * @param controllerUser + * @param controllerPassword + * @param keystorePassword + * @return Returns the return code of remove command. Please refer to remove command for return codes. + * @throws Exception If the command being executed throws an Exception + */ + public static int genKey(Machine machine, LibertyServer server, + String controllerHost, int controllerPort, + String controllerUser, String controllerPassword, + String keystorePassword, String keystoreFile) throws Exception { + String installRoot = server.getInstallRoot(); + + Log.info(c, "genKey", "Running genKey with target file " + keystoreFile); + Properties env = new Properties(); + env.put("JVM_ARGS", "-Dcom.ibm.websphere.collective.utility.autoAcceptCertificates=true"); + env.put("JAVA_HOME", server.getMachineJavaJDK()); + ProgramOutput po = machine.execute(installRoot + "/bin/collective", + new String[] { "genKey", + "--host=" + controllerHost, + "--port=" + controllerPort, + "--user=" + controllerUser, + "--password=" + controllerPassword, + "--keystorePassword=" + keystorePassword, + "--keystoreFile=" + keystoreFile }, + installRoot, + env); + + String stdout = po.getStdout(); + Log.info(c, "genKey", "Command Result (getCommand):" + po.getCommand()); + Log.info(c, "genKey", "Command Result (getReturnCode):" + po.getReturnCode()); + Log.info(c, "genKey", "Command Result (stdout):\n" + stdout); + Log.info(c, "genKey", "Command Result (stderr):\n" + po.getStderr()); + + return po.getReturnCode(); + } + + /** + * Sets a host and its servers or a single server into maintenance mode. + * + * @param machine The Machine to run the command on + * @param server The LibertyServer to run the command from + * @param targetHost The target host name + * @param targetUserDir The target WLP user directory + * @param targetServer The target server name + * @param breakAffinity Break session affinity + * @param force Set maintenance mode even if it causes autoScaling policy to be violated + * @param controllerHost The hostname where the controller is located + * @param controllerPort The port that the controller is listening on + * @param controllerUser The User ID required to perform admin commands on the controller + * @param controllerPassword The password of the User ID required to perform admin commands on the controller + * @param expectedResults A map of host/server names to expected results. + * @throws Exception + */ + public static void enterMaintenanceMode(Machine machine, LibertyServer server, + String targetHost, String targetUserDir, String targetServer, + boolean breakAffinity, boolean force, + String controllerHost, int controllerPort, + String controllerUser, String controllerPassword, + Map expectedResults) throws Exception { + String controllerName = server.getServerName(); + String installRoot = server.getInstallRoot(); + + Log.info(c, "enterMaintenanceMode", "Running collective enterMaintenanceMode command on controller " + controllerName); + Properties env = new Properties(); + env.put("JVM_ARGS", "-Dcom.ibm.websphere.collective.utility.autoAcceptCertificates=true"); + env.put("JAVA_HOME", server.getMachineJavaJDK()); + + List cmdArgs = new ArrayList(); + cmdArgs.add("enterMaintenanceMode"); + cmdArgs.add("--hostName=" + targetHost); + if (targetUserDir != null) + cmdArgs.add("--usrDir=" + targetUserDir); + if (targetServer != null) + cmdArgs.add("--server=" + targetServer); + if (breakAffinity) + cmdArgs.add("--break"); + if (force) + cmdArgs.add("--force"); + cmdArgs.add("--host=" + controllerHost); + cmdArgs.add("--port=" + controllerPort); + cmdArgs.add("--user=" + controllerUser); + cmdArgs.add("--password=" + controllerPassword); + + Log.info(c, "enterMaintenanceMode", "Command: " + cmdArgs); + + ProgramOutput po = machine.execute(installRoot + "/bin/collective", + cmdArgs.toArray(new String[0]), + installRoot, + env); + + String stdout = po.getStdout(); + String stderr = po.getStderr(); + Log.info(c, "enterMaintenanceMode", "Command Result (getCommand):" + po.getCommand()); + Log.info(c, "enterMaintenanceMode", "Command Result (getReturnCode):" + po.getReturnCode()); + Log.info(c, "enterMaintenanceMode", "Command Result (stdout):\n" + stdout); + Log.info(c, "enterMaintenanceMode", "Command Result (stderr):\n" + stderr); + + for (Map.Entry entry : expectedResults.entrySet()) { + String name = entry.getKey(); + MaintenanceModeExpectedResult expectedResult = entry.getValue(); + switch (expectedResult) { + case STATUS_IN_MAINTENANCE_MODE: + assertTrue("enterMaintenanceMode was not successful", + findMatchingLine(stdout, ".*Successfully set maintenance mode for " + name + ".*")); + break; + case STATUS_NOT_IN_MAINTENANCE_MODE: + fail("Test case is checking for a result that is not applicable to this operation."); + break; + case STATUS_ALTERNATE_SERVER_IS_STARTING: + assertTrue("enterMaintenanceMode did not start an alternate server for " + name, + findMatchingLine(stdout, ".*An alternate server must be started. Maintenance mode will be set for " + + name + " when the alternate server is started.*")); + break; + case STATUS_ALTERNATE_SERVER_IS_NOT_AVAILABLE: + boolean foundInStdErr = false, + foundInStdOut = false; + foundInStdErr = findMatchingLine(stderr, ".*Could not set maintenance mode for " + name + " because an alternate server is not available.*"); + if (!foundInStdErr) + // Look in stdOut in case of redirected output + foundInStdOut = findMatchingLine(stdout, ".*Could not set maintenance mode for " + name + " because an alternate server is not available.*"); + assertTrue("enterMaintenanceMode expected result STATUS_ALTERNATE_SERVER_IS_NOT_AVAILABLE did not occur for " + name, + foundInStdErr || foundInStdOut); + } + } + } + + /** + * Resets a host and its servers or a single server from maintenance mode. + * + * @param machine The Machine to run the command on + * @param server The LibertyServer to run the command from + * @param targetHost The target host name + * @param targetUserDir The target WLP user directory + * @param targetServer The target server name + * @param controllerHost The hostname where the controller is located + * @param controllerPort The port that the controller is listening on + * @param controllerUser The User ID required to perform admin commands on the controller + * @param controllerPassword The password of the User ID required to perform admin commands on the controller + * @param expectedResults A map of host/server names to expected status results. + * @throws Exception + */ + public static void exitMaintenanceMode(Machine machine, LibertyServer server, + String targetHost, String targetUserDir, String targetServer, + String controllerHost, int controllerPort, + String controllerUser, String controllerPassword, + Map expectedResults) throws Exception { + String controllerName = server.getServerName(); + String installRoot = server.getInstallRoot(); + + Log.info(c, "exitMaintenanceMode", "Running collective exitMaintenanceMode command on controller " + controllerName); + Properties env = new Properties(); + env.put("JVM_ARGS", "-Dcom.ibm.websphere.collective.utility.autoAcceptCertificates=true"); + env.put("JAVA_HOME", server.getMachineJavaJDK()); + + List cmdArgs = new ArrayList(); + cmdArgs.add("exitMaintenanceMode"); + cmdArgs.add("--hostName=" + targetHost); + if (targetUserDir != null) + cmdArgs.add("--usrDir=" + targetUserDir); + if (targetServer != null) + cmdArgs.add("--server=" + targetServer); + cmdArgs.add("--host=" + controllerHost); + cmdArgs.add("--port=" + controllerPort); + cmdArgs.add("--user=" + controllerUser); + cmdArgs.add("--password=" + controllerPassword); + + Log.info(c, "exitMaintenanceMode", "Command: " + cmdArgs); + + ProgramOutput po = machine.execute(installRoot + "/bin/collective", + cmdArgs.toArray(new String[0]), + installRoot, + env); + + String stdout = po.getStdout(); + String stderr = po.getStderr(); + Log.info(c, "exitMaintenanceMode", "Command Result (getCommand):" + po.getCommand()); + Log.info(c, "exitMaintenanceMode", "Command Result (getReturnCode):" + po.getReturnCode()); + Log.info(c, "exitMaintenanceMode", "Command Result (stdout):\n" + stdout); + Log.info(c, "exitMaintenanceMode", "Command Result (stderr):\n" + stderr); + + for (Map.Entry entry : expectedResults.entrySet()) { + String name = entry.getKey(); + MaintenanceModeExpectedResult expectedResult = entry.getValue(); + switch (expectedResult) { + case STATUS_NOT_IN_MAINTENANCE_MODE: + assertTrue("exitMaintenanceMode was not successful", + findMatchingLine(stdout, ".*Successfully unset maintenance mode for " + name + ".*")); + break; + default: + fail("Test case is checking for a result that is not applicable to this operation."); + break; + } + } + } + + /** + * Gets the maintenance mode status of a host and its servers or a single server. + * + * @param machine The Machine to run the command on + * @param server The LibertyServer to run the command from + * @param targetHost The target host name + * @param targetUserDir The target WLP user directory + * @param targetServer The target server name + * @param controllerHost The hostname where the controller is located + * @param controllerPort The port that the controller is listening on + * @param controllerUser The User ID required to perform admin commands on the controller + * @param controllerPassword The password of the User ID required to perform admin commands on the controller + * @param expectedResults A map of host/server names to expected results. + * @throws Exception + */ + public static void getMaintenanceMode(Machine machine, LibertyServer server, + String targetHost, String targetUserDir, String targetServer, + String controllerHost, int controllerPort, + String controllerUser, String controllerPassword, + Map expectedResults) throws Exception { + String controllerName = server.getServerName(); + String installRoot = server.getInstallRoot(); + + Log.info(c, "getMaintenanceMode", "Running collective getMaintenanceMode command on controller " + controllerName); + Properties env = new Properties(); + env.put("JVM_ARGS", "-Dcom.ibm.websphere.collective.utility.autoAcceptCertificates=true"); + env.put("JAVA_HOME", server.getMachineJavaJDK()); + + List cmdArgs = new ArrayList(); + cmdArgs.add("getMaintenanceMode"); + cmdArgs.add("--hostName=" + targetHost); + if (targetUserDir != null) + cmdArgs.add("--usrDir=" + targetUserDir); + if (targetServer != null) + cmdArgs.add("--server=" + targetServer); + cmdArgs.add("--host=" + controllerHost); + cmdArgs.add("--port=" + controllerPort); + cmdArgs.add("--user=" + controllerUser); + cmdArgs.add("--password=" + controllerPassword); + + Log.info(c, "getMaintenanceMode", "Command: " + cmdArgs); + + ProgramOutput po = machine.execute(installRoot + "/bin/collective", + cmdArgs.toArray(new String[0]), + installRoot, + env); + + String stdout = po.getStdout(); + String stderr = po.getStderr(); + Log.info(c, "getMaintenanceMode", "Command Result (getCommand):" + po.getCommand()); + Log.info(c, "getMaintenanceMode", "Command Result (getReturnCode):" + po.getReturnCode()); + Log.info(c, "getMaintenanceMode", "Command Result (stdout):\n" + stdout); + Log.info(c, "getMaintenanceMode", "Command Result (stderr):\n" + stderr); + + for (Map.Entry entry : expectedResults.entrySet()) { + String name = entry.getKey(); + MaintenanceModeExpectedResult expectedResult = entry.getValue(); + switch (expectedResult) { + case STATUS_IN_MAINTENANCE_MODE: + assertTrue("Server is not in maintenance mode as expected", + findMatchingLine(stdout, name + " is in maintenance mode.*")); + break; + case STATUS_NOT_IN_MAINTENANCE_MODE: + assertTrue("Server is in maintenance mode which is not expected", + findMatchingLine(stdout, name + " is not in maintenance mode.*")); + break; + default: + // Alternate server starting is a timing window and hard to test. + fail("Test case is checking for a result that is not handled."); + break; + } + } + } + + public enum MaintenanceModeExpectedResult { + STATUS_IN_MAINTENANCE_MODE, + STATUS_NOT_IN_MAINTENANCE_MODE, + STATUS_ALTERNATE_SERVER_IS_STARTING, + STATUS_ALTERNATE_SERVER_IS_NOT_AVAILABLE + } + + /** + * Sets maintenance mode using the MBean rather than the command line interface. + * The MBean supports multiple targets unlike the command line interface. + * + * @param connection MBeanServerConnection + * @param targets List of targets + * @param breakAffinity Break session affinity + * @param force Set maintenance mode even if it causes autoScaling policy to be violated + * @param expectedResultsList Expected results + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static void enterMaintenanceModeUsingMBean(MBeanServerConnection connection, + List targets, + MaintenanceModeTargetType targetType, + boolean breakAffinity, boolean force, + List> expectedResultsList) throws Exception { + + Log.info(c, "enterMaintenanceModeUsingMBean", targets.toString()); + + String operationName = null; + switch (targetType) { + case SERVER: + operationName = "enterServerMaintenanceMode"; + break; + case HOST: + operationName = "enterHostMaintenanceMode"; + } + + ObjectName on = new ObjectName("WebSphere:feature=collectiveController,type=MaintenanceMode,name=MaintenanceMode"); + List> resultsList = (List>) connection.invoke(on, operationName, + new Object[] { targets, !breakAffinity, force }, + new String[] { "java.util.List", "boolean", "boolean" }); + + for (int targetNumber = 0; targetNumber < targets.size(); targetNumber++) { + Map results = resultsList.get(targetNumber); + Map expectedResults = expectedResultsList.get(targetNumber); + for (Map.Entry entry : expectedResults.entrySet()) { + String name = entry.getKey(); + String expectedResult = entry.getValue(); + String actualResult = results.get(name); + assertEquals("Unexpected result for " + name, + expectedResult, + actualResult); + } + } + } + + /** + * Resets maintenance mode using the MBean rather than the command line interface. + * The MBean supports multiple targets unlike the command line interface. + * + * @param connection MBeanServerConnection + * @param targets List of targets + * @param expectedResultsList Expected results + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static void exitMaintenanceModeUsingMBean(MBeanServerConnection connection, + List targets, + MaintenanceModeTargetType targetType, + List> expectedResultsList) throws Exception { + + Log.info(c, "exitMaintenanceModeUsingMBean", targets.toString()); + + String operationName = null; + switch (targetType) { + case SERVER: + operationName = "exitServerMaintenanceMode"; + break; + case HOST: + operationName = "exitHostMaintenanceMode"; + } + + ObjectName on = new ObjectName("WebSphere:feature=collectiveController,type=MaintenanceMode,name=MaintenanceMode"); + List> resultsList = (List>) connection.invoke(on, operationName, + new Object[] { targets }, + new String[] { "java.util.List" }); + + for (int targetNumber = 0; targetNumber < targets.size(); targetNumber++) { + Map results = resultsList.get(targetNumber); + Map expectedResults = expectedResultsList.get(targetNumber); + for (Map.Entry entry : expectedResults.entrySet()) { + String name = entry.getKey(); + String expectedResult = entry.getValue(); + String actualResult = results.get(name); + assertEquals("Unexpected result for " + name, + expectedResult, + actualResult); + } + } + } + + /** + * Gets maintenance mode using the MBean rather than the command line interface. + * The MBean supports multiple targets unlike the command line interface. + * + * @param connection MBeanServerConnection + * @param targets List of targets + * @param expectedResultsList Expected results + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static void getMaintenanceModeUsingMBean(MBeanServerConnection connection, + List targets, + MaintenanceModeTargetType targetType, + List> expectedResultsList) throws Exception { + + Log.info(c, "getMaintenanceModeUsingMBean", targets.toString()); + + String operationName = null; + switch (targetType) { + case SERVER: + operationName = "getServerMaintenanceMode"; + break; + case HOST: + operationName = "getHostMaintenanceMode"; + } + + ObjectName on = new ObjectName("WebSphere:feature=collectiveController,type=MaintenanceMode,name=MaintenanceMode"); + List> resultsList = (List>) connection.invoke(on, operationName, + new Object[] { targets }, + new String[] { "java.util.List" }); + + for (int targetNumber = 0; targetNumber < targets.size(); targetNumber++) { + Map results = resultsList.get(targetNumber); + Map expectedResults = expectedResultsList.get(targetNumber); + for (Map.Entry entry : expectedResults.entrySet()) { + String name = entry.getKey(); + String expectedResult = entry.getValue(); + String actualResult = results.get(name); + assertEquals("Unexpected result for " + name, + expectedResult, + actualResult); + } + } + } + + public enum MaintenanceModeTargetType { + HOST, + SERVER + } + + /** + * Set tags for the given resource type and identity. + * + * @param resourceType + * @param identity + * @param tags + */ + public static void setAdminTags(MBeanServerConnection connection, String resourceType, String identity, String[] tags) throws Exception { + + Log.info(c, "setAdminTags", "Setting tags " + tags + " on " + resourceType + " " + identity); + + ObjectName on = new ObjectName("WebSphere:feature=collectiveController,type=AdminMetadataManager,name=AdminMetadataManager"); + + connection.invoke(on, "setAdminTags", + new Object[] { resourceType, identity, tags }, + new String[] { "java.lang.String", "java.lang.String", "[Ljava.lang.String;" }); + + } + + /** + * Register a remote host. Assumes the SSL certificates can be accepted. + * + * @param command The host related command to run. Currently, updateHost is supported. + * @param machine The Machine to run the command on + * @param server The LibertyServer to run the command from + * @param hostName The host name to register + * @param controllerHost The hostname where the controller is running + * @param controllerPort The port the controller is listening on + * @param controllerUser The User ID that performs Admin operations on the controller + * @param controllerPassword The password of the User ID that performs Admin operations on the controller + * @param remoteUser The remote User who will be used when performing remote commands to the host being registered + * @param remotePassword The password of the remote User who will be used when performing remote commands to the host being registered + * @param sshPrivateKey The path of the controller's private key file. + * @param autoAcceptCerts True if the autoAcceptCertificates flag should be set to automatically trust SSL certificates during this command + * @return Returns the return code of specified command. Please refer to the command's return code for details + * @throws Exception If the command being executed throws an Exception + */ + public static int hostwlpnCommand(String command, Machine machine, LibertyServer server, String hostName, String controllerHost, int controllerPort, String controllerUser, + String controllerPassword, String remoteUser, String remotePassword, String sshPrivateKey, Boolean autoAcceptCerts) throws Exception { + String installRoot = server.getInstallRoot(); + Properties env = new Properties(); + + List alCmdArgs = new ArrayList(); + alCmdArgs.add(command); + alCmdArgs.add(hostName); + alCmdArgs.add("--host=" + controllerHost); + alCmdArgs.add("--port=" + controllerPort); + alCmdArgs.add("--user=" + controllerUser); + alCmdArgs.add("--password=" + controllerPassword); + + if (sshPrivateKey != null) + alCmdArgs.add("--sshPrivateKey=" + sshPrivateKey); + else { + alCmdArgs.add("--rpcUser=" + remoteUser); + alCmdArgs.add("--rpcUserPassword=" + remotePassword); + } + + if (autoAcceptCerts) { + alCmdArgs.add(" --autoAcceptCertificates"); + } + + String[] cmdArgs = new String[alCmdArgs.size()]; + alCmdArgs.toArray(cmdArgs); + Log.info(c, "hostCommand", "Command: " + cmdArgs); + + env.put("JVM_ARGS", "-Dcom.ibm.websphere.collective.utility.autoAcceptCertificates=true"); + env.put("JAVA_HOME", server.getMachineJavaJDK()); + + ProgramOutput po = machine.execute(installRoot + "/bin/wlpn-collective", + cmdArgs, + installRoot, + env); + + String stdout = po.getStdout(); + Log.info(c, command, "Command Result (getCommand):" + po.getCommand()); + Log.info(c, command, "Command Result (getReturnCode):" + po.getReturnCode()); + Log.info(c, command, "Command Result (stdout):\n" + stdout); + Log.info(c, command, "Command Result (stderr):\n" + po.getStderr()); + return po.getReturnCode(); + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/CustomSSLSocketFactory.java b/dev/fattest.simplicity/src/componenttest/topology/utils/CustomSSLSocketFactory.java new file mode 100755 index 000000000000..9f05f3f50ed5 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/CustomSSLSocketFactory.java @@ -0,0 +1,102 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.utils; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.Socket; +import java.net.UnknownHostException; + +import javax.net.SocketFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * Class used for creating SSL connections to LDAP servers without needing to obtain or add the LDAP servers' signer + * certificates to a truststore, considering a truststore likely isn't yet available at the time of the connection. + */ +public class CustomSSLSocketFactory extends SSLSocketFactory { + private static final Class c = CustomSSLSocketFactory.class; + private SSLSocketFactory factory; + + public CustomSSLSocketFactory() { + // Create trust manager that performs no checking of certificates + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {} + } }; + + try { + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); + factory = sslContext.getSocketFactory(); + } catch (Exception e) { + Log.error(c, "CustomSSLSocketFactory", e, "Error creating SSL context: " + e); + } + } + + public static SocketFactory getDefault() { + return new CustomSSLSocketFactory(); + } + + @Override + public Socket createSocket() throws IOException { + return factory.createSocket(); + } + + @Override + public Socket createSocket(String host, int port) throws IOException, UnknownHostException { + return factory.createSocket(host, port); + } + + @Override + public Socket createSocket(InetAddress host, int port) throws IOException { + return factory.createSocket(host, port); + } + + @Override + public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException, UnknownHostException { + return factory.createSocket(host, port, localHost, localPort); + } + + @Override + public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException { + return factory.createSocket(address, port, localAddress, localPort); + } + + @Override + public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException { + return factory.createSocket(s, host, port, autoClose); + } + + @Override + public String[] getDefaultCipherSuites() { + return factory.getDefaultCipherSuites(); + } + + @Override + public String[] getSupportedCipherSuites() { + return factory.getSupportedCipherSuites(); + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/FATServletClient.java b/dev/fattest.simplicity/src/componenttest/topology/utils/FATServletClient.java new file mode 100755 index 000000000000..510e92465216 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/FATServletClient.java @@ -0,0 +1,151 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.utils; + +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; + +import com.ibm.websphere.simplicity.config.dsprops.testrules.DataSourcePropertiesOnlyRule; +import com.ibm.websphere.simplicity.config.dsprops.testrules.DataSourcePropertiesSkipRule; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; + +/** + * Utilities for running tests using {@link FATServlet}-style output. + */ +public class FATServletClient { + public static final String SUCCESS = "SUCCESS"; + public static final String TEST_METHOD = "testMethod"; + + @Rule + public TestName testName = new TestName(); + + public static DataSourcePropertiesOnlyRule onlyRule = new DataSourcePropertiesOnlyRule(); + public static DataSourcePropertiesSkipRule skipRule = new DataSourcePropertiesSkipRule(); + + @Rule + public TestRule dataSourcePropertiesSkipRule = skipRule; + + @Rule + public TestRule dataSourcePropertiesOnlyRule = onlyRule; + + @Before + public void logBeginTest() { + Log.info(getClass(), testName.getMethodName(), "BEGIN"); + } + + @After + public void logEndTest() { + Log.info(getClass(), testName.getMethodName(), "END"); + } + + /** + * Runs a servlet test method. + * + * @param server the started server containing the started application + * @param testName the {@code @Rule public TestName testName} field + * @param path the servlet context and path (e.g., {@code "test"}) + */ + public static void runTest(LibertyServer server, String path, TestName testName) throws Exception { + runTest(server, path, testName.getMethodName()); + } + + /** + * Runs a servlet test method. + * + * @param server the started server containing the started application + * @param path the servlet context and path (e.g., {@code "test"}) + * @param testName the servlet test method name + */ + public static void runTest(LibertyServer server, String path, String testName) throws Exception { + HttpUtils.findStringInReadyUrl(server, getPathAndQuery(path, testName), FATServletClient.SUCCESS); + } + + /** + * Runs a servlet test method and verifies that the expected response code was returned. + * + * @param server the started server containing the started application + * @param path the servlet context and path (e.g., {@code "test"}) + * @param testName the servlet test method name + * @param allowedReturnCodes an array of allowed HttpUrlConnection response codes + */ + public static int runTestForResponseCode(LibertyServer server, String path, String testName) throws Exception { + HttpURLConnection con = HttpUtils.getHttpConnectionWithAnyResponseCode(server, getPathAndQuery(path, testName)); + int rc = con.getResponseCode(); + con.disconnect(); + return rc; + } + + /** + * Runs a test in the servlet and returns the servlet output. + * + * @param server the started server containing the started application + * @param the url path (e.g. myApp/myServlet) + * @param queryString query string including at least the test name + * @return output of the servlet + */ + public StringBuilder runTestWithResponse(LibertyServer server, String path, String queryString) throws Exception { + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + getPathAndQuery(path, queryString)); + Log.info(getClass(), testName.getMethodName(), "URL is " + url); + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + try { + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + + String sep = System.getProperty("line.separator"); + StringBuilder lines = new StringBuilder(); + + // Send output from servlet to console output + for (String line = br.readLine(); line != null; line = br.readLine()) { + lines.append(line).append(sep); + Log.info(getClass(), "runInServlet", line); + } + + // Look for success message, otherwise fail test + if (lines.indexOf(FATServletClient.SUCCESS) < 0) { + Log.info(getClass(), testName.getMethodName(), "failed to find completed successfully message"); + fail("Missing success message in output. " + lines); + } + return lines; + } finally { + con.disconnect(); + } + } + + /** + * Return the path and query for a servlet test method URL. + * + * @param path the servlet context and path (e.g., {@code "test"}) + * @param testName the test name + * @return the path and query (e.g., {@code "/test?testMethod=test"}) + */ + public static String getPathAndQuery(String path, String testName) { + return '/' + path + '?' + FATServletClient.TEST_METHOD + '=' + testName; + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/FileUtils.java b/dev/fattest.simplicity/src/componenttest/topology/utils/FileUtils.java new file mode 100755 index 000000000000..e460e33b11ca --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/FileUtils.java @@ -0,0 +1,99 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.utils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.nio.channels.FileChannel; + +/** + * Utilities for working with files + */ +public class FileUtils { + + /** + * Recursively deletes files within the supplied directory and then deletes the directory itself. + * + * @param dir The directory to delete + */ + public static void recursiveDelete(File dir) { + if (dir.exists()) { + for (File f : dir.listFiles()) { + if (f.isDirectory()) { + recursiveDelete(f); + } else { + f.delete(); + } + } + dir.delete(); + } + } + + /** + * Copies the contents of a source file into a destination file + * + * @param sourceFile + * @param destFile + * @throws IOException + */ + public static void copyFile(File sourceFile, File destFile) throws IOException { + // Creates the destination file if it doesn't exists + if (!destFile.exists()) { + destFile.createNewFile(); + } + + FileChannel source = null; + FileChannel destination = null; + + try { + source = new FileInputStream(sourceFile).getChannel(); + destination = new FileOutputStream(destFile).getChannel(); + destination.transferFrom(source, 0, source.size()); + } finally { + if (source != null) { + try { + source.close(); + } catch (IOException e) { + } + } + if (destination != null) { + try { + destination.close(); + } catch (IOException e) { + } + } + } + } + + public static String readFile(String file) throws IOException { + File f = new File(file); + if (!f.exists() || f.isDirectory()) + throw new FileNotFoundException(file); + + StringBuilder sb = new StringBuilder(); + BufferedReader br = new BufferedReader(new FileReader(f)); + try { + String line; + while ((line = br.readLine()) != null) + sb.append(line).append('\n'); + } finally { + br.close(); + } + return sb.toString(); + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/HttpUtils.java b/dev/fattest.simplicity/src/componenttest/topology/utils/HttpUtils.java new file mode 100755 index 000000000000..b7cc53d448bb --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/HttpUtils.java @@ -0,0 +1,673 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.utils; + +import static org.junit.Assert.assertEquals; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.Authenticator; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.PasswordAuthentication; +import java.net.ProtocolException; +import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; + +/** + * Utilities for testing HTTP connections. + */ +public class HttpUtils { + private final static Class c = HttpUtils.class; + private final static String LS = System.getProperty("line.separator"); + + private final static int DEFAULT_TIMEOUT = 5000; + + private final static int LOWEST_ERROR_CODE = 400; + + public enum HTTPRequestMethod { + GET, POST, HEAD, OPTIONS, PUT, DELETE, TRACE + } + + /** + * Get the response body of this connection, regardless of whether it returned an error code. + */ + public static BufferedReader getResponseBody(HttpURLConnection con) throws IOException { + if (con.getResponseCode() < LOWEST_ERROR_CODE) { + return getConnectionStream(con); + } else { + return getErrorStream(con); + } + } + + /** + * Get the response body of this connection, regardless of whether it returned an error code. + */ + public static BufferedReader getResponseBody(HttpURLConnection con, String charsetName) throws IOException { + if (con.getResponseCode() < LOWEST_ERROR_CODE) { + return getConnectionStream(con, charsetName); + } else { + return getErrorStream(con, charsetName); + } + } + + /** + * This method is used to get a connection stream from an HTTP connection. It + * gives the output from the webpage that it gets from the connection + * + * @param con The connection to the HTTP address + * @return The Output from the webpage + */ + public static BufferedReader getConnectionStream(HttpURLConnection con) throws IOException { + InputStream is = con.getInputStream(); + return getBufferedReader(is); + } + + /** + * This method is used to get a connection stream from an HTTP connection. It + * gives the output from the webpage that it gets from the connection + * + * @param con The connection to the HTTP address + * @param charsetName The character set name + * @return The Output from the webpage + */ + public static BufferedReader getConnectionStream(HttpURLConnection con, String charsetName) throws IOException { + InputStream is = con.getInputStream(); + return getBufferedReader(is, charsetName); + } + + /** + * This method is used to get an error connection stream from a HTTP connection. + * + * @param con + * @return + * @throws IOException + */ + public static BufferedReader getErrorStream(HttpURLConnection con) throws IOException { + InputStream is = con.getErrorStream(); + return getBufferedReader(is); + } + + /** + * This method is used to get an error connection stream from a HTTP connection. + * + * @param con + * @param charsetName + * @return + * @throws IOException + */ + public static BufferedReader getErrorStream(HttpURLConnection con, String charsetName) throws IOException { + InputStream is = con.getErrorStream(); + return getBufferedReader(is, charsetName); + } + + private static BufferedReader getBufferedReader(InputStream is) { + InputStreamReader isr = new InputStreamReader(is); + return new BufferedReader(isr); + } + + private static BufferedReader getBufferedReader(InputStream is, String charsetName) throws UnsupportedEncodingException { + InputStreamReader isr = new InputStreamReader(is, charsetName); + return new BufferedReader(isr); + } + + /** + * This method creates a connection to a webpage and then returns the connection, it doesn't care what the response code is. + * + * @param server The liberty server that is hosting the URL + * @param path The path to the URL with the output to test (excluding port and server information). For instance "/someContextRoot/servlet1" + * @return The connection to the http address + */ + public static HttpURLConnection getHttpConnectionWithAnyResponseCode(LibertyServer server, String path) throws IOException { + int timeout = DEFAULT_TIMEOUT; + URL url = createURL(server, path); + HttpURLConnection con = getHttpConnection(url, timeout, HTTPRequestMethod.GET); + Log.info(HttpUtils.class, "getHttpConnection", "Connecting to " + url.toExternalForm() + " expecting http response in " + timeout + " seconds."); + con.connect(); + return con; + } + + /** + * This method creates a connection to a webpage and then returns the connection + * + * @param url The Http Address to connect to + * @param expectedResponseCode The expected response code to wait for + * @param connectionTimeout The timeout in seconds + * @return The connection to the http address + */ + public static HttpURLConnection getHttpConnection(URL url, int expectedResponseCode, int connectionTimeout) throws IOException, ProtocolException { + return getHttpConnection(url, expectedResponseCode, connectionTimeout, HTTPRequestMethod.GET); + } + + /** + * This method creates a connection to a webpage and then returns the connection + * + * @param url The Http Address to connect to + * @param expectedResponseCode The expected response code to wait for + * @param connectionTimeout The timeout in seconds + * @param requestMethod The HTTP request method (GET, POST, HEAD, OPTIONS, PUT, DELETE, TRACE) + * @return The connection to the http address + */ + public static HttpURLConnection getHttpConnection(URL url, int expectedResponseCode, int connectionTimeout, + HTTPRequestMethod requestMethod) throws IOException, ProtocolException { + return getHttpConnection(url, expectedResponseCode, null, connectionTimeout, requestMethod); + } + + /** + * This method creates a connection to a webpage and then returns the connection + * + * @param url The Http Address to connect to + * @param expectedResponseCode The expected response code to wait for + * @param allowedUnexpectedResponseCodes A list of unexpected response codes that should not cause a failure, or null to allow all unexpected response codes + * @param connectionTimeout The timeout in seconds + * @param requestMethod The HTTP request method (GET, POST, HEAD, OPTIONS, PUT, DELETE, TRACE) + * @return The connection to the http address + */ + public static HttpURLConnection getHttpConnection(URL url, int expectedResponseCode, int[] allowedUnexpectedResponseCodes, int connectionTimeout, + HTTPRequestMethod requestMethod) throws IOException, ProtocolException { + + if (System.getSecurityManager() == null) { + return getHttpConnection(url, expectedResponseCode, allowedUnexpectedResponseCodes, connectionTimeout, requestMethod, null, null); + + } else { + final URL f_url = url; + final int f_expectedResponseCode = expectedResponseCode; + final int[] f_allowedUnexpectedResponseCodes = allowedUnexpectedResponseCodes; + final int f_connectionTimeout = connectionTimeout; + final HTTPRequestMethod f_requestMethod = requestMethod; + try { + return AccessController.doPrivileged(new PrivilegedExceptionAction() { + @Override + public HttpURLConnection run() throws IOException, ProtocolException { + return getHttpConnection(f_url, f_expectedResponseCode, f_allowedUnexpectedResponseCodes, f_connectionTimeout, f_requestMethod, null, null); + } + }); + } catch (PrivilegedActionException e) { + Throwable cause = e.getCause(); + if (cause instanceof IOException) { + throw (IOException) cause; + } else if (cause instanceof ProtocolException) { + throw (ProtocolException) cause; + } + return null; + } + + } + } + + /** + * This method creates a connection to a webpage and then returns the connection + * + * @param url The Http Address to connect to + * @param expectedResponseCode The expected response code to wait for + * @param allowedUnexpectedResponseCodes A list of unexpected response codes that should not cause a failure, or null to allow all unexpected response codes + * @param connectionTimeout The timeout in seconds + * @param requestMethod The HTTP request method (GET, POST, HEAD, OPTIONS, PUT, DELETE, TRACE) + * @param headers A map of HTTP headers keys and values. + * @return The connection to the http address + */ + public static HttpURLConnection getHttpConnection(URL url, int expectedResponseCode, int[] allowedUnexpectedResponseCodes, int connectionTimeout, + HTTPRequestMethod requestMethod, Map headers, + InputStream streamToWrite) throws IOException, ProtocolException { + Log.info(HttpUtils.class, "getHttpConnection", "Connecting to " + url.toExternalForm() + " expecting http response of " + expectedResponseCode + " in " + connectionTimeout + + " seconds."); + + long startTime = System.currentTimeMillis(); + int timeout = connectionTimeout * 1000; // this is bad practice because it could overflow but the connection timeout on a urlconnection has to fit in an int. + boolean streamToWriteReset = true; // true for first pass, set after first use. + + int count = 0; + HttpURLConnection con = null; + try { + do { + // If we've tried and failed to connect + if (con != null) { + // fail if surprised or if streamToWrite unable to retry + if ((allowedUnexpectedResponseCodes != null + && !contains(allowedUnexpectedResponseCodes, con.getResponseCode())) + || !streamToWriteReset) { + String msg = "Expected response " + expectedResponseCode + + ", received " + con.getResponseCode() + + " (" + con.getResponseMessage() + + ") while connecting to " + url; + if (!streamToWriteReset) + msg += ". Unable to reset streamToWrite"; + + String errorStream = read(con.getErrorStream()); + + // The Liberty 404 page is big and meaningless for our purposes. + if (con.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND && + errorStream.contains("Context Root Not Found")) { + msg += ". Error title: Context Root Not Found"; + } else { + msg += ". Error stream: " + errorStream; + } + + AssertionError e = new AssertionError(msg); + Log.error(HttpUtils.class, "getHttpConnection", e); + throw e; + } + + // fail when time's up + if (timeout <= (System.currentTimeMillis() - startTime)) { + String msg = "Expected response " + expectedResponseCode + + " within " + connectionTimeout + + " seconds, last received " + con.getResponseCode() + + " (" + con.getResponseMessage() + + ") while connecting to " + url; + AssertionError e = new AssertionError(msg); + Log.error(HttpUtils.class, "getHttpConnection", e, msg); + throw e; + } + + // wait a second and try again + try { + Log.info(HttpUtils.class, "getHttpConnection", + "Waiting 1s before retry " + count + + " to connect to " + url + + " due to response " + con.getResponseCode() + ": " + con.getResponseMessage()); + Thread.sleep(1000); + } catch (InterruptedException e) { + //swallow the InterruptedException if there is one + } finally { + } + } + con = getHttpConnection(url, timeout, requestMethod); + + //Add additional headers, if any + if (headers != null) { + Iterator> entries = headers.entrySet().iterator(); + while (entries.hasNext()) { + Entry entry = entries.next(); + con.setRequestProperty(entry.getKey(), entry.getValue()); + } + } + + //Write bytes if applicable + if (streamToWrite != null) { + OutputStream out = con.getOutputStream(); + + byte[] buffer = new byte[1024]; + int byteCount = 0; + while ((byteCount = streamToWrite.read(buffer)) != -1) { + out.write(buffer, 0, byteCount); + } + // if possible reset stream for retry + if (streamToWrite.markSupported()) { + streamToWrite.reset(); + } else { + streamToWriteReset = false; + } + } + + con.connect(); + count++; + } while (con.getResponseCode() != expectedResponseCode); + Log.info(HttpUtils.class, "getHttpConnection", "RC=" + con.getResponseCode() + ", Connection established"); + return con; + } finally { + Log.info(HttpUtils.class, "getHttpConnection", "Returning after " + count + " attempts to establish a connection."); + } + } + + /** + * Return true if haystack contains needle. + * + * @param haystack the array to search + * @param needle the value to find + * @return true if the value was found + */ + private static boolean contains(int[] haystack, int needle) { + for (int value : haystack) { + if (needle == value) { + return true; + } + } + return false; + } + + /** + * Method to find some text from the output of a URL. If the text isn't found an assertion error is thrown. + * + * @param server The liberty server for that is hosting the URL + * @param path The path to the URL with the output to test (excluding port and server information). For instance "/someContextRoot/servlet1" + * @param stringsToFind The strings to search for, there must be at least one string to find. Duplicates will only be searched for once + * @throws IOException + * @throws {@link AssertionError} If the text isn't found + * @throws IllegalArgumentException If stringsToFind is null or empty + */ + public static void findStringInUrl(LibertyServer server, String path, String... stringsToFind) throws IOException { + + final LibertyServer f_server = server; + final String f_path = path; + final String[] f_stringsToFind = stringsToFind; + try { + AccessController.doPrivileged(new PrivilegedExceptionAction() { + @Override + public Void run() throws IOException { + findStringInUrl(f_server, f_path, HTTPRequestMethod.GET, f_stringsToFind); + return null; + + } + }); + } catch (PrivilegedActionException e) { + Throwable cause = e.getCause(); + if (cause instanceof IOException) { + throw (IOException) cause; + } + } + } + + /** + * Method to find some text from the output of a URL. An assertion error is thrown if the connection returns an unexpected response code or if the text isn't found in the + * response. This method should only be used if the caller knows URL is ready because the application is known to be started. + * + * @param server The liberty server for that is hosting the URL + * @param path The path to the URL with the output to test (excluding port and server information). For instance "/someContextRoot/servlet1" + * @param stringsToFind The strings to search for, there must be at least one string to find. Duplicates will only be searched for once + * @throws Exception + * @throws {@link AssertionError} If the text isn't found + * @throws IllegalArgumentException If stringsToFind is null or empty + */ + public static void findStringInReadyUrl(LibertyServer server, String path, String... stringsToFind) throws Exception { + findStringInReadyUrl(server, path, HTTPRequestMethod.GET, stringsToFind); + } + + /** + * Method to find some text from the output of a URL. If the text isn't found an assertion error is thrown. + * + * @param server The liberty server for that is hosting the URL + * @param path The path to the URL with the output to test (excluding port and server information). For instance "/someContextRoot/servlet1" + * @param requestMethod The HTTP request method (GET, POST, HEAD, OPTIONS, PUT, DELETE, TRACE) + * @param stringsToFind The strings to search for, there must be at least one string to find. Duplicates will only be searched for once + * @throws IOException + * @throws {@link AssertionError} If the text isn't found + * @throws IllegalArgumentException If stringsToFind is null or empty + */ + public static void findStringInUrl(LibertyServer server, String path, HTTPRequestMethod requestMethod, String... stringsToFind) throws IOException { + findStringInUrl(server, path, null, requestMethod, stringsToFind); + } + + /** + * Method to find some text from the output of a URL. An assertion error is thrown if the connection returns an unexpected response code or if the text isn't found in the + * response. This method should only be used if the caller knows URL is ready because the application is known to be started. + * + * @param server The liberty server for that is hosting the URL + * @param path The path to the URL with the output to test (excluding port and server information). For instance "/someContextRoot/servlet1" + * @param stringsToFind The strings to search for, there must be at least one string to find. Duplicates will only be searched for once + * @throws Exception + * @throws {@link AssertionError} If the text isn't found + * @throws IllegalArgumentException If stringsToFind is null or empty + */ + public static void findStringInReadyUrl(LibertyServer server, String path, HTTPRequestMethod requestMethod, String... stringsToFind) throws Exception { + findStringInUrl(server, path, new int[0], requestMethod, stringsToFind); + } + + /** + * Method to find some text from the output of a URL. An assertion error is thrown if the connection returns an unexpected response code or if the text isn't found in the + * response. + * + * @param server The liberty server for that is hosting the URL + * @param path The path to the URL with the output to test (excluding port and server information). For instance "/someContextRoot/servlet1" + * @param allowedUnexpectedResponseCodes A list of unexpected response codes that should not cause a failure, or null to allow all unexpected response codes + * @param stringsToFind The strings to search for, there must be at least one string to find. Duplicates will only be searched for once + * @throws IOException + * @throws {@link AssertionError} If the text isn't found + * @throws IllegalArgumentException If stringsToFind is null or empty + */ + public static void findStringInUrl(LibertyServer server, String path, int[] allowedUnexpectedResponseCodes, HTTPRequestMethod requestMethod, + String... stringsToFind) throws IOException { + if (stringsToFind == null || stringsToFind.length == 0) { + throw new IllegalArgumentException("No strings were supplied to look for"); + } + URL url = createURL(server, path); + Log.info(HttpUtils.class, "findStringInUrl", "Calling application with URL=" + url.toString() + " and request method=" + requestMethod); + + HttpURLConnection con = null; + + try { + //check application is installed + con = HttpUtils.getHttpConnection(url, HttpURLConnection.HTTP_OK, allowedUnexpectedResponseCodes, 5, requestMethod); + findStringInHttpConnection(con, stringsToFind); + } catch (IOException e) { + Log.info(HttpUtils.class, "findStringInUrl", "Exception " + e.getClass().getName() + " requesting URL=" + url.toString(), e); + throw e; + } + } + + private static URL createURL(LibertyServer server, String path) throws MalformedURLException { + return new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + path); + } + + /** + * Method to find some text from the output of an HttpURLConnection. If the text isn't found an assertion error is thrown. + * + * @param con The HttpURLconnection to retrieve the text from + * @param stringsToFind The strings to search for, there must be at least one string to find. Duplicates will only be searched for once + * @throws IOException + * @throws {@link AssertionError} If the text isn't found + * @throws IllegalArgumentException If stringsToFind is null or empty + */ + public static void findStringInHttpConnection(HttpURLConnection con, String... stringsToFind) throws IOException { + findStringInHttpConnection(null, con, stringsToFind); + } + + /** + * Method to find some text from the output of an HttpURLConnection. If the text isn't found an assertion error is thrown. + * + * @param charsetName The character set name. If null, use the default character set. + * @param con The HttpURLconnection to retrieve the text from + * @param stringsToFind The strings to search for, there must be at least one string to find. Duplicates will only be searched for once + * @throws IOException + * @throws {@link AssertionError} If the text isn't found + * @throws IllegalArgumentException If stringsToFind is null or empty + */ + public static void findStringInHttpConnection(String charsetName, HttpURLConnection con, String... stringsToFind) throws IOException { + try { + BufferedReader br = charsetName == null ? getResponseBody(con) : getResponseBody(con, charsetName); + String line; + + // Convert the strings to find to a set and then remove strings as they are found + final Set stringsToFindSet = toSet(stringsToFind); + + final StringBuilder outputBuilder = new StringBuilder(); + + while ((line = br.readLine()) != null) { + outputBuilder.append(line); + outputBuilder.append("\n"); + // Continue to read until response is finished, but only bother + // looking at lines if we're still trying to find stuff.. + if (stringsToFindSet.size() > 0) { + Iterator stringToFindIterator = stringsToFindSet.iterator(); + while (stringToFindIterator.hasNext()) { + String textToFind = stringToFindIterator.next(); + if (line.contains(textToFind)) { + stringToFindIterator.remove(); + } + } + } + } + + //AccessController.doPrivileged(new PrivilegedAction() { + // @Override + // public Void run() { + assertEquals("The response did not contain \"" + stringsToFindSet.toString() + "\". Full output is:\"\n" + outputBuilder.toString() + "\".", + 0, stringsToFindSet.size()); + // return null; + + // } + //}); + + } catch (IOException e) { + Log.info(HttpUtils.class, "findStringInHttpConnection", "Exception " + e.getClass().getName() + " requesting URL=" + con.getURL().toString(), e); + throw e; + } finally { + if (con != null) { + con.disconnect(); + } + } + } + + private static Set toSet(String[] array) { + Set collection = new HashSet(); + for (String string : array) { + collection.add(string); + } + return collection; + } + + /** + * This gets an HttpURLConnection to the requested address + * + * @param url The URL to get a connection to + * @param requestMethod The HTTP request method (GET, POST, HEAD, OPTIONS, PUT, DELETE, TRACE) + * @return + * @throws IOException + * @throws ProtocolException + */ + private static HttpURLConnection getHttpConnection(URL url, int timeout, HTTPRequestMethod requestMethod) throws IOException, ProtocolException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod(requestMethod.toString()); + con.setConnectTimeout(timeout); + + if (con instanceof HttpsURLConnection) { + ((HttpsURLConnection) con).setHostnameVerifier(new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }); + } + + return con; + } + + public static void trustAllCertificates() throws Exception { + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + } + + public static void trustAllHostnames() { + HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }); + } + + public static void setDefaultAuth(final String user, final String password) { + Authenticator.setDefault(new Authenticator() { + @Override + public PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(user, password.toCharArray()); + } + }); + } + + public static String getHttpResponseAsString(String urlStr) throws IOException { + URL url = new URL(urlStr); + return getHttpResponseAsString(url); + } + + public static String getHttpResponseAsString(URL url) throws IOException { + final String method = "getHttpResponseAsString"; + Log.info(c, method, "url = " + url); + HttpURLConnection con = null; + InputStream is = null; + try { + con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + // See if we can get the stream for the response, may be an input or error stream + try { + is = con.getInputStream(); + } catch (FileNotFoundException e) { + // No input stream so try the error + is = con.getErrorStream(); + } catch (IOException ioe) { + String errStream = read(con.getErrorStream()); + Log.info(c, method, "rc=" + con.getResponseCode() + " response=" + LS + errStream); + throw new IOException(ioe.getMessage() + ": " + errStream, ioe); + } + + String output = read(is); + Log.info(c, method, "rc=" + con.getResponseCode() + " response=" + LS + output); + return output; + } finally { + if (con != null) { + con.disconnect(); + } + if (is != null) { + is.close(); + } + } + } + + private static String read(InputStream in) throws IOException { + if (in == null) { + return null; + } + BufferedReader br = getBufferedReader(in); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(LS); + } + return builder.toString(); + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/HttpsRequest.java b/dev/fattest.simplicity/src/componenttest/topology/utils/HttpsRequest.java new file mode 100644 index 000000000000..a82fa837e50a --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/HttpsRequest.java @@ -0,0 +1,122 @@ +package componenttest.topology.utils; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import javax.net.ssl.HttpsURLConnection; + +import componenttest.topology.impl.LibertyServer; + +public class HttpsRequest { + + private final String url; + private int expectedResponseCode = HttpsURLConnection.HTTP_OK; + private String reqMethod = "GET"; + private String json = null; + private String basicAuth = null; + private final Map props = new HashMap(); + + public HttpsRequest(String url) { + this.url = url; + } + + public HttpsRequest(LibertyServer server, String... pathParts) { + String base = "https://" + server.getHostname() + ":" + server.getHttpDefaultSecurePort(); + for (String part : pathParts) + base += part; + this.url = base; + } + + /** + * The HTTP request method. Default method is GET. + */ + public HttpsRequest method(String method) { + this.reqMethod = method; + return this; + } + + /** + * Add a HTTP request property name and value using HttpUrlConnection.setRequestProperty() + */ + public HttpsRequest requestProp(String key, String value) { + props.put(key, value); + return this; + } + + /** + * Set the expected response code. Default is HTTP_OK + */ + public HttpsRequest expectCode(int expectedResponse) { + this.expectedResponseCode = expectedResponse; + return this; + } + + /** + * Set the json data to send with the request. + */ + public HttpsRequest jsonBody(String json) { + this.json = json; + return this; + } + + public HttpsRequest basicAuth(String user, String pass) { + try { + String userPass = user + ':' + pass; + String base64Auth = javax.xml.bind.DatatypeConverter.printBase64Binary((userPass).getBytes("UTF-8")); + this.basicAuth = "Basic " + base64Auth; + } catch (UnsupportedEncodingException e) { + // nothing to be done + } + return this; + } + + /** + * Make an HTTPS request and receive the response as a JSON object. + */ + public String run() throws Exception { + System.out.println(reqMethod + ' ' + url); + + HttpsURLConnection con = (HttpsURLConnection) new URL(url).openConnection(); + try { + con.setDoInput(true); + con.setDoOutput(true); + con.setRequestMethod(reqMethod); + + if (json != null) { + con.setRequestProperty("Accept", "application/json"); + con.setRequestProperty("Content-Type", "application/json"); + OutputStream out = con.getOutputStream(); + out.write(json.getBytes("UTF-8")); + out.close(); + } + + if (basicAuth != null) + con.setRequestProperty("Authorization", basicAuth); + + if (props != null) + for (Map.Entry entry : props.entrySet()) + con.setRequestProperty(entry.getKey(), entry.getValue()); + + int responseCode = con.getResponseCode(); + if (responseCode != expectedResponseCode) + throw new Exception("Unexpected response (See HTTP_* constant values on HttpURLConnection): " + responseCode); + + if (responseCode / 100 == 2) { // response codes in the 200s mean success + StringBuilder response = new StringBuilder(); + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); + while (in.ready()) + response.append(in.readLine()).append('\n'); + in.close(); + return response.toString(); + } else + return null; + } finally { + con.disconnect(); + } + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/JavaMTUtils.java b/dev/fattest.simplicity/src/componenttest/topology/utils/JavaMTUtils.java new file mode 100755 index 000000000000..50ef51b91417 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/JavaMTUtils.java @@ -0,0 +1,238 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.utils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.List; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; +import componenttest.topology.impl.LibertyServer; + +/** + * + */ +public class JavaMTUtils { + + private static final Class c = JavaMTUtils.class; + + private static final String JAVA_VERSION = + AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public String run() { + return System.getProperty("java.version"); + } + }); + private static final String JAVA_VM_VENDOR = + AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public String run() { + return System.getProperty("java.vm.vendor"); + } + }); + private static final String OS_NAME = + AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public String run() { + return System.getProperty("os.name"); + } + }); + private static final String JVM_BIT_MODE = + AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public String run() { + return System.getProperty("com.ibm.vm.bitmode"); + } + }); + + private static String javadDir = null; + private static String javadFilePath = null; + + private static boolean isJava7; // -Xmt flag support did not make it to Java 8. Hence we need to only check with Java 7. + private static boolean isIBMJDK; + private static boolean isOSIBMiOrzOS; + private static boolean is64BitMachine; + + private static String jvmOptionsFilePath = null; + + public static boolean checkSupportedEnvForMultiTenancy() { + + // MT is only available on IBM Java. Check this first to avoid errors in parsing foreign JVM strings below. + if (!JAVA_VM_VENDOR.contains("IBM")) + return false; + String method = "checkSupportedEnvForMultiTenancy"; + String[] version = JAVA_VERSION.split("\\."); + Integer[] versionNum = new Integer[version.length]; + int i = 0; + for (String str : version) { + versionNum[i] = Integer.parseInt(str); + i++; + } + if (versionNum[0] >= 1 && versionNum[1] == 7 && versionNum[2] >= 0) //Only IBM JRE v7R1 supports the -Xmt flag. The support was dropped in Java 8 + isJava7 = true; + else + isJava7 = false; + //isJava7orAbove = JAVA_VERSION.matches("1\\.[7-9]\\.[0-9]"); + isIBMJDK = JAVA_VM_VENDOR.contains("IBM"); + isOSIBMiOrzOS = OS_NAME.contains("OS/400") || OS_NAME.contains("z/OS"); + is64BitMachine = JVM_BIT_MODE != null && JVM_BIT_MODE.matches("64"); + + Log.info(c, method, "MT environment test properties.."); + Log.info(c, method, "isJava7orAbove : " + JAVA_VERSION); + Log.info(c, method, "isIBMJDK : " + JAVA_VM_VENDOR); + Log.info(c, method, "isOSIBMiOrzOS : " + OS_NAME); + Log.info(c, method, "is64BitMachine : " + JVM_BIT_MODE); + + if (!isOSIBMiOrzOS && isJava7 && isIBMJDK && is64BitMachine) { + if (supportsXmtFlag()) + return true; + else + return false; + } else + return false; + } + + public static boolean supportsXmtFlag() { + boolean supportsMT = true; + + Process javaMTCommandProcess = null; + BufferedReader in = null; + + String method = "supportsXmtFlag"; + Log.entering(c, method); + Log.info(c, method, "Testing for Java MT by issuing the java -version command"); + + //Get machine java.home using bootstrap + Bootstrap b = null; + try { + b = Bootstrap.getInstance(); + } catch (Exception e1) { + Log.error(c, method, e1, "Error while Getting the bootstrap instance"); + } + String hostName = b.getValue("hostName"); + String machineJavaHome = b.getValue(hostName + ".JavaHome"); + Log.info(c, method, "machineJavaHome from Bootstrap : " + machineJavaHome); + String JAVA_COMMAND = machineJavaHome + "/bin/java"; + String JAVA_MT_FLAG = "-Xmt"; + + List params = java.util.Arrays.asList(JAVA_COMMAND, JAVA_MT_FLAG); + Log.info(c, method, " jvm params : " + params.toString()); + + // Start the java process in multitenancy mode + try { + ProcessBuilder pb = new ProcessBuilder(params); + pb.redirectErrorStream(true); + javaMTCommandProcess = pb.start(); + } catch (IOException e3) { + Log.error(c, method, e3, "Error while starting the Java MT Process"); + try { + throw new Exception("Error while starting the Java MT Process"); + } catch (Exception e) { + Log.error(c, method, e3, "Error while throwing new exception"); + } + } + + in = new BufferedReader(new InputStreamReader(javaMTCommandProcess.getInputStream())); + + try { + String line = null; + long time = System.currentTimeMillis(); + long timeout = time + 120000; //wait max two minutes for java -Xmt to execute + while (System.currentTimeMillis() <= timeout) { + line = in.readLine(); + if (line != null) { + //Java v7R1 SR2 has changed the message to indicate non-support of -Xmt. The new message reads "Error: -Xmt no longer supported" + if (line.contains("JVMJ9VM007E") || line.contains("JVMJ9VM143E") || line.contains("Error")) { //Java 8 gives error code JVMJ9VM143E to indicate no support for -Xmt flag + supportsMT = false; + Log.info(c, method, line); + break; + } else { + //wasn't the output we expected, but wasn't end of stream + //so just continue + continue; + } + } else { + //reached the end of the stream, wait 1 second before trying again + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + Log.error(c, "start", e, "Error occured while Thread.sleep()"); + } + } + } + } catch (IOException e2) { + Log.error(c, "start", e2, "Error occured while reading the buffered reader"); + } finally { + try { + in.close(); + } catch (IOException e) { + Log.error(c, "start", e, "Error occured while closing the buffered reader"); + } + } + if (!supportsMT) + Log.info(c, method, "The Java version which is used does not support -Xmt flag."); + Log.exiting(c, method); + return supportsMT; + } + + public static void createJavad(LibertyServer server) throws Exception { + server.copyFileToLibertyServerRoot("../../javad", "javad.options"); + javadDir = server.getUserDir() + "/" + "javad"; + javadFilePath = javadDir + "/" + "javad.options"; + + try { + FileOutputStream out = new FileOutputStream(new File(javadFilePath), true); + String javaDumpFlag = "-Xdump:java:label=" + javadDir + + "/javacore.%pid.%seq.txt"; + String heapDumpFlag = "-Xdump:heap:label=" + javadDir + + "/heapcore.%pid.%seq.txt"; + String systemDumpFlag = "-Xdump:system:label=" + javadDir + + "/systemcore.%pid.%seq.txt"; + String newLine = System.getProperty("line.separator"); + out.write(javaDumpFlag.getBytes()); + out.write(newLine.getBytes()); + out.write(heapDumpFlag.getBytes()); + out.write(newLine.getBytes()); + out.write(systemDumpFlag.getBytes()); + out.close(); + } catch (IOException e) { + throw new Exception("Error occured while updating the javad.options file."); + } + } + + public static void createJvmOptions(LibertyServer server) throws Exception { + server.copyFileToLibertyServerRoot("jvm.options"); + jvmOptionsFilePath = server.getServerRoot() + "/" + "jvm.options"; + + try { + FileOutputStream out = new FileOutputStream(new File(jvmOptionsFilePath), true); + String newLine = System.getProperty("line.separator"); + String javadHomePath = "-Djavad.home=" + server.getUserDir() + "/" + "javad"; + out.write(newLine.getBytes()); + out.write(javadHomePath.getBytes()); + out.close(); + } catch (IOException e) { + throw new Exception("Error occured while updating the jvm.options file."); + } + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/LDAPUtils.java b/dev/fattest.simplicity/src/componenttest/topology/utils/LDAPUtils.java new file mode 100755 index 000000000000..9196870c850e --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/LDAPUtils.java @@ -0,0 +1,474 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.utils; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.directory.InitialDirContext; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; + +/** + * + */ +public class LDAPUtils { + + private static final Class c = LDAPUtils.class; + public static boolean USE_LOCAL_LDAP_SERVER = + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Boolean run() { + String useInMemoryLdapString = System.getProperty("fat.test.really.use.local.ldap"); + boolean inMemoryLdap = false; + if (useInMemoryLdapString != null) { + Log.info(c, "", "fat.test.really.use.local.ldap=" + useInMemoryLdapString); + inMemoryLdap = Boolean.parseBoolean(useInMemoryLdapString); + } + Log.info(c, "", "USE_LOCAL_LDAP_SERVER=" + inMemoryLdap); + return inMemoryLdap; + } + }); + + public static String LDAP_SERVER_1_NAME = "ctldap2.rtp.raleigh.ibm.com"; // Old server : "ralwang.rtp.raleigh.ibm.com" + public static String LDAP_SERVER_2_NAME = "adsrv.rtp.raleigh.ibm.com"; // smpc100 was primary server, but as it down, we are using adsrv as primary AD server now. + public static String LDAP_SERVER_3_NAME = "oraldap.rtp.raleigh.ibm.com"; // h07sun05.rtp.raleigh.ibm.com has silently ridden off into the sunset, replaced by oraldap + public static String LDAP_SERVER_4_NAME = "nc135005.tivlab.austin.ibm.com"; // Old server : "ccwin12.austin.ibm.com" + public static String LDAP_SERVER_5_NAME = "ctldap1.rtp.raleigh.ibm.com"; // Old server : "ctldap1.austin.ibm.com" + public static String LDAP_SERVER_6_NAME = "smpc100.austin.ibm.com"; + public static String LDAP_SERVER_7_NAME = "cc004-w2k8.rtp.raleigh.ibm.com"; // Old server : "ccwin94.austin.ibm.com"; + public static String LDAP_SERVER_8_NAME = "nc135007.tivlab.austin.ibm.com"; + public static String LDAP_SERVER_9_NAME = "svtwin006.austin.ibm.com"; + public static String LDAP_SERVER_10_NAME = "nc135024.tivlab.austin.ibm.com"; + public static String LDAP_SERVER_11_NAME = "nc135025.tivlab.austin.ibm.com"; + public static String LDAP_SERVER_12_NAME = "nc049244.tivlab.raleigh.ibm.com"; + public static String LDAP_SERVER_13_NAME = "oraldap.rtp.raleigh.ibm.com"; // Newly setup Sun LDAP + public static String LDAP_SERVER_1_PORT = "389"; + public static String LDAP_SERVER_2_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_2_SSL_PORT = "636"; + public static String LDAP_SERVER_3_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_3_SSL_PORT = LDAP_SERVER_2_SSL_PORT; + public static String LDAP_SERVER_4_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_4_SSL_PORT = LDAP_SERVER_2_SSL_PORT; + public static String LDAP_SERVER_5_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_6_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_6_SSL_PORT = LDAP_SERVER_2_SSL_PORT; + public static String LDAP_SERVER_7_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_7_SSL_PORT = LDAP_SERVER_2_SSL_PORT; + public static String LDAP_SERVER_8_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_8_SSL_PORT = LDAP_SERVER_2_SSL_PORT; + public static String LDAP_SERVER_9_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_10_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_11_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_12_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_13_PORT = LDAP_SERVER_1_PORT; + public static String LDAP_SERVER_13_SSL_PORT = LDAP_SERVER_2_SSL_PORT; + + public static String LDAP_SERVER_2_BINDDN = "cn=testuser,cn=users,dc=secfvt2,dc=austin,dc=ibm,dc=com"; + public static String LDAP_SERVER_2_BINDPWD = "testuserpwd"; + public static String LDAP_SERVER_3_BINDDN = "cn=Directory Manager"; + public static String LDAP_SERVER_3_BINDPWD = "oracle1ldap"; + + public static String LDAP_SERVER_4_BINDDN = "cn=root"; + public static String LDAP_SERVER_4_BINDPWD = "rootpwd"; + public static String LDAP_SERVER_7_BINDDN = LDAP_SERVER_4_BINDDN; + public static String LDAP_SERVER_7_BINDPWD = LDAP_SERVER_4_BINDPWD; + public static String LDAP_SERVER_8_BINDDN = LDAP_SERVER_4_BINDDN; + public static String LDAP_SERVER_8_BINDPWD = LDAP_SERVER_4_BINDPWD; + public static String LDAP_SERVER_10_BINDDN = LDAP_SERVER_4_BINDDN; + public static String LDAP_SERVER_10_BINDPWD = LDAP_SERVER_4_BINDPWD; + public static String LDAP_SERVER_11_BINDDN = LDAP_SERVER_4_BINDDN; + public static String LDAP_SERVER_11_BINDPWD = LDAP_SERVER_4_BINDPWD; + public static String LDAP_SERVER_12_BINDDN = LDAP_SERVER_4_BINDDN; + public static String LDAP_SERVER_12_BINDPWD = LDAP_SERVER_4_BINDPWD; + public static String LDAP_SERVER_13_BINDDN = "cn=Directory Manager"; + public static String LDAP_SERVER_13_BINDPWD = "oracle1ldap"; + + /** + * Adds the following LDAP variables to the bootstrap.properties file for + * use in server.xml: + *
      + *
    • ldap.server.1.name - the host of the first LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be ctldap2.rtp.raleigh.ibm.com(TDS) + *
    • ldap.server.1.port - the port of the first LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(TDS) + *
    • ldap.server.2.name - the host of the second LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be adsrv.rtp.raleigh.ibm.com(AD) + *
    • ldap.server.2.port - the port of the second LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(AD) + *
    • ldap.server.3.name - the host of the third LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be h07sun05.rtp.raleigh.ibm.com(SUNONE) + *
    • ldap.server.3.port - the port of the third LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 689(SUNONE) + *
    • ldap.server.4.name - the host of the fourth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be nc135005.tivlab.austin.ibm.com(TDS) + *
    • ldap.server.4.port - the port of the fourth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(TDS) + *
    • ldap.server.5.name - the host of the fifth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be ctldap1.rtp.raleigh.ibm.com(TDS) + *
    • ldap.server.5.port - the port of the fifth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(TDS) + *
    • ldap.server.6.name - the host of the sixth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be smpc100.austin.ibm.com(AD) + *
    • ldap.server.6.port - the port of the sixth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(AD) + *
    • ldap.server.7.name - the host of the seventh LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be cc004-w2k8.rtp.raleigh.ibm.com(TDS) + *
    • ldap.server.7.port - the port of the seventh LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(TDS) + *
    • ldap.server.8.name - the host of the eighth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be nc135007.tivlab.austin.ibm.com(TDS) + *
    • ldap.server.8.port - the port of the eighth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(TDS) + *
    • ldap.server.9.name - the host of the ninth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be svtwin0006.austin.ibm.com(TDS) + *
    • ldap.server.9.port - the port of the ninth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(TDS) + *
    • ldap.server.10.name - the host of the tenth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be nc135024.tivlab.austin.ibm.com(TDS) + *
    • ldap.server.10.port - the port of the tenth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(TDS) + *
    • ldap.server.11.name - the host of the eleventh LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be nc135025.tivlab.austin.ibm.com(TDS) + *
    • ldap.server.11.port - the port of the eleventh LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(TDS) + *
    • ldap.server.12.name - the host of the twelfth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be nc049244.tivlab.raleigh.ibm.com(TDS) + *
    • ldap.server.12.port - the port of the twelfth LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(TDS) + *
    • ldap.server.13.name - the host of the thirteen LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be oraldap.rtp.raleigh.ibm.com(SUNONE) + *
    • ldap.server.13.port - the port of the thirteen LDAP server, if {@link #USE_LOCAL_LDAP_SERVER} is false, this will be 389(SUNONE) + * + *
    + * + * @param server + * server for which bootstrap properties file needs updating with LDAP server host/ports + * @throws Exception + */ + public static void addLDAPVariables(LibertyServer server) throws Exception { + addLDAPVariables(server, true); + } + + /** + * Adds LDAP variables for various servers and ports to the bootstrap.properties file for use in server.xml. + * + * @param server + * @param isInMemoryAllowed If false, physical LDAP servers and ports will be used as the property values. + * @throws Exception + */ + public static void addLDAPVariables(LibertyServer server, boolean isInMemoryAllowed) throws Exception { + String method = "addLDAPVariables"; + Log.entering(c, method); + // Read LDAP ports from system properties + final String LDAP_1_PORT = + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + Log.info(c, "", "LDAP_1_PORT=" + System.getProperty("ldap.1.port")); + return System.getProperty("ldap.1.port"); + } + }); + final String LDAP_2_PORT = + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + Log.info(c, "", "LDAP_2_PORT=" + System.getProperty("ldap.2.port")); + return System.getProperty("ldap.2.port"); + } + }); + final String LDAP_3_PORT = + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + Log.info(c, "", "LDAP_3_PORT=" + System.getProperty("ldap.3.port")); + return System.getProperty("ldap.3.port"); + } + }); + + final String LDAP_1_SSL_PORT = + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + Log.info(c, "", "LDAP_1_SSL_PORT=" + System.getProperty("ldap.1.ssl.port")); + return System.getProperty("ldap.1.ssl.port"); + } + }); + final String LDAP_2_SSL_PORT = + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + Log.info(c, "", "LDAP_2_SSL_PORT=" + System.getProperty("ldap.2.ssl.port")); + return System.getProperty("ldap.2.ssl.port"); + } + }); + final String LDAP_3_SSL_PORT = + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + Log.info(c, "", "LDAP_3_SSL_PORT=" + System.getProperty("ldap.3.ssl.port")); + return System.getProperty("ldap.3.ssl.port"); + } + }); + + Properties props = new Properties(); + + // Get bootstrap properties file from server + RemoteFile bootstrapPropFile = null; + try { + bootstrapPropFile = server.getServerBootstrapPropertiesFile(); + } catch (Exception e) { + Log.error(c, method, e, "Error while getting the bootstrap properties file from liberty server"); + throw new Exception("Error while getting the bootstrap properties file from liberty server"); + } + + // Open the remote file for reading + FileInputStream in = null; + try { + in = (FileInputStream) bootstrapPropFile.openForReading(); + } catch (Exception e) { + Log.error(c, method, e, "Error while reading the remote bootstrap properties file"); + throw new Exception("Error while reading the remote bootstrap properties file"); + } + + // Load properties from bootstrap + try { + props.load(in); + } catch (IOException e) { + Log.error(c, method, e, "Error while loading properties from file input stream"); + throw new IOException("Error while loading properties from file input stream"); + } finally { + //Close the input stream + try { + in.close(); + } catch (IOException e1) { + Log.error(c, method, e1, "Error while closing the input stream"); + throw new IOException("Error while closing the input stream"); + } + } + + // Open the remote file for writing with append as false + FileOutputStream out = null; + try { + out = (FileOutputStream) bootstrapPropFile.openForWriting(false); + } catch (Exception e) { + Log.error(c, method, e, "Error while writing to remote bootstrap properties file"); + throw new Exception("Error while writing to remote bootstrap properties file"); + } + + Log.info(c, "addLDAPVariables", "USE_LOCAL_LDAP_SERVER=" + USE_LOCAL_LDAP_SERVER); + Log.info(c, "addLDAPVariables", "isInMemoryAllowed=" + isInMemoryAllowed); + + if (USE_LOCAL_LDAP_SERVER && isInMemoryAllowed) { + Log.info(c, "addLDAPVariables", "Setting in-memory LDAP server properties"); + // Add in-memory LDAP server host/ports. Host will be localhost an port changes on instances used + props.setProperty("ldap.server.1.name", "localhost"); + props.setProperty("ldap.server.2.name", "localhost"); + props.setProperty("ldap.server.3.name", "localhost"); + props.setProperty("ldap.server.4.name", "localhost"); + props.setProperty("ldap.server.5.name", "localhost"); + props.setProperty("ldap.server.6.name", "localhost"); + props.setProperty("ldap.server.7.name", "localhost"); + props.setProperty("ldap.server.8.name", "localhost"); + props.setProperty("ldap.server.9.name", "localhost"); + props.setProperty("ldap.server.10.name", "localhost"); + props.setProperty("ldap.server.11.name", "localhost"); + props.setProperty("ldap.server.12.name", "localhost"); + props.setProperty("ldap.server.13.name", "localhost"); + + props.setProperty("ldap.server.1.port", LDAP_1_PORT); + props.setProperty("ldap.server.2.port", LDAP_2_PORT); + props.setProperty("ldap.server.2.ssl.port", LDAP_2_SSL_PORT); + props.setProperty("ldap.server.3.port", LDAP_3_PORT); + props.setProperty("ldap.server.3.ssl.port", LDAP_3_SSL_PORT); + props.setProperty("ldap.server.4.port", LDAP_1_PORT); + props.setProperty("ldap.server.4.ssl.port", LDAP_1_SSL_PORT); + props.setProperty("ldap.server.5.port", LDAP_1_PORT); + props.setProperty("ldap.server.6.port", LDAP_2_PORT); + props.setProperty("ldap.server.6.ssl.port", LDAP_2_SSL_PORT); + props.setProperty("ldap.server.7.port", LDAP_1_PORT); + props.setProperty("ldap.server.7.ssl.port", LDAP_1_SSL_PORT); + props.setProperty("ldap.server.8.port", LDAP_1_PORT); + props.setProperty("ldap.server.8.ssl.port", LDAP_1_SSL_PORT); + props.setProperty("ldap.server.9.port", LDAP_1_PORT); + props.setProperty("ldap.server.10.port", LDAP_1_PORT); + props.setProperty("ldap.server.11.port", LDAP_1_PORT); + props.setProperty("ldap.server.12.port", LDAP_1_PORT); + props.setProperty("ldap.server.13.port", LDAP_3_PORT); + props.setProperty("ldap.server.13.ssl.port", LDAP_3_SSL_PORT); + + props.setProperty("ldap.server.4.bindDN", "uid=admin,ou=system"); + props.setProperty("ldap.server.4.bindPassword", "secret"); + + props.setProperty("ldap.server.7.bindDN", "uid=admin,ou=system"); + props.setProperty("ldap.server.7.bindPassword", "secret"); + + props.setProperty("ldap.server.8.bindDN", "uid=admin,ou=system"); + props.setProperty("ldap.server.8.bindPassword", "secret"); + + props.setProperty("ldap.server.10.bindDN", "uid=admin,ou=system"); + props.setProperty("ldap.server.10.bindPassword", "secret"); + + props.setProperty("ldap.server.11.bindDN", "uid=admin,ou=system"); + props.setProperty("ldap.server.11.bindPassword", "secret"); + + props.setProperty("ldap.server.12.bindDN", "uid=admin,ou=system"); + props.setProperty("ldap.server.12.bindPassword", "secret"); + + } else { + Log.info(c, "addLDAPVariables", "Setting physical LDAP server properties"); + // Add physical LDAP server host/ports + props.setProperty("ldap.server.1.name", LDAP_SERVER_1_NAME); + props.setProperty("ldap.server.2.name", LDAP_SERVER_2_NAME); + props.setProperty("ldap.server.3.name", LDAP_SERVER_3_NAME); + props.setProperty("ldap.server.4.name", LDAP_SERVER_4_NAME); + props.setProperty("ldap.server.5.name", LDAP_SERVER_5_NAME); + props.setProperty("ldap.server.6.name", LDAP_SERVER_6_NAME); + props.setProperty("ldap.server.7.name", LDAP_SERVER_7_NAME); + props.setProperty("ldap.server.8.name", LDAP_SERVER_8_NAME); + props.setProperty("ldap.server.9.name", LDAP_SERVER_9_NAME); + props.setProperty("ldap.server.10.name", LDAP_SERVER_10_NAME); + props.setProperty("ldap.server.11.name", LDAP_SERVER_11_NAME); + props.setProperty("ldap.server.12.name", LDAP_SERVER_12_NAME); + props.setProperty("ldap.server.13.name", LDAP_SERVER_13_NAME); + + props.setProperty("ldap.server.1.port", LDAP_SERVER_1_PORT); + props.setProperty("ldap.server.2.port", LDAP_SERVER_2_PORT); + props.setProperty("ldap.server.2.ssl.port", LDAP_SERVER_2_SSL_PORT); + props.setProperty("ldap.server.3.port", LDAP_SERVER_3_PORT); + props.setProperty("ldap.server.3.ssl.port", LDAP_SERVER_3_SSL_PORT); + props.setProperty("ldap.server.4.port", LDAP_SERVER_4_PORT); + props.setProperty("ldap.server.4.ssl.port", LDAP_SERVER_4_SSL_PORT); + props.setProperty("ldap.server.5.port", LDAP_SERVER_5_PORT); + props.setProperty("ldap.server.6.port", LDAP_SERVER_6_PORT); + props.setProperty("ldap.server.6.ssl.port", LDAP_SERVER_6_SSL_PORT); + props.setProperty("ldap.server.7.port", LDAP_SERVER_7_PORT); + props.setProperty("ldap.server.7.ssl.port", LDAP_SERVER_7_SSL_PORT); + props.setProperty("ldap.server.8.port", LDAP_SERVER_8_PORT); + props.setProperty("ldap.server.8.ssl.port", LDAP_SERVER_8_SSL_PORT); + props.setProperty("ldap.server.9.port", LDAP_SERVER_9_PORT); + props.setProperty("ldap.server.10.port", LDAP_SERVER_10_PORT); + props.setProperty("ldap.server.11.port", LDAP_SERVER_11_PORT); + props.setProperty("ldap.server.12.port", LDAP_SERVER_12_PORT); + props.setProperty("ldap.server.13.port", LDAP_SERVER_13_PORT); + props.setProperty("ldap.server.13.ssl.port", LDAP_SERVER_13_SSL_PORT); + + props.setProperty("ldap.server.2.bindDN", "cn=testuser,cn=users,dc=secfvt2,dc=austin,dc=ibm,dc=com"); + props.setProperty("ldap.server.2.bindPassword", "testuserpwd"); + + props.setProperty("ldap.server.4.bindDN", "cn=root"); + props.setProperty("ldap.server.4.bindPassword", "rootpwd"); + + props.setProperty("ldap.server.7.bindDN", "cn=root"); + props.setProperty("ldap.server.7.bindPassword", "rootpwd"); + + props.setProperty("ldap.server.8.bindDN", "cn=root"); + props.setProperty("ldap.server.8.bindPassword", "rootpwd"); + + props.setProperty("ldap.server.10.bindDN", "cn=root"); + props.setProperty("ldap.server.10.bindPassword", "rootpwd"); + + props.setProperty("ldap.server.11.bindDN", "cn=root"); + props.setProperty("ldap.server.11.bindPassword", "rootpwd"); + + props.setProperty("ldap.server.12.bindDN", "cn=root"); + props.setProperty("ldap.server.12.bindPassword", "rootpwd"); + + } + + // Write above LDAP variables to remote bootstrap properties file + try { + props.store(out, null); + Log.info(c, method, "added ldap variables to bootstrap file"); + } catch (IOException e) { + Log.error(c, method, e, "Error while reading the remote bootstrap properties file"); + throw new Exception("Error while reading the remote bootstrap properties file"); + } finally { + //Close the output stream + try { + out.close(); + Log.info(c, method, "closed output stream"); + } catch (IOException e) { + Log.error(c, method, e, "Error while closing the output stream"); + throw new IOException("Error while closing the output stream"); + } + } + Log.info(c, method, "about to exit routine"); + + Log.exiting(c, method); + } + + public static boolean isLdapServerAvailable(String hostname, String port) throws Exception { + return isLdapServerAvailable(hostname, port, false); + } + + public static boolean isLdapServerAvailable(String hostname, String port, boolean useSsl) throws Exception { + return isLdapServerAvailable(hostname, port, false, null, null); + } + + public static boolean isLdapServerAvailable(String hostname, String port, boolean useSsl, String bindDn, String bindPwd) throws Exception { + String method = "isLdapServerAvaialble"; + Log.entering(c, method); + + Hashtable env = new Hashtable(); + env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); + env.put(Context.PROVIDER_URL, "ldap://" + hostname + ":" + port); + env.put(Context.SECURITY_AUTHENTICATION, "none"); + if (useSsl) { + env.put(Context.PROVIDER_URL, "ldaps://" + hostname + ":" + port); + if (bindDn != null && bindPwd != null) { + env.put(Context.SECURITY_AUTHENTICATION, "simple"); + env.put(Context.SECURITY_PRINCIPAL, bindDn); + env.put(Context.SECURITY_CREDENTIALS, bindPwd); + } + // Use a custom SSLSocketFactory class that doesn't check the remote server's signer certificate + env.put("java.naming.ldap.factory.socket", CustomSSLSocketFactory.class.getName()); + } + DirContext ctx = null; + boolean isLdapServerAvailable = false; + // Create initial context + try { + ctx = new InitialDirContext(env); + Log.info(c, method, "Successfully created context to ldap with hostname " + hostname + " and port " + port); + + isLdapServerAvailable = true; + } catch (Exception e) { + Log.error(c, method, e, "Error while creating context to ldap with hostname " + hostname + " and port " + port); + throw new Exception("Error while creating context to ldap with hostname " + hostname + " and port " + port); + } finally { + try { + if (ctx != null) { + ctx.close(); + } + } catch (NamingException e) { + Log.error(c, method, e, "Error while closing context to ldap with hostname " + hostname + " and port " + port); + } + } + return isLdapServerAvailable; + + } + + public static boolean areAnyLdapServersAvailable(HashMap servers) throws Exception { + Set> hostsAndPorts = servers.entrySet(); + ArrayList> failedServers = new ArrayList>(); + boolean atLeastOneIsRunning = false; + for (Entry e : hostsAndPorts) { + try { + if (isLdapServerAvailable(e.getKey(), e.getValue())) { + atLeastOneIsRunning = true; + } + } catch (Exception e1) { + failedServers.add(e); + } + } + if (!atLeastOneIsRunning) { + String exceptionMessage = "Error while creating context to ldap with hostname(s) "; + + for (Entry e : failedServers) { + exceptionMessage = exceptionMessage + e.getKey() + ":" + e.getValue() + ", "; + } + + throw new Exception(exceptionMessage); + } + return atLeastOneIsRunning; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/LibertyServerUtils.java b/dev/fattest.simplicity/src/componenttest/topology/utils/LibertyServerUtils.java new file mode 100755 index 000000000000..715d74f0332f --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/LibertyServerUtils.java @@ -0,0 +1,248 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.utils; + +import java.io.File; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.ByteBuffer; +import java.nio.channels.SocketChannel; +import java.util.Properties; + +import com.ibm.websphere.simplicity.ConnectionInfo; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.common.apiservices.Bootstrap; + +/** + * + */ +public class LibertyServerUtils { + + private static final Class c = LibertyServerUtils.class; + + /** + * Makes the String compatible with Java, this problem only exists where + * Windows uses \ for a path seperator and Java uses / + * + * @param s + * the string to change + */ + public static String makeJavaCompatible(String s) { + try { + File f = new File(s); + return f.getCanonicalPath().replace('\\', '/'); + } catch (IOException e) { + Log.info(c, "makeJavaCompatible", "Unable to normalize the path: " + s + ". Error: " + e.getMessage()); + e.printStackTrace(); + } + + return s.replace('\\', '/'); + } + + /** + * Makes the String compatible with Java, this problem only exists where + * Windows uses \ for a path seperator and Java uses / + * + * @param s + * the string to change + */ + public static String makeJavaCompatible(String s, Machine machine) { + try { + if (machine.isLocal()) { + File f = new File(s); + return f.getCanonicalPath().replace('\\', '/'); + } else { + return s.replace('\\', '/'); + } + } catch (Exception e) { + Log.info(c, "makeJavaCompatible", "Unable to normalize the path: " + s + ". Error: " + e.getMessage()); + e.printStackTrace(); + } + + return s.replace('\\', '/'); + } + + /* + * Testing of process status removed, simple hard-coded wait of 5 seconds. + */ + public static boolean osgiShutdown(Machine machine, int osgiPort) throws Exception { + String method = "osgiShutdown"; + Log.entering(c, method); + + // let exceptions percolate up the stack as not all will be errors + executeOsgiCommand(machine, osgiPort, "shutdown", false); + + Thread.sleep(5000); + + Log.exiting(c, method, true); + return true; + } + + private static String executeOsgiCommand(Machine machine, int osgiPort, + String cmd, boolean waitForReply) + throws Exception { + String method = "executeOsgiCommand"; + String ret = ""; + SocketChannel channel = null; + try { + channel = SocketChannel.open(new InetSocketAddress(machine + .getHostname(), osgiPort)); + + channel.configureBlocking(false); + + ret = readFrom(channel, "osgi>", 500); + if (ret.contains("osgi>")) { + writeCommandTo(channel, cmd); + if (waitForReply) + ret = readFrom(channel, "osgi>", 1000); + else + ret = ""; + } + } catch (Exception e) { + //absorb as this may not be an error + } finally { + //channel may be null if open failed + if (channel != null) + channel.close(); + } + + if (ret.contains("Connection refused")) { + throw new Exception( + "Another client is using telnet. This can also be caused by other servers listening on this telnet port (" + + osgiPort + + "). Please ensure there are no other running instances."); + } + + ret = ret.replace("osgi>", ""); + + Log.exiting(c, method, ret); + return ret; + } + + /** + * This method attempts to read, up to a certain point, for a specified time + * period. It will return what is read in the return value. + * + * @param channel + * the socket channel to read from. + * @param prompt + * the prompt to look for. + * @param timeout + * how long to read for. + * @return what was read. + * @throws IOException + */ + private static String readFrom(SocketChannel channel, String prompt, long timeout) + throws IOException { + StringBuilder builder = new StringBuilder(); + + long startTime = System.currentTimeMillis(); + int osgiIndex = -1; + + do { + ByteBuffer buffer = ByteBuffer.allocate(1024); + channel.read(buffer); + builder.append(new String(buffer.array())); + osgiIndex = builder.indexOf(prompt); + } while (osgiIndex == -1 + && System.currentTimeMillis() - startTime < timeout); + + if (osgiIndex != -1) { + builder.delete(osgiIndex + 5, builder.length()); + } + return builder.toString().trim(); + } + + /** + * We want to send a command to the OSGi console. + * + * @param channel + * the channel to write to. + * @param command + * the command to send + * @throws IOException + */ + private static void writeCommandTo(SocketChannel channel, String command) + throws IOException { + command = command + "\r\n"; + byte[] bytes = command.getBytes(); + ByteBuffer buffer = ByteBuffer.allocate(bytes.length); + buffer.put(bytes); + buffer.flip(); + channel.write(buffer); + buffer.clear(); + } + + public static Machine createMachine(Bootstrap b) throws Exception { + final String method = "createMachine"; + String hostName = b.getValue("hostName"); + String user = b.getValue(hostName + ".user"); + String password = b.getValue(hostName + ".password"); + String keystore = b.getValue("keystore"); + + Log.info(c, method, + "getting Machine from credentials in Boostrapping file"); + Log.info(c, method, "Connecting to machine " + hostName + " with User " + + user + "."); + ConnectionInfo machineDetails = new ConnectionInfo( + hostName, user, password); + if ((password == null || password.length() == 0) && keystore != null && keystore.length() != 0) { + File keyfile = new File(keystore); + machineDetails = new ConnectionInfo(hostName, keyfile, user, password); + } + return Machine.getMachine(machineDetails); + } + + public static ProgramOutput execute(Machine machine, String javaHome, String command, String... parms) throws Exception { + return execute(machine, javaHome, null, command, parms); + } + + /** + * Execute a command on the file system. The javaHome parameter can be null if + * the command being executed does not need a JAVA_HOME env variable to be set. + * + * @param machine + * @param javaHome + * @param command + * @param parms + * @return + * @throws Exception + */ + public static ProgramOutput execute(Machine machine, String javaHome, Properties envVars, String command, String... parms) throws Exception { + final String method = "execute"; + Log.info(c, method, "Executing: " + command, parms); + + //Need to ensure JAVA_HOME is set correctly - can't rely on user's environment to be set to the same Java as the build/runtime environment + Properties _envVars = new Properties(); + _envVars.setProperty("JAVA_HOME", javaHome); + if (envVars != null) + _envVars.putAll(envVars); + Log.info(c, method, "Using additional env props: " + _envVars.toString()); + + parms = parms != null ? parms : new String[] {}; + ProgramOutput output = machine.execute(command, parms, _envVars); + String stdout = output.getStdout(); + Log.info(c, method, "Server script output: " + stdout); + Log.info(c, method, "Return code from script is: " + output.getReturnCode()); + return output; + } + + public static ProgramOutput executeLibertyCmd(Bootstrap bootstrap, String command, String... parms) throws Exception { + Machine machine = createMachine(bootstrap); + String hostName = bootstrap.getValue("hostName"); + String javaHome = bootstrap.getValue(hostName + ".JavaHome"); + String cmd = bootstrap.getValue("libertyInstallPath") + "/bin/" + command; + return execute(machine, javaHome, null, cmd, parms); + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/MBeanEventListener.java b/dev/fattest.simplicity/src/componenttest/topology/utils/MBeanEventListener.java new file mode 100755 index 000000000000..1d6f86b5b6e0 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/MBeanEventListener.java @@ -0,0 +1,51 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.utils; + +import java.util.concurrent.CountDownLatch; + +import javax.management.MBeanServerNotification; +import javax.management.Notification; +import javax.management.NotificationListener; + +/** + * + */ +public class MBeanEventListener implements NotificationListener { + + /* + * (non-Javadoc) + * + * @see javax.management.NotificationListener#handleNotification(javax.management.Notification, java.lang.Object) + */ + private boolean registered = false; + + public final CountDownLatch latchForListener = new CountDownLatch(1); + + /* + * (non-Javadoc) + * + * @see javax.management.NotificationListener#handleNotification(javax.management.Notification, java.lang.Object) + */ + @Override + public void handleNotification(Notification notification, Object handback) { + if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notification.getType())) { + registered = true; + latchForListener.countDown(); + } + } + + public boolean isRegistered() { + return registered; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/MBeanRegistrationCheckAndWait.java b/dev/fattest.simplicity/src/componenttest/topology/utils/MBeanRegistrationCheckAndWait.java new file mode 100755 index 000000000000..7e9a07f439b7 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/MBeanRegistrationCheckAndWait.java @@ -0,0 +1,102 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.utils; + +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +import javax.management.InstanceNotFoundException; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanServerConnection; +import javax.management.MBeanServerDelegate; +import javax.management.MBeanServerNotification; +import javax.management.ObjectName; +import javax.management.relation.MBeanServerNotificationFilter; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.exception.TopologyException; + +/** + * + */ +public class MBeanRegistrationCheckAndWait { + + public static void waitForRegistrationForMBean(MBeanServerConnection mbsc, ObjectName objName) throws InstanceNotFoundException, IOException { + (new MBeanRegistrationCheckAndWait()).waitOnMBeanRegistration(mbsc, objName); + } + + private static final Class c = MBeanRegistrationCheckAndWait.class; + private MBeanEventListener listener; + + private MBeanRegistrationCheckAndWait() {} + + private boolean waitOnLatchRelease(MBeanEventListener listener) { + boolean done = false; + boolean countDownLatchReachZero = false; + do { + try { + countDownLatchReachZero = listener.latchForListener.await(120, TimeUnit.SECONDS); + done = true; + } catch (InterruptedException e) { + } + } while (!done); + return countDownLatchReachZero; + } + + private synchronized boolean needToWaitForListener(MBeanServerConnection mbsc, ObjectName objName) throws IOException, InstanceNotFoundException { + + listener = new MBeanEventListener(); + // MBeanServerDelegate.DELEGATE_NAME; + MBeanServerNotificationFilter registerFilter = new MBeanServerNotificationFilter(); + registerFilter.enableObjectName(objName); + registerFilter.disableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION); + + mbsc.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener, registerFilter, null); + // check again right after the listener is added + if (mbsc.isRegistered(objName)) { + return false; + } + return true; + } + + private void waitOnMBeanRegistration(MBeanServerConnection mbsc, ObjectName objName) throws InstanceNotFoundException, IOException { + + final String METHOD = "waitOnMBeanRegistration"; + + if (mbsc.isRegistered(objName)) { + Log.info(c, METHOD, "No need to add listener; as the MBean; " + objName + ", has already been registered."); + return; + } + + try { + boolean waitForListener = needToWaitForListener(mbsc, objName); + if (!waitForListener) { + Log.info(c, METHOD, "No need to add listener, as the MBean, " + objName + ", has already been registered."); + return; + } + if (!waitOnLatchRelease(listener)) { + String exMessage = "The MBean with object name" + objName + ", cannot be registered."; + TopologyException serverStartException = new TopologyException(exMessage); + Log.error(c, METHOD, serverStartException, exMessage); + } + } finally { + if (listener != null) { + try { + mbsc.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener); + listener = null; + } catch (ListenerNotFoundException e) { + Log.info(c, METHOD, "Listener not found, no need to remove listener for object name, " + objName); + } + } + } + } +} diff --git a/dev/fattest.simplicity/src/componenttest/topology/utils/SSHKeysUtil.java b/dev/fattest.simplicity/src/componenttest/topology/utils/SSHKeysUtil.java new file mode 100755 index 000000000000..8dfef04adb10 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/topology/utils/SSHKeysUtil.java @@ -0,0 +1,151 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.topology.utils; + +import java.io.File; +import java.io.IOException; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * Utilities for backing up and restoring SSH keys before and after running FAT tests + */ +public class SSHKeysUtil { + + /** + * Creates a temporary backup of the authorized_keys file. If the file doesn't exist, the backup file + * is not created. + * + * @param c The calling class + * @return True if the backup was successful. + * False if the backup was unsuccessful. + * @throws IOException + */ + public static boolean backupAuthorizedKeys(Class c) throws IOException { + return backupAuthorizedKeys(c, null); + } + + /** + * Creates a temporary backup of the authorized_keys file. If the file doesn't exist, the backup file + * is not created. + * + * @param c The calling class + * @param userHome The user's home directory which contains the .ssh directory. + * If it is null, userHome is set to the value of system property "user.home". + * @return True if the backup was successful. + * False if the backup was unsuccessful. + * @throws IOException + */ + public static boolean backupAuthorizedKeys(Class c, String userHome) throws IOException { + boolean result = false; + + //Paths to the source file and backup file + if (userHome == null) { + userHome = System.getProperty("user.home"); + } + String sourcePath = userHome + "/.ssh/authorized_keys"; + String destPath = userHome + "/.ssh/tempAuth_keys"; + + File sourceFile = new File(sourcePath); + File destFile = new File(destPath); + + if (!sourceFile.exists()) { + Log.info(c, "backupAuthorizedKeys", "File: " + sourcePath + " doesn't exist. Exiting backup."); + return result; + } + + try { + Log.info(c, "backupAuthorizedKeys", "Creating: " + sourcePath + " backup."); + FileUtils.copyFile(sourceFile, destFile); + result = true; + Log.info(c, "backupAuthorizedKeys", "Successfully created backup of authorized_keys file to: " + destPath); + } catch (IOException e) { + Log.info(c, "backupAuthorizedKeys", "Failed to create authorized_keys backup due to: " + e.getMessage()); + throw e; + } finally { + //Delete the backup file if the backup is unsuccessful + if (!result) { + destFile.delete(); + Log.info(c, "backupAuthorizedKeys", "Successfully deleted backup file: " + destPath); + } + } + + return result; + } + + /** + * Restores the authorized_keys file and deletes the temporary file created. If the temporary backup file + * doesn't exist, it means the user didn't have an authorized_keys file before the test ran, therefore + * the one left by the tests will be deleted. + * + * @param c The calling class + * @return True if the restore was successful. + * False if the restore was unsuccessful. + * @throws IOException + */ + public static boolean restoreAuthorizedKeys(Class c) throws IOException { + return restoreAuthorizedKeys(c, null); + } + + /** + * Restores the authorized_keys file and deletes the temporary file created. If the temporary backup file + * doesn't exist, it means the user didn't have an authorized_keys file before the test ran, therefore + * the one left by the tests will be deleted. + * + * @param c The calling class + * @param userHome The user's home directory which contains the .ssh directory. + * If it is null, userHome is set to the value of system property "user.home". + * @return True if the restore was successful. + * False if the restore was unsuccessful. + * @throws IOException + */ + public static boolean restoreAuthorizedKeys(Class c, String userHome) throws IOException { + boolean result = false; + + //Paths to the source file and backup file + if (userHome == null) { + userHome = System.getProperty("user.home"); + } + String sourcePath = userHome + "/.ssh/tempAuth_keys"; + String destPath = userHome + "/.ssh/authorized_keys"; + + File sourceFile = new File(sourcePath); + File destFile = new File(destPath); + + if (!sourceFile.exists()) { + Log.info(c, "restoreAuthorizedKeys", "File: " + sourcePath + " doesn't exist. Exiting restore."); + Log.info(c, "restoreAuthorizedKeys", "Deleting: " + destFile); + destFile.delete(); + return result; + } + + try { + Log.info(c, "backupAuthorizedKeys", "Restoring from: " + sourcePath); + FileUtils.copyFile(sourceFile, destFile); + result = true; + Log.info(c, "restoreAuthorizedKeys", "Successfully restored authorized_keys file."); + } catch (IOException e) { + Log.info(c, "restoreAuthorizedKeys", "Failed to restore authorized_keys from backup due to: " + e.getMessage()); + Log.info(c, "restoreAuthorizedKeys", "Backup file located at: " + sourcePath); + throw e; + } finally { + // Keep the backup file if the restore is not successful + if (result) { + sourceFile.delete(); + Log.info(c, "restoreAuthorizedKeys", "Successfully deleted backup file: " + sourcePath); + } + } + + return result; + } + +} diff --git a/dev/fattest.simplicity/src/componenttest/vulnerability/LeakedPasswordChecker.java b/dev/fattest.simplicity/src/componenttest/vulnerability/LeakedPasswordChecker.java new file mode 100755 index 000000000000..402b1dc461b5 --- /dev/null +++ b/dev/fattest.simplicity/src/componenttest/vulnerability/LeakedPasswordChecker.java @@ -0,0 +1,101 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package componenttest.vulnerability; + +import static org.junit.Assert.assertEquals; + +import java.util.Collections; +import java.util.List; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.CheckForLeakedPasswords; +import componenttest.topology.impl.LibertyServer; + +/** + * Test rule to verify passwords for tests annotated + * with the {@link componenttest.annotation.CheckForLeakedPasswords} annotation. + * To use, create a LeakedPasswordChecker test rule passing the LibertyServer as shown and + * annotate the test method(s) with the {@link componenttest.annotation.CheckForLeakedPasswords} annotation. + *
    + * @Rule
    + * public TestRule passwordChecker = new LeakedPasswordChecker(server);
    + * 
    + * + */ +public class LeakedPasswordChecker implements TestRule { + + private LibertyServer server = null; + private CheckForLeakedPasswords testPasswords = null; + + public LeakedPasswordChecker(LibertyServer server) { + this.server = server; + } + + @Override + public Statement apply(final Statement statement, final Description description) { + testPasswords = description.getAnnotation(CheckForLeakedPasswords.class); + return new Statement() { + + @Override + public void evaluate() throws Throwable { + statement.evaluate(); + if (testPasswords != null) { + Log.info(LeakedPasswordChecker.class, "evaluate", + "Verifying that there were no passwords leaked for test " + description.getMethodName()); + String[] passwords = testPasswords.value(); + testPasswords = null; + for (String password : passwords) { + checkForPasswordInTrace(password); + } + } + } + }; + } + + /** + * Checks to see if the specified password was found in the trace. + * + * @param password + */ + public void checkForPasswordInTrace(String password) { + List passwordsInTrace = Collections.emptyList(); + try { + passwordsInTrace = server.findStringsInLogsAndTrace(password); + } catch (Exception e) { + } + assertEquals("Should not find password in the log file", Collections.emptyList(), passwordsInTrace); + } + + /** + * Checks to see if any XOR encoded passwords were found in the trace. + * + * @param password + */ + public void checkForXOREncodedPasswordsInTrace() { + checkForPasswordInTrace("\\{xor\\}"); + } + + /** + * Checks to see if the specified password was found in the trace, + * including XOR encoded + * + * @param password + */ + public void checkForPasswordInAnyFormat(String password) { + checkForPasswordInTrace(password); + checkForXOREncodedPasswordsInTrace(); + } +} diff --git a/dev/wlp.lib.extract_fat/.classpath b/dev/wlp.lib.extract_fat/.classpath new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/wlp.lib.extract_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/wlp.lib.extract_fat/.classpath.gradle b/dev/wlp.lib.extract_fat/.classpath.gradle new file mode 100644 index 000000000000..c422489df400 --- /dev/null +++ b/dev/wlp.lib.extract_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/wlp.lib.extract_fat/.gitignore b/dev/wlp.lib.extract_fat/.gitignore new file mode 100644 index 000000000000..27e131e35a6b --- /dev/null +++ b/dev/wlp.lib.extract_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/wlp.lib.extract_fat/.project b/dev/wlp.lib.extract_fat/.project new file mode 100755 index 000000000000..568e8fa58b90 --- /dev/null +++ b/dev/wlp.lib.extract_fat/.project @@ -0,0 +1,23 @@ + + + wlp.lib.extract_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/wlp.lib.extract_fat/.settings/org.eclipse.core.resources.prefs b/dev/wlp.lib.extract_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000000..25d9425fe34e --- /dev/null +++ b/dev/wlp.lib.extract_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.core.prefs b/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000000..870320143e5e --- /dev/null +++ b/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,292 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 000000000000..51bbe7fcd53a --- /dev/null +++ b/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,61 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=1 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/wlp.lib.extract_fat/bnd.bnd b/dev/wlp.lib.extract_fat/bnd.bnd new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/wlp.lib.extract_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/wlp.lib.extract_fat/bnd.bnd.gradle b/dev/wlp.lib.extract_fat/bnd.bnd.gradle new file mode 100644 index 000000000000..20b28a82bd21 --- /dev/null +++ b/dev/wlp.lib.extract_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/wlp.lib.extract_fat/build-test.xml b/dev/wlp.lib.extract_fat/build-test.xml new file mode 100755 index 000000000000..d492e74eab9f --- /dev/null +++ b/dev/wlp.lib.extract_fat/build-test.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/wlp.lib.extract_fat/build.gradle b/dev/wlp.lib.extract_fat/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/dev/wlp.lib.extract_fat/delivery.sets b/dev/wlp.lib.extract_fat/delivery.sets new file mode 100755 index 000000000000..674398425a01 --- /dev/null +++ b/dev/wlp.lib.extract_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/ExternalDependencyDownloadTest.java b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/ExternalDependencyDownloadTest.java new file mode 100755 index 000000000000..112c014940b0 --- /dev/null +++ b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/ExternalDependencyDownloadTest.java @@ -0,0 +1,338 @@ +package wlp.lib.extract; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.*; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ExternalDependencyDownloadTest { + private static LibertyServer hostingServer = LibertyServerFactory.getLibertyServer("dependencyHostServer"); + private static final String HOST_APP_NAME = "dependencyHost"; + private static final File FILES_DIR = new File("lib/LibertyFATTestFiles/"); + private static final File SERVERS_DIR = new File("publish/servers"); + + @BeforeClass + public static void setupClass() throws Exception { + // Start the server which hosts the dependency URLs + // This runs for the whole test suite while we test installing samples which reference it + hostingServer.startServer(); + } + + @AfterClass + public static void tearDownClass() throws Exception { + if (hostingServer != null && hostingServer.isStarted()) { + hostingServer.stopServer(); + } + } + + @Test + public void testHTTP2HTTPSRedirect() throws Exception { + String serverName = "http2httpsRedirectGood"; + String dependencyTargetFile = "shared/lib/" + serverName + ".testfile.jar"; + + File tmpJar = new File(FILES_DIR, serverName + ".jar"); + if (tmpJar.exists()) { + tmpJar.delete(); + } + + String dependencyUrl = "http://search.maven.org/remotecontent?filepath=com/datastax/cassandra/cassandra-driver-core/2.0.4/cassandra-driver-core-2.0.4.jar"; + String dependencyTargetPath = "servers/" + serverName + "/" + dependencyTargetFile; + createExternalDependencySample(tmpJar, serverName, dependencyUrl, dependencyTargetPath); + tmpJar.deleteOnExit(); + + LibertyServer installServer = createEmptyServer(serverName); + installServer.installSampleWithExternalDependencies(serverName); + + assertTrue(installServer.fileExistsInLibertyServerRoot(dependencyTargetFile)); + } + + @Test + public void testInstallDependency() throws Exception { + assertGoodInstall("/good", "depGood"); + } + + @Test + public void testInstallNotFound() throws Exception { + assertBadInstall("/notfound", "depNotFound"); + } + + @Test + public void testInstallBadRequest() throws Exception { + assertBadInstall("/badrequest", "depBadRequest"); + } + + @Test + public void testInstallForbidden() throws Exception { + assertBadInstall("/forbidden", "depForbidden"); + } + + @Test + public void testInstallServerError() throws Exception { + assertBadInstall("/serverError", "depServerError"); + } + + @Test + public void testRedirect301() throws Exception { + assertGoodInstall("/redirect301", "dep301"); + } + + @Test + public void testRedirect302() throws Exception { + assertGoodInstall("/redirect302", "dep302"); + } + + @Test + public void testRedirect303() throws Exception { + assertGoodInstall("/redirect303", "dep303"); + } + + @Test + public void testRedirect307() throws Exception { + assertGoodInstall("/redirect307", "dep307"); + } + + @Test + public void testRedirectNotFound() throws Exception { + assertBadInstall("/redirectnotfound", "depRedirectNotFound"); + } + + @Test + public void testInstallProtocolRedirect() throws Exception { + assertGoodInstall("/protocolchange", "depProtoChange"); + } + + /** + * Generate a sample with the given dependency and server name and ensure that installing it fails. + * + * @param dependencyPath the path to download the dependency from, relative to the root of the dependency hosting app + * @param serverName the server name that should be included in the sample + * @throws Exception + */ + private void assertGoodInstall(String dependencyPath, String serverName) throws Exception { + String dependencyTargetFile = serverName + ".testfile"; + + prepareSampleJar(dependencyPath, serverName); + LibertyServer installServer = createEmptyServer(serverName); + + // This method uses the sample jar created above + installServer.installSampleWithExternalDependencies(serverName); + + assertTrue(installServer.fileExistsInLibertyServerRoot(dependencyTargetFile)); + } + + /** + * Generate a sample with the given dependency and server name and ensure that installing it fails. + * + * @param dependencyPath the path to download the dependency from, relative to the root of the dependency hosting app + * @param serverName the server name that should be included in the sample + * @throws Exception + */ + private void assertBadInstall(String dependencyPath, String serverName) throws Exception { + String dependencyTargetFile = serverName + ".testfile"; + + prepareSampleJar(dependencyPath, serverName); + LibertyServer installServer = createEmptyServer(serverName); + + try { + // This method uses the sample jar created above + installServer.installSampleWithExternalDependencies(serverName); + fail("Expected sample installation to fail but it did not"); + } catch (Exception e) { + // Expected exception, do nothing + } + + assertFalse(installServer.fileExistsInLibertyServerRoot(dependencyTargetFile)); + } + + /** + * Generate a simple sample with a dependency + *

    + * The sample has one external dependency which points to a path under the depedencyHost app. + * + * @param dependencyPath the path to download the dependency from, relative to the root of the dependency hosting app + * @param serverName the server name that should be included in the sample + * @throws Exception + */ + private void prepareSampleJar(String dependencyPath, String serverName) throws Exception { + File tmpJar = new File(FILES_DIR, serverName + ".jar"); + if (tmpJar.exists()) { + tmpJar.delete(); + } + + String dependencyUrl = "http://" + hostingServer.getHostname() + ":" + hostingServer.getHttpDefaultPort() + "/" + HOST_APP_NAME + dependencyPath; + String dependencyTargetFile = serverName + ".testfile"; + String dependencyTargetPath = "servers/" + serverName + "/" + dependencyTargetFile; + createExternalDependencySample(tmpJar, serverName, dependencyUrl, dependencyTargetPath); + tmpJar.deleteOnExit(); + } + + /** + * Ensure the server directory exists and create a new LibertyServer. + * + * @param serverName the name for the new server + * @return the newly created server + */ + private LibertyServer createEmptyServer(String serverName) { + File serverDir = new File(SERVERS_DIR, serverName); + serverDir.mkdirs(); + + return LibertyServerFactory.getLibertyServer(serverName); + } + + /** + * Create a new minimal sample file with the given external dependency. + *

    + * The generated sample includes + *

      + *
    • The wlp.lib.extract classes
    • + *
    • A server directory with the given name
    • + *
    • A basic server.xml from publish/files/sampleServer.xml
    • + *
    • A generated externaldependencies.xml
    • + * + * + * @param outSample the jar file to write the new sample to + * @param serverName the name of the server to include in the sample jar + * @param dependencyUrl the URL which the externaldependencies.xml file should point to + * @param dependencyTargetPath the path which the external dependency should be downloaded to + */ + private static void createExternalDependencySample(File outSample, String serverName, String dependencyUrl, String dependencyTargetPath) throws IOException { + ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outSample)); + + writeDir(out, "META-INF"); + writeFile(out, "META-INF/MANIFEST.MF", new File(FILES_DIR, "MANIFEST.MF")); + + writeExternalDependencies(out, dependencyUrl, dependencyTargetPath); + + copyArchive(out, new File(FILES_DIR, "wlp.lib.extract.zip")); + + writeDir(out, "wlp/usr"); + writeDir(out, "wlp/usr/servers"); + writeDir(out, "wlp/usr/servers/" + serverName); + writeFile(out, "wlp/usr/servers/" + serverName + "/server.xml", new File(FILES_DIR, "sampleServer.xml")); + + out.close(); + assertTrue(outSample.getAbsolutePath() + " was not created", outSample.exists()); + } + + /** + * Write a directory to an archive + * + * @param out + * @param path + * @throws IOException + */ + private static void writeDir(ZipOutputStream out, String path) throws IOException { + if (!path.endsWith("/")) { + path += "/"; + } + out.putNextEntry(new ZipEntry(path)); + } + + /** + * Read a file from disk and write it into an archive + * + * @param out + * @param path + * @param file + * @throws IOException + */ + private static void writeFile(ZipOutputStream out, String path, File file) throws IOException { + if (path.endsWith("/")) { + throw new IOException("File paths may not end with a slash"); + } + out.putNextEntry(new ZipEntry(path)); + InputStream in = new FileInputStream(file); + copyStream(out, in); + in.close(); + out.closeEntry(); + } + + /** + * Copy the contents of one archive into another archive + * + * @param out + * @param archive + * @throws IOException + */ + private static void copyArchive(ZipOutputStream out, File archive) throws IOException { + ZipInputStream in = new ZipInputStream(new FileInputStream(archive)); + ZipEntry e; + while ((e = in.getNextEntry()) != null) { + out.putNextEntry(new ZipEntry(e.getName())); + if (!e.isDirectory()) { + copyStream(out, in); + } + out.closeEntry(); + } + in.close(); + } + + /** + * Copy from an input stream into an output stream until the end of the input stream is reached. + *

      + * Does not close either stream. + * + * @param out + * @param in + * @throws IOException + */ + private static void copyStream(OutputStream out, InputStream in) throws IOException { + byte[] buf = new byte[1024]; + int count; + while ((count = in.read(buf)) != -1) { + out.write(buf, 0, count); + } + } + + /** + * Write a simple externaldependencies.xml file entry into a ZipOutputStream. + *

      + * The generated file specifies one dependency with the given url and target path. + * + * @param out the ZipOutputStream to write to + * @param dependencyUrl the URL hosting the dependency + * @param dependencyTargetPath the destination path for the dependency + * @throws IOException + */ + private static void writeExternalDependencies(ZipOutputStream out, String dependencyUrl, String dependencyTargetPath) throws IOException { + out.putNextEntry(new ZipEntry("externaldependencies.xml")); + OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8"); + writer.append("\n"); + + writer.append(" \n"); + + writer.append("\n"); + writer.flush(); + out.closeEntry(); + } +} \ No newline at end of file diff --git a/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/FATSuite.java b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/FATSuite.java new file mode 100755 index 000000000000..25bbf754ff5b --- /dev/null +++ b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/FATSuite.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package wlp.lib.extract; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Collection of all example tests + */ +@RunWith(Suite.class) +/* + * The classes specified in the @SuiteClasses annotation + * below should represent all of the test cases for this FAT. + */ +@SuiteClasses({ + ExternalDependencyDownloadTest.class, + PackageRunnableTest.class +}) +public class FATSuite {} diff --git a/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/PackageRunnableTest.java b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/PackageRunnableTest.java new file mode 100755 index 000000000000..b7e00c34adbd --- /dev/null +++ b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/PackageRunnableTest.java @@ -0,0 +1,217 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package wlp.lib.extract; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.*; +import static org.junit.Assume.*; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.util.Iterator; +import java.util.Map; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class PackageRunnableTest { + private static String serverName = "runnableTestServer"; + private static LibertyServer server = LibertyServerFactory.getLibertyServer(serverName); + private static final File runnableJar = new File("publish/" + serverName + ".jar"); + private static final File extractDirectory = new File("publish" + File.separator + "wlpExtract"); + + /* + * return env as array and add WLP_JAR_EXTRACT_DIR=extractDirectory + */ + private static String[] runEnv(String extractDirectory) { + + Map envmap = System.getenv(); + Iterator iKeys = envmap.keySet().iterator(); + String[] envArray = new String[envmap.size() + 1]; + + int i = 0; + while (iKeys.hasNext()) { + String key = iKeys.next(); + String val = envmap.get(key); + envArray[i++] = key + "=" + val; + } + // add extract dir to end + String extDirVar = "WLP_JAR_EXTRACT_DIR=" + extractDirectory; + envArray[envArray.length - 1] = extDirVar; + + return envArray; + + } + + @BeforeClass + public static void setupClass() throws Exception {} + + @AfterClass + public static void tearDownClass() throws Exception {} + + @Test + public void testRunnableJar() throws Exception { + + // Doesn't work on z/OS (because you can't package into a jar on z/OS) + assumeTrue(!System.getProperty("os.name").equals("z/OS")); + + String stdout = server.executeServerScript("package", + new String[] { "--archive=" + runnableJar.getAbsolutePath(), + "--include=minify,runnable" }).getStdout(); + + String searchString = "Server " + serverName + " package complete"; + if (!stdout.contains(searchString)) { + System.out.println("Warning: test case " + PackageRunnableTest.class.getName() + " could not package server " + serverName); + return; // get out + } + + if (!extractDirectory.exists()) { + extractDirectory.mkdirs(); + } + + assertTrue("Extract directory " + extractDirectory.getAbsolutePath() + " does not exist.", extractDirectory.exists()); + + String cmd = "java -jar " + runnableJar.getAbsolutePath(); + Process proc = Runtime.getRuntime().exec(cmd, runEnv(extractDirectory.getAbsolutePath()), null); // run server + + // setup and start reader threads for error and output streams + StreamReader errorReader = new StreamReader(proc.getErrorStream(), "ERROR", null); + errorReader.start(); + StreamReader outputReader = new StreamReader(proc.getInputStream(), "OUTPUT", "CWWKF0011I"); + outputReader.start(); + + int count = 0; + + // wait up to 90 seconds to find watch for string + + boolean found = outputReader.foundWatchFor(); + while (!found && count <= 90) { + + synchronized (proc) { + proc.wait(1000); // wait 1 second + System.out.println("Waiting for server to complete initialization - " + count + " seconds elapsed."); + } + found = outputReader.foundWatchFor(); + count++; + } + + assertTrue("Server did not start successfully in time.", found); + + proc.destroy(); // ensure no process left behind + + } + + class StreamReader extends Thread + { + InputStream is; + String type; + OutputStream os; + String watchFor; + boolean foundWatchFor = false; + + StreamReader(InputStream is, String type, String watchFor) + { + this(is, type, watchFor, null); + } + + StreamReader(OutputStream os, String type, String watchFor) + { + this.os = os; + this.type = type; + this.watchFor = watchFor; + + } + + StreamReader(InputStream is, String type, String watchFor, OutputStream redirect) + { + this.is = is; + this.type = type; + this.os = redirect; + this.watchFor = watchFor; + } + + public boolean foundWatchFor() { + return foundWatchFor; + } + + @Override + public void run() + { + try { + // stdin, process stream is output + if (type.equals("INPUT")) { + runOutputStream(); + } + // else stdout, stderr, process stream is input + else { + runInputStream(); + } + } catch (IOException e) { + throw new RuntimeException(e.getMessage()); + } + } + + public void runInputStream() throws IOException { + PrintWriter pw = null; + if (os != null) + pw = new PrintWriter(os); + + InputStreamReader isr = new InputStreamReader(is, "UTF-8"); + BufferedReader br = new BufferedReader(isr); + String line = null; + while ((line = br.readLine()) != null) + { + if (pw != null) + pw.println(line); + System.out.println(line); + // if watchFor string supplied - search for it + if (watchFor != null) { + if (line.indexOf(watchFor) > -1) { + foundWatchFor = true; + } + } + + } + + if (pw != null) + pw.flush(); + } + + public void runOutputStream() throws IOException { + OutputStreamWriter osr = new OutputStreamWriter(os, "UTF-8"); + BufferedWriter br = new BufferedWriter(osr); + br.write("Y"); + } + } + +} diff --git a/dev/wlp.lib.extract_fat/publish/files/MANIFEST.MF b/dev/wlp.lib.extract_fat/publish/files/MANIFEST.MF new file mode 100755 index 000000000000..da15908105ef --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/files/MANIFEST.MF @@ -0,0 +1,10 @@ +Manifest-Version: 1.0 +Ant-Version: Apache Ant 1.8.4 +Created-By: pwa6460sr11-20120806_01 (SR11) (IBM Corporation) +Applies-To: com.ibm.websphere.appserver +Archive-Root: wlp/usr/ +Bundle-Vendor: IBM +Import-Package: javax.xml.parsers,org.w3c.dom +Main-Class: wlp.lib.extract.SelfExtract +Map-Based-Self-Extractor: wlp.lib.extract.MapBasedSelfExtractor +Archive-Content-Type: sample diff --git a/dev/wlp.lib.extract_fat/publish/files/sampleServer.xml b/dev/wlp.lib.extract_fat/publish/files/sampleServer.xml new file mode 100755 index 000000000000..a88bac7394da --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/files/sampleServer.xml @@ -0,0 +1,8 @@ + + + + servlet-3.0 + + + + diff --git a/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/.gitignore b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/.gitignore new file mode 100644 index 000000000000..47ebb767c4dc --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/.gitignore @@ -0,0 +1,2 @@ +/apps +/dropins diff --git a/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/bootstrap.properties b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/bootstrap.properties new file mode 100755 index 000000000000..31f32c6fd529 --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/server.xml b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/server.xml new file mode 100755 index 000000000000..2e841a22e054 --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/server.xml @@ -0,0 +1,9 @@ + + + servlet-3.0 + + + + + + diff --git a/dev/wlp.lib.extract_fat/publish/servers/runnableTestServer/server.xml b/dev/wlp.lib.extract_fat/publish/servers/runnableTestServer/server.xml new file mode 100755 index 000000000000..8514878d3010 --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/servers/runnableTestServer/server.xml @@ -0,0 +1,8 @@ + + + + servlet-3.0 + + + + diff --git a/dev/wlp.lib.extract_fat/test-applications/dependencyHost/resources/WEB-INF/web.xml b/dev/wlp.lib.extract_fat/test-applications/dependencyHost/resources/WEB-INF/web.xml new file mode 100755 index 000000000000..14e0d2313156 --- /dev/null +++ b/dev/wlp.lib.extract_fat/test-applications/dependencyHost/resources/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + + Dependency Host + This is a servlet hosts test dependencies for test samples. + + + + Dependency Host Servlet + Dependency Host Servlet + Hosts sample dependencies + web.DependencyHostServlet + + + + + + Dependency Host Servlet + /* + + diff --git a/dev/wlp.lib.extract_fat/test-applications/dependencyHost/src/web/DependencyHostServlet.java b/dev/wlp.lib.extract_fat/test-applications/dependencyHost/src/web/DependencyHostServlet.java new file mode 100755 index 000000000000..4c4ce0b1c98a --- /dev/null +++ b/dev/wlp.lib.extract_fat/test-applications/dependencyHost/src/web/DependencyHostServlet.java @@ -0,0 +1,95 @@ +package web; + +import java.io.IOException; +import java.io.Writer; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * A servlet that can return a variety of HTTP response codes and redirects. + *

      + * Used to test that the sample extractor can cope with various server responses. + */ +@SuppressWarnings("serial") +public class DependencyHostServlet extends HttpServlet { + + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + String path = request.getPathInfo(); + boolean validRequest = true; + if (path != null) { + if (path.equals("/good")) { + sendGoodFile(response); + } else if (path.equals("/notfound")) { + sendErrorCode(response, HttpServletResponse.SC_NOT_FOUND); + } else if (path.equals("/badrequest")) { + sendErrorCode(response, HttpServletResponse.SC_BAD_REQUEST); + } else if (path.equals("/forbidden")) { + sendErrorCode(response, HttpServletResponse.SC_FORBIDDEN); + } else if (path.equals("/serverError")) { + sendErrorCode(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } else if (path.equals("/redirect302")) { + sendRedirect(response, request, 302, "good"); + } else if (path.equals("/redirect301")) { + sendRedirect(response, request, 301, "good"); + } else if (path.equals("/redirect303")) { + sendRedirect(response, request, 303, "good"); + } else if (path.equals("/redirect307")) { + sendRedirect(response, request, 307, "good"); + } else if (path.equals("/redirectnotfound")) { + sendRedirect(response, request, 302, "notfound"); + } else if (path.equals("/protocolchange")) { + sendAbsoluteRedirect(response, 302, "https://example.com"); + } else { + validRequest = false; + } + } else { + validRequest = false; + } + + if (validRequest) { + log("Request OK: " + path); + } else { + log("Bad request: " + path); + sendErrorCode(response, HttpServletResponse.SC_NOT_FOUND); + } + } + + private void sendGoodFile(HttpServletResponse response) throws IOException { + response.setStatus(HttpServletResponse.SC_OK); + sendText(response, "DependencyContent"); + } + + private void sendErrorCode(HttpServletResponse response, int code) throws IOException { + response.setStatus(code); + sendText(response, "ErrorContent"); + } + + private void sendRedirect(HttpServletResponse response, HttpServletRequest request, int code, String location) throws IOException { + response.setStatus(code); + StringBuffer locationUrl = request.getRequestURL(); + locationUrl.delete(locationUrl.lastIndexOf("/"), locationUrl.length()); + locationUrl.append("/").append(location); + response.setHeader("Location", locationUrl.toString()); + sendText(response, "Redirecting..."); + } + + private void sendAbsoluteRedirect(HttpServletResponse response, int code, String location) throws IOException { + response.setStatus(code); + response.setHeader("Location", location); + sendText(response, "Redirecting..."); + } + + private void sendText(HttpServletResponse response, String text) throws IOException { + response.setContentType("text/plain"); + response.setCharacterEncoding("UTF-8"); + Writer writer = response.getWriter(); + writer.append(text); + writer.append("\r\n"); + writer.close(); + } +} diff --git a/dev/wlp.lib.extract_test/.classpath b/dev/wlp.lib.extract_test/.classpath index 786329955d6f..bd880329225d 100755 --- a/dev/wlp.lib.extract_test/.classpath +++ b/dev/wlp.lib.extract_test/.classpath @@ -1,11 +1,7 @@ - - - - - - - - + + + + diff --git a/dev/wlp.lib.extract_test/.classpath.gradle b/dev/wlp.lib.extract_test/.classpath.gradle new file mode 100644 index 000000000000..bd880329225d --- /dev/null +++ b/dev/wlp.lib.extract_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/wlp.lib.extract_test/.project b/dev/wlp.lib.extract_test/.project index 991aa965262a..1571db511565 100755 --- a/dev/wlp.lib.extract_test/.project +++ b/dev/wlp.lib.extract_test/.project @@ -10,8 +10,14 @@ + + bndtools.core.bndbuilder + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature diff --git a/dev/wlp.lib.extract_test/bnd.bnd b/dev/wlp.lib.extract_test/bnd.bnd new file mode 100755 index 000000000000..3ef7d083727a --- /dev/null +++ b/dev/wlp.lib.extract_test/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.ws.org.apache.aries.util.1.1.2;version=latest,\ + wlp.lib.extract;version=latest \ No newline at end of file diff --git a/dev/wlp.lib.extract_test/bnd.bnd.gradle b/dev/wlp.lib.extract_test/bnd.bnd.gradle new file mode 100755 index 000000000000..3ef7d083727a --- /dev/null +++ b/dev/wlp.lib.extract_test/bnd.bnd.gradle @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.ws.org.apache.aries.util.1.1.2;version=latest,\ + wlp.lib.extract;version=latest \ No newline at end of file diff --git a/dev/wlp.lib.extract_test/build.gradle b/dev/wlp.lib.extract_test/build.gradle new file mode 100644 index 000000000000..e69de29bb2d1